From 077dd1267cbe547ca584cb7befc99c238c68b08f Mon Sep 17 00:00:00 2001
From: jingh <jingh@LAPTOP-I53VDLOO>
Date: 星期三, 06 十月 2021 09:20:22 +0800
Subject: [PATCH] 控制不良品入库单

---
 DAL/仓库管理/ClsKf_ProductInBill.cs           |   24 ++++++++++++++++++++++--
 WorkM/流转卡管理/MES_StationOutBillList_Bad.cs |   24 +++++++++++++++++++-----
 2 files changed, 41 insertions(+), 7 deletions(-)

diff --git "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_ProductInBill.cs" "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_ProductInBill.cs"
index 576cc13..2055ed8 100644
--- "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_ProductInBill.cs"
+++ "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_ProductInBill.cs"
@@ -456,8 +456,28 @@
                 }
                 //鐢熸垚鍑哄叆搴撳崟鎹�
                 //鎻掑叆瀛愯〃
-                oCn.RunProc("EXEC h_p_Kf_ProductInBillSub_Insert_StationOutBad " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + sHSourceType + "'");
-                //鎻掑叆涓昏〃
+                DataSet DS2 = oCn.RunProcReturn("EXEC h_p_Kf_ProductInBillSub_Insert_StationOutBad " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + sHSourceType + "'", "h_p_Kf_ProductInBillSub_Insert_StationOutBad");
+                if (DS2 == null || DS2.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鍒ゆ柇鍐欏叆瀛愯〃鐘舵�佸け璐ワ紝鏈煡閿欒锛�";
+                    if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                    }
+                    else
+                    {
+                        oCn.RollBack();
+                    }
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isStrNull(DS2.Tables[0].Rows[0][0]) != "OK")
+                    {
+                        sErrMsg = "鍐欏叆瀛愯〃澶辫触锛�";
+                        return false;
+                    }
+                }
+                        //鎻掑叆涓昏〃
                 oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                 "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
                 ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
diff --git "a/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/MES_StationOutBillList_Bad.cs" "b/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/MES_StationOutBillList_Bad.cs"
index 1ed6549..1912471 100644
--- "a/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/MES_StationOutBillList_Bad.cs"
+++ "b/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/MES_StationOutBillList_Bad.cs"
@@ -618,6 +618,10 @@
             int MainIDCol =  Fun_GetCol("hmainid");
             int SubIDCol = Fun_GetCol("hsubid");
             int BillNoCol = Fun_GetCol("鍗曟嵁鍙�");
+            int HUserK3Col = Fun_GetCol("K3鐢ㄦ埛");
+            int HKeepCol = Fun_GetCol("K3淇濈");
+            int HSecManagerCol = Fun_GetCol("K3楠屾敹");
+            int HDeptCol = Fun_GetCol("K3閮ㄩ棬");
             DAL.ClsKf_ProductInBill oClsKf_ProductInBill ;
             //鑾峰彇绯荤粺鍙傛暟
             Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
@@ -645,15 +649,23 @@
                 oClsKf_ProductInBill.omodel.HInterID = ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[MainIDCol].Value);
                 oClsKf_ProductInBill.omodel.HDate = DateTime.Today;
                 oClsKf_ProductInBill.omodel.HBillNo = ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[BillNoCol].Value);
-                oClsKf_ProductInBill.omodel.HDeptID = 0;
-                oClsKf_ProductInBill.omodel.HEmpID = 0;
-                oClsKf_ProductInBill.omodel.HSecManagerID = 0;
-                oClsKf_ProductInBill.omodel.HKeeperID = 0;
+                oClsKf_ProductInBill.omodel.HDeptID = ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[HDeptCol].Value);
+                oClsKf_ProductInBill.omodel.HEmpID = ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[HKeepCol].Value);
+                oClsKf_ProductInBill.omodel.HSecManagerID = ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[HSecManagerCol].Value);
+                oClsKf_ProductInBill.omodel.HKeeperID = ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[HKeepCol].Value);
+                oClsKf_ProductInBill.omodel.HBillerID = ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[HUserK3Col].Value);
                 oClsKf_ProductInBill.omodel.HRemark = "涓嶈壇鍝佸悓姝�";
                 oClsKf_ProductInBill.omodel.HMaker =  DBUtility.ClsPub.CurUserName;
                 oClsKf_ProductInBill.omodel.HWHID = 0;
                 oClsKf_ProductInBill.omodel.HSupID = 0;
                 oClsKf_ProductInBill.omodel.HExplanation = ""; 
+                if(oClsKf_ProductInBill.omodel.HBillerID==0 || oClsKf_ProductInBill.omodel.HKeeperID==0 
+                    || oClsKf_ProductInBill.omodel.HEmpID==0 || oClsKf_ProductInBill.omodel.HDeptID==0
+                    || oClsKf_ProductInBill.omodel.HSecManagerID ==0 )
+                {
+                    MessageBox.Show("娌℃湁璁剧疆閲戣澏鐢ㄦ埛銆侀儴闂ㄣ�佷繚绠°�侀獙鏀跺憳锛� " + DBUtility.ClsPub.sExeReturnInfo);
+                    continue;
+                }
                 if(oClsKf_ProductInBill.AddBill_StationOut_Bad("3710", oSystemParameter.omodel, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
                     n++;
@@ -663,13 +675,15 @@
                     MessageBox.Show("鍚屾鍗曟嵁澶辫触锛�"+ DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //浼戠湢5绉�
-                System.Threading.Thread.Sleep(5000);
+                System.Threading.Thread.Sleep(2000);
                 //
             }
             //
             if (n > 0)
             {
                 MessageBox.Show("鍚屾鍗曟嵁瀹屾瘯锛佷竴鍏辨湁" + n.ToString() + "寮犲叆搴撳崟锛�");
+                initGrid();
+                Display();
             }
         }
 

--
Gitblit v1.9.1