From 60ac3842b3c7e89204ef3eee5386fd11a8eb424b Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期六, 11 五月 2024 16:46:24 +0800
Subject: [PATCH] 条码生成模块,增加是否启用保质期判断,启用保质期的物料,根据物料保质期单位、保质期算出有效期至写入条码档案

---
 SCM/条码打印/Gy_BarCodeBill.cs |  158 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 SCM/公用类/ClsPub1.cs         |    4 
 2 files changed, 158 insertions(+), 4 deletions(-)

diff --git "a/SCM/\345\205\254\347\224\250\347\261\273/ClsPub1.cs" "b/SCM/\345\205\254\347\224\250\347\261\273/ClsPub1.cs"
index 0f06270..e072ba8 100644
--- "a/SCM/\345\205\254\347\224\250\347\261\273/ClsPub1.cs"
+++ "b/SCM/\345\205\254\347\224\250\347\261\273/ClsPub1.cs"
@@ -14,7 +14,7 @@
         //public static string WEBSURL = "http://124.70.129.242/WEBS-WMS/WebService1.asmx";             //闆呯惇璇�
         //public static string WEBSURL = "http://192.168.1.29/WEBS-WMS/WebService1.asmx";               //鍦i緳    鍐呯綉
         //public static string WEBSURL = "http://122.227.138.236/WEBS-WMS/WebService1.asmx";            //鍦i緳(涓嶇敤)
-        public static string WEBSURL = "http://220.189.218.154:8092/WEBS-WMS/WebService1.asmx";   //鍥涚淮灏�    鏂颁腑闂村眰    澶栫綉
+        //public static string WEBSURL = "http://220.189.218.154:8092/WEBS-WMS/WebService1.asmx";   //鍥涚淮灏�    鏂颁腑闂村眰    澶栫綉
         //public static string WEBSURL = "http://192.168.0.178:8099/WEBS-WMS/WebService1.asmx";          //鍥涚淮灏�    鏂颁腑闂村眰    鍐呯綉
         //public static string WEBSURL = "http://192.168.0.178/WEBS-WMS/WebService1.asmx";          //鍥涚淮灏�    鏂颁腑闂村眰    鍐呯綉锛堜綔搴燂級
         //public static string WEBSURL = "http://122.227.199.62:5050/LMESWEBS/WebService1.asmx";        //闊╃數    澶栫綉JIT锛堜笉鐢級
@@ -25,7 +25,7 @@
         //public static string WEBSURL = "http://120.195.29.36:1230/WEBS-WMS/WebService1.asmx";         //姹熻嫃榫欎酣
         //public static string WEBSURL = "http://60.191.27.141:8090/WEBS-WMS/WebService1.asmx";         //妫シ
         //public static string WEBSURL = "http://192.168.63.195/WEBS-WMS/WebService1.asmx";
-        //public static string WEBSURL = "http://192.168.63.20/WEBS-WMS/WebService1.asmx";              //鍏徃鍙板紡鏈�
+        public static string WEBSURL = "http://192.168.0.81/WEBS-WMS/WebService1.asmx";              //鍏徃鍙板紡鏈�
         //public static string WEBSURL = "http://192.168.0.107/WEBS-WMS/WebService1.asmx";              //瀹�
 
         //public static string WEBSURL = "http://47.96.97.237/WEBS-WMS/WebService1.asmx";              //鍏徃鏈嶅姟鍣�
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 5bd4b5b..802cf8c 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"
@@ -95,6 +95,11 @@
         public const Int16 POOrderBillNoCol = 74;
         public const Int16 HBarCode_PackCol = 75;
         public const Int16 HCustomQty1Col = 76;
+        public const Int16 HProduceDateCol = 77;
+        public const Int16 HExpiryDateCol = 78;
+        public const Int16 HISKFPERIODCol = 79;
+        public const Int16 HEXPUNITCol = 80;
+        public const Int16 HEXPPERIODCol = 81;
 
         public Int16 HSelectCol = 0;
         public Int16 HSno2Col = 1;
@@ -172,6 +177,11 @@
         public Int16 HBarCode_Pack2Col = 73;
         public Int16 HCustomQty12Col = 74;
         public Int16 HCusBarCodeCol = 75;
+        public Int16 HProduceDate2Col = 76;
+        public Int16 HExpiryDate2Col = 77;
+        public Int16 HISKFPERIOD2Col = 78;
+        public Int16 HEXPUNIT2Col = 79;
+        public Int16 HEXPPERIOD2Col = 80;
         //
         public  string ModName = "85";
         public  string ModCaption = "鏉$爜鐢熸垚";
@@ -189,6 +199,7 @@
         public Int64 HOrgID = -1;
         public string HOrgNumber = "";
         public string CampanyName = ""; //瀹㈡埛瀹氬埗鍖栧悕绉�
+        public string SourceQtyCtl = "Y"; //瓒呮簮鍗曟暟閲忔帶鍒�
         //-------------------------------------------------------------------------
         #region 鍥哄畾浠g爜
          
@@ -635,8 +646,74 @@
                 MessageBox.Show("鏄庣粏琛屼笉瀛樺湪锛�", "鎻愮ず");
                 return false;
             }
+
+            string sHRemark = "";
             for (int j = 0; j < grdMain.Rows.Count; j++)
             {
+                long HSno = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value);                  // 搴忓彿
+                string HBarCodeType = cmbHBarCodeType.Text;                                                 // 鏉$爜绫诲瀷
+                string HSourceBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBillNoCol].Value); // 婧愬崟鍗曞彿
+                long HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value);          // 鐗╂枡鍐呯爜
+                string HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);     // 鎵瑰彿
+                long HAuxPropID = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value);      // 杈呭姪灞炴�D
+                double HSourceQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HinitQtyCol].Value);     // 婧愬崟鏁伴噺
+                double HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value);               // 鏁伴噺
+                double HMinQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value);         // 鏈�灏忓寘瑁呮暟
+
+                if (HMaterID != 0)
+                {
+                    DataSet oDsCheck = oWeb.getDataSetBySQL("exec h_p_Gy_BarCodeBill_AddCheck " + HSno.ToString() + ",'" + HBarCodeType + "','" + HSourceBillNo + "'," + HMaterID.ToString() + ",'" + HBatchNo + "'," + HAuxPropID.ToString() + "," + HSourceQty.ToString() + "," + HQty.ToString() + "," + HMinQty.ToString() + "," + HOrgID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_AddCheck", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //
+                    if (oDsCheck == null && oDsCheck.Tables[0].Rows.Count == 0)
+                    {
+                        MessageBox.Show("鏉$爜鐢熸垚瀹屾暣鎬у垽鏂敊璇紒");
+                        return false;
+                    }
+                    else if (DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0][0]) == "1")
+                    {
+                        sHRemark = sHRemark + DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HRemark"]);
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isBool(oDsCheck.Tables[0].Rows[0]["HISKFPERIOD"]))
+                        {
+                            DateTime HProduceDate;  //鐢熶骇鏃ユ湡
+                            string HEXPUNIT;        //淇濊川鏈熷崟浣�
+                            int HEXPPERIOD;         //淇濊川鏈�
+
+                            HProduceDate = dtpHDate.Value;
+                            HEXPUNIT = DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HEXPUNIT"]);
+                            HEXPPERIOD = DBUtility.ClsPub.isInt(oDsCheck.Tables[0].Rows[0]["HEXPPERIOD"]);
+
+                            grdMain.Rows[j].Cells[HISKFPERIODCol].Value = 1;
+                            grdMain.Rows[j].Cells[HEXPUNITCol].Value = HEXPUNIT;
+                            grdMain.Rows[j].Cells[HEXPPERIODCol].Value = HEXPPERIOD.ToString();
+                            grdMain.Rows[j].Cells[HProduceDateCol].Value = HProduceDate.ToShortDateString();
+
+                            if (HEXPUNIT == "Y")
+                            {
+                                grdMain.Rows[j].Cells[HExpiryDateCol].Value = HProduceDate.AddYears(HEXPPERIOD).ToShortDateString();
+                            }
+                            else if (HEXPUNIT == "M")
+                            {
+                                grdMain.Rows[j].Cells[HExpiryDateCol].Value = HProduceDate.AddMonths(HEXPPERIOD).ToShortDateString();
+                            }
+                            else
+                            {
+                                grdMain.Rows[j].Cells[HExpiryDateCol].Value = HProduceDate.AddDays(HEXPPERIOD).ToShortDateString();
+                            }
+                        }
+                        else
+                        {
+                            grdMain.Rows[j].Cells[HISKFPERIODCol].Value = 0;
+                            grdMain.Rows[j].Cells[HEXPUNITCol].Value = "";
+                            grdMain.Rows[j].Cells[HEXPPERIODCol].Value = 0;
+                            grdMain.Rows[j].Cells[HProduceDateCol].Value = "";
+                            grdMain.Rows[j].Cells[HExpiryDateCol].Value = "";
+                        }
+                    }
+                }
+
                 if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0 && (ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value) == 0 || ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value) == 0 || ClsPub.isDoule(grdMain.Rows[j].Cells[HBQtyCol].Value) == 0))
                 {
                     MessageBox.Show(" 绗�" + ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value) + "琛岋紝鐗╂枡锛�" + ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNameCol].Value) + " 锛屼腑瀛樺湪鏁伴噺銆佹渶灏忓寘瑁呮暟銆佺鏁颁负 0锛屼笉鍏佽鐢熸垚鏉$爜锛�");
@@ -704,6 +781,11 @@
                     //    return false;
                     //}
                 }
+            }
+            if (sHRemark != "")
+            {
+                MessageBox.Show(sHRemark);
+                return false;
             }
             if (CampanyName == "妫シ") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
             {
@@ -1792,6 +1874,18 @@
                             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;
+                            grdSub.Rows[i].Cells[HProduceDate2Col].Value = grdMain.Rows[j].Cells[HProduceDateCol].Value;
+                            grdSub.Rows[i].Cells[HExpiryDate2Col].Value = grdMain.Rows[j].Cells[HExpiryDateCol].Value;
+                            grdSub.Rows[i].Cells[HISKFPERIOD2Col].Value = grdMain.Rows[j].Cells[HISKFPERIODCol].Value;
+                            grdSub.Rows[i].Cells[HEXPUNIT2Col].Value = grdMain.Rows[j].Cells[HEXPUNITCol].Value;
+                            grdSub.Rows[i].Cells[HEXPPERIOD2Col].Value = grdMain.Rows[j].Cells[HEXPPERIODCol].Value;
+                            //缃戞牸鎵撳嬀
+                            //鏄惁鍚敤淇濊川鏈�
+                            DataGridViewCheckBoxCell oCell2 = new DataGridViewCheckBoxCell();
+                            oCell2.ThreeState = false;
+                            oCell2.Value = grdSub.Rows[i].Cells[HISKFPERIOD2Col].Value;
+                            oCell2.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
+                            grdSub.Rows[i].Cells[HISKFPERIOD2Col] = oCell2;
                             k = k + 1;
                             n = n + 1;
                             //oWeb.getRunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -1886,6 +1980,11 @@
                 string HCusBarCode = "";
                 string HBarCodeStatus = "";
                 Int64 sHLayerNumber = 0;     //鐮佹斁灞傛暟
+                string HProduceDate;
+                string HExpiryDate;
+                bool HISKFPERIOD = false;
+                string HEXPUNIT = "";
+                double HEXPPERIOD = 0;
 
                 string[] sSQLMul = new string[grdSub.Rows.Count];
 
@@ -1974,6 +2073,25 @@
                         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);
+                        if (ClsPub.isDate(grdSub.Rows[i].Cells[HProduceDate2Col].Value) < Convert.ToDateTime("1950-01-01"))
+                        {
+                            HProduceDate = "";
+                        }
+                        else
+                        {
+                            HProduceDate = ClsPub.isStrNull(grdSub.Rows[i].Cells[HProduceDate2Col].Value);
+                        }
+                        if (ClsPub.isDate(grdSub.Rows[i].Cells[HExpiryDate2Col].Value) < Convert.ToDateTime("1950-01-01"))
+                        {
+                            HExpiryDate = "";
+                        }
+                        else
+                        {
+                            HExpiryDate = ClsPub.isStrNull(grdSub.Rows[i].Cells[HExpiryDate2Col].Value);
+                        }
+                        HISKFPERIOD = ClsPub.isBool(grdSub.Rows[i].Cells[HISKFPERIOD2Col].Value);
+                        HEXPUNIT = ClsPub.isStrNull(grdSub.Rows[i].Cells[HEXPUNIT2Col].Value);
+                        HEXPPERIOD = ClsPub.isDoule(grdSub.Rows[i].Cells[HEXPPERIOD2Col].Value);
                         sSQLMul[mm] = "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                                     ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                                     ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
@@ -1983,6 +2101,8 @@
                                     ",HLogo,HPackageSize,HMaterialJQty,HMaterialMQty,HCustomBatchNo " +
                                     ",HSTOCKORGID,HOWNERID,HBeginDate,HSeOrderBillNo,HGBBarCode " +
                                     ",POOrderBillNo,HInterID,HInitSourceEntryID,HBarCode_Pack " +
+                                    ",HProduceDate,HExpiryDate " +
+                                    ",HISKFPERIOD,HEXPUNIT,HEXPPERIOD " +
                                     ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo " +
                                     ",HCustomQty1,HLayerNumber,HCusBarCode,HBarCodeStatus " +
                                     ") values ("
@@ -1995,6 +2115,8 @@
                                     + ",'" + HLogo + "','" + HPackageSize + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + ",'" + HCustomBatchNo + "'"
                                     + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HBeginDate.ToShortDateString() + "','" + HSeOrderBillNo + "','" + HGBBarCode + "'"
                                     + ",'" + POOrderBillNo + "'," + HInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HBarCode_Pack + "'"
+                                    + ", " + (HProduceDate == "" ? "NULL" : "'" + HProduceDate + "'") + "," + (HExpiryDate == "" ? "NULL" : "'" + HExpiryDate + "'")
+                                    + ", " + DBUtility.ClsPub.BoolToString(HISKFPERIOD) + ",'" + HEXPUNIT + "'," + HEXPPERIOD.ToString()
                                     + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "'"
                                     + ", " + HCustomQty1.ToString() + "," + sHLayerNumber.ToString() + ",'" + HCusBarCode + "','" + HBarCodeStatus + "')";
                         //oCn.RunProc("exec setLSH '" + ClsPub.GetServerDate(0) + "'");
@@ -2078,7 +2200,7 @@
         {
             grdMain.RowCount = 0;
             grdSub.RowCount = 0;
-            grdMain.ColumnCount = 77;                       //鎬诲垪鏁�
+            grdMain.ColumnCount = 82;                       //鎬诲垪鏁�
             ClsPub1.initGridFst(grdMain, this.Name);
             grdMain.Columns[HSnoCol].HeaderText = "搴忓彿";
             grdMain.Columns[HMainIDCol].HeaderText = "婧愬崟涓籌D";
@@ -2148,6 +2270,11 @@
             grdMain.Columns[POOrderBillNoCol].HeaderText = "閲囪喘璁㈠崟鍙�";
             grdMain.Columns[HBarCode_PackCol].HeaderText = "鎵樻潯鐮佺紪鍙�";
             grdMain.Columns[HLayerNumberCol].HeaderText = "鐮佹斁灞傛暟";
+            grdMain.Columns[HProduceDateCol].HeaderText = "鐢熶骇鏃ユ湡";
+            grdMain.Columns[HExpiryDateCol].HeaderText = "鏈夋晥鏈熻嚦";
+            grdMain.Columns[HISKFPERIODCol].HeaderText = "鏄惁鍚敤淇濊川鏈�";
+            grdMain.Columns[HEXPUNITCol].HeaderText = "淇濊川鏈熷崟浣�";
+            grdMain.Columns[HEXPPERIODCol].HeaderText = "淇濊川鏈�";
             ////
             //鏍煎紡鍖�    闅愯棌鍒�
             grdMain.Columns[HTagCol].Visible = false;
@@ -2217,6 +2344,11 @@
             grdMain.Columns[HBarCode_PackCol].Visible = false;
             grdMain.Columns[HCustomQty1Col].Visible = false;
             grdMain.Columns[HLayerNumberCol].Visible = false;
+            grdMain.Columns[HProduceDateCol].Visible = false;
+            grdMain.Columns[HExpiryDateCol].Visible = false;
+            grdMain.Columns[HISKFPERIODCol].Visible = false;
+            grdMain.Columns[HEXPUNITCol].Visible = false;
+            grdMain.Columns[HEXPPERIODCol].Visible = false;
 
             if (CampanyName == "闊╃數") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
             {
@@ -2301,7 +2433,7 @@
             ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
             //----------------------------
 
-            grdSub.ColumnCount = 76;                       //鎬诲垪鏁�
+            grdSub.ColumnCount = 81;                       //鎬诲垪鏁�
             ClsPub1.initGridFst(grdSub, this.Name);
             grdSub.Columns[HSelectCol].HeaderText = "閫夋嫨";
             grdSub.Columns[HTMCol].HeaderText = "鏉$爜缂栧彿";
@@ -2376,6 +2508,11 @@
             grdSub.Columns[HBarCode_Pack2Col].HeaderText = "鎵樻潯鐮佺紪鍙�";
             grdSub.Columns[HCusBarCodeCol].HeaderText = "瀹㈡埛鏉$爜";
             grdSub.Columns[HLayerNumber2Col].HeaderText = "鐮佹斁灞傛暟";
+            grdSub.Columns[HProduceDate2Col].HeaderText = "鐢熶骇鏃ユ湡";
+            grdSub.Columns[HExpiryDate2Col].HeaderText = "鏈夋晥鏈熻嚦";
+            grdSub.Columns[HISKFPERIOD2Col].HeaderText = "鏄惁鍚敤淇濊川鏈�";
+            grdSub.Columns[HEXPUNIT2Col].HeaderText = "淇濊川鏈熷崟浣�";
+            grdSub.Columns[HEXPPERIOD2Col].HeaderText = "淇濊川鏈�";
 
             //鏍煎紡鍖�    闅愯棌鍒�
             grdSub.Columns[HBarCodeType2Col].Visible = false;
@@ -2444,6 +2581,18 @@
             grdSub.Columns[HCustomQty12Col].Visible = false;
             grdSub.Columns[HCusBarCodeCol].Visible = false;
             grdSub.Columns[HLayerNumber2Col].Visible = false;
+
+            //璁剧疆鐗规畩鍒�
+            for (int i = 0; i < grdSub.Rows.Count; i++)
+            {
+                //缃戞牸鎵撳嬀
+                //鏄惁鍚敤淇濊川鏈�
+                DataGridViewCheckBoxCell oCell2 = new DataGridViewCheckBoxCell();
+                oCell2.ThreeState = false;
+                oCell2.Value = 0;
+                oCell2.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
+                grdSub.Rows[i].Cells[HISKFPERIOD2Col] = oCell2;
+            }
 
             if (CampanyName == "闊╃數") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
             {
@@ -3460,6 +3609,11 @@
             grdMain.Rows[i].Cells[HGroupIDCol].Value = oTable.Rows[0]["HGroupID"].ToString();
             grdMain.Rows[i].Cells[HGroupNumberCol].Value = oTable.Rows[0]["鐝粍浠g爜"].ToString();
             grdMain.Rows[i].Cells[HGroupNameCol].Value = oTable.Rows[0]["鐝粍"].ToString();
+            grdMain.Rows[i].Cells[HProduceDateCol].Value = oTable.Rows[0]["HProduceDate"].ToString();
+            grdMain.Rows[i].Cells[HExpiryDateCol].Value = oTable.Rows[0]["HExpiryDate"].ToString();
+            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();
             //--
             //璁剧疆鍙紪杈戝垪
             string sAllowCol = HTagCol.ToString();

--
Gitblit v1.9.1