From 73596f23e5a5e1ef39900a650e092c1669925966 Mon Sep 17 00:00:00 2001
From: 杨乐 <yang.le.192@qq.com>
Date: 星期五, 21 一月 2022 08:57:45 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WarM/仓库管理/Gy_BarCodeBill_ChaiMa.cs |  109 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 65 insertions(+), 44 deletions(-)

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..0b8af13 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"
@@ -61,7 +61,24 @@
             oSumGrid_Pay.NoCol = HSnoCol2;
         }
 
-       #region 绐椾綋澶勭悊鏂规硶
+        #region 绐椾綋澶勭悊鏂规硶
+        //鍒濆鍖栭〉绛�1鏁版嵁
+        private void intoDate()
+        {
+            try
+            {
+                DataSet Ds;
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                Ds = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_ChaiMa", "h_v_Gy_BarCodeBill_ChaiMa");
+                grdMain.DataSource = Ds.Tables[0].DefaultView;
+
+            }
+            catch (Exception ex )
+            {
+                MessageBox.Show(ex.Message.ToString());
+            }
+            
+        }
 
         //鍒濆鍖栭〉绛�1
         private void initGrid()
@@ -82,10 +99,8 @@
             ////闅愯棌鍒�
             grdMain.Columns[HTagCol].Visible = false;
             grdMain.Columns[HInterID].Visible = false;
-            //璁剧疆鍙紪杈戝垪
-            string sAllowCol = HNum.ToString();
-            //璁剧疆鍚堣鍒�
-            string sTotalCol = HTagCol.ToString() + "0";
+            
+            intoDate();
             //鏍煎紡鍖栫綉鏍�
             //DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid_Mater);
         }
@@ -134,26 +149,26 @@
             Sub_ClearBill();
         }
 
-        //鏁版嵁楠岃瘉
-        private bool Sub_AllowSave()
-        {
-            for (int i = 0; i <= grdMain_Pay.RowCount - 1; i++)
-            {
-                if (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HSnoCol2].Value) != 0)
-                {
-                    if (ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HNum2].Value) ==null)
-                    {
-                        MessageBox.Show("璇峰皢琛ㄦ牸鎷嗗垎鏁伴噺濉啓瀹屾暣", "鎻愮ず");
-                        return false;
-                    }
-                }
-                else
-                {
-                    return false;
-                }
-            }
-            return true;
-        }
+        ////鏁版嵁楠岃瘉
+        //private bool Sub_AllowSave()
+        //{
+        //    for (int i = 0; i <= grdMain_Pay.RowCount - 1; i++)
+        //    {
+        //        if (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HSnoCol2].Value) != 0)
+        //        {
+        //            if (ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HNum2].Value) ==null)
+        //            {
+        //                MessageBox.Show("璇峰皢琛ㄦ牸鎷嗗垎鏁伴噺濉啓瀹屾暣", "鎻愮ず");
+        //                return false;
+        //            }
+        //        }
+        //        else
+        //        {
+        //            return true;
+        //        }
+        //    }
+        //    return true;
+        //}
         
         //鐢熸垚鎸夐挳
         private void xz_Click(object sender, EventArgs e)
@@ -170,13 +185,13 @@
                 //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
                 string HBillNo = txtHBillNo.Text;
                 DataSet Ds;
+                double sum = 0.00000000;
                 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 +213,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 +225,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.isDoule(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