From 0d0b24b1b7ff2b5d32cf44c053b50b93b9c4704b Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期二, 01 三月 2022 17:51:43 +0800
Subject: [PATCH] 新增核算方式组+工资运算

---
 WarM/条码打印/Gy_BarCodeBill.cs |  244 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 188 insertions(+), 56 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 854732c..bf698e8 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"
@@ -43,42 +43,44 @@
         public const Int16 HQtyCol = 22;
         public const Int16 HMinQtyCol = 23;
         public const Int16 HBQtyCol = 24;
-        public const Int16 HDeptIDCol = 25;
-        public const Int16 HDeptNumberCol = 26;
-        public const Int16 HDeptNameCol = 27;
-        public const Int16 HSourceIDCol = 28;
-        public const Int16 HSourceNumberCol = 29;
-        public const Int16 HSourceNameCol = 30;
-        public const Int16 HDateCol = 31;
-        public const Int16 HEndDateCol = 32;
-        public const Int16 HSupIDCol = 33;
-        public const Int16 HSupNumberCol = 34;
-        public const Int16 HSupNameCol = 35;
-        public const Int16 HCusIDCol = 36;
-        public const Int16 HCusNumberCol = 37;
-        public const Int16 HCusNameCol = 38;
-        public const Int16 HCusTypeCol = 39;
-        public const Int16 HSourceInterIDCol = 40;
-        public const Int16 HSourceEntryIDCol = 41;
-        public const Int16 HSourceBillNoCol = 42;
-        public const Int16 HSourceBillTypeCol = 43;
-        public const Int16 HInstructIDCol = 44;
-        public const Int16 HInstructNoCol = 45;
-        public const Int16 HSeOrderBillIDCol = 46;
-        public const Int16 HSeOrderBillNoCol = 47;
-        public const Int16 HWhIDCol = 48;
-        public const Int16 HWhNumberCol = 49;
-        public const Int16 HWhNameCol = 50;
-        public const Int16 HSPIDCol = 51;
-        public const Int16 HSPNumberCol = 52;
-        public const Int16 HSPNameCol = 53;
-        public const Int16 HinitQtyCol = 54;
-        public const Int16 HRemarkCol = 55;
-        public const Int16 HPinfanBarCodeCol = 56;
-        public const Int16 HMTONoCol = 57;
-        public const Int16 HShowDateCol = 58;
-        public const Int16 HInnerBillNoCol = 59;
-        public const Int16 HMakerCol = 60;
+        public const Int16 HPackQtyCol = 25;
+        public const Int16 HDeptIDCol = 26;
+        public const Int16 HDeptNumberCol = 27;
+        public const Int16 HDeptNameCol = 28;
+        public const Int16 HSourceIDCol = 29;
+        public const Int16 HSourceNumberCol = 30;
+        public const Int16 HSourceNameCol = 31;
+        public const Int16 HDateCol = 32;
+        public const Int16 HEndDateCol = 33;
+        public const Int16 HSupIDCol = 34;
+        public const Int16 HSupNumberCol = 35;
+        public const Int16 HSupNameCol = 36;
+        public const Int16 HCusIDCol = 37;
+        public const Int16 HCusNumberCol = 38;
+        public const Int16 HCusNameCol = 39;
+        public const Int16 HCusTypeCol = 40;
+        public const Int16 HSourceInterIDCol = 41;
+        public const Int16 HSourceEntryIDCol = 42;
+        public const Int16 HSourceBillNoCol = 43;
+        public const Int16 HSourceBillTypeCol = 44;
+        public const Int16 HInstructIDCol = 45;
+        public const Int16 HInstructNoCol = 46;
+        public const Int16 HSeOrderBillIDCol = 47;
+        public const Int16 HSeOrderBillNoCol = 48;
+        public const Int16 HSeOrderSEQCol = 49;
+        public const Int16 HWhIDCol = 50;
+        public const Int16 HWhNumberCol = 51;
+        public const Int16 HWhNameCol = 52;
+        public const Int16 HSPIDCol = 53;
+        public const Int16 HSPNumberCol = 54;
+        public const Int16 HSPNameCol = 55;
+        public const Int16 HinitQtyCol = 56;
+        public const Int16 HRemarkCol = 57;
+        public const Int16 HPinfanBarCodeCol = 58;
+        public const Int16 HMTONoCol = 59;
+        public const Int16 HShowDateCol = 60;
+        public const Int16 HInnerBillNoCol = 61;
+        public const Int16 HMakerCol = 62;
 
         public Int16 HSelectCol = 0;
         public Int16 HSno2Col = 1;
@@ -126,18 +128,20 @@
         public Int16 HInstructNo2Col = 43;
         public Int16 HSeOrderBillID2Col = 44;
         public Int16 HSeOrderBillNo2Col = 45;
-        public Int16 HWhID2Col = 46;
-        public Int16 HWhNumber2Col = 47;
-        public Int16 HWhName2Col = 48;
-        public Int16 HSPID2Col = 49;
-        public Int16 HSPNumber2Col = 50;
-        public Int16 HSPName2Col = 51;
-        public Int16 HRemark2Col = 52;
-        public Int16 HPinfanBarCode2Col = 53;
-        public Int16 HMTONo2Col = 54;
-        public Int16 HShowDate2Col = 55;
-        public Int16 HInnerBillNo2Col = 56; 
-        public Int16 HMaker2Col = 57; 
+        public Int16 HSeOrderSEQ2Col = 46;
+        public Int16 HWhID2Col = 47;
+        public Int16 HWhNumber2Col = 48;
+        public Int16 HWhName2Col = 49;
+        public Int16 HSPID2Col = 50;
+        public Int16 HSPNumber2Col = 51;
+        public Int16 HSPName2Col = 52;
+        public Int16 HRemark2Col = 53;
+        public Int16 HPinfanBarCode2Col = 54;
+        public Int16 HMTONo2Col = 55;
+        public Int16 HShowDate2Col = 56;
+        public Int16 HInnerBillNo2Col = 57; 
+        public Int16 HMaker2Col = 58;
+        public Int16 HEntryID2Col = 59;
         //
         public  string ModName = "85";
         public  string ModCaption = "鏉$爜鐢熸垚";
@@ -266,6 +270,7 @@
         {
             this.Sub_SaveBill();
             Display();
+            
         }
 
         //閲嶇疆鎸夌航
@@ -910,6 +915,7 @@
                             return;
                         }
                         grdSub.Rows[i].Cells[HTMCol].Value = TM;
+                        grdSub.Rows[i].Cells[HEntryID2Col].Value = j + 1;
                         grdSub.Rows[i].Cells[HMaterID2Col].Value = grdMain.Rows[j].Cells[HMaterIDCol].Value;
                         grdSub.Rows[i].Cells[HMaterNumber2Col].Value = grdMain.Rows[j].Cells[HMaterNumberCol].Value;
                         grdSub.Rows[i].Cells[HMaterName2Col].Value = grdMain.Rows[j].Cells[HMaterNameCol].Value;
@@ -960,6 +966,7 @@
                         grdSub.Rows[i].Cells[HSourceName2Col].Value = grdMain.Rows[j].Cells[HSourceNameCol].Value;
                         grdSub.Rows[i].Cells[HEndDate2Col].Value = grdMain.Rows[j].Cells[HEndDateCol].Value;
                         grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value = grdMain.Rows[j].Cells[HSeOrderBillNoCol].Value;
+                        grdSub.Rows[i].Cells[HSeOrderSEQ2Col].Value = grdMain.Rows[j].Cells[HSeOrderSEQCol].Value;
                         grdSub.Rows[i].Cells[HInnerBillNo2Col].Value = grdMain.Rows[j].Cells[HInnerBillNoCol].Value;
                         grdSub.Rows[i].Cells[HMaker2Col].Value = grdMain.Rows[j].Cells[HMakerCol].Value;
                         grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value = grdMain.Rows[j].Cells[HGiveAwayFlagCol].Value;
@@ -1005,8 +1012,10 @@
             DateTime HEndDate;
             string HWorkLineName = "";
             string HSeOrderBillNo = "";
+            Int64 HSeOrderSEQ = 0;
             string HInnerBillNo = "";
             bool HGiveAwayFlag = false;
+            Int64 HEntryID = 0;
             try
             {
                 oCn.BeginTran();
@@ -1024,6 +1033,7 @@
                         }
                         //
                         HMaterID = ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value);
+                        HEntryID = ClsPub.isLong(grdSub.Rows[i].Cells[HEntryID2Col].Value);
                         HAuxPropID = ClsPub.isLong(grdSub.Rows[i].Cells[HAuxPropID2Col].Value);
                         HUnitID = ClsPub.isLong(grdSub.Rows[i].Cells[HUnitID2Col].Value);
                         HQty2 = ClsPub.isDoule(grdSub.Rows[i].Cells[HQty2Col].Value);
@@ -1048,6 +1058,7 @@
                         HEndDate = ClsPub.isDate(grdSub.Rows[i].Cells[HEndDate2Col].Value);
                         HWorkLineName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceName2Col].Value);
                         HSeOrderBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value);
+                        HSeOrderSEQ = ClsPub.isLong(grdSub.Rows[i].Cells[HSeOrderSEQ2Col].Value);
                         HInnerBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HInnerBillNo2Col].Value);
                         HGiveAwayFlag = ClsPub.isBool(grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value);
                         oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
@@ -1055,8 +1066,8 @@
                                     ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
                                     ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
                                     ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
-                                    ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
-                                    ",HGiveAwayFlag " +
+                                    ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
+                                    ",HGiveAwayFlag,HSeOrderSEQ " +
                                     ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
                                     ") values ("
                                     + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
@@ -1064,8 +1075,8 @@
                                     + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
                                     + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
                                     + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
-                                    + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString()
-                                    + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
+                                    + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() + "," + HEntryID.ToString() + ""
+                                    + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag) + "," + HSeOrderSEQ.ToString()
                                     + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')");
 
 
@@ -1472,7 +1483,7 @@
             //
             grdMain.RowCount = 0;
             grdSub.RowCount = 0;
-            grdMain.ColumnCount = 61;                       //鎬诲垪鏁�
+            grdMain.ColumnCount = 63;                       //鎬诲垪鏁�
             DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
             grdMain.Columns[HSnoCol].HeaderText = "搴忓彿";
             grdMain.Columns[HMainIDCol].HeaderText = "婧愬崟涓籌D";
@@ -1498,6 +1509,7 @@
             grdMain.Columns[HGiveAwayFlagCol].HeaderText = "鏄惁璧犲搧";
             grdMain.Columns[HQtyCol].HeaderText = "鏁伴噺";
             grdMain.Columns[HMinQtyCol].HeaderText = "鏈�灏忓寘瑁呮暟";
+            grdMain.Columns[HPackQtyCol].HeaderText = "澶栫鏁�";
             grdMain.Columns[HBQtyCol].HeaderText = "绠辨暟";
             grdMain.Columns[HSupIDCol].HeaderText = "渚涘簲鍟咺D";
             grdMain.Columns[HSupNumberCol].HeaderText = "渚涘簲鍟嗕唬鐮�";
@@ -1513,6 +1525,7 @@
             grdMain.Columns[HSPNameCol].HeaderText = "浠撲綅";
             grdMain.Columns[HInstructNoCol].HeaderText = "鎸囦护鍗曞彿";
             grdMain.Columns[HSeOrderBillNoCol].HeaderText = "閿�鍞鍗曞彿";
+            grdMain.Columns[HSeOrderSEQCol].HeaderText = "閿�鍞鍗曡鍙�";
             grdMain.Columns[HDateCol].HeaderText = "杩涙枡鏃ユ湡";
             grdMain.Columns[HRemarkCol].HeaderText = "澶囨敞";
             grdMain.Columns[HMTONoCol].HeaderText = "璁″垝璺熻釜鍙�";
@@ -1584,6 +1597,7 @@
                                 "," + HSeOrderBillNoCol.ToString() +
                                 "," + HBatchNoCol.ToString() +
                                 "," + HCusNumberCol.ToString() +
+                                "," + HPackQtyCol.ToString() +
                                 "," + HRemarkCol.ToString();
             //璁剧疆鍚堣鍒�
             string sTotalCol = HQtyCol.ToString();
@@ -1603,7 +1617,7 @@
             DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol,oSumGrid);
             //----------------------------
 
-            grdSub.ColumnCount = 58;                       //鎬诲垪鏁�
+            grdSub.ColumnCount = 60;                       //鎬诲垪鏁�
             DBUtility.Xt_BaseBillFun.initGridFst(grdSub, this.Name);
             grdSub.Columns[HSelectCol].HeaderText = "閫夋嫨";
             grdSub.Columns[HTMCol].HeaderText = "鏉$爜缂栧彿";
@@ -1632,6 +1646,7 @@
             grdSub.Columns[HSourceBillNo2Col].HeaderText = "婧愬崟鍗曞彿";
             grdSub.Columns[HSourceBillType2Col].HeaderText = "婧愬崟绫诲瀷";
             grdSub.Columns[HSeOrderBillNo2Col].HeaderText = "閿�鍞鍗曞彿";
+            grdSub.Columns[HSeOrderSEQ2Col].HeaderText = "閿�鍞鍗曡鍙�";
             grdSub.Columns[HBarcodeNoCol].HeaderText = "鎵樺彿";
             grdSub.Columns[HBarcodeQtysCol].HeaderText = "鎬绘墭鏁�";
             grdSub.Columns[HSupID2Col].HeaderText = "渚涘簲鍟咺D";
@@ -1661,6 +1676,7 @@
             grdSub.Columns[HShowDate2Col].HeaderText = "鏃ユ湡";
             grdSub.Columns[HInnerBillNo2Col].HeaderText = "鍐呴儴閲囪喘璁㈠崟鍙�";
             grdSub.Columns[HMaker2Col].HeaderText = "鍒跺崟浜�";
+            grdSub.Columns[HEntryID2Col].HeaderText = "琛屽彿";
             //鏍煎紡鍖� 
             grdSub.Columns[HMaterID2Col].Visible = false;
             grdSub.Columns[HModel2Col].Visible = false;
@@ -2376,6 +2392,7 @@
                                 "," + HMinQtyCol.ToString() +
                                 "," + HAuxPropNumberCol.ToString() +
                                 "," + HBatchNoCol.ToString() +
+                                "," + HPackQtyCol.ToString() +
                                 "," + HRemarkCol.ToString();
             grdMain.Columns[HBillNoCol].ReadOnly = true;
             //璁剧疆鍚堣鍒�
@@ -2449,6 +2466,8 @@
                     {
                         grdMain.Rows[i].Cells[HGiveAwayFlagCol].Value = 0;
                     }
+                    grdMain.Rows[i].Cells[HSeOrderBillNoCol].Value = oTable.Rows[0]["閿�鍞鍗曞彿"].ToString();
+                    grdMain.Rows[i].Cells[HSeOrderSEQCol].Value = oTable.Rows[0]["閿�鍞鍗曡鍙�"].ToString();
                 }
 
             }
@@ -3212,9 +3231,122 @@
         //鐢熸垚澶栫鐮�
         private void wxm_Click(object sender, EventArgs e)
         {
-            //鏍规嵁HINTERID鎵惧埌宸茬敓鎴愬绠辩爜锛涘苟鏄剧ず鍒版墦鍗版ā鏉�
+            try
+            {
+                Int64 iInterID = 0;
+                Int64 dPackQty = 0; //澶栫鏁伴噺
+                Int64 dPackLeftQty = 0; //澶栫鍓╀綑鏁伴噺
+                Int64 dLabelQty = 0; //灏忕鏁伴噺
+                Int64 dQty = 0; //鎬绘暟閲�
+                Int64 dEntryID = 0; //琛屽彿
+                string sPackBarCode = ""; //澶栫鐮�
+                string sBarCode = ""; //鍞竴鐮�
+                Int64 LSH = 0;
+                DataSet Ds;
+                string sYear = DateTime.Today.Year.ToString().Substring(2, 2);
+                string sPeriod = "0" + DateTime.Today.Month.ToString();
+                sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
+                string sDay = "0" + DateTime.Today.Day.ToString();
+                sDay = sDay.Substring(sDay.Length - 2, 2);
+                //
+                string sPackStr = "ZXM" + sYear + sPeriod + sDay; //澶栫鐮� 鍓嶇紑
 
-
+                //蹇呴』鏉$爜鐢熸垚鎸夐挳鏄伆搴︽墠鍙互鐢熸垚绠辨潯鐮�
+                if (bc.Enabled != false)
+                {
+                    MessageBox.Show("璇峰厛鐢熸垚鏉″舰鐮侊紝鍐嶇敓鎴愮鏉$爜");
+                    return;
+                }
+                //-------------------鏍规嵁HINTERID鐢熸垚绠辨潯鐮�
+                //鐢熸垚鍓嶅垽鏂紝寰幆鐗╂枡缃戞牸锛屽垽鏂� 鏄惁璁剧疆浜嗗悎鐞嗙殑 澶栫鏁伴噺銆� 澶栫鏁伴噺 蹇呴』鏄� 鏈�灏忓寘瑁呮暟鐨� 鍊嶆暟 骞跺繀椤诲ぇ浜�0鍜屽ぇ浜庣瓑浜庢渶灏忓寘瑁呮暟閲忋��
+                for (int i = 0; i < grdMain.Rows.Count; i++)
+                {
+                    if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
+                    {
+                        if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value) <= 0)
+                        {
+                            MessageBox.Show("璇峰綍鍏ュ悎鐞嗙殑澶栫鏁伴噺锛岀" + Convert.ToString(i + 1) + "琛�");
+                            return;
+                        }
+                        if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value)
+                            % DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMinQtyCol].Value) != 0
+                            || DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value)
+                            < DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMinQtyCol].Value))
+                        {
+                            MessageBox.Show("澶栫鏁伴噺蹇呴』鏄渶灏忓寘瑁呮暟鐨勫�嶆暟锛屼笖澶т簬绛変簬鏈�灏忓寘瑁呮暟锛岀" + Convert.ToString(i + 1) + "琛�");
+                            return;
+                        }
+                    }
+                }
+                //oCn.BeginTran();
+                //浠�0琛岃繘琛屽惊鐜� 鐗╂枡缃戞牸锛岃幏鍙栧绠辨暟閲�
+                for (int i = 0; i < grdMain.Rows.Count; i++)
+                {
+                    if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
+                    {
+                        //鑾峰彇鎬绘暟閲忋�佸绠辨暟閲� 
+                        dPackQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value);
+                        dQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HQtyCol].Value);
+                        dEntryID = i + 1;
+                        dPackLeftQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value);
+                        //鐢熸垚涓�涓绠辩爜
+                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿                                                                                          //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1;
+                        sPackBarCode = sPackStr + LSH.ToString();
+                        oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+                        //瀛愬惊鐜� 鏉$爜缃戞牸
+                        for (int j = 0; j < grdSub.Rows.Count; j++)
+                        {
+                            if (dEntryID == DBUtility.ClsPub.isLong(grdSub.Rows[j].Cells[HEntryID2Col].Value))
+                            {
+                                if (dQty <= 0)
+                                {
+                                    continue;
+                                }
+                                if (dPackLeftQty > 0) //褰撳墿浣欏绠辨暟閲忓皬浜庣瓑浜�0鏃讹紝閲嶆柊鐢熸垚澶栫鐮�
+                                {
+                                }
+                                else
+                                {
+                                    //鐢熸垚涓�涓绠辩爜
+                                    Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿                                                                                          //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+                                    LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1;
+                                    sPackBarCode = sPackStr + LSH.ToString();
+                                    oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+                                    dPackLeftQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value);
+                                }
+                                sBarCode = DBUtility.ClsPub.isStrNull(grdSub.Rows[j].Cells[HTMCol].Value); // 鏉$爜
+                                dLabelQty = DBUtility.ClsPub.isLong(grdSub.Rows[j].Cells[HQty2Col].Value); // 灏忕鏁伴噺
+                                oCn.RunProc("update Gy_BarCodebill set HInnerBillNo= '" + sPackBarCode + "' Where HbarCode='" + sBarCode + "'");
+                                dPackLeftQty = dPackLeftQty - dLabelQty;
+                                dQty = dQty - dLabelQty;
+                                if (dPackLeftQty <= 0)//褰撶鍓╀綑鏁伴噺灏忎簬绛変簬0鏃� 鎵ц 缁勬墭鍗�
+                                {
+                                    //鑾峰彇缁勬墭鍗曞唴鐮�
+                                    iInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo); ;//寰楀埌鏂板崟鍙�; 
+                                                                                                                            //鏍规嵁澶栫鐮� 鍐欏叆 缁勬墭鍗曚富琛紝缁勬墭鍗曞瓙琛紝SUM锛屽绠辩爜妗f锛孲UM妗f
+                                    oCn.RunProc("exec  h_p_WMS_PackUnionBill_AddNew  '" + sPackBarCode + "'," + iInterID.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //鏍规嵁绠辨潯鐮侊紝鍐欏叆 涓昏〃锛屽瓙琛� 锛岀鏉$爜妗f 
+                                    oCn.RunProc("exec  h_p_WMS_PackUnionBill_SumSubBill  " + iInterID.ToString() + ",'" + sPackBarCode + "','3783','" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //鏍规嵁绠辨潯鐮侊紝鍐欏叆 SUM琛紝SUM鏉$爜妗f
+                                }
+                            }
+                            else
+                            {
+                                continue;
+                            }
+                        }
+                    }
+                }
+                wxm.Enabled = false;
+                //oCn.Commit();
+                MessageBox.Show("鐢熸垚绠辩爜瀹屾瘯锛�");
+                //鍒锋柊鏁版嵁
+                Display();
+            }
+            catch(Exception e1)
+            {
+                //oCn.RollBack();
+                MessageBox.Show("鐢熸垚绠辩爜澶辫触锛�" + e1.Message );
+            }
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1