智云SRM-WEBAPI(目前客户通用API)
王 垚
2022-09-13 1204150d723e868fe761911f877500b1aad9ab81
优化
2个文件已修改
97 ■■■■ 已修改文件
WebAPI/Controllers/BarCodeController.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/POInStockController.cs 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BarCodeController.cs
@@ -899,7 +899,6 @@
                List<Model.ClsGy_MaterialList_WMS_Model> ls = new List<Model.ClsGy_MaterialList_WMS_Model>();
                List<Model.ClsGy_BarCodeBill_WMS_Model> ls2 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();
                List<Model.ClsGy_BarCodeBill_WMS_Model> ls3 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();
                ls = oListModels.getObjectByJson_MaterialList(msg3);
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
@@ -956,8 +955,8 @@
                                WeiShu = "尾数";
                                HMinQty = HSumQty - (HBQty - 1) * HMinQty;
                            }
                            //TM = $"{oItemSub.HMaterID}#{HMinQty}";
                            TM = $"{oItemSub.HMaterID}";
                            TM = $"{oItemSub.HMaterID}#{HMinQty}";
                            //TM = $"{oItemSub.HMaterID}";
                            Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
                            bar.HBarCode = TM;
                            bar.HMaterID = oItemSub.HMaterID;
@@ -1028,37 +1027,6 @@
                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
                        oCn.RunProc(sql);
                        sql = "exec setLSH '" + DateTime.Today + "'";
                        oCn.RunProc(sql);
                    }
                }
                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls3)
                {
                    //LogService.Write("循环第三次:" + oItemSub.HSupID);
                    if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                    {
                        HBarCode = oItemSub.HBarCode.ToString();
                        HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
                        HBarCodeType = "箱号内条码";
                        HMaterID = ClsPub.isLong(oItemSub.HMaterID);
                        HUnitID = ClsPub.isLong(oItemSub.HUnitID);
                        HQty2 = ClsPub.isDoule(oItemSub.HQty);
                        HBatchNo = ClsPub.isStrNull(oItemSub.HBatchNo);
                        HSupID = oItemSub.HSupID;
                        HKFPeriod = ClsPub.isInt(oItemSub.HKFPeriod);
                        HKFDate = ClsPub.isStrNull(oItemSub.HKFDate);
                        HKFDQDate = ClsPub.isStrNull(oItemSub.HKFDQDate);
                        HSourceInterID = ClsPub.isLong(oItemSub.HSourceInterID);
                        HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
                        HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                        HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                        string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                    ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
                                    ") values ("
                                    + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                    + "','" + HBatchNo + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
                        oCn.RunProc(sql);
                    }
                }
WebAPI/Controllers/POInStockController.cs
@@ -23,7 +23,6 @@
        private json objjson = new json();
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        /// <summary>
        /// 更新打印次数
        /// </summary>
@@ -55,7 +54,6 @@
                return objJsonResult;
            }
        }
        /// <summary>
        /// 生成送货单单据号、日期
        /// </summary>
@@ -273,7 +271,6 @@
                return objJsonResult;
            }
        }
        /// <summary>
        /// 保存送货单
        /// </summary>
@@ -580,7 +577,6 @@
                return objjson;
            }
        }
        [Route("AuditPOInStockBill")]
        [HttpGet]
        public object AuditPOInStockBill(string HInterID, string CurUserName, string HBillNo)
@@ -609,7 +605,7 @@
                var HValue = oCn.RunProcReturn(parameterSql, "dt").Tables[0].Rows[0][0].ToString();
                if (HValue == "Y")
                {
                    if (FCusName == "瑞与祺" || FCusName == "")
                    if (FCusName == "瑞与祺" || FCusName == "" || FCusName.Contains("四维尔"))
                    {
                        sql = string.Format(@"
SELECT T3.FNAME AS FTYPENAME,M.HBILLNO,B.HINTERID,B.HENTRYID,C.FID,C.FENTRYID, D.FBILLNO,B.HQTY,CD.FRECEIVEORGID,CDOO.FNUMBER AS FRECEIVENUMBER
@@ -635,21 +631,16 @@
LEFT JOIN {0}..T_BD_CURRENCY EC ON E. FSETTLECURRID =EC.FCURRENCYID  
 WHERE b.hinterid in ({1}) and M.HERPInterID = 0
", kdTbaleName, HInterID);
                        LogService.Write(sql);
                        //LEFT JOIN  {0}..T_HR_EMPINFO T5 ON D.F_XBKF_BASE1 = T5.FID
                        dt = oCn.RunProcReturn(sql, "sltz").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            foreach (DataRow dr in dt.Rows)
                            {
                                if (fidList.Contains(dr["FID"].ToString() + dr["HINTERID"].ToString()))
                                if (fidList.Contains(dr["HINTERID"].ToString()))
                                    continue;
                                else
                                    fidList.Add(dr["FID"].ToString() + dr["HINTERID"].ToString());
                                DataRow[] drs = dt.Select("FID = " + dr["FID"].ToString() + " and HINTERID = " + dr["HINTERID"].ToString());
                                    fidList.Add(dr["HINTERID"].ToString());
                                DataRow[] drs = dt.Select("HINTERID = " + dr["HINTERID"].ToString());
                                JObject model = new JObject();
                                string fTypeName = "SLD01_SYS";//标准采购订单类型
                                string ywTypeName = "CG";//标准业务类型
@@ -671,10 +662,8 @@
                                model.Add("FPurOrgId", new JObject() { ["Fnumber"] = dr["FPURCHASEORGNUMBER"].ToString() }); //采购组织
                                model.Add("FSupplierId", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() }); //供应商
                                model.Add("FPURCHASERID", new JObject() { ["Fnumber"] = dr["FPURCHASERNUMBER"].ToString() }); //采购员
                                                                                                                              //model.Add("F_xbkf_Base", new JObject() { ["Fnumber"] = dr["FRECEIVEMENNUMBER"].ToString() }); //收料员
                                model.Add("FOwnerTypeIdHead", "BD_Supplier");//  货主类型
                                model.Add("FOwnerIdHead", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() });//货主 供应商 
                                                                                                                            //model.Add("F_XBKF_COMBO", dr["F_xbkf_Combo1"].ToString());//是否有票
                                JArray Fentity = new JArray();
                                foreach (var item in drs)
                                {
@@ -743,7 +732,6 @@
                                    //更新送货单 主表 ERP单据号 以及 ERP主内玛
                                    string FBillNo = JObject.Parse(result)["Result"]["Number"].ToString();
                                    string FID = JObject.Parse(result)["Result"]["Id"].ToString();
                                    string updateSql = string.Format(@"
                                                      update a set 
                                                      a.HERPInterID = {0} ,
@@ -764,7 +752,11 @@
                                    objjson.data = null;
                                    return objjson;
                                }
                            }
                        }
                        else {
                            LogService.Write("收料通知单审核无数据:"+sql);
                        }
                    }
                    else if (FCusName == "夏宝电器")
@@ -805,7 +797,6 @@
                                    fidList.Add(dr["FID"].ToString() + dr["HINTERID"].ToString());
                                DataRow[] drs = dt.Select("FID = " + dr["FID"].ToString() + " and HINTERID = " + dr["HINTERID"].ToString());
                                JObject model = new JObject();
                                string fTypeName = "SLD01_SYS";//标准采购订单类型
                                string ywTypeName = "CG";//标准业务类型
@@ -967,7 +958,6 @@
            objjson.data = HinterID;
            return objjson;
        }
        public int GetHinterIDByBillNo(string HBillNo, string type)
        {
            SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
@@ -980,8 +970,6 @@
                HInterID = Convert.ToInt32(dt.Rows[0]["HInterID"]);
            return HInterID;
        }
        [Route("DeltetPOInStockBill")]
        [HttpGet]
        public object DeltetPOInStockBill(string HInterID, string HUserName)
@@ -1023,7 +1011,6 @@
                return objJsonResult;
            }
        }
        //审核 删除 删除金蝶数据库对应 收料通知到数据
        public json DeleteKingDee(string hinterid)
        {
@@ -1088,10 +1075,6 @@
            return objjson;
        }
        //[Route("POInStockAccept")]
        //[HttpGet]
        ///// <summary>
@@ -1164,8 +1147,6 @@
        //            return objJsonResult;
        //        }
        //    }
        [Route("TestSaverPOInStock")]
        [HttpGet]
        /// <summary>
@@ -1199,20 +1180,20 @@
                    //更新关联数量
                    var HinterID = mylist[i].ToString();
                    oCn.RunProc($"exec h_p_SRM_UpDatePPBomRelationQty {HinterID}");
                    //判断未关联数量是否为0
                    DataSet ds = oCn.RunProcReturn("select * from H_v_SRM_POOrderBillList where hmainid='" + HinterID + "'", "H_v_SRM_POOrderBillList");
                    DataTable dt = ds.Tables[0];
                    if (dt.Rows.Count > 0)
                }
                //判断未关联数量是否为0
                DataSet ds = oCn.RunProcReturn($"select * from H_v_SRM_POOrderBillList where hsubid in ({string.Join(", ", entryList)}) ", "H_v_SRM_POOrderBillList");
                DataTable dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataRow[] dr = dt.Select("未关联数量 = " + 0);
                    if (dr.Count() > 0)
                    {
                        DataRow[] dr = dt.Select("未关联数量 = " + 0);
                        if (dr.Count() > 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据号:" + dr[0]["单据号"].ToString() + "未关联数量为0,已全部生成送货单!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = $"请检查数据,单据号:{dr[0]["单据号"]},物料代码:{dr[0]["物料代码"]},未关联数量为0,已全部生成送货单!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                objJsonResult.code = "1";