From 4cd6df69db38312c99192ce1f442ff2ce0b68b24 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期五, 17 二月 2023 16:26:55 +0800
Subject: [PATCH] 奇瑞箱条码生成规则修改

---
 SCM/条码打印/Gy_BarCodeBill.cs |  149 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 90 insertions(+), 59 deletions(-)

diff --git "a/SCM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/SCM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
index 6eba708..60a1c2b 100644
--- "a/SCM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
+++ "b/SCM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
@@ -72,28 +72,29 @@
         public const Int16 HSeOrderBillIDCol = 51;
         public const Int16 HSeOrderBillNoCol = 52;
         public const Int16 HCustomBatchNoCol = 53;
-        public const Int16 HWhIDCol = 54;
-        public const Int16 HWhNumberCol = 55;
-        public const Int16 HWhNameCol = 56;
-        public const Int16 HSPIDCol = 57;
-        public const Int16 HSPNumberCol = 58;
-        public const Int16 HSPNameCol = 59;
-        public const Int16 HinitQtyCol = 60;
-        public const Int16 HRemarkCol = 61;
-        public const Int16 HPinfanBarCodeCol = 62;
-        public const Int16 HMTONoCol = 63;
-        public const Int16 HColorCol = 64;
-        public const Int16 HPressModelCol = 65;
-        public const Int16 HJiaYeCol = 66;
-        public const Int16 HPackageSizeCol = 67;
-        public const Int16 HJQtyCol = 68;
-        public const Int16 HMQtyCol = 69;
-        public const Int16 HGBBarCodeCol = 70;
-        public const Int16 HJiaYeLXCol = 71;
-        public const Int16 HJiaYeLCol = 72;
-        public const Int16 POOrderBillNoCol = 73;
-        public const Int16 HBarCode_PackCol = 74;
-        public const Int16 HCustomQty1Col = 75;
+        public const Int16 HLayerNumberCol = 54;
+        public const Int16 HWhIDCol = 55;
+        public const Int16 HWhNumberCol = 56;
+        public const Int16 HWhNameCol = 57;
+        public const Int16 HSPIDCol = 58;
+        public const Int16 HSPNumberCol = 59;
+        public const Int16 HSPNameCol = 60;
+        public const Int16 HinitQtyCol = 61;
+        public const Int16 HRemarkCol = 62;
+        public const Int16 HPinfanBarCodeCol = 63;
+        public const Int16 HMTONoCol = 64;
+        public const Int16 HColorCol = 65;
+        public const Int16 HPressModelCol = 66;
+        public const Int16 HJiaYeCol = 67;
+        public const Int16 HPackageSizeCol = 68;
+        public const Int16 HJQtyCol = 69;
+        public const Int16 HMQtyCol = 70;
+        public const Int16 HGBBarCodeCol = 71;
+        public const Int16 HJiaYeLXCol = 72;
+        public const Int16 HJiaYeLCol = 73;
+        public const Int16 POOrderBillNoCol = 74;
+        public const Int16 HBarCode_PackCol = 75;
+        public const Int16 HCustomQty1Col = 76;
 
         public Int16 HSelectCol = 0;
         public Int16 HSno2Col = 1;
@@ -147,29 +148,30 @@
         public Int16 HSeOrderBillID2Col = 49;
         public Int16 HSeOrderBillNo2Col = 50;
         public Int16 HCustomBatchNo2Col = 51;
-        public Int16 HWhID2Col = 52;
-        public Int16 HWhNumber2Col = 53;
-        public Int16 HWhName2Col = 54;
-        public Int16 HSPID2Col = 55;
-        public Int16 HSPNumber2Col = 56;
-        public Int16 HSPName2Col = 57;
-        public Int16 HRemark2Col = 58;
-        public Int16 HPinfanBarCode2Col = 59;
-        public Int16 HMTONo2Col = 60;
-        public Int16 HColor2Col = 61;
-        public Int16 HPressModel2Col = 62;
-        public Int16 HJiaYe2Col = 63;
-        public Int16 HPackageSize2Col = 64;
-        public Int16 HJQty2Col = 65;
-        public Int16 HMQty2Col = 66;
-        public Int16 HMakeDate2Col = 67;
-        public Int16 HGBBarCode2Col = 68;
-        public Int16 HJiaYeLX2Col = 69;
-        public Int16 HJiaYeL2Col = 70;
-        public Int16 POOrderBillNo2Col = 71;
-        public Int16 HBarCode_Pack2Col = 72;
-        public Int16 HCustomQty12Col = 73;
-        public Int16 HCusBarCodeCol = 74;
+        public Int16 HLayerNumber2Col = 52;
+        public Int16 HWhID2Col = 53;
+        public Int16 HWhNumber2Col = 54;
+        public Int16 HWhName2Col = 55;
+        public Int16 HSPID2Col = 56;
+        public Int16 HSPNumber2Col = 57;
+        public Int16 HSPName2Col = 58;
+        public Int16 HRemark2Col = 59;
+        public Int16 HPinfanBarCode2Col = 60;
+        public Int16 HMTONo2Col = 61;
+        public Int16 HColor2Col = 62;
+        public Int16 HPressModel2Col = 63;
+        public Int16 HJiaYe2Col = 64;
+        public Int16 HPackageSize2Col = 65;
+        public Int16 HJQty2Col = 66;
+        public Int16 HMQty2Col = 67;
+        public Int16 HMakeDate2Col = 68;
+        public Int16 HGBBarCode2Col = 69;
+        public Int16 HJiaYeLX2Col = 70;
+        public Int16 HJiaYeL2Col = 71;
+        public Int16 POOrderBillNo2Col = 72;
+        public Int16 HBarCode_Pack2Col = 73;
+        public Int16 HCustomQty12Col = 74;
+        public Int16 HCusBarCodeCol = 75;
         //
         public  string ModName = "85";
         public  string ModCaption = "鏉$爜鐢熸垚";
@@ -677,6 +679,17 @@
                             MessageBox.Show(" 绗�" + ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value) + "琛岋紝鐗╂枡锛�" + ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNameCol].Value) + " 锛屾湭鍚敤鎵规绠$悊锛屼笉鍏佽鏈夋壒娆★紒");
                             return false;
                         }
+                        if (cmbHBarCodeType.Text == "濂囩憺鏉$爜")
+                        {
+                            string HCusBatchNo = "";    //瀹㈡埛鎵规
+                            HCusBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustomBatchNoCol].Value);
+                            if (HCusBatchNo.Trim() == "")
+                            {
+                                MessageBox.Show(" 绗�" + ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value) + "琛岋紝鐗╂枡锛�" + ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNameCol].Value) + " 锛屽鎴锋壒娆″彿涓嶅厑璁镐负绌猴紒");
+                                bc.Enabled = true;
+                                return false;
+                            }
+                        }
                     }
 
                     ////鍘熸帶鍒�
@@ -772,6 +785,7 @@
                 string LSH2 = "";           //娴佹按鍙疯浆鎹㈡垚瀛楃
                 string sDate = "";          //鏃ユ湡
                 string sYear = "";          //骞�
+                string sYear2 = "";         //骞�
                 string sPeriod = "";        //鏈�
                 string sDay = "";           //鏃�
                 string HBatchNo = "";       //鎵规
@@ -787,6 +801,8 @@
                 string CusTM = "";          //瀹㈡埛鏉$爜
                 string sCusTMNumber = "";   //瀹㈡埛鏉$爜鑷畾涔夊墠缂�
                 int CusTMLSH = 0;           //瀹㈡埛鏉$爜娴佹按鍙�
+                int HLayerNumber = 0;       //鐮佹斁灞傛暟
+                string HLayerNumber2 = "";  //鐮佹斁灞傛暟杞崲鎴愬瓧绗�
                 DataSet Ds;
                 pb1.Value = 0;
                 for (int j = 0; j < grdMain.Rows.Count; j++)
@@ -798,6 +814,7 @@
                         HBatchNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);
                         sDate = dtpHDate.Value.ToShortDateString();
                         sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
+                        sYear2 = 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();
@@ -1580,8 +1597,8 @@
                             HModel = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterModelCol].Value);
                             HCusNumber = "8DP";     //渚涘簲鍟嗕唬鐮佸浐瀹氫负8DP
                             HCusBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustomBatchNoCol].Value);
-                            //瀹㈡埛鏉$爜鍓嶇紑 = 10#瑙勬牸鍨嬪彿$+11#渚涘簲鍟嗕唬鐮�$
-                            sCusTMNumber = "10#" + HModel + "$11#" + HCusNumber + "$";
+                            //瀹㈡埛鏉$爜鍓嶇紑 = 10#瑙勬牸鍨嬪彿$+11#渚涘簲鍟嗕唬鐮�$+20#鍖呰鏃ユ湡$
+                            sCusTMNumber = "10#" + HModel + "$11#" + HCusNumber + "$20#" + sYear2 + sPeriod + sDay + "$";
                             Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo  '" + sCusTMNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//鑾峰彇鏈�澶ф祦姘村彿
                             CusTMLSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                         }
@@ -1654,16 +1671,18 @@
                                 //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
                                 TM = sTMNumber + LSH2;
 
-                                //瀹㈡埛鏉$爜鍓嶇紑 = 10#瑙勬牸鍨嬪彿$+11#渚涘簲鍟嗕唬鐮�$
-                                //瀹㈡埛鏉$爜 = 瀹㈡埛鏉$爜鍓嶇紑+17#鏈�灏忓寘瑁呮暟閲�$+18#渚涘簲鍟嗘壒娆�$+娴佹按鍙�
-                                CusTMLSH = CusTMLSH + 1;
-                                CusTM = sCusTMNumber + "17#"+ HMinQty+ "$18#"+ HCusBatchNo+ "$"+ CusTMLSH;
-                                if (HCusBatchNo.Trim() == "")
+                                //瀹㈡埛鏉$爜 = 10#瑙勬牸鍨嬪彿$+11#渚涘簲鍟嗕唬鐮�$+17#鏈�灏忓寘瑁呮暟閲�$+18#渚涘簲鍟嗘壒娆�$+19#鐮佹斁灞傛暟$+20#鍖呰鏃ユ湡+31#娴佹按鍙�$
+                                HLayerNumber = DBUtility.ClsPub.isInt(grdMain.Rows[j].Cells[HLayerNumberCol].Value);
+                                if(HLayerNumber==0)
                                 {
-                                    MessageBox.Show("瀹㈡埛鎵规鍙蜂笉鍏佽涓虹┖锛�");
-                                    bc.Enabled = true;
-                                    return;
+                                    HLayerNumber2 = "";
                                 }
+                                else
+                                {
+                                    HLayerNumber2 = HLayerNumber.ToString();
+                                }
+                                CusTMLSH = CusTMLSH + 1;
+                                CusTM = "10#" + HModel + "$11#" + HCusNumber + "$17#" + HMinQty+ "$18#"+ HCusBatchNo + "$19#" + HLayerNumber2 + "$20#" + sYear2 + sPeriod + sDay + "$31#" + CusTMLSH + "$";
                             }
 
                             if (CampanyName == "闊╃數" && cmbHBarCodeType.Text != "绠卞彂鏉$爜") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
@@ -1767,6 +1786,7 @@
                             grdSub.Rows[i].Cells[HBarCode_Pack2Col].Value = grdMain.Rows[j].Cells[HBarCode_PackCol].Value;
                             grdSub.Rows[i].Cells[HCustomQty12Col].Value = ClsPub.isLong(txtHCaseNo.Text) + i;
                             grdSub.Rows[i].Cells[HCusBarCodeCol].Value = CusTM;
+                            grdSub.Rows[i].Cells[HLayerNumber2Col].Value = grdMain.Rows[j].Cells[HLayerNumberCol].Value;
                             k = k + 1;
                             n = n + 1;
                             //oWeb.getRunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -1860,6 +1880,7 @@
                 long HCustomQty1 = 0;
                 string HCusBarCode = "";
                 string HBarCodeStatus = "";
+                Int64 sHLayerNumber = 0;     //鐮佹斁灞傛暟
 
                 string[] sSQLMul = new string[grdSub.Rows.Count];
 
@@ -1941,6 +1962,7 @@
                         HBarCode_Pack = ClsPub.isStrNull(grdSub.Rows[i].Cells[HBarCode_Pack2Col].Value);
                         HCustomQty1 = ClsPub.isLong(grdSub.Rows[i].Cells[HCustomQty12Col].Value); //绠卞彿锛堟.妤凤級
                         HCusBarCode = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCusBarCodeCol].Value);
+                        sHLayerNumber = ClsPub.isLong(grdSub.Rows[i].Cells[HLayerNumber2Col].Value);
                         sSQLMul[mm] = "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                                     ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                                     ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
@@ -1951,7 +1973,7 @@
                                     ",HSTOCKORGID,HOWNERID,HBeginDate,HSeOrderBillNo,HGBBarCode " +
                                     ",POOrderBillNo,HInterID,HInitSourceEntryID,HBarCode_Pack " +
                                     ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo " +
-                                    ",HCustomQty1,HCusBarCode,HBarCodeStatus " +
+                                    ",HCustomQty1,HLayerNumber,HCusBarCode,HBarCodeStatus " +
                                     ") values ("
                                     + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
                                     + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
@@ -1963,7 +1985,7 @@
                                     + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HBeginDate.ToShortDateString() + "','" + HSeOrderBillNo + "','" + HGBBarCode + "'"
                                     + ",'" + POOrderBillNo + "'," + HInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HBarCode_Pack + "'"
                                     + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "'"
-                                    + ", " + HCustomQty1.ToString() + ",'" + HCusBarCode + "','" + HBarCodeStatus + "')";
+                                    + ", " + HCustomQty1.ToString() + "," + sHLayerNumber.ToString() + ",'" + HCusBarCode + "','" + HBarCodeStatus + "')";
                         //oCn.RunProc("exec setLSH '" + ClsPub.GetServerDate(0) + "'");
                         mm = mm + 1;
                         Application.DoEvents();
@@ -2034,7 +2056,7 @@
         {
             grdMain.RowCount = 0;
             grdSub.RowCount = 0;
-            grdMain.ColumnCount = 76;                       //鎬诲垪鏁�
+            grdMain.ColumnCount = 77;                       //鎬诲垪鏁�
             ClsPub1.initGridFst(grdMain, this.Name);
             grdMain.Columns[HSnoCol].HeaderText = "搴忓彿";
             grdMain.Columns[HMainIDCol].HeaderText = "婧愬崟涓籌D";
@@ -2103,6 +2125,7 @@
             grdMain.Columns[HJiaYeLCol].HeaderText = "鍔犳恫閲�";
             grdMain.Columns[POOrderBillNoCol].HeaderText = "閲囪喘璁㈠崟鍙�";
             grdMain.Columns[HBarCode_PackCol].HeaderText = "鎵樻潯鐮佺紪鍙�";
+            grdMain.Columns[HLayerNumberCol].HeaderText = "鐮佹斁灞傛暟";
             ////
             //鏍煎紡鍖�    闅愯棌鍒�
             grdMain.Columns[HTagCol].Visible = false;
@@ -2171,6 +2194,7 @@
             grdMain.Columns[POOrderBillNoCol].Visible = false;
             grdMain.Columns[HBarCode_PackCol].Visible = false;
             grdMain.Columns[HCustomQty1Col].Visible = false;
+            grdMain.Columns[HLayerNumberCol].Visible = false;
 
             if (CampanyName == "闊╃數") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
             {
@@ -2212,6 +2236,7 @@
                 grdMain.Columns[HAuxPropNumberCol].Visible = true;
                 grdMain.Columns[HAuxPropNameCol].Visible = true;
                 grdMain.Columns[HCustomBatchNoCol].Visible = true;
+                grdMain.Columns[HLayerNumberCol].Visible = true;
             }
             else if (CampanyName == "鍦i緳") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
             {
@@ -2245,6 +2270,7 @@
                                     "," + HPressModelCol.ToString() +
                                     "," + HGBBarCodeCol.ToString() +
                                     "," + HCustomBatchNoCol.ToString() +
+                                    "," + HLayerNumberCol.ToString() +
                                     "," + HRemarkCol.ToString();
             //璁剧疆鍚堣鍒�
             string sTotalCol = HQtyCol.ToString();
@@ -2253,7 +2279,7 @@
             ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
             //----------------------------
 
-            grdSub.ColumnCount = 75;                       //鎬诲垪鏁�
+            grdSub.ColumnCount = 76;                       //鎬诲垪鏁�
             ClsPub1.initGridFst(grdSub, this.Name);
             grdSub.Columns[HSelectCol].HeaderText = "閫夋嫨";
             grdSub.Columns[HTMCol].HeaderText = "鏉$爜缂栧彿";
@@ -2327,6 +2353,7 @@
             grdSub.Columns[POOrderBillNo2Col].HeaderText = "閲囪喘璁㈠崟鍙�";
             grdSub.Columns[HBarCode_Pack2Col].HeaderText = "鎵樻潯鐮佺紪鍙�";
             grdSub.Columns[HCusBarCodeCol].HeaderText = "瀹㈡埛鏉$爜";
+            grdSub.Columns[HLayerNumber2Col].HeaderText = "鐮佹斁灞傛暟";
 
             //鏍煎紡鍖�    闅愯棌鍒�
             grdSub.Columns[HBarCodeType2Col].Visible = false;
@@ -2394,6 +2421,7 @@
             grdSub.Columns[HBarCode_Pack2Col].Visible = false;
             grdSub.Columns[HCustomQty12Col].Visible = false;
             grdSub.Columns[HCusBarCodeCol].Visible = false;
+            grdSub.Columns[HLayerNumber2Col].Visible = false;
 
             if (CampanyName == "闊╃數") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
             {
@@ -2437,6 +2465,7 @@
                 grdSub.Columns[HAuxPropName2Col].Visible = true;
                 grdSub.Columns[HCustomBatchNo2Col].Visible = true;
                 grdSub.Columns[HCusBarCodeCol].Visible = true;
+                grdSub.Columns[HLayerNumber2Col].Visible = true;
             }
             else if (CampanyName == "鍦i緳") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
             {
@@ -3186,6 +3215,7 @@
                                 "," + HSupNumberCol.ToString() +
                                 "," + POOrderBillNoCol.ToString() +
                                 "," + HCustomBatchNoCol.ToString() +
+                                "," + HLayerNumberCol.ToString() +
                                 "," + HMinQtyCol.ToString();
                 }
                 grdMain.Columns[HBillNoCol].ReadOnly = true;
@@ -3273,6 +3303,7 @@
                                 "," + HPressModelCol.ToString() +
                                 "," + HGBBarCodeCol.ToString() +
                                 "," + HCustomBatchNoCol.ToString() +
+                                "," + HLayerNumberCol.ToString() +
                                 "," + HMinQtyCol.ToString();
             }
             grdMain.Columns[HBillNoCol].ReadOnly = true;

--
Gitblit v1.9.1