智云SRM-WEBAPI(目前客户通用API)
1
王 垚
2023-01-04 0c5df3ecaf922d07a02960791c0ab1dd3bb16f5e
WebAPI/Controllers/BarCodeController.cs
@@ -495,6 +495,7 @@
        /// <returns></returns>
        public object GetBarcodeSaveBill_Box([FromBody] JObject msg)
        {
            string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
@@ -526,33 +527,9 @@
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    //if (oBill.CheckBarCode(oItemSub.HSourceInterID, oItemSub.HSourceEntryID) == false)
                    //{
                    //    objJsonResult.code = "0";
                    //    objJsonResult.count = 0;
                    //    objJsonResult.Message = "已存在条码,不允许重复生成!";
                    //    objJsonResult.data = null;
                    //    return objJsonResult;
                    //}
                    if (msg2 != string.Empty)
                    {
                        if (oItemSub.HBQty == 0 || oItemSub.HMinQty == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "内箱包装数不能为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (oItemSub.HWBQty == 0 || oItemSub.HWXQty == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "外箱包装数不能为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //数量为0 跳过
                    if (oItemSub.HQty == 0 || oItemSub.HMinQty == 0 || oItemSub.HWXQty == 0)
                        continue;
                }
                long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
                int LSHlen = 6;             //流水号长度
@@ -734,6 +711,7 @@
                        }
                    }
                }
                string HBarCode = "";
                string HBarCodeType = "";
                Int64 HMaterID = 0;
@@ -753,6 +731,11 @@
                string HWei = "";
                string HMTONO = "";
                oCn.BeginTran();
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    //更新条码档案 该源单其它条码默认已经打印过一次
                    oCn.RunProc($"update Gy_BarCodeBill set  HPrintQty += 1   where HPrintQty = 0 and  HSourceInterID={oItemSub.HSourceInterID} and HSourceEntryID = {oItemSub.HSourceEntryID}");
                }
                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls2)
                {
                    //LogService.Write("循环第二次:" + oItemSub.HSupID);
@@ -775,6 +758,11 @@
                        HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                        HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                        if (FCusName.Contains("夏宝"))
                        {
                            HBarCode = $"{oItemSub.HMaterID}";
                            HBarCodeType = "品种码_外箱";
                        }
                        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 " +
@@ -810,6 +798,11 @@
                        HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                        HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                        if (FCusName.Contains("夏宝"))
                        {
                            HBarCode = $"{oItemSub.HMaterID}";
                            HBarCodeType = "品种码";
                        }
                        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 " +