From a04a1d45c9390547ab9cce332c9aa663dbe715f3 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期二, 07 五月 2024 15:50:38 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 PayM/bin/x86/Debug/SQLHelper.dll                            |    0 
 PayM/obj/x86/Debug/PayM.csproj.GenerateResource.cache       |    0 
 PayM/bin/x86/Debug/DAL.dll                                  |    0 
 PayM/obj/x86/Debug/PayM.csproj.ResolveComReference.cache    |    0 
 WarM/条码打印/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs |   38 ++-
 PayM/bin/x86/Debug/DBUtility.pdb                            |    0 
 PayM/bin/x86/Debug/Pub_Control.pdb                          |    0 
 WarM/条码打印/Gy_BarCodeBill_automaticallyByPLC_New.cs          |   68 ++++++
 PayM/bin/x86/Debug/Pub_Class.pdb                            |    0 
 Model/销售管理/ClsXs_SeOrderBillSub.cs                          |    3 
 PayM/obj/x86/Debug/PayM.pdb                                 |    0 
 PayM/bin/x86/Debug/Pub_Control.dll                          |    0 
 DAL/销售管理/ClsXs_SeOrderBill.cs                               |   19 +
 WebAPI/Controllers/项目管理/工程项目/PM_ProjectBillController.cs    |   22 +
 PayM/obj/x86/Debug/PayM.dll                                 |    0 
 PayM/bin/x86/Debug/Model.dll                                |    0 
 PayM/bin/x86/Debug/Pub_Class.dll                            |    0 
 PayM/bin/x86/Debug/SQLHelper.pdb                            |    0 
 WarM/条码打印/Gy_BarCodeBill_automaticallyByPLC_New.designer.cs |   25 +-
 LMES/bin/x86/Debug.zip                                      |    0 
 PayM/bin/x86/Debug/Model.pdb                                |    0 
 PayM/bin/x86/Debug/BLL.dll                                  |    0 
 WarM/条码打印/Gy_PackBarCodeBill_automaticallyByPLC.cs          |  363 +++++++++++++++++++++++++++++------
 PayM/obj/x86/Debug/PayM.csproj.AssemblyReference.cache      |    0 
 PayM/bin/x86/Debug/BLL.pdb                                  |    0 
 WebAPI/Controllers/项目管理/工作任务/PM_WorkTaskBillController.cs   |    7 
 PayM/bin/x86/Debug/DAL.pdb                                  |    0 
 WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs         |    6 
 PayM/bin/x86/Debug/PayM.dll                                 |    0 
 PayM/bin/x86/Debug/PayM.pdb                                 |    0 
 PayM/bin/x86/Debug/DBUtility.dll                            |    0 
 31 files changed, 438 insertions(+), 113 deletions(-)

diff --git "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs" "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
index 185066c..1c0e78f 100644
--- "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
+++ "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
@@ -134,7 +134,7 @@
                     string subSql = "Insert into Xs_SeOrderBillSub" +
                         "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationQty_SellOutCheck,HRelationMoney_SellOutCheck,HRelationQty_ICMO,HRelationQty_SellBack,HRelationQty_SellBackCheck,HRelationMoney,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HMoney" +
                         ",HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney,HlineTotal,HlineTotalBB,HDate,HOutStockQty,HInvoiceQty,HRemark,HOrderLevID" +
-                        ",HCusMaterNumber,HCusModel,HCusMaterName,HisStockGoods,HWHID) " +
+                        ",HCusMaterNumber,HCusModel,HCusMaterName,HisStockGoods,HWHID,HRemark_TL,HRemark_SJG) " +
                         "values(" +
                         "" + omodel.HInterID +
                         "," + oSub.HEntryID +
@@ -170,8 +170,10 @@
                         "','" + oSub.HCusModel +
                         "','" + oSub.HCusMaterName +
                         "'," + (oSub.HisStockGoods?1:0) +
-                         ",'" + oSub.HWhID +
-                        "')";
+                         ",'" + oSub.HWhID + "'" +
+                         ",'" + oSub.HRemark_TL + "'" +
+                         ",'" + oSub.HRemark_SJG + "'" +
+                        ")";
                     oCn.RunProc(subSql);
                 }
 
@@ -350,7 +352,7 @@
                     string subSql = "Insert into Xs_SeOrderBillSub" +
                         "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationQty_SellOutCheck,HRelationMoney_SellOutCheck,HRelationQty_ICMO,HRelationQty_SellBack,HRelationQty_SellBackCheck,HRelationMoney,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HMoney" +
                         ",HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney,HlineTotal,HlineTotalBB,HDate,HOutStockQty,HInvoiceQty,HRemark,HOrderLevID" +
-                        ",HCusMaterNumber,HCusModel,HCusMaterName,HisStockGoods,HWHID) " +
+                        ",HCusMaterNumber,HCusModel,HCusMaterName,HisStockGoods,HWHID,HRemark_TL,HRemark_SJG) " +
                         "values(" +
                         "" + omodel.HInterID +
                         "," + oSub.HEntryID +
@@ -386,8 +388,10 @@
                         "','" + oSub.HCusModel +
                         "','" + oSub.HCusMaterName +
                         "'," + (oSub.HisStockGoods?1:0) +
-                        ",'" + oSub.HWhID +
-                        "')";
+                        ",'" + oSub.HWhID + "'" +
+                        ",'" + oSub.HRemark_TL + "'" +
+                        ",'" + oSub.HRemark_SJG + "'" +
+                        ")";
                     oCn.RunProc(subSql);
                 }
 
@@ -538,6 +542,9 @@
                     oSub.HInvoiceQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HInvoiceQty"]);
                     oSub.HisStockGoods = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HisStockGoods"]) == 1 ? true : false;
 
+                    oSub.HRemark_TL = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[0]["HRemark_TL"]);
+                    oSub.HRemark_SJG = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[0]["HRemark_SJG"]);
+
                     DetailColl.Add(oSub);
                 }
                 sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
diff --git a/LMES/bin/x86/Debug.zip b/LMES/bin/x86/Debug.zip
index e79df31..3cce815 100644
--- a/LMES/bin/x86/Debug.zip
+++ b/LMES/bin/x86/Debug.zip
Binary files differ
diff --git "a/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillSub.cs" "b/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillSub.cs"
index 85ecdbc..678e592 100644
--- "a/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillSub.cs"
+++ "b/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillSub.cs"
@@ -93,5 +93,8 @@
         public double HRelationQty_ICMO;
         public double HRelationQty_SellBack;
         public double HRelationQty_SellBackCheck;
+
+        public string HRemark_TL;           //投料
+        public string HRemark_SJG;          //深加工
     }
 }
diff --git a/PayM/bin/x86/Debug/BLL.dll b/PayM/bin/x86/Debug/BLL.dll
index 7a5ed00..bccfb5a 100644
--- a/PayM/bin/x86/Debug/BLL.dll
+++ b/PayM/bin/x86/Debug/BLL.dll
Binary files differ
diff --git a/PayM/bin/x86/Debug/BLL.pdb b/PayM/bin/x86/Debug/BLL.pdb
index 7cd1875..e1750df 100644
--- a/PayM/bin/x86/Debug/BLL.pdb
+++ b/PayM/bin/x86/Debug/BLL.pdb
Binary files differ
diff --git a/PayM/bin/x86/Debug/DAL.dll b/PayM/bin/x86/Debug/DAL.dll
index 3c1fb8c..1264702 100644
--- a/PayM/bin/x86/Debug/DAL.dll
+++ b/PayM/bin/x86/Debug/DAL.dll
Binary files differ
diff --git a/PayM/bin/x86/Debug/DAL.pdb b/PayM/bin/x86/Debug/DAL.pdb
index c1092cd..c501852 100644
--- a/PayM/bin/x86/Debug/DAL.pdb
+++ b/PayM/bin/x86/Debug/DAL.pdb
Binary files differ
diff --git a/PayM/bin/x86/Debug/DBUtility.dll b/PayM/bin/x86/Debug/DBUtility.dll
index d82eed2..e07f770 100644
--- a/PayM/bin/x86/Debug/DBUtility.dll
+++ b/PayM/bin/x86/Debug/DBUtility.dll
Binary files differ
diff --git a/PayM/bin/x86/Debug/DBUtility.pdb b/PayM/bin/x86/Debug/DBUtility.pdb
index 84f212e..7816369 100644
--- a/PayM/bin/x86/Debug/DBUtility.pdb
+++ b/PayM/bin/x86/Debug/DBUtility.pdb
Binary files differ
diff --git a/PayM/bin/x86/Debug/Model.dll b/PayM/bin/x86/Debug/Model.dll
index 0393c69..18da444 100644
--- a/PayM/bin/x86/Debug/Model.dll
+++ b/PayM/bin/x86/Debug/Model.dll
Binary files differ
diff --git a/PayM/bin/x86/Debug/Model.pdb b/PayM/bin/x86/Debug/Model.pdb
index 92f12c0..52743b9 100644
--- a/PayM/bin/x86/Debug/Model.pdb
+++ b/PayM/bin/x86/Debug/Model.pdb
Binary files differ
diff --git a/PayM/bin/x86/Debug/PayM.dll b/PayM/bin/x86/Debug/PayM.dll
index 2f0a384..7b30b9a 100644
--- a/PayM/bin/x86/Debug/PayM.dll
+++ b/PayM/bin/x86/Debug/PayM.dll
Binary files differ
diff --git a/PayM/bin/x86/Debug/PayM.pdb b/PayM/bin/x86/Debug/PayM.pdb
index c4b3640..bd8ca73 100644
--- a/PayM/bin/x86/Debug/PayM.pdb
+++ b/PayM/bin/x86/Debug/PayM.pdb
Binary files differ
diff --git a/PayM/bin/x86/Debug/Pub_Class.dll b/PayM/bin/x86/Debug/Pub_Class.dll
index 3d6a754..af4bf43 100644
--- a/PayM/bin/x86/Debug/Pub_Class.dll
+++ b/PayM/bin/x86/Debug/Pub_Class.dll
Binary files differ
diff --git a/PayM/bin/x86/Debug/Pub_Class.pdb b/PayM/bin/x86/Debug/Pub_Class.pdb
index 40138c1..a4c180e 100644
--- a/PayM/bin/x86/Debug/Pub_Class.pdb
+++ b/PayM/bin/x86/Debug/Pub_Class.pdb
Binary files differ
diff --git a/PayM/bin/x86/Debug/Pub_Control.dll b/PayM/bin/x86/Debug/Pub_Control.dll
index 394b4e1..16c2d95 100644
--- a/PayM/bin/x86/Debug/Pub_Control.dll
+++ b/PayM/bin/x86/Debug/Pub_Control.dll
Binary files differ
diff --git a/PayM/bin/x86/Debug/Pub_Control.pdb b/PayM/bin/x86/Debug/Pub_Control.pdb
index 8059a13..d8a67a5 100644
--- a/PayM/bin/x86/Debug/Pub_Control.pdb
+++ b/PayM/bin/x86/Debug/Pub_Control.pdb
Binary files differ
diff --git a/PayM/bin/x86/Debug/SQLHelper.dll b/PayM/bin/x86/Debug/SQLHelper.dll
index d6ab7f3..a201f7f 100644
--- a/PayM/bin/x86/Debug/SQLHelper.dll
+++ b/PayM/bin/x86/Debug/SQLHelper.dll
Binary files differ
diff --git a/PayM/bin/x86/Debug/SQLHelper.pdb b/PayM/bin/x86/Debug/SQLHelper.pdb
index 6265c0b..8589493 100644
--- a/PayM/bin/x86/Debug/SQLHelper.pdb
+++ b/PayM/bin/x86/Debug/SQLHelper.pdb
Binary files differ
diff --git a/PayM/obj/x86/Debug/PayM.csproj.AssemblyReference.cache b/PayM/obj/x86/Debug/PayM.csproj.AssemblyReference.cache
index 26c8fce..7252149 100644
--- a/PayM/obj/x86/Debug/PayM.csproj.AssemblyReference.cache
+++ b/PayM/obj/x86/Debug/PayM.csproj.AssemblyReference.cache
Binary files differ
diff --git a/PayM/obj/x86/Debug/PayM.csproj.GenerateResource.cache b/PayM/obj/x86/Debug/PayM.csproj.GenerateResource.cache
index 05e9dd9..4b865a8 100644
--- a/PayM/obj/x86/Debug/PayM.csproj.GenerateResource.cache
+++ b/PayM/obj/x86/Debug/PayM.csproj.GenerateResource.cache
Binary files differ
diff --git a/PayM/obj/x86/Debug/PayM.csproj.ResolveComReference.cache b/PayM/obj/x86/Debug/PayM.csproj.ResolveComReference.cache
index 307fc5b..ff08134 100644
--- a/PayM/obj/x86/Debug/PayM.csproj.ResolveComReference.cache
+++ b/PayM/obj/x86/Debug/PayM.csproj.ResolveComReference.cache
Binary files differ
diff --git a/PayM/obj/x86/Debug/PayM.dll b/PayM/obj/x86/Debug/PayM.dll
index 2f0a384..7b30b9a 100644
--- a/PayM/obj/x86/Debug/PayM.dll
+++ b/PayM/obj/x86/Debug/PayM.dll
Binary files differ
diff --git a/PayM/obj/x86/Debug/PayM.pdb b/PayM/obj/x86/Debug/PayM.pdb
index c4b3640..bd8ca73 100644
--- a/PayM/obj/x86/Debug/PayM.pdb
+++ b/PayM/obj/x86/Debug/PayM.pdb
Binary files differ
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_automaticallyByPLC_New.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_automaticallyByPLC_New.cs"
index b681710..6da5b7b 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_automaticallyByPLC_New.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_automaticallyByPLC_New.cs"
@@ -850,6 +850,8 @@
                             HBatchNo2 = getBatchNo();
                         }
 
+                        HBarCode = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterModel2Col].Value) + getHBarCode_MaxNo();
+
                         long HSourceID = 0;
                         string sql = "select * from Gy_Source where HName = '" + comboBox_SourceNameParams.Text + "' ";
                         DataSet ds = oCn.RunProcReturn(sql, "Gy_Source");
@@ -917,7 +919,7 @@
                 string LIU = "";
                 int LEN = 4;
                 DataSet ds;
-                string sql = "select * from h_v_IF_BarCodeBillList Where 婧愬崟鍗曞彿 ='" + grdMain.Rows[0].Cells[HSourceBillNoCol].Value + "' and HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),鏉$爜鏃ユ湡, 23) = '" + HDate + "' order by 鎵瑰彿 desc";
+                string sql = "select * from h_v_IF_BarCodeBillList Where HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),鏉$爜鏃ユ湡, 23) = '" + HDate + "' order by 鎵瑰彿 desc";
                 ds = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList");
                 if (ds != null)
                 {
@@ -944,6 +946,69 @@
 
             return HBatchNo;
         }
+
+        //鐢熸垚褰撳ぉ浜у搧鏉$爜鐨勬祦姘村彿
+        private string getHBarCode_MaxNo()
+        {
+            string HBarCode_MaxNo = "";
+
+            //鏃ユ湡鑾峰彇鏂瑰紡
+            string sDate = dtpHDate.Value.ToShortDateString();                                                                                   //
+            string sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
+            string sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
+            sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
+            string sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
+            sDay = sDay.Substring(sDay.Length - 2, 2);
+
+            string HDate = "20" + sYear + "-" + sPeriod + "-" + sDay;
+
+            //鑾峰彇娴佹按鍙凤細鍥涗綅锛岃鐗╂枡褰撳ぉ鐢熸垚鐨勬潯鐮佹暟
+            string LIU = "";
+            int LEN = 4;
+
+            //鑾峰彇浜у搧鏉$爜澶囦唤琛ㄤ腑褰撴棩鏈骇鍝佹潯鐮佺紪鍙锋渶澶х殑璁板綍
+            long HMaxNo_Bak = 0;                //璁板綍浜у搧鏉$爜澶囦唤琛ㄤ腑褰撴棩鏈骇鍝佹潯鐮佺紪鍙锋渶澶х殑璁板綍鐨勬潯鐮佺紪鍙风殑娴佹按鍙�
+            DataSet ds1;
+            string sql1 = "select * from Gy_BarCodeBill_SWELL_SubBarCodeBill Where HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),HBarCodeDate, 23) = '" + HDate + "' and HInterID <>0 order by HBarCode desc";
+            ds1 = oCn.RunProcReturn(sql1, "Gy_BarCodeBill_SWELL_SubBarCodeBill");
+            if (ds1 != null && ds1.Tables[0].Rows.Count>0)
+            {
+                string HBarCodeMaxNo = ds1.Tables[0].Rows[0]["HBarCode"].ToString();
+                HBarCodeMaxNo = HBarCodeMaxNo.Substring(HBarCodeMaxNo.Length - LEN, LEN);
+                HMaxNo_Bak = ClsPub.isLong(HBarCodeMaxNo);
+            }
+
+            ////鑾峰彇鏉$爜妗f涓綋鏃ユ湰浜у搧鏉$爜缂栧彿鏈�澶х殑璁板綍
+            long HMaxNo = 0;                //璁板綍鏉$爜妗f涓綋鏃ユ湰浜у搧鏉$爜缂栧彿鏈�澶х殑璁板綍鐨勬潯鐮佺紪鍙风殑娴佹按鍙�
+            DataSet ds;
+            string sql = "select * from h_v_IF_BarCodeBillList Where HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),鏉$爜鏃ユ湡, 23) = '" + HDate + "' and HInterID <> 0 order by 鏉$爜缂栧彿 desc";
+            ds = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList");
+            if (ds != null && ds.Tables[0].Rows.Count > 0)
+            {
+                string HBarCodeMaxNo = ds.Tables[0].Rows[0]["鏉$爜缂栧彿"].ToString();
+                HBarCodeMaxNo = HBarCodeMaxNo.Substring(HBarCodeMaxNo.Length - LEN, LEN);
+                HMaxNo = ClsPub.isLong(HBarCodeMaxNo);
+            }
+
+
+            //鑾峰彇褰撴棩鏈骇鍝� 鍦ㄦ潯鐮佹。妗堝拰浜у搧鏉$爜澶囦唤琛ㄤ腑 鏈�澶х殑娴佹按鍙�
+            long count = 0;
+            count = HMaxNo >= HMaxNo_Bak ? HMaxNo : HMaxNo_Bak;
+
+            //涓烘祦姘村彿鍓嶉潰琛ラ浂
+            LIU += count + 1;
+            while (LIU.Length < LEN)  //濡傛灉娴佹按鍙峰皬浜�6浣嶆暟鍓嶉潰琛�0
+            {
+                LIU = "0" + LIU;
+            }
+
+            //鎷兼帴鎵瑰彿
+            HBarCode_MaxNo = sYear + sPeriod + sDay + LIU;
+
+            return HBarCode_MaxNo;
+        }
+        #endregion
+
         #endregion
 
         #region 鐩戝惉閫氳
@@ -1712,7 +1777,6 @@
         {
             return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdList);
         }
-        #endregion
         #endregion
 
 
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_automaticallyByPLC_New.designer.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_automaticallyByPLC_New.designer.cs"
index 4ee964d..0831a25 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_automaticallyByPLC_New.designer.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_automaticallyByPLC_New.designer.cs"
@@ -296,7 +296,7 @@
             this.bc.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
             this.bc.ImageTransparentColor = System.Drawing.Color.Magenta;
             this.bc.Name = "bc";
-            this.bc.Size = new System.Drawing.Size(35, 47);
+            this.bc.Size = new System.Drawing.Size(60, 60);
             this.bc.Text = "鐢熸垚";
             this.bc.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
             this.bc.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
@@ -498,8 +498,9 @@
             this.tc.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
             this.tc.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
             this.tc.ImageTransparentColor = System.Drawing.Color.White;
+            this.tc.Margin = new System.Windows.Forms.Padding(100, 2, 0, 3);
             this.tc.Name = "tc";
-            this.tc.Size = new System.Drawing.Size(35, 47);
+            this.tc.Size = new System.Drawing.Size(60, 60);
             this.tc.Text = "閫�鍑�";
             this.tc.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
             this.tc.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
@@ -593,11 +594,10 @@
             // cmdSourceBillNo
             // 
             this.cmdSourceBillNo.Image = ((System.Drawing.Image)(resources.GetObject("cmdSourceBillNo.Image")));
-            this.cmdSourceBillNo.ImageAlign = System.Drawing.ContentAlignment.TopRight;
-            this.cmdSourceBillNo.Location = new System.Drawing.Point(1214, 11);
+            this.cmdSourceBillNo.Location = new System.Drawing.Point(1214, -4);
             this.cmdSourceBillNo.Margin = new System.Windows.Forms.Padding(4);
             this.cmdSourceBillNo.Name = "cmdSourceBillNo";
-            this.cmdSourceBillNo.Size = new System.Drawing.Size(33, 33);
+            this.cmdSourceBillNo.Size = new System.Drawing.Size(60, 60);
             this.cmdSourceBillNo.TabIndex = 99;
             this.cmdSourceBillNo.UseVisualStyleBackColor = true;
             this.cmdSourceBillNo.Click += new System.EventHandler(this.cmdSourceBillNo_Click_1);
@@ -638,6 +638,7 @@
             // radioButton_HIsUsingBatchNo
             // 
             this.radioButton_HIsUsingBatchNo.AutoSize = true;
+            this.radioButton_HIsUsingBatchNo.Enabled = false;
             this.radioButton_HIsUsingBatchNo.Location = new System.Drawing.Point(874, 190);
             this.radioButton_HIsUsingBatchNo.Name = "radioButton_HIsUsingBatchNo";
             this.radioButton_HIsUsingBatchNo.Size = new System.Drawing.Size(141, 22);
@@ -657,9 +658,9 @@
             // 
             // button_stopListen
             // 
-            this.button_stopListen.Location = new System.Drawing.Point(404, 250);
+            this.button_stopListen.Location = new System.Drawing.Point(404, 223);
             this.button_stopListen.Name = "button_stopListen";
-            this.button_stopListen.Size = new System.Drawing.Size(151, 35);
+            this.button_stopListen.Size = new System.Drawing.Size(192, 62);
             this.button_stopListen.TabIndex = 97;
             this.button_stopListen.Text = "鍋滄鐩戝惉";
             this.button_stopListen.UseVisualStyleBackColor = true;
@@ -711,9 +712,9 @@
             // 
             // button_startListen
             // 
-            this.button_startListen.Location = new System.Drawing.Point(214, 250);
+            this.button_startListen.Location = new System.Drawing.Point(187, 223);
             this.button_startListen.Name = "button_startListen";
-            this.button_startListen.Size = new System.Drawing.Size(133, 35);
+            this.button_startListen.Size = new System.Drawing.Size(160, 62);
             this.button_startListen.TabIndex = 96;
             this.button_startListen.Text = "寮�濮嬬洃鍚�";
             this.button_startListen.UseVisualStyleBackColor = true;
@@ -906,7 +907,7 @@
             // 
             this.button_resetParams.Location = new System.Drawing.Point(590, 173);
             this.button_resetParams.Name = "button_resetParams";
-            this.button_resetParams.Size = new System.Drawing.Size(89, 40);
+            this.button_resetParams.Size = new System.Drawing.Size(153, 75);
             this.button_resetParams.TabIndex = 105;
             this.button_resetParams.Text = "閲�  缃�";
             this.button_resetParams.UseVisualStyleBackColor = true;
@@ -914,9 +915,9 @@
             // 
             // button_saveParams
             // 
-            this.button_saveParams.Location = new System.Drawing.Point(377, 173);
+            this.button_saveParams.Location = new System.Drawing.Point(311, 173);
             this.button_saveParams.Name = "button_saveParams";
-            this.button_saveParams.Size = new System.Drawing.Size(89, 40);
+            this.button_saveParams.Size = new System.Drawing.Size(155, 75);
             this.button_saveParams.TabIndex = 104;
             this.button_saveParams.Text = "淇�  瀛�";
             this.button_saveParams.UseVisualStyleBackColor = true;
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs"
index c435527..703f4cb 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs"
@@ -34,6 +34,7 @@
             this.tabControl_MainInfo = new System.Windows.Forms.TabControl();
             this.tabPage_BillInfo = new System.Windows.Forms.TabPage();
             this.gbUp = new System.Windows.Forms.GroupBox();
+            this.button_produceTemp = new System.Windows.Forms.Button();
             this.label_sBillNo = new System.Windows.Forms.Label();
             this.textBox_sBillNo = new System.Windows.Forms.TextBox();
             this.label_sBillID = new System.Windows.Forms.Label();
@@ -121,6 +122,7 @@
             // gbUp
             // 
             this.gbUp.BackColor = System.Drawing.Color.Transparent;
+            this.gbUp.Controls.Add(this.button_produceTemp);
             this.gbUp.Controls.Add(this.label_sBillNo);
             this.gbUp.Controls.Add(this.textBox_sBillNo);
             this.gbUp.Controls.Add(this.label_sBillID);
@@ -149,6 +151,16 @@
             this.gbUp.Size = new System.Drawing.Size(1374, 310);
             this.gbUp.TabIndex = 33;
             this.gbUp.TabStop = false;
+            // 
+            // button_produceTemp
+            // 
+            this.button_produceTemp.Location = new System.Drawing.Point(829, 215);
+            this.button_produceTemp.Name = "button_produceTemp";
+            this.button_produceTemp.Size = new System.Drawing.Size(158, 70);
+            this.button_produceTemp.TabIndex = 123;
+            this.button_produceTemp.Text = "涓存椂缁勬墭";
+            this.button_produceTemp.UseVisualStyleBackColor = true;
+            this.button_produceTemp.Click += new System.EventHandler(this.button_produceTemp_Click);
             // 
             // label_sBillNo
             // 
@@ -193,9 +205,9 @@
             // 
             // button_produceByHand
             // 
-            this.button_produceByHand.Location = new System.Drawing.Point(591, 250);
+            this.button_produceByHand.Location = new System.Drawing.Point(591, 215);
             this.button_produceByHand.Name = "button_produceByHand";
-            this.button_produceByHand.Size = new System.Drawing.Size(151, 35);
+            this.button_produceByHand.Size = new System.Drawing.Size(186, 70);
             this.button_produceByHand.TabIndex = 118;
             this.button_produceByHand.Text = "鏈弧鎵樼敓鎴�";
             this.button_produceByHand.UseVisualStyleBackColor = true;
@@ -276,9 +288,9 @@
             // 
             // button_stopListen
             // 
-            this.button_stopListen.Location = new System.Drawing.Point(404, 250);
+            this.button_stopListen.Location = new System.Drawing.Point(379, 215);
             this.button_stopListen.Name = "button_stopListen";
-            this.button_stopListen.Size = new System.Drawing.Size(151, 35);
+            this.button_stopListen.Size = new System.Drawing.Size(176, 70);
             this.button_stopListen.TabIndex = 97;
             this.button_stopListen.Text = "鍋滄缁勬墭";
             this.button_stopListen.UseVisualStyleBackColor = true;
@@ -287,11 +299,11 @@
             // textBox_HPackBarCode
             // 
             this.textBox_HPackBarCode.BackColor = System.Drawing.SystemColors.ScrollBar;
-            this.textBox_HPackBarCode.Enabled = false;
             this.textBox_HPackBarCode.Location = new System.Drawing.Point(122, 81);
             this.textBox_HPackBarCode.Name = "textBox_HPackBarCode";
             this.textBox_HPackBarCode.Size = new System.Drawing.Size(280, 28);
             this.textBox_HPackBarCode.TabIndex = 43;
+            this.textBox_HPackBarCode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox_HPackBarCode__KeyPress);
             // 
             // dtpHDate
             // 
@@ -312,9 +324,9 @@
             // 
             // button_startListen
             // 
-            this.button_startListen.Location = new System.Drawing.Point(214, 250);
+            this.button_startListen.Location = new System.Drawing.Point(147, 215);
             this.button_startListen.Name = "button_startListen";
-            this.button_startListen.Size = new System.Drawing.Size(133, 35);
+            this.button_startListen.Size = new System.Drawing.Size(200, 70);
             this.button_startListen.TabIndex = 96;
             this.button_startListen.Text = "鑷姩缁勬墭";
             this.button_startListen.UseVisualStyleBackColor = true;
@@ -387,16 +399,16 @@
             // 
             this.button_resetParams.Location = new System.Drawing.Point(590, 173);
             this.button_resetParams.Name = "button_resetParams";
-            this.button_resetParams.Size = new System.Drawing.Size(89, 40);
+            this.button_resetParams.Size = new System.Drawing.Size(134, 81);
             this.button_resetParams.TabIndex = 105;
             this.button_resetParams.Text = "閲�  缃�";
             this.button_resetParams.UseVisualStyleBackColor = true;
             // 
             // button_saveParams
             // 
-            this.button_saveParams.Location = new System.Drawing.Point(377, 173);
+            this.button_saveParams.Location = new System.Drawing.Point(311, 173);
             this.button_saveParams.Name = "button_saveParams";
-            this.button_saveParams.Size = new System.Drawing.Size(89, 40);
+            this.button_saveParams.Size = new System.Drawing.Size(155, 81);
             this.button_saveParams.TabIndex = 104;
             this.button_saveParams.Text = "淇�  瀛�";
             this.button_saveParams.UseVisualStyleBackColor = true;
@@ -638,7 +650,7 @@
             this.toolStripButton_Delete.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
             this.toolStripButton_Delete.ImageTransparentColor = System.Drawing.Color.White;
             this.toolStripButton_Delete.Name = "toolStripButton_Delete";
-            this.toolStripButton_Delete.Size = new System.Drawing.Size(35, 47);
+            this.toolStripButton_Delete.Size = new System.Drawing.Size(60, 60);
             this.toolStripButton_Delete.Text = "鍒犻櫎";
             this.toolStripButton_Delete.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
             this.toolStripButton_Delete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
@@ -651,8 +663,9 @@
             this.tc.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
             this.tc.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
             this.tc.ImageTransparentColor = System.Drawing.Color.White;
+            this.tc.Margin = new System.Windows.Forms.Padding(100, 2, 0, 3);
             this.tc.Name = "tc";
-            this.tc.Size = new System.Drawing.Size(35, 47);
+            this.tc.Size = new System.Drawing.Size(60, 60);
             this.tc.Text = "閫�鍑�";
             this.tc.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
             this.tc.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
@@ -743,5 +756,6 @@
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
         private System.Windows.Forms.ToolStripButton tc;
         private System.Windows.Forms.ToolStripButton toolStripButton_Delete;
+        private System.Windows.Forms.Button button_produceTemp;
     }
 }
\ No newline at end of file
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.cs"
index bec4a79..a53a36e 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.cs"
@@ -347,12 +347,18 @@
         //鏈弧鎵樼敓鎴� 鎸夐挳 鐐瑰嚮浜嬩欢
         private void button_produceByHand_Click(object sender, EventArgs e)
         {
-            if (HQty == 0)
+            try
             {
-                MessageBox.Show("璇锋壂鐮佸瓙鏉$爜!");
-                return;
+                if (HQty == 0)
+                {
+                    MessageBox.Show("璇锋壂鐮佸瓙鏉$爜!");
+                    return;
+                }
+                this.Sub_SaveBill();
+            }catch(Exception ex)
+            {
+                MessageBox.Show(ex.Message);
             }
-            this.Sub_SaveBill();
         }
 
         //鑷姩缁勬墭 
@@ -379,6 +385,8 @@
             comboBox_SourceNameParams.Enabled = false;
 
             button_saveParams.Enabled = false;
+
+            textBox_HBarCode.Focus();
         }
 
         //鍋滄缁勬墭
@@ -406,22 +414,28 @@
         {
             if(isStartListen == 1)
             {
-                if(HQty == DBUtility.ClsPub.isDoule(textBox_PackQty.Text))
+                try
                 {
-                    this.Sub_SaveBill();
-
-                    //璁剧疆鎵撳嵃妯℃澘锛屾墦鍗�
-                    grdSub.Rows[0].Cells[0].Value = "*";
-                    Report = new GridppReport();
-                    Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf");  //here .
-                    Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
-                    Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
-                    Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
-                    if (comboBox_PrinterParams.Text != "")
+                    if (HQty == DBUtility.ClsPub.isDoule(textBox_PackQty.Text))
                     {
-                        Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(榛樿)", "");
+                        this.Sub_SaveBill();
+
+                        //璁剧疆鎵撳嵃妯℃澘锛屾墦鍗�
+                        grdSub.Rows[0].Cells[0].Value = "*";
+                        Report = new GridppReport();
+                        Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf");  //here .
+                        Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
+                        Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
+                        Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
+                        if (comboBox_PrinterParams.Text != "")
+                        {
+                            Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(榛樿)", "");
+                        }
+                        Report.Print(false);
                     }
-                    Report.Print(false);
+                }catch(Exception ex)
+                {
+                    MessageBox.Show(ex.Message);
                 }
             }
         }
@@ -430,25 +444,29 @@
         //鐢熸垚鎵樼洏鏉$爜
         private bool Sub_SaveBill()
         {
-            //鑾峰彇缁勭粐淇℃伅
-            HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
-            HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
-
-            if (HOrgID == -1)
+            try
             {
-                MessageBox.Show("閫夋嫨缁勭粐鏈夐敊璇紒");
-                return false;
-            }
+                //鑾峰彇缁勭粐淇℃伅
+                HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
+                HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
 
+                if (HOrgID == -1)
+                {
+                    throw new Exception("閫夋嫨缁勭粐鏈夐敊璇紒");
+                }
 
-            if (!Sub_AllowSave())//鍗曟嵁瀹屾暣鎬у垽鏂�
+                if (!Sub_AllowSave())//鍗曟嵁瀹屾暣鎬у垽鏂�
+                {
+                    throw new Exception("鍗曟嵁瀹屾暣鎬у垽鏂け璐ワ紒");
+                }
+
+                SaveBarCode();
+                return true;
+            }catch(Exception ex)
             {
-                return false;
+                throw new Exception(ex.Message);
             }
-
-
-            SaveBarCode();
-            return true;
+            
         }
 
         //鍗曟嵁瀹屾暣鎬у垽鏂�          鏈畬鎴�
@@ -506,6 +524,15 @@
 
                 sSQLMul[1] = " exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + HQty.ToString() + " ";
 
+                //鍒ゆ柇褰撳墠鎵樼洏鏉$爜鏄惁宸茬粡閫氳繃涓存椂缁勬墭鍦ㄦ潯鐮佹。妗堜腑鐢熸垚浜嗭紝鑻ュ凡缁忕敓鎴愪簡鍒欎笉闇�瑕佸湪鎻掑叆
+                ds = oCn.RunProcReturn("select * from Gy_BarCodeBill where HBarCode = '" + textBox_HPackBarCode.Text + "' and HSTOCKORGID = " + HOrgID, "Gy_BarCodeBill");
+                if (ds != null && ds.Tables[0].Rows.Count > 0)
+                {
+                    sSQLMul[0] = "";                
+                }
+
+                oCn.BeginTran();
+
                 if (getRunProcByMul_Back(sSQLMul, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
                     //MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
@@ -517,15 +544,21 @@
                     setPackBarCodeBillData();
 
                     getDisplay_GrdMain();
+
+                    oCn.Commit();
                 }
                 else
                 {
                     //MessageBox.Show("鏉$爜鐢熸垚澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo);
+                    oCn.RollBack();
                 }
+
+                //oCn.Commit();
             }
             catch (Exception e)
             {
-                //MessageBox.Show("鏉$爜鐢熸垚澶辫触锛�" + e.Message);
+                oCn.RollBack();
+                throw new Exception(e.Message);
             }
         }
 
@@ -540,27 +573,30 @@
                 {
                     for (int i = 0; i < 1; i++)
                     {
-                        oCn.RunProc(sSQL[i]);
+                        if (sSQL[i].Length > 0)
+                        {
+                            oCn.RunProc(sSQL[i]);
+                        }
                     }
 
-                    
-
+                    //涓婁紶缁勬墭淇℃伅鍒版湇鍔″櫒
                     send();
+                    oCn.Commit();
                 }
                 else
                 {
-                    sErrMsg = "娌℃湁鏁版嵁锛�";
                     oCn.Commit();
-                    return false;
+                    sErrMsg = "娌℃湁鏁版嵁锛�";
+                    throw new Exception(sErrMsg);
                 }
-                oCn.Commit();
+                //oCn.Commit();
                 return true;
             }
             catch (Exception e)
             {
-                sErrMsg = e.Message;
                 oCn.RollBack();
-                return false;
+                sErrMsg = e.Message;
+                throw new Exception(sErrMsg);
             }
         }
         #endregion
@@ -570,16 +606,22 @@
         private void send()
         {
             string err = "";
-            if (!CheckModRight(ModRightNamePackUnion, DBUtility.ClsPub.CurUserName, ref err))
-            {
-                MessageBox.Show(err);
-                return;
-            }
+            //if (!CheckModRight(ModRightNamePackUnion, DBUtility.ClsPub.CurUserName, ref err))
+            //{
+            //    MessageBox.Show(err);
+            //    return;
+            //}
             //if (MessageBox.Show("纭畾瑕佷笂浼狅紵", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
             //{
             //    return;
             //}
-            LoadData();
+            try
+            {
+                LoadData();
+            }catch(Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
         }
 
         //鍒ゆ柇鐢ㄦ埛鏉冮檺
@@ -608,7 +650,7 @@
             //鍒ゆ柇鏄惁鏁版嵁瀹屾暣 
             if (AllowLoadData() == false)
             {
-                return;
+                throw new Exception("鏁版嵁瀹屾暣鎬у垽鏂け璐ワ紒");
             }
             try
             {
@@ -626,14 +668,14 @@
                 }
                 else
                 {
-                    MessageBox.Show("鐢熸垚澶辫触锛佸師鍥�:" + err);
-                    return;
+                    string error = "鐢熸垚澶辫触锛佸師鍥�:" + err;
+                    throw new Exception(error);
                 }
             }
             catch (Exception e)
             {
-                MessageBox.Show("鍗曟嵁鍙凤細" + textBox_sBillID.Text + "锛屽崟鎹甀D锛�" + textBox_sBillID.Text + "锛涗笂浼犲け璐ワ紒" + e.Message);
-                return;
+                string error = "鍗曟嵁鍙凤細" + textBox_sBillID.Text + "锛屽崟鎹甀D锛�" + textBox_sBillID.Text + "锛涗笂浼犲け璐ワ紒" + e.Message;
+                throw new Exception(error);
             }
         }
 
@@ -657,37 +699,37 @@
         public bool set_SavePackUnionBill_Add(Int64 HInterID, string HBillType, string HBillNo, string HBarCode_Pack, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            oCn.BeginTran();
             try
             {
-                oCn.BeginTran();
                 DataSet ds = oCn.RunProcReturn("exec h_p_Sc_PackUnionBill_Insert_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode_Pack + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_Sc_PackUnionBill_Insert_New");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
-                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涗笂浼犲け璐ワ紒";
                     oCn.RollBack();
-                    return false;
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涗笂浼犲け璐ワ紒";
+                    throw new Exception(sErrMsg);
                 }
                 else
                 {
                     if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1)
                     {
-                        sErrMsg = "涓婁紶澶辫触锛屽崟鎹彿锛�" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                         oCn.RollBack();
-                        return false;
+                        sErrMsg = "涓婁紶澶辫触锛屽崟鎹彿锛�" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                        throw new Exception(sErrMsg);
                     }
                     else
                     {
-                        //sErrMsg = "鐢熸垚鐢熶骇缁勬墭鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�" + HBillNo;
                         oCn.Commit();
+                        //sErrMsg = "鐢熸垚鐢熶骇缁勬墭鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�" + HBillNo;
                         return true;
                     }
                 }
             }
             catch (Exception e)
             {
-                sErrMsg = "鐢熸垚鐢熶骇缁勬墭鍗曞け璐ワ紒" + e.Message;
                 oCn.RollBack();
-                return false;
+                sErrMsg = "鐢熸垚鐢熶骇缁勬墭鍗曞け璐ワ紒" + e.Message;
+                throw new Exception(sErrMsg);
             }
         }
 
@@ -713,11 +755,9 @@
             }
             catch (Exception e2)
             {
-                //if (DBUtility.ClsPub.bSound)
-                //{
-                //    DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning);
-                //}
-                MessageBox.Show("鍙戠敓缃戠粶寮傚父锛岃绋嶅悗鍐嶈瘯锛�");
+                textBox_HBarCode.Text = "";
+                textBox_HBarCode.Focus();
+                MessageBox.Show(e2.Message);
             }
         }
         //灏嗘潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
@@ -741,13 +781,13 @@
                 }
                 else
                 {
-                    MessageBox.Show(err);
-                    return;
+                    throw new Exception(err);
                 }
             }
             catch (Exception e)
             {
-                MessageBox.Show("鎵弿瀛愭潯鐮侊紝鍐欏叆涓存椂琛ㄤ俊鎭け璐ワ紒" + e.Message + err);
+                string sError = "鎵弿瀛愭潯鐮侊紝鍐欏叆涓存椂琛ㄤ俊鎭け璐ワ紒" + e.Message + err;
+                throw new Exception(sError);
             }
         }
 
@@ -1161,9 +1201,196 @@
             }
         }
 
+
         #endregion
 
-        
+
+        #region 涓存椂缁勬墭
+        #region 涓存椂缁勬墭 鎸夐挳鐐瑰嚮浜嬩欢
+        private void button_produceTemp_Click(object sender, EventArgs e)
+        {
+            if (HQty == 0)
+            {
+                MessageBox.Show("璇锋壂鐮佸瓙鏉$爜!");
+                return;
+            }
+            this.produceTemp();
+
+            //璁剧疆鎵撳嵃妯℃澘锛屾墦鍗�
+            grdSub.Rows[0].Cells[0].Value = "*";
+            Report = new GridppReport();
+            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + "_Temp" + ".grf");  //here .
+            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
+            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
+            Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
+            if (comboBox_PrinterParams.Text != "")
+            {
+                Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(榛樿)", "");
+            }
+            Report.Print(false);
+        }
+        #endregion
+
+        #region 涓存椂缁勬墭
+        private void produceTemp()
+        {
+            //鍒ゆ柇鏉$爜妗f涓槸鍚﹀凡缁忓瓨鍦ㄨ鎵樻潯鐮侊紝鑻ュ瓨鍦紝鍒欎笉闇�瑕佸啀鍒涘缓銆傞噸鏂板姞杞界晫闈㈠嵆鍙��
+            DataSet ds_getPackBarCode;
+            string sql_getPackBarCode = "select * from Gy_BarCodeBill where HBarCode = '" + textBox_HPackBarCode.Text + "'";
+            ds_getPackBarCode = oCn.RunProcReturn(sql_getPackBarCode, "Gy_BarCodeBill");
+            if (ds_getPackBarCode != null && ds_getPackBarCode.Tables[0].Rows.Count > 0)
+            {
+                //閲嶆柊鍔犺浇鐣岄潰
+                getDisplay_grdSub();
+
+                setPackBarCodeBillData();
+
+                getDisplay_GrdMain();
+                return;
+            }
+
+
+            //鑾峰彇缁勭粐淇℃伅
+            HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
+            HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
+
+            //楠岃瘉缁勭粐
+            if (HOrgID == -1)
+            {
+                MessageBox.Show("閫夋嫨缁勭粐鏈夐敊璇紒");
+                return;
+            }
+
+            //鍗曟嵁瀹屾暣鎬у垽鏂�
+            if (!Sub_AllowSave())
+            {
+                return;
+            }
+
+            //鑾峰彇褰撳墠浜х嚎鍙婁骇绾垮唴鐮�
+            long HSourceID = 0;
+            string sql = "select * from Gy_Source where HName = '" + comboBox_SourceNameParams.Text + "' ";
+            DataSet ds = oCn.RunProcReturn(sql, "Gy_Source");
+            if (ds != null && ds.Tables[0].Rows.Count > 0)
+            {
+                HSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HItemID"].ToString());
+            }
+
+            //鎷兼帴涓存椂缁勬墭鏃讹紝鎵樻潯鐮佺殑鐢熸垚璇彞
+            sSQLMul = new string[2];
+            sSQLMul[0] = "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,HJiaYe " +
+                            ",HPressModel,HCusModel,HMaterialModel,HColor,HBarCodeDate " +
+                            ",HLogo,HPackageSize,HMaterialJQty,HMaterialMQty,HCustomBatchNo " +
+                            ",HSTOCKORGID,HOWNERID,HBeginDate,HSeOrderBillNo,HGBBarCode " +
+                            ",POOrderBillNo,HInterID,HInitSourceEntryID,HBarCode_Pack " +
+                            ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo " +
+                            ",HCustomQty1,HLayerNumber,HCusBarCode,HBarCodeStatus,HSourceID " +
+                            ") values ("
+                            + "'" + textBox_HPackBarCode.Text + "','" + HBarCodeType + "',0,0,1"
+                            + ",'',0,0,'" + ClsPub.CurUserName + "',getdate(),0,1"
+                            + ",0,0,'','',''"
+                            + "," + HQty.ToString() + ",1,0,0,0,''"
+                            + ",0,'','','',''"
+                            + ",'','','','','" + sDate + "'"
+                            + ",'','',0,0,''"
+                            + "," + HOrgID.ToString() + "," + HOrgID.ToString() + ",'','',''"
+                            + ",''," + HInterID.ToString() + ",0,'" + textBox_HPackBarCode.Text + "'"
+                            + ",'','','',0,''"
+                            + ",0,0,'',''," + HSourceID +
+                            ")";
+            //鎷兼帴 鏇存柊 鎵樻潯鐮佹祦姘村彿 鐨剆ql璇彞
+            sSQLMul[1] = " exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + HQty.ToString() + " ";
+
+            if (sSQLMul.Length > 0)
+            {
+                //鎵ц鎵樻潯鐮佺殑鐢熸垚璇彞涓庢墭鏉$爜娴佹按鍙风殑鏇存柊璇彞
+                for (int i = 0; i < 1; i++)
+                {
+                    oCn.RunProc(sSQLMul[i]);
+                }
+
+                //閲嶆柊鍔犺浇鐣岄潰
+                getDisplay_grdSub();
+
+                setPackBarCodeBillData();
+
+                getDisplay_GrdMain();
+            }
+            else
+            {
+                MessageBox.Show("娌℃湁鏁版嵁锛�");
+                return;
+            }
+        }
+        #endregion
+
+        #region 鎵樻潯鐮� 鎵爜
+        private void textBox_HPackBarCode__KeyPress(object sender, KeyPressEventArgs e)
+        {
+            if (e.KeyChar == (char)Keys.Return)
+            {
+                //鑾峰彇鎵弿鐨勬墭鏉$爜
+                string HPackBarCode = textBox_HPackBarCode.Text;
+                //鏉$爜绫诲瀷
+                HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
+                //鑾峰彇缁勭粐淇℃伅
+                HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
+                HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
+
+                //澹版槑鐢ㄤ簬鏁版嵁搴撴煡璇㈢殑鍙橀噺
+                string sql = "";
+                DataSet ds;
+
+                //鍒ゆ柇 鎵樻潯鐮佹槸鍚﹀凡缁忕敓鎴愮粍鎵樺崟
+                sql = "select * from Sc_PackUnionBillMain where HBarCode_Pack = '" + HPackBarCode + "'";
+                ds = oCn.RunProcReturn(sql, "Sc_PackUnionBillMain");
+                if (ds != null && ds.Tables[0].Rows.Count > 0)
+                {
+                    MessageBox.Show("鎵樻潯鐮乕" + HPackBarCode + "]宸茬粡缁勬墭锛�");
+                    return;
+                }
+
+
+                //鑾峰彇褰撳墠浜х嚎
+                long HSourceID = 0;
+                sql = "select * from Gy_Source where HName = '" + comboBox_SourceNameParams.Text + "'";
+                ds = oCn.RunProcReturn(sql, "Gy_Source");
+                if (ds != null && ds.Tables[0].Rows.Count > 0)
+                {
+                    HSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HItemID"].ToString());
+                }
+
+
+                //鑾峰彇缂撳瓨鍒楄〃涓� 鎵樻潯鐮� 瀵瑰簲鐨� 缁勬墭璁板綍
+                sql = "select top(1) a.* from Sc_PackUnionBill_Temp as a inner join Gy_BarCodeBill as b on a.HBarCode = b.HBarCode where a.HBarCode_Pack = '" + HPackBarCode + "' and b.HSourceID = " + HSourceID + " and a.HStockorgID = " + HOrgID;
+                ds = oCn.RunProcReturn(sql, "Sc_PackUnionBill_Temp");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    MessageBox.Show("缂撳瓨鍒楄〃涓湭鏌ヨ鍒拌鎵樻潯鐮佷笌瀛愭潯鐮佺殑缁勬墭璁板綍锛�");
+                    return;
+                }
+                else
+                {
+                    string HBarCode_Pack = ds.Tables[0].Rows[0]["HBarCode_Pack"].ToString();
+                    long HBillID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HInterID"].ToString());
+                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+
+                    textBox_HPackBarCode.Text = HBarCode_Pack;
+                    textBox_sBillID.Text = HBillID.ToString();
+                    textBox_sBillNo.Text = HBillNo;
+
+                    getDisplay_GrdMain();
+                }
+            }
+        }
+        #endregion
+        #endregion
+
+
     }
 }
 
diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
index 134f9dc..9812528 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
@@ -87,12 +87,12 @@
 
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList order by hmainid desc", "h_v_IF_SeOrderBillList");
+                    ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList order by hmainid desc,hsubid asc", "h_v_IF_SeOrderBillList");
                 }
                 else
                 {
                     string sql1 = "select * from h_v_IF_SeOrderBillList where 1 = 1 ";
-                    string sql = sql1 + sWhere+ " order by hmainid desc";
+                    string sql = sql1 + sWhere+ " order by hmainid desc,hsubid asc";
                     ds = oCN.RunProcReturn(sql, "h_v_IF_SeOrderBillList");
                 }
 
@@ -1268,7 +1268,7 @@
             try
             {
 
-                ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList where hmainid =" + HInterID, "h_v_IF_SeOrderBillList");
+                ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList where hmainid =" + HInterID + " order by hsubid asc", "h_v_IF_SeOrderBillList");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs"
index 844703b..e6009d5 100644
--- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs"
+++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs"
@@ -66,6 +66,7 @@
             public string HMainSourceBillNo;
             public string HMainSourceBillType;
             public int HOrderLevID;
+            public int HTaskClassID;
         }
         #endregion
 
@@ -184,7 +185,7 @@
                 string HMainSourceBillNo = mainList[0].HMainSourceBillNo;
                 string HMainSourceBillType = mainList[0].HMainSourceBillType;
                 int HOrderLevID = mainList[0].HOrderLevID;
-
+                int HTaskClassID = mainList[0].HTaskClassID;
 
 
                 if (OperationType == 2)
@@ -206,7 +207,7 @@
                 {
                     string sql = "insert into PM_WorkTaskBillMain" +
                         "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HBillNo,HProjectID,HProNumber,HProjectStageID,HName,HDate,HTaskNote,HPlanTimes" +
-                        ",HSelfTimes,HLastDate,HSendEmp,HReceiveEmp,HType,HCopyEmp,HRemark,HOrgID,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HOrderLevID)" +
+                        ",HSelfTimes,HLastDate,HSendEmp,HReceiveEmp,HType,HCopyEmp,HRemark,HOrgID,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HOrderLevID,HTaskClassID)" +
                         "values(" +
                         "" + HYear +
                         "," + HPeriod +
@@ -236,6 +237,7 @@
                         ",'" + HMainSourceBillNo +
                         "','" + HMainSourceBillType +
                         "','" + HOrderLevID  +
+                        "','"+ HTaskClassID+
                         "')";
 
                     //涓昏〃
@@ -273,6 +275,7 @@
                         ",HMainSourceBillNo = '" + HMainSourceBillNo +
                         "',HMainSourceBillType = '" + HMainSourceBillType +
                         "',HOrderLevID  = '" + HOrderLevID  +
+                        "',HTaskClassID  = '" + HTaskClassID +
                         "' where HInterID = " + HInterID;
 
                     oCN.RunProc(sql);
diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
index 82f7912..1205101 100644
--- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
+++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
@@ -34,6 +34,12 @@
         public DAL.ClsPM_ProjectMoneyBillMain BillNew4 = new DAL.ClsPM_ProjectMoneyBillMain();   //椤圭洰璐圭敤鍗曞搴斿崟鎹被
         public DAL.ClsPM_ProjectMoneyBillMain BillOld4 = new DAL.ClsPM_ProjectMoneyBillMain();
 
+        public DAL.ClsPM_ProjectBeginBillMain BillNew5 = new DAL.ClsPM_ProjectBeginBillMain();   //椤圭洰鍚姩鍗曞搴斿崟鎹被
+        public DAL.ClsPM_ProjectBeginBillMain BillOld5 = new DAL.ClsPM_ProjectBeginBillMain();
+
+        public DAL.ClsPM_ProjectEndBillMain BillNew6 = new DAL.ClsPM_ProjectEndBillMain();   //椤圭洰楠屾敹鍗曞搴斿崟鎹被
+        public DAL.ClsPM_ProjectEndBillMain BillOld6 = new DAL.ClsPM_ProjectEndBillMain();
+
         #region 宸ョ▼椤圭洰 鏂板/缂栬緫
         #region 宸ョ▼椤圭洰 琛ㄥご鏁版嵁
         public class PM_ProjectBill_Main
@@ -3255,7 +3261,7 @@
                     if (refSav == "Add")
                     {
                         //鍗曟嵁鍙锋槸鍚﹂噸澶�
-                        if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
+                        if (BillNew5.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -3266,7 +3272,7 @@
                     }
                     if (refSav == "Update")
                     {
-                        if (BillOld1.ShowBill(oItem.HInterID, ref s) == false)
+                        if (BillOld5.ShowBill(oItem.HInterID, ref s) == false)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -3275,7 +3281,7 @@
                             return objJsonResult;
                         }
                         //鍒ゆ柇鏄惁鍙紪杈�
-                        if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null)
+                        if (BillOld5.omodel.HChecker != "" && BillOld5.omodel.HChecker != null)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -3283,7 +3289,7 @@
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
-                        if (BillOld1.omodel.HBillStatus > 1)
+                        if (BillOld5.omodel.HBillStatus > 1)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -3893,7 +3899,7 @@
                     if (refSav == "Add")
                     {
                         //鍗曟嵁鍙锋槸鍚﹂噸澶�
-                        if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
+                        if (BillNew6.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -3904,7 +3910,7 @@
                     }
                     if (refSav == "Update")
                     {
-                        if (BillOld1.ShowBill(oItem.HInterID, ref s) == false)
+                        if (BillOld6.ShowBill(oItem.HInterID, ref s) == false)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -3913,7 +3919,7 @@
                             return objJsonResult;
                         }
                         //鍒ゆ柇鏄惁鍙紪杈�
-                        if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null)
+                        if (BillOld6.omodel.HChecker != "" && BillOld6.omodel.HChecker != null)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -3921,7 +3927,7 @@
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
-                        if (BillOld1.omodel.HBillStatus > 1)
+                        if (BillOld6.omodel.HBillStatus > 1)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;

--
Gitblit v1.9.1