From 44d8a4fbe4abfbf82376a49ae7d07eda5c9cd374 Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期四, 20 一月 2022 11:05:13 +0800
Subject: [PATCH] 条码拆码

---
 WarM/仓库管理/Gy_BarCodeBill_ChaiMa.cs        |   46 ++++++++++++++++++++++++++--------------------
 DAL/仓库管理/条码管理/ClsGy_BarCodeBill_ChaiMa.cs |   12 ++++++------
 2 files changed, 32 insertions(+), 26 deletions(-)

diff --git "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsGy_BarCodeBill_ChaiMa.cs" "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsGy_BarCodeBill_ChaiMa.cs"
index 78f0f0e..8e8333f 100644
--- "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsGy_BarCodeBill_ChaiMa.cs"
+++ "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsGy_BarCodeBill_ChaiMa.cs"
@@ -12,13 +12,13 @@
         public List<Model.ClsGy_BarCodeEdit_Model> DetailColl_Pay = new List<Model.ClsGy_BarCodeEdit_Model>();
 
 
-        public  bool AddBill(ref string sReturn)
+        public  bool AddBill(ref string sReturn,string HBillNo)
         {
             try
             {
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCn.BeginTran();
-                string sql = "delete Gy_BarCodeBill where HBarCode='" + omodel.HBarCode + "'";
+                string sql = "delete Gy_BarCodeBill where HBarCode='" + HBillNo + "'";
                 oCn.RunProc(sql);
                 ////鎻掑叆瀛愯〃
                 foreach (Model.ClsGy_BarCodeEdit_Model oSub in DetailColl_Mater)
@@ -37,10 +37,10 @@
                 ",HSendGoodsBillNo,HServerItemID,HBadReasonList,HProdLev,HInnerBillNo,HCusBarCode,HStatus,HInitSourceEntryID" +
                 ",HOldSourceBillType,HMZ,HGiveAwayFlag" +
                 ") " +
-                " values("+ oSub.HInterID + ",1,'3710',0," + oSub.HBarCode + ",'" + oSub.HBarCodeType + "','" + oSub.HItemSubID+
-                "'," + oSub.HMaterID + ","+ oSub.HUnitID + ",0,"+ oSub.HQty + ","+ oSub.HBatchNo + ","+ oSub.HSupID + "," + oSub.HGroupID + "," + oSub.HDeptID + "," + oSub.HEmpID +
-                "," + oSub.HMaker + ",'" + oSub.HMakeDate + "',0," + oSub.HSourceInterID + ","+ oSub.HSourceEntryID + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," +
-                "'','" + oSub.HUseFlag + "','',''," + oSub.HStopflag + ",'',0,"+ oSub.HInitQty+",0"+
+                " values("+ oSub.HInterID + ",1,'3710',0,'" + oSub.HBarCode + "','" + oSub.HBarCodeType + "','" + oSub.HItemSubID+
+                "'," + oSub.HMaterID + ","+ oSub.HUnitID + ",0,"+ oSub.HQty + ",'"+oSub.HBatchNo + "',"+ oSub.HSupID + "," + oSub.HGroupID + "," + oSub.HDeptID + "," + oSub.HEmpID +
+                ",'" + oSub.HMaker + "','" + oSub.HMakeDate + "',0," + oSub.HSourceInterID + ","+ oSub.HSourceEntryID + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," +
+                "'','" + oSub.HUseFlag + "','','',0,'',0,"+ oSub.HInitQty+",0"+
                 ",'',0,'',"+ oSub.HSourceID+",'','',"+ oSub.HCusID+","+ oSub.HSTOCKORGID+","+ oSub.HOWNERID + 
                 ",'','','','','','','',0,"+
                 "0,'','"+oSub.HBarCodeDate+"','',0,0"+
diff --git "a/WarM/\344\273\223\345\272\223\347\256\241\347\220\206/Gy_BarCodeBill_ChaiMa.cs" "b/WarM/\344\273\223\345\272\223\347\256\241\347\220\206/Gy_BarCodeBill_ChaiMa.cs"
index 7251f41..762a6a5 100644
--- "a/WarM/\344\273\223\345\272\223\347\256\241\347\220\206/Gy_BarCodeBill_ChaiMa.cs"
+++ "b/WarM/\344\273\223\345\272\223\347\256\241\347\220\206/Gy_BarCodeBill_ChaiMa.cs"
@@ -149,7 +149,7 @@
                 }
                 else
                 {
-                    return false;
+                    return true;
                 }
             }
             return true;
@@ -170,13 +170,13 @@
                 //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
                 string HBillNo = txtHBillNo.Text;
                 DataSet Ds;
+                double sum = 0;
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-                Ds = oCn.RunProcReturn("select top 1* from h_v_Gy_BarCodeBill_ChaiMa where 鏉$爜缂栧彿='" + HBillNo + "'", "h_v_Gy_BarCodeBill_ChaiMa");
+                Ds = oCn.RunProcReturn("select top 1* from Gy_BarCodeBill where HBarCode='" + HBillNo + "'", "h_v_Gy_BarCodeBill_ChaiMa");
                 for (i = 0; i <= grdMain_Pay.RowCount - 1; i++)
                 {
                     if (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HSnoCol2].Value) != 0)
                     {
-
                         Model.ClsGy_BarCodeEdit_Model model = new Model.ClsGy_BarCodeEdit_Model();
                         //鍥哄畾璧嬪��========================================
                         model.HEntryID = i + 1;
@@ -198,7 +198,6 @@
                         model.HSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillNo"].ToString());
                         model.HSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillType"].ToString());
                         model.HUseFlag = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUseFlag"].ToString());
-                        model.HStopflag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HStopflag"].ToString());
                         model.HInitQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HInitQty"].ToString());
                         model.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInitQty"].ToString());
                         model.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"].ToString());
@@ -211,33 +210,40 @@
                         model.HMakeDate = DateTime.Now;
                         model.HMaker = ClsPub.CurUserName;
 
-                        if (model.HPieceQty <= 0 || model.HPieceQty.ToString() == "")
+                        if (model.HQty <= 0 || model.HQty.ToString() == "")
                         {
-                            MessageBox.Show("绗�" + ClsPub.isStrNull(i + 1) + "琛岋紝鎷嗗垎鏁伴噺蹇呴』澶т簬0锛�");
+                            MessageBox.Show("椤�2绗�" + ClsPub.isStrNull(i + 1) + "琛岋紝鎷嗗垎鏁伴噺蹇呴』澶т簬0锛�");
                             return false;
                         }
+                        sum += model.HQty;
                         BillNew.DetailColl_Mater.Add(model);
                     }
+                    else
+                    {
+                        break;
+                    }
                 }
-
-                //淇濆瓨
-                bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
-                //鎻愮ず
-                if (bResult == true)
+                if (sum > DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells[HQty].Value))
                 {
-                    MessageBox.Show("鍗曟嵁瀛樼洏瀹屾瘯!鍗曟嵁鍙�:" + this.txtHBillNo.Text.Trim(), "鎻愮ず");
-                    return true;
+                     MessageBox.Show("椤�2鎷嗗垎鏁伴噺涔嬪拰蹇呴』灏忎簬鏉$爜鏁伴噺锛�");
+                    return false;
                 }
                 else
                 {
-                    MessageBox.Show("淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo, "鎻愮ず");
-                    return false;
+                    //淇濆瓨
+                    bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo, HBillNo);
+                    //鎻愮ず
+                    if (bResult == true)
+                    {
+                        MessageBox.Show("鍗曟嵁瀛樼洏瀹屾瘯!鍗曟嵁鍙�:" + this.txtHBillNo.Text.Trim(), "鎻愮ず");
+                        return true;
+                    }
+                    else
+                    {
+                        MessageBox.Show("淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo, "鎻愮ず");
+                        return false;
+                    }
                 }
-            //}
-            //else
-            //{
-            //    return false;
-            //}
         }
         //纭畾鎸夐挳
         private void button1_Click(object sender, EventArgs e)

--
Gitblit v1.9.1