From dc43a1eacd999caeb907b11ff1aca339e94e3a5b Mon Sep 17 00:00:00 2001
From: jingh <jingh@LAPTOP-I53VDLOO>
Date: 星期日, 02 一月 2022 03:31:28 +0800
Subject: [PATCH] 夏宝条码

---
 WarM/条码打印/Gy_BarCodeBill.cs |   65 ++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 24 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 8a76fc9..d210a73 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"
@@ -688,6 +688,7 @@
             string HModelName = "";       //鏈哄瀷
             string HICMOBillNo = "";       //婧愬崟鍙�
             string HBarCodeBatchNo = "";       //鏉$爜鎵规鍙�
+            string HBarCodeDate = "";         //鏉$爜鏃ユ湡
             int k = 0;
             int n = 0;                  //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯
             string sTMNumber = "";      //鏉$爜鑷畾涔夊墠缂�
@@ -712,14 +713,15 @@
                     {
                         sDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HEndDateCol].Value);
                     }
-                    else if (CompanyName=="澶忓疂鐢靛櫒")// 鏃ユ湡锛氱敓浜ц鍗� 鏉$爜鏃ユ湡
+                    else if (CampanyName == "澶忓疂鐢靛櫒")// 鏃ユ湡锛氱敓浜ц鍗� 鏉$爜鏃ユ湡
                     {
                         sDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HDateCol].Value);
                     }
                     HYasuoji= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HPinfanCol].Value); //鍘嬬缉鏈轰唬鐮侊紙澶忓疂鐢靛櫒锛�
-                    HModelName= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterModelCol].Value); //鏈哄瀷锛堝瀹濈數鍣級
+                    HModelName= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusTypeCol].Value); //鏈哄瀷锛堝瀹濈數鍣級
                     HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSourceBillNoCol].Value); //鐢熶骇璁㈠崟鍙凤紙澶忓疂鐢靛櫒锛�
                     HBarCodeBatchNo= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HPinfanBarCodeCol].Value); //鏉$爜鎵规鍙凤紙澶忓疂鐢靛櫒锛�
+                    HBarCodeDate= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSupNumberCol].Value); //鏉$爜鏃ユ湡锛堝瀹濈數鍣級
                     //
                     sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
                     sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
@@ -806,20 +808,31 @@
                     {
                         //鍒堕�犳湰閮�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 + "00" ;
+                        sTMNumber = "1" + HModelName + HBarCodeDate + 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]);
                         LSHlen = 4;
+                        if (sTMNumber.Length != 16)
+                        {
+                            MessageBox.Show("鏉$爜闀垮害涓嶅16浣嶏紝鏄惁鏁版嵁涓嶅叏锛�");
+                            return;
+                        }
                     }
                     else if (cmbHBarCodeType.Text == "澶栭攢鏈烘潯鐮�")
                     {
                         //鐗╂枡浠g爜11浣�+骞�2浣�+鏈�1浣嶏紙A銆丅銆丆浠f浛10鏈堜唤锛�+鏃�2浣�+鎵规2浣�+娴佹按鍙�4浣�
-                        sTMNumber = HMaterNumber + sYear + Sub_PeriodChange(sPeriod) + sDay + HBarCodeBatchNo ;
+                        //sTMNumber = HMaterNumber.Replace(Convert.ToChar("."),Convert.ToChar("")) + HBarCodeDate + HBarCodeBatchNo;
+                        sTMNumber = HMaterNumber.Replace( "."  ,  "" ) + HBarCodeDate + HBarCodeBatchNo;
                         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]);
                         LSHlen = 4;
+                        if (sTMNumber.Length != 18)
+                        {
+                            MessageBox.Show("鏉$爜闀垮害涓嶅16浣嶏紝鏄惁鏁版嵁涓嶅叏锛�");
+                            return;
+                        }
                     }
                     else if (cmbHBarCodeType.Text == "鍗婃垚鍝佹潯鐮�")
                     {
@@ -879,6 +892,7 @@
                             || cmbHBarCodeType.Text == "鍗婃垚鍝佹潯鐮�" || cmbHBarCodeType.Text == "澶栭攢鏈烘潯鐮�")
                         {
                             TM = sTMNumber + LSH2;
+
                         }
                         else if (cmbHBarCodeType.Text == "鍐呴攢鏈烘潯鐮�")
                         {
@@ -1100,26 +1114,26 @@
             }
         }
 
-        //鏈堜唤杞寲
-        private string Sub_PeriodChange(string sPeriod)
-        {
-            if(sPeriod=="10")
-            {
-                return "A";
-            }
-            else if (sPeriod == "11")
-            {
-                return "B";
-            }
-            else if (sPeriod == "12")
-            {
-                return "C";
-            }
-            else
-            {
-                return sPeriod.Substring(2, 1);
-            }
-        }
+        ////鏈堜唤杞寲
+        //private string Sub_PeriodChange(string sPeriod)
+        //{
+        //    if(sPeriod=="10")
+        //    {
+        //        return "A";
+        //    }
+        //    else if (sPeriod == "11")
+        //    {
+        //        return "B";
+        //    }
+        //    else if (sPeriod == "12")
+        //    {
+        //        return "C";
+        //    }
+        //    else
+        //    {
+        //        return sPeriod.Substring(1, 1);
+        //    }
+        //}
 
 
         //鐢熸垚鏉$爜 鍗氭棩 
@@ -2311,6 +2325,7 @@
             grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString();
             grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString();
             grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["鍗曟嵁鍙�"].ToString();
+            grdMain.Rows[i].Cells[HSourceBillNoCol].Value = oTable.Rows[0]["鍗曟嵁鍙�"].ToString();
             grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString();
             grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["鏃ユ湡"].ToString(); //鍗氭棩 鏀舵枡鍗曟嵁鏃ユ湡
             grdMain.Rows[i].Cells[HShowDateCol].Value = dtpHDate.Value.ToShortDateString();
@@ -2335,6 +2350,8 @@
             grdMain.Rows[i].Cells[HCusNumberCol].Value = oTable.Rows[0]["瀹㈡埛浠g爜"].ToString();
             grdMain.Rows[i].Cells[HCusNameCol].Value = oTable.Rows[0]["瀹㈡埛"].ToString();
             grdMain.Rows[i].Cells[HCusTypeCol].Value = oTable.Rows[0]["瀹㈡埛鍨嬪彿"].ToString();
+            grdMain.Rows[i].Cells[HPinfanBarCodeCol].Value = oTable.Rows[0]["HPinfanBarCode"].ToString();
+            grdMain.Rows[i].Cells[HPinfanCol].Value = oTable.Rows[0]["HPinfan"].ToString();
             //grdMain.Rows[i].Cells[HSourceIDCol].Value = oTable.Rows[0]["HSourceID"].ToString();
             //grdMain.Rows[i].Cells[HSourceNumberCol].Value = oTable.Rows[0]["鐢熶骇绾夸唬鐮�"].ToString();
             grdMain.Rows[i].Cells[HSourceNameCol].Value = oTable.Rows[0]["鐢熶骇绾�"].ToString();

--
Gitblit v1.9.1