From decf3bc3b6eafa8541af8c724f994d6a0f31b8e1 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期三, 11 九月 2024 20:44:35 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WarM/条码打印/Gy_CusBarCodeBill_KaiBei.cs |   44 ++++++++++++++++++++++++++++++++------------
 1 files changed, 32 insertions(+), 12 deletions(-)

diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei.cs"
index bc5cde2..0f192e4 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei.cs"
@@ -78,7 +78,8 @@
         public Int64 HOrgID = ClsPub.HOrgID;
         public string HCusModel = "Z";     //鍘傚晢浠g爜
         public string sDate = "";          //鏃ユ湡
-        public string sYear = "";          //骞�
+        public string sYear = "";          //骞达紙2浣嶏級
+        public string sYear4 = "";         //骞达紙4浣嶏級
         public string sPeriod = "";        //鏈�
         public string sDay = "";           //鏃�
 
@@ -450,6 +451,7 @@
             //鏃ユ湡鑾峰彇鏂瑰紡
             sDate = dtpHDate.Value.ToShortDateString();
             sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
+            sYear4 = ClsPub.isDate(sDate).Year.ToString();
             sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
             sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
             sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
@@ -650,11 +652,14 @@
                 double HSumQty = 0;         //浜у搧鏁伴噺
                 double HMinQty = 0;         //鏈�灏忓寘瑁呮暟
                 int HBQty = 0;              //绠辨暟
-                int LSH = 0;                //娴佹按鍙�
+                int LSH = 0;                //鍐呯娴佹按鍙�
+                int LWSH = 0;               //澶栫娴佹按鍙�
                 string LSH2 = "";           //娴佹按鍙疯浆鎹㈡垚瀛楃
                 string HCode1 = "";         //鐗╂枡绫诲埆
                 string HCode2 = "";         //鎵规浣�
                 string HCode3 = "";         //鐗堟湰鍙�
+                string sTMNumber = "";      //澶栫鏉$爜鍓嶇紑
+                DataSet Ds;
 
                 Int64 HEntryID = 0;
                 string HBarCode = "";       //鏉″舰鐮� 
@@ -699,11 +704,19 @@
                         {
                             //鑾峰彇鏈�澶ф祦姘村彿
                             LSH = 0;
-                            DataSet Ds = oCn.RunProcReturn("select top 1 HSno from Gy_BarCodeBill_Cus where HBatchNo='" + HBatchNo + "' order by HSno desc", "Gy_BarCodeBill_Cus");
+                            Ds = oCn.RunProcReturn("select top 1 HSno from Gy_BarCodeBill_Cus where HBatchNo='" + HBatchNo + "' order by HSno desc", "Gy_BarCodeBill_Cus");
                             if (Ds != null && Ds.Tables[0].Rows.Count != 0)
                             {
                                 LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                             }
+                        }
+                        //澶栫鐮�   渚涘簲鍟嗕唬鐮侊紙娴疆瀹氫箟鐨勪緵搴斿晢浠g爜锛�+8浣嶆棩鏈燂紙渚嬪20230905锛�+5浣嶆祦姘寸爜锛堢函鏁板瓧锛�
+                        else
+                        {
+                            //鏉$爜鍓嶇紑 = 渚涘簲鍟嗕唬鐮� + 骞� + 鏈� + 鏃�
+                            sTMNumber = HCusModel + sYear + sPeriod + sDay;
+                            Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                            LWSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                         }
 
                         HBQty = ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value);
@@ -714,7 +727,7 @@
 
                         for (int i = 0; i < HBQty; i++)
                         {
-                            pb1.Value = n+1;
+                            pb1.Value = n+1;    
                             if (HSumQty - HMinQty > 0)
                             {
                                 HSumQty = HSumQty - HMinQty;
@@ -724,21 +737,27 @@
                                 HMinQty = HSumQty;
                             }
                             //
-                            LSH = LSH + 1;
-                            LSH2 = ConvertToBase(LSH, 36);
-                            while (LSH2.Length < LSHlen)  //濡傛灉娴佹按鍙蜂綅鏁板皬浜� LSHlen 鍓嶉潰琛�0
-                            {
-                                LSH2 = "0" + LSH2;
-                            }
                             if (cmbHBarCodeType.Text == "鍐呯鐮�")
                             {
+                                LSH = LSH + 1;
+                                LSH2 = ConvertToBase(LSH, 36);
+                                while (LSH2.Length < LSHlen)  //濡傛灉娴佹按鍙蜂綅鏁板皬浜� LSHlen 鍓嶉潰琛�0
+                                {
+                                    LSH2 = "0" + LSH2;
+                                }
                                 //鏉$爜缂栧彿 = 鎵规 + 娴佹按鍙� + 鐗堟湰鍙�
                                 TM = HBatchNo + LSH2 + HCode3;
                             }
+                            //澶栫鐮�
                             else
                             {
-                                TM = HBatchNo;
-                                LSH = 0;
+                                LWSH = LWSH + 1;
+                                LSH2 = LWSH.ToString();
+                                while (LSH2.Length < 5)  //濡傛灉娴佹按鍙蜂綅鏁板皬浜� 5 鍓嶉潰琛�0
+                                {
+                                    LSH2 = "0" + LSH2;
+                                }
+                                TM = sTMNumber + LSH2;
                             }
 
                             HEntryID = j + 1;
@@ -1332,6 +1351,7 @@
             grdMain.Rows[i].Cells[HISKFPERIODCol].Value = oTable.Rows[0]["HISKFPERIOD"].ToString();
             grdMain.Rows[i].Cells[HEXPUNITCol].Value = oTable.Rows[0]["HEXPUNIT"].ToString();
             grdMain.Rows[i].Cells[HEXPPERIODCol].Value = oTable.Rows[0]["HEXPPERIOD"].ToString();
+            grdMain.Rows[i].Cells[HInnerBillNoCol].Value = oTable.Rows[0]["閿�鍞鍗曠紪鍙�"].ToString();
             //--
             //璁剧疆鍙紪杈戝垪
             string sAllowCol = HQtyCol.ToString() +

--
Gitblit v1.9.1