From 7ce5df49becfd770e719e5bc3d078389ea35d0f9 Mon Sep 17 00:00:00 2001
From: ch <37327@LLOOCCY>
Date: 星期一, 14 三月 2022 21:18:09 +0800
Subject: [PATCH] 修改了生产汇报单扫描条码方法

---
 WarM/条码打印/Sc_ICMOToBarCode.cs |  315 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 283 insertions(+), 32 deletions(-)

diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs"
index 29ed5b8..a704a01 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs"
@@ -37,6 +37,10 @@
         public string sDlgWhere = "";  //澶栫獥浣撻�掑叆
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;
         public Int64 HInterID = 0;
+        public const string ModName1 = "3783";
+        public Int64 HInterID_TTM = 0;
+        public string HBillNo_TTM = "";
+        ClsCN SubCn = new ClsCN();
         //
         private void initGrid()
         {
@@ -46,7 +50,6 @@
 
         private void Display()
         {
-            ClsCN SubCn = new ClsCN();
             DataSet DSet;
             string sSql = "";
             string sFastSQL = "";
@@ -90,8 +93,8 @@
             //{
             //    sFastSQL = sFastSQL + " and 鏃ユ湡<='" + dtpHEndDate.Value.ToShortDateString() + "'";
             //}
-            string HEndDate = "";
-            HEndDate = dtpHEndDate.Value.ToShortDateString();
+            //string HEndDate = "";
+            //HEndDate = dtpHEndDate.Value.ToShortDateString();
             //if (sFastSQL.Trim() == "")
             //{
             //    MessageBox.Show("娌℃湁杈撳叆鏉′欢!");
@@ -101,7 +104,7 @@
             //杩囨护鏉′欢
 
             //
-            DSet = SubCn.RunProcReturn("exec h_p_KSTMSC '" + HSeOrderBillNo + "' ,'" + HICMOBillNo + "' , '" + HMaterName + "' , '" + HSourceName + "' ,'" + HEmpName + "' ,'" + HBeginDate + "', '" + HEndDate + "'", "h_p_KSTMSC", ref DBUtility.ClsPub.sExeReturnInfo);
+            DSet = SubCn.RunProcReturn("exec h_p_KSTMSC '" + HSeOrderBillNo + "' ,'" + HICMOBillNo + "' , '" + HMaterName + "' , '" + HSourceName + "' ,'" + HEmpName + "' ,'" + HBeginDate + "'", "h_p_KSTMSC", ref DBUtility.ClsPub.sExeReturnInfo);
             //鐢熸垚棣栬鏍囬
             if (DSet == null)
             {
@@ -758,6 +761,15 @@
             Display();
         }
 
+        string TTM = "";            //鎵樻潯鐮�
+        string HTTMNumber = "";
+        string HICMOBillNo = "";    //鐢熶骇璁㈠崟鍙�
+        int TLSH = 0;
+        string TLSH2 = "";
+        string HOrgNumber = "";
+
+
+
         private void button4_Click(object sender, EventArgs e)
         {
             //1.鑾峰彇鐣岄潰涓婇潰鏁寸鏁伴噺妗嗚緭鍏ョ殑鏁伴噺 璧嬪�肩粰鍙橀噺  骞跺埛鏂扮綉鏍�
@@ -771,31 +783,38 @@
             }
             Display();
             //2.鑾峰彇缃戞牸閫変腑琛岀墿鏂橧D
-            int a = grdMain.CurrentRow.Index;
-            long HMaterID = 0;
-            HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[a].Cells[Fun_GetCol("HMaterID")].Value);
-                if (HMaterID == 0)
-                {
-                    MessageBox.Show("娌℃湁閫変腑浠讳綍璁板綍锛�");
-                    return;
-                }
+            //int a = grdMain.CurrentRow.Index;
+            //long HMaterID = 0;
+            ////HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[a].Cells[Fun_GetCol("HMaterID")].Value);
+            //    if (HMaterID == 0)
+            //    {
+            //        MessageBox.Show("娌℃湁閫変腑浠讳綍璁板綍锛�");
+            //        return;
+            //    }
             //3.瀹氫箟鏄惁缁勬墭鐨勫彉閲�
             int Mul = 0;
             //4.鏍规嵁鍗曟嵁绫诲瀷鑾峰彇鏈鏉$爜涓诲唴鐮丠InterID
             HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo);
-            //5.浠庣綉鏍肩涓�琛屽惊鐜嚦鏈�鍚庝竴琛�  鍒ゆ柇I琛岀殑鐗╂枡鍐呯爜涓嶮鏄惁涓�鑷达紱濡傛灉涓嶄竴鑷村垯寰幆涓嬩竴琛岋紱
             for (int i = 0; i < grdMain.Rows.Count; i++)
             {
-                long HGrdMaterID = 0;
-                HGrdMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.Rows[i].Index].Cells[Fun_GetCol("HMaterID")].Value);
-                if (HMaterID == HGrdMaterID)
-                {
-                    double HDDQty = 0;
-                    HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[grdMain.Rows[i].Index].Cells[Fun_GetCol("璁㈠崟鏁伴噺")].Value);
+
+                //鑾峰彇缃戞牸閲岄潰姣忎竴琛岃鍗曞搴旂殑璁㈠崟鏁伴噺
+                double HDDQty = 0;
+                HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[grdMain.Rows[i].Index].Cells[Fun_GetCol("璁㈠崟鏁伴噺")].Value);
+
+
+                //鑾峰彇褰撳墠绯荤粺鐧婚檰缁勭粐浠g爜
+                HOrgNumber = ClsPub.HOrgNumber;
+
+              
+
+
+                //鑷姩鍖归厤閫昏緫  鍒ゆ柇璁㈠崟鏁伴噺鏄惁澶т簬鏁寸鏁伴噺   濡傛灉璁㈠崟鏁伴噺澶т簬鏁寸鏁伴噺  鐩存帴鐢熸垚鍞竴鐮�
+                //濡傛灉璁㈠崟鏁伴噺灏忎簬鏁寸鏁伴噺  鍒欏惊鐜敓鎴愬敮涓�鐮�   鐢熸垚瀵瑰簲鐨勬墭鏉$爜
                     if (HDDQty >= HZXQty)
                     {
                         HBarCodeQty = HZXQty;
-                        this.Sub_SaveBill();
+                        this.Sub_SaveBill_TTM();
                         Display();
                         Mul = Mul + 1;
                         break;
@@ -804,10 +823,45 @@
                     {
                         HBarCodeQty = HDDQty;
                         HZXQty = HZXQty - HDDQty;
-                        this.Sub_SaveBill();
+                        this.Sub_SaveBill_TTM();
                         Mul = Mul + 1;
+                        continue;
                     }
-                }
+
+                //濡傛灉Mul>1 鏂板缁勬墭鍗曚富琛�
+              
+            }
+
+            if (Mul > 1)
+            {
+                //HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
+                DataSet DS1;
+                HTTMNumber = HOrgNumber + HICMOBillNo;
+                DS1 = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                TLSH = ClsPub.isInt(DS1.Tables[0].Rows[0][0]);
+                TLSH2 = TLSH.ToString();
+                TTM = HTTMNumber + TLSH2;
+                HInterID_TTM = DBUtility.ClsPub.CreateBillID_Prod(ModName1, ref DBUtility.ClsPub.sExeReturnInfo);
+                HBillNo_TTM = DBUtility.ClsPub.CreateBillCode_Prod(ModName1, ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙�
+
+                string HDate = "";
+                string HYear = "";
+                string HPeriod = "";
+                string HDay = "";
+                HDate = DateTime.Now.ToShortDateString();
+                HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
+                HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
+                HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+                HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
+                HDay = HDay.Substring(HDay.Length - 2, 2);
+
+                oCn.RunProc("insert into Sc_PackUnionBillMain (HYear,HPeriod,HBillType,HInterID,HDate" +
+                                   ",HBillNo,HBillStatus,HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID,HWeight" +
+                                   ",HPWeight,HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo " +
+                                   ") values ("
+                                   + HYear + "," + HPeriod + ",'3783'," + HInterID_TTM + ",'" + HDate + "'"
+                                   + ", " + HBillNo_TTM.ToString() + ",1,''," + TTM.ToString() + ",0,0,0"
+                                   + ",0,1,0,0,0,0,'','')");
             }
 
 
@@ -871,10 +925,10 @@
             string WeiShu = "";         //灏炬暟
             int LSHlen = 6;             //娴佹按鍙烽暱搴�
             string TM = "";             //鏉$爜
-            for (int j = 0; j < grdMain.SelectedRows.Count; j++)
+            for (int j = 0; j < grdMain.Rows.Count; j++)
             {
-                HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[j].Index].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value);
-                HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[j].Index].Cells[Fun_GetCol("鎵规")].Value);
+                HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value);
+                HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
                 HDate = DateTime.Now.ToShortDateString();
                 HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
                 HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
@@ -886,7 +940,7 @@
 
                 //HBQty = HBQty + ClsPub.isInt(txtHBQty.Text);
                 HZXQty = ClsPub.isDoule(txtHZXQty.Text);
-                HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[grdMain.SelectedRows[j].Index].Cells[Fun_GetCol("璁㈠崟鏁伴噺")].Value);
+                HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("璁㈠崟鏁伴噺")].Value);
 
 
                 if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
@@ -953,14 +1007,14 @@
                         HWei = WeiShu;
                         HBarCode = TM;
                         HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
-                        HMaterID1 = ClsPub.isLong(grdMain.SelectedRows[j].Cells[Fun_GetCol("HMaterID")].Value);
+                        HMaterID1 = ClsPub.isLong(grdMain.Rows[j].Cells[Fun_GetCol("HMaterID")].Value);
                         HAuxPropID = 0;
                         HUnitID = 0;
                         HQty2 = HZXQty;
-                        HBatchNo2 = ClsPub.isStrNull(grdMain.SelectedRows[j].Cells[Fun_GetCol("鎵规")].Value);
+                        HBatchNo2 = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
                         HSourceInterID = 0;
                         HSourceEntryID = 0;
-                        HSourceBillNo = ClsPub.isStrNull(grdMain.SelectedRows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
+                        HSourceBillNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
                         HSourceBillType = "3710";
                         HBarcodeQtys = 0;
                         HBarcodeNo = 0;
@@ -969,13 +1023,13 @@
                         HWhID = 0;
                         HSPID = 0;
                         HRemark = "";
-                        HMaterName = ClsPub.isStrNull(grdMain.SelectedRows[j].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value);
-                        HMaterModel = ClsPub.isStrNull(grdMain.SelectedRows[j].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value);
+                        HMaterName = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value);
+                        HMaterModel = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value);
                         HPinfan = "";
                         HMTONo = "";
                         HCusID = 0;
                         HCusType = "";
-                        HEndDate = ClsPub.isDate(grdMain.SelectedRows[j].Cells[Fun_GetCol("鏃ユ湡")].Value);
+                        HEndDate = ClsPub.isDate(grdMain.Rows[j].Cells[Fun_GetCol("鏃ユ湡")].Value);
                         HWorkLineName = "";
                         HSeOrderBillNo = "";
                         HInnerBillNo = "";
@@ -1005,6 +1059,178 @@
                         oCn.RollBack();
                         MessageBox.Show("鏉$爜鐢熸垚澶辫触锛�" + e1.Message);
                     }
+            }
+        }
+
+
+
+        private void Sub_SaveBill_TTM()
+        {
+            HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo);
+            HInterID_TTM = DBUtility.ClsPub.CreateBillID_Prod(ModName1, ref DBUtility.ClsPub.sExeReturnInfo);
+            HBillNo_TTM = DBUtility.ClsPub.CreateBillCode_Prod(ModName1, ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙�
+            string HMaterNumber = "";
+            string HBatchNo = "";
+            string HDate = "";
+            string HYear = "";
+            string HPeriod = "";
+            string HDay = "";
+            string HTMNumber = "";
+            string HOrgNumber = "";
+            DataSet Ds;
+            int LSH = 0;                //娴佹按鍙�
+            string LSH2 = "";           //娴佹按鍙疯浆鎹㈡垚瀛楃
+            double HZXQty = 0;         //瑁呯鏁伴噺
+            double HDDQty = 0;         //璁㈠崟鏁伴噺
+            double HBQty = 0;         //绠辨暟
+            int k = 0;
+            int n = 0;                  //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯
+            string WeiShu = "";         //灏炬暟
+            int LSHlen = 6;             //娴佹按鍙烽暱搴�
+            string TM = "";             //鏉$爜
+            for (int j = 0; j < grdMain.Rows.Count; j++)
+            {
+                HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value);
+                HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
+                HDate = DateTime.Now.ToShortDateString();
+                HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
+                HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
+                HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+                HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
+                HDay = HDay.Substring(HDay.Length - 2, 2);
+                HOrgNumber = ClsPub.HOrgNumber;
+
+
+                //HBQty = HBQty + ClsPub.isInt(txtHBQty.Text);
+                HZXQty = ClsPub.isDoule(txtHZXQty.Text);
+                HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("璁㈠崟鏁伴噺")].Value);
+                HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
+
+                if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+                {
+                    HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
+                    Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                    LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                }
+                else if (cmbHBarCodeType.Text == "鎵规鏉$爜")
+                {
+                    TM = HOrgNumber + HMaterNumber + HBatchNo;
+                }
+             
+
+                n = 0;
+
+                LSH2 = LSH.ToString();
+                while (LSH2.Length < LSHlen)  //濡傛灉娴佹按鍙峰皬浜�6浣嶆暟鍓嶉潰琛�0
+                {
+                    LSH2 = "0" + LSH2;
+                }
+                if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+                {
+                    //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
+                    TM = HTMNumber + LSH2;
+                }
+                if (TM.Trim() == "")
+                {
+                    MessageBox.Show("鏉″舰鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�");
+                    return;
+                }
+                string HWei = "";      //灏炬暟
+                string HBarCode = "";
+                string HBarCodeType = "";
+                Int64 HMaterID1 = 0;
+                Int64 HAuxPropID = 0;
+                Int64 HUnitID = 0;
+                double HQty2 = 0;
+                string HBatchNo2 = "";
+                Int64 HSupID = 0;
+                Int64 HGroupID = 0;
+                int HPrintQty = 0;
+                Int64 HSourceInterID = 0;
+                Int64 HSourceEntryID = 0;
+                string HSourceBillNo = "";
+                string HSourceBillType = "";
+                Int64 HBarcodeNo = 0;       //鎵樺彿
+                Int64 HBarcodeQtys = 0;     //鎬绘墭鏁�
+                Int64 HDeptID = 0;
+                Int64 HWhID = 0;
+                Int64 HSPID = 0;
+                string HRemark = "";
+                string HMaterName = "";
+                string HMaterModel = "";
+                string HPinfan = "";
+                string HMTONo = "";
+                Int64 HCusID = 0;
+                string HCusType = "";
+                DateTime HEndDate;
+                string HWorkLineName = "";
+                string HSeOrderBillNo = "";
+                string HInnerBillNo = "";
+                try
+                {
+                    oCn.BeginTran();
+                    HWei = WeiShu;
+                    HBarCode = TM;
+                    HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
+                    HMaterID1 = ClsPub.isLong(grdMain.Rows[j].Cells[Fun_GetCol("HMaterID")].Value);
+                    HAuxPropID = 0;
+                    HUnitID = 0;
+                    HQty2 = HZXQty;
+                    HBatchNo2 = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
+                    HSourceInterID = 0;
+                    HSourceEntryID = 0;
+                    HSourceBillNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
+                    HSourceBillType = "3710";
+                    HBarcodeQtys = 0;
+                    HBarcodeNo = 0;
+                    HSupID = 0;
+                    HDeptID = 0;
+                    HWhID = 0;
+                    HSPID = 0;
+                    HRemark = "";
+                    HMaterName = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value);
+                    HMaterModel = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value);
+                    HPinfan = "";
+                    HMTONo = "";
+                    HCusID = 0;
+                    HCusType = "";
+                    HEndDate = ClsPub.isDate(grdMain.Rows[j].Cells[Fun_GetCol("鏃ユ湡")].Value);
+                    HWorkLineName = "";
+                    HSeOrderBillNo = "";
+                    HInnerBillNo = "";
+                    oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+                                        ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+                                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+                                        ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+                                        ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+                                        ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
+                                        ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
+                                        ") values ("
+                                        + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID1.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
+                                        + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
+                                        + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
+                                        + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
+                                        + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + HDate + "'"
+                                        + ", " + ClsPub.HOrgID.ToString() + "," + ClsPub.HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString()
+                                        + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')");
+                    oCn.RunProc("insert into Sc_PackUnionBillSub (HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo" +
+                                        ",HSourceBillType,HMaterID,HUnitID,HQty,HSourceID,HEquipID,HGroupID" +
+                                        ",HWorkerID,HScanDate,HBarCode,HBarCode_Pack,HStatus,HICMOEntryID " +
+                                        ") values ("
+                                        +  HInterID_TTM + "," + j + ",0,0,''"
+                                        + ",'3710'," + HMaterID1.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString() + ",0,0,0"
+                                        + ", 0,getdate(),'" + HBarCode + "','" + TTM + "',0,0)");
+
+                    oCn.Commit();
+                    MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
+                    //grdSub.RowCount = 0;
+                    DisplayTM();
+                }
+                catch (Exception e1)
+                {
+                    oCn.RollBack();
+                    MessageBox.Show("鏉$爜鐢熸垚澶辫触锛�" + e1.Message);
+                }
             }
         }
 
@@ -1364,5 +1590,30 @@
             grdSub.DataSource = null;
             grdMain.DataSource = null;
         }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            //鑾峰彇缃戞牸绗竴琛孒InterID鐨勫��
+            Int64 HInterID = 0;
+            HInterID = DBUtility.ClsPub.isInt(grdMain.Rows[0].Cells[Fun_GetCol("HInterID")].Value);
+            DataSet DSBefore;
+            DSBefore =  SubCn.RunProcReturn("exec h_p_PreviousMater "+ HInterID, "h_p_PreviousMater", ref DBUtility.ClsPub.sExeReturnInfo);
+            grdMain.DataSource = DSBefore.Tables[0].DefaultView;
+        }
+
+        private void button3_Click(object sender, EventArgs e)
+        {
+            //鏍规嵁
+            Int64 HInterID = 0;
+            HInterID = DBUtility.ClsPub.isInt(grdMain.Rows[0].Cells[Fun_GetCol("HInterID")].Value);
+            DataSet DSBefore;
+            DSBefore = SubCn.RunProcReturn("exec h_p_NextMater " + HInterID, "h_p_NextMater", ref DBUtility.ClsPub.sExeReturnInfo);
+            grdMain.DataSource = DSBefore.Tables[0].DefaultView;
+        }
+
+        private void button7_Click(object sender, EventArgs e)
+        {
+            
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1