From c3fab579ae26614c5ef830afbc6b1345ea2931a0 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期五, 24 三月 2023 14:51:48 +0800
Subject: [PATCH] 新增系统参数:条码生成时同步生成条码出入库记录

---
 WorkM/流转卡管理/MES_StationOutBillList_Bad.cs |   66 +++++++++++++++++++++++++++++---
 1 files changed, 59 insertions(+), 7 deletions(-)

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..5effe0d 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"
@@ -47,6 +47,7 @@
             string sSql = "";
             string sWhere = "";
 
+            bzd.Enabled = true;
             if (frmCondition.SqlStr.Trim().Length == 0)
             {
                 sSql = "Select top 5000 * from " + ViewName + " Where 1=1 " + sWhere + sDlgWhere + " order by hmainid desc ";
@@ -496,7 +497,7 @@
             //LOT鍙�
             if (txtHBillNo.Text.Trim() != "")
             {
-                sFastSQL = sFastSQL + " and 娴佽浆鍗″彿 like '%" + txtHBillNo.Text + "%'";
+                sFastSQL = sFastSQL + " and 宸ュ簭娴佽浆鍗″彿 like '%" + txtHBillNo.Text + "%'";
             }
             //宸ヤ綔涓績
             if (txtHCenterID.Text.Trim() != "")
@@ -614,16 +615,24 @@
 
         private void bzd_Click(object sender, EventArgs e)
         {
+            //鐐瑰嚮鍚庡叆搴撴寜閽彉鐏�
+            bzd.Enabled = false;
             //鏍规嵁閫変腑鐨勬暟鎹敓鎴愬寘瑁呭崟
             int MainIDCol =  Fun_GetCol("hmainid");
             int SubIDCol = Fun_GetCol("hsubid");
             int BillNoCol = Fun_GetCol("鍗曟嵁鍙�");
-            DAL.ClsKf_ProductInBill oClsKf_ProductInBill ;
+            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;
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
             //鑾峰彇绯荤粺鍙傛暟
             Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
             if (oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo) == false)
             {
                 MessageBox.Show("鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + DBUtility.ClsPub.sExeReturnInfo);
+                bzd.Enabled = true;
                 return;
             }
             //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
@@ -633,8 +642,40 @@
             if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Today, ref sYear, ref sPeriod, ref s) == false)
             {
                 MessageBox.Show("浼氳鏈熼棿鏈夐敊璇紒 " + DBUtility.ClsPub.sExeReturnInfo);
+                bzd.Enabled = true;
                 return;
             }
+            string sHInterID = "";
+            for (int i = 0; i < grdMain.SelectedRows.Count; i++)
+            {
+                sHInterID = sHInterID + "," + DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[MainIDCol].Value);
+            }
+            if (sHInterID=="")
+            {
+                MessageBox.Show("娌℃湁閫変腑鐨勫崟鎹槑缁嗚锛岃鍏堥�夋嫨瑕佸叆搴撶殑鍗曟嵁锛�", "鎻愮ず");
+                bzd.Enabled = true;
+                return;
+            }
+            else
+            {
+                DataSet DS = oCn.RunProcReturn("exec h_p_MES_StationOutBillList_Bad_PreProductIn '" + sHInterID + "'", "h_p_MES_StationOutBillList_Bad_PreProductIn", ref DBUtility.ClsPub.sExeReturnInfo);
+                if (DS == null || DS.Tables[0].Rows.Count == 0)
+                {
+                    MessageBox.Show("鍏ュ簱鍓嶅垽鏂け璐ワ紒", "鎻愮ず");
+                    bzd.Enabled = true;
+                    return;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][0]) == "1")
+                    {
+                        MessageBox.Show(DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]));
+                        bzd.Enabled = true;
+                        return;
+                    }
+                }
+            }
+
             Int64 n = 0;
             //寰幆 閫変腑琛�
             for (int i = 0; i < grdMain.SelectedRows.Count; i++)
@@ -645,15 +686,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 +712,16 @@
                     MessageBox.Show("鍚屾鍗曟嵁澶辫触锛�"+ DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //浼戠湢5绉�
-                System.Threading.Thread.Sleep(5000);
+                System.Threading.Thread.Sleep(2000);
                 //
             }
+            bzd.Enabled = true;
             //
             if (n > 0)
             {
                 MessageBox.Show("鍚屾鍗曟嵁瀹屾瘯锛佷竴鍏辨湁" + n.ToString() + "寮犲叆搴撳崟锛�");
+                initGrid();
+                Display();
             }
         }
 

--
Gitblit v1.9.1