From 3c434584c37880246ca5defe7defeba64036b456 Mon Sep 17 00:00:00 2001
From: jingh <jingh@LAPTOP-I53VDLOO>
Date: 星期四, 30 十二月 2021 08:18:48 +0800
Subject: [PATCH] 博日夏宝条码完善

---
 WarM/条码打印/Gy_BarCodeBill.cs |   81 +++++++++++++++++++++++++---------------
 1 files changed, 51 insertions(+), 30 deletions(-)

diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
index 833372c..64a818b 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
@@ -785,7 +785,7 @@
                         LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 4;
                     }
-                    else if (cmbHBarCodeType.Text == "浠櫒鎴愬搧鏉$爜瑙勫垯")
+                    else if (cmbHBarCodeType.Text == "浠櫒鎴愬搧鏉$爜瑙勫垯") //鍙﹀澶勭悊浜�
                     {
                         //鐗╂枡缂栫爜+搴忓垪鍙�+鐢熶骇鏃ユ湡
                         //sTMNumber = HMaterNumber + sYear + sPeriod + sDay;
@@ -806,7 +806,7 @@
                     {
                         //鍒堕�犳湰閮�1浣嶏紙榛樿1锛�+鏈哄瀷浠g爜5浣嶏紙锛�+骞�2浣�+鏈�1浣嶏紙A銆丅銆丆浠f浛10鏈堜唤锛�
                         //+鏃�2浣�+鏉$爜鎵规鐮�2浣�+鍘嬬缉鏈轰唬鐮�1浣�+00+娴佹按鍙�4浣�+鏍¢獙鐮侊紙榛樿0锛�
-                        sTMNumber = "1" + HModelName + sYear + Sub_PeriodChange(sPeriod) + sDay + HBarCodeBatchNo + HYasuoji;
+                        sTMNumber = "1" + HModelName + sYear + Sub_PeriodChange(sPeriod) + sDay + HBarCodeBatchNo + HYasuoji + "00" ;
                         Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                         LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
@@ -875,7 +875,16 @@
                             //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
                             TM = sTMNumber + LSH2;
                         }
-
+                        else if(cmbHBarCodeType.Text == "浠櫒澶栬喘浠舵潯鐮佹櫘閫氳鍒�" || cmbHBarCodeType.Text == "璇曞墏鎴愬搧鏉$爜瑙勫垯" 
+                            || cmbHBarCodeType.Text == "鍗婃垚鍝佹潯鐮�" || cmbHBarCodeType.Text == "澶栭攢鏈烘潯鐮�")
+                        {
+                            TM = sTMNumber + LSH2;
+                        }
+                        else if (cmbHBarCodeType.Text == "鍐呴攢鏈烘潯鐮�")
+                        {
+                            TM = sTMNumber + LSH2 + "0";
+                        }
+                        //
                         if (i + 1 > grdSub.Rows.Count)
                         {
                             grdSub.RowCount = grdSub.RowCount + 1;
@@ -1113,7 +1122,8 @@
         }
 
 
-        //鐢熸垚鏉$爜 鍗氭棩 //鐗╂枡缂栫爜+搴忓垪鍙�+鐢熶骇鏃ユ湡
+        //鐢熸垚鏉$爜 鍗氭棩 
+        //鐗╂枡缂栫爜+搴忓垪鍙�+鐢熶骇鏃ユ湡
         private void SaveBarCode_bori() 
         {
             grdSub.Rows.Clear();
@@ -1127,7 +1137,7 @@
             int HBQty = 0;              //绠辨暟
             double HQty = 0;            //鏁伴噺
             string WeiShu = "";         //灏炬暟
-            int LSH = 0;                //娴佹按鍙�
+            //int LSH = 0;                //娴佹按鍙�
             string LSH2 = "";           //娴佹按鍙疯浆鎹㈡垚瀛楃
             string sDate = "";          //鏃ユ湡
             string sYear = "";          //骞�
@@ -1161,25 +1171,36 @@
                     sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
                     sDay = sDay.Substring(sDay.Length - 2, 2);
                     //==================================
-                    if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
-                    { 
-                        //鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
-                        sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay;
-                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
-                        //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); 
-                    }
-                    else
-                    {
-                        MessageBox.Show("閿欒鐨勬潯鐮佺被鍨嬶紝涓嶈兘鐢熸垚鏉$爜锛�");
-                        return;
-                    }
+                    //if (cmbHBarCodeType.Text == "璇曞墏鎴愬搧鏉$爜瑙勫垯")
+                    //{ 
+                    //    //鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
+                    //sTMNumber = HMaterNumber + HNumber + sYear + sPeriod + sDay;
+                    //    Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                    //    //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+                    //    LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); 
+                    //}
+                    //else
+                    //{
+                    //    MessageBox.Show("閿欒鐨勬潯鐮佺被鍨嬶紝涓嶈兘鐢熸垚鏉$爜锛�");
+                    //    return;
+                    //}
 
                     HBQty = HBQty + ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value);
                     HMinQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value);
                     HSumQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value);
                     n = 0;
-                    for (int i = k; i < HBQty; i++)
+                    //浠庨噾铦跺簭鍒楀彿琛ㄨ幏鍙栧簭鍒楀彿
+                    DataSet DSet = oCn.RunProcReturn("exec h_p_CLD_GetBarCodeSno  "+ ClsPub.isStrNull(grdMain.Rows[j].Cells[HMainIDCol].Value) + "," + ClsPub.isStrNull(grdMain.Rows[j].Cells[HSubIDCol].Value) + "  ", "h_p_CLD_GetBarCodeSno", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //鐢熸垚棣栬鏍囬
+                    if (DSet == null)
+                    {
+                        MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,閲戣澏浜戝簭鍒楀彿涓嶅瓨鍦紒" + DBUtility.ClsPub.sExeReturnInfo);
+                        continue;
+                    }
+                    //
+
+                    for (int i = k; i < DSet.Tables[0].Rows.Count; i++)
+                    //for (int i = k; i < HBQty; i++)
                     {
                         if (HSumQty - HMinQty > 0)
                         {
@@ -1199,17 +1220,17 @@
                             HMinQty = HSumQty;
                         }
                         //
-                        LSH = LSH + 1;
-                        LSH2 = LSH.ToString();
-                        while (LSH2.Length < LSHlen)  //濡傛灉娴佹按鍙峰皬浜�6浣嶆暟鍓嶉潰琛�0
-                        {
-                            LSH2 = "0" + LSH2;
-                        }
-                        if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
-                        {
+                        //LSH = LSH + 1;
+                        LSH2 =DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[n]["SHNO"]);
+                        //while (LSH2.Length < LSHlen)  //濡傛灉娴佹按鍙峰皬浜�6浣嶆暟鍓嶉潰琛�0
+                        //{
+                        //    LSH2 = "0" + LSH2;
+                        //}
+                        //if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+                        //{
                             //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
-                            TM = sTMNumber + LSH2;
-                        }
+                            TM = HMaterNumber + LSH2 + sYear + sPeriod + sDay ;
+                        //}
 
                         if (i + 1 > grdSub.Rows.Count)
                         {
@@ -1283,7 +1304,7 @@
                         grdSub.Rows[i].Cells[HGiveAwayFlag2Col] = oCell;
                         k = k + 1;
                         n = n + 1;
-                        oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+                        //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                     }
                 }
             }

--
Gitblit v1.9.1