From c4c8ad30b13937190c3e17e50ccbe22d17cb97c9 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期四, 11 八月 2022 14:16:51 +0800
Subject: [PATCH] 优化

---
 WebAPI/Controllers/BarCodeController.cs |   63 ++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/WebAPI/Controllers/BarCodeController.cs b/WebAPI/Controllers/BarCodeController.cs
index ad0e3a6..9665667 100644
--- a/WebAPI/Controllers/BarCodeController.cs
+++ b/WebAPI/Controllers/BarCodeController.cs
@@ -585,6 +585,27 @@
                         HSumQty = ClsPub.isDoule(oItemSub.HQty);  //HWXQtyCol
                         for (int i = 0; i < HBQty; i++)
                         {
+                            LSH = LSH + 1;
+                            LSH2 = LSH.ToString();
+                            while (LSH2.Length < LSHlen)  //濡傛灉娴佹按鍙峰皬浜�6浣嶆暟鍓嶉潰琛�0
+                            {
+                                LSH2 = "0" + LSH2;
+                            }
+                            sDate = ClsPub.GetServerDate(0);
+                            sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
+                            sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
+                            sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
+                            sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
+                            sDay = sDay.Substring(sDay.Length - 2, 2);
+                            //==================================
+                            TM = HNumber + sYear + sPeriod + sDay + LSH2;
+                            while (TM.Length < SumLen)  //濡傛灉鏉$爜灏忎簬12浣嶆暟鍓嶉潰琛�0
+                            {
+                                TM = "0" + TM;
+                            }
+                            //TM = "B" + TM;
+                            TM = "SRM" + "B" + TM;
+                          
                             if (HSumQty - HMinQty > 0)
                             {
                                 WeiShu = "";
@@ -602,8 +623,6 @@
                                 }
                                 HMinQty = HSumQty;
                             }
-                            TM = $"{oItemSub.HMaterID}#{HMinQty}";
-
                             Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
                             bar.HBarCode = TM;
                             bar.HMaterID = oItemSub.HMaterID;
@@ -695,7 +714,7 @@
                                 TM2 = "0" + TM2;
                             }
                             bar2.HMaterID = oItemSub2.HMaterID;
-                            bar2.HBarCode = oItemSub2.HBarCode.Split('#')[0] + "#" + HWXQty.ToString();
+                            bar2.HBarCode = oItemSub2.HBarCode + "-" + TM2;
                             bar2.HUnitID = oItemSub2.HUnitID;
                             bar2.HQty = HWXQty;
                             bar2.HBatchNo = DBUtility.ClsPub.isStrNull(oItemSub2.HBatchNo);
@@ -903,14 +922,7 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
-                        if (oItemSub.HBQty > oItemSub.HBQty)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍐呯鍖呰鏁颁笉鑳戒负0锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
+
                     }
                 }
                 long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -944,7 +956,8 @@
                                 WeiShu = "灏炬暟";
                                 HMinQty = HSumQty - (HBQty - 1) * HMinQty;
                             }
-                            TM = $"{oItemSub.HMaterID}#{HMinQty}";
+                            //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;
@@ -991,7 +1004,7 @@
                     {
                         HBarCode = oItemSub.HBarCode.ToString();
                         HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
-                        HBarCodeType = "绠卞彿鍐呮潯鐮�";
+                        HBarCodeType = "鍝佺鐮�";
                         HMaterID = ClsPub.isLong(oItemSub.HMaterID);
                         HUnitID = ClsPub.isLong(oItemSub.HUnitID);
                         HQty2 = ClsPub.isDoule(oItemSub.HQty);
@@ -1195,7 +1208,7 @@
                     return objjson;
                 }
                 DAL.ClsWeb_BarCodeBill oClsWeb_BarCodeBill = new DAL.ClsWeb_BarCodeBill();
-                ds = oClsWeb_BarCodeBill.ShowBillSub6(DBUtility.ClsPub.isLong(sMsg), ShowItem, ref DBUtility.ClsPub.sExeReturnInfo);
+                ds = ShowBillSub6(DBUtility.ClsPub.isLong(sMsg), ShowItem, ref DBUtility.ClsPub.sExeReturnInfo);
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objjson.code = "0";
@@ -1223,6 +1236,28 @@
                 return objjson;
             }
         }
+        public DataSet ShowBillSub6(long lngBillKey, string sShowItem, ref string sReturn)
+        {
+            string str = "";
+            try
+            {
+                string MvarItemKeySubForWeb4 = "h_v_Web_BarCodeBill_ForWeb2";
+                str = string.Concat(new object[] { "Select ", sShowItem, "  from ", MvarItemKeySubForWeb4, " Where HInterID=", lngBillKey.ToString(), " order by HEntryID " });
+                DataSet set = oCn.RunProcReturn(string.Concat(new object[] { "Select ", sShowItem, "  from ", MvarItemKeySubForWeb4, " Where HInterID=", lngBillKey.ToString(), " order by HEntryID " }), MvarItemKeySubForWeb4);
+                if ((set == null) || (set.Tables[0].Rows.Count == 0))
+                {
+                    sReturn = "鍗曟嵁浣撴湭鎵惧埌锛�";
+                    return null;
+                }
+                sReturn = "鏄剧ず鍗曟嵁浣撴垚鍔燂紒";
+                return set;
+            }
+            catch (Exception exception)
+            {
+                sReturn = exception.Message + str;
+                return null;
+            }
+        }
         [Route("GetHBarCodeShowBillMain")]
         [HttpGet]
         /// <summary>

--
Gitblit v1.9.1