From caf31525f29e659cca49dd6e35b5f13e8e0496d7 Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期一, 28 三月 2022 17:20:05 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WarM/条码打印/Gy_BarCodeBill.cs |  232 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 153 insertions(+), 79 deletions(-)

diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
index bf698e8..ac71f5a 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
@@ -165,7 +165,10 @@
         public string ERPMode = ""; //ERP妯″紡锛圵ISE銆丆LOUD锛�
         public string CampanyName = ""; //瀹㈡埛瀹氬埗鍖栧悕绉�
         public string SourceQtyCtl = ""; //瓒呮簮鍗曟暟閲忔帶鍒�
-                                         //-------------------------------------------------------------------------
+        public long PrintQty = 0;               //鍏佽鏉$爜鎵撳嵃娆℃暟
+        public string PrintQtyCtl = "";         //鏉$爜鎵撳嵃娆℃暟鎺у埗
+        public string UpdatePrintQtyCtl = "";   //鏉$爜鎵撳嵃娆℃暟鏇存柊
+                                                //-------------------------------------------------------------------------
         #region 鍥哄畾浠g爜
 
         //娓呯┖鐣岄潰
@@ -405,6 +408,9 @@
                 ERPMode = oSystemParameter.omodel.WMS_WMSStockCtl_ERPMode;
                 CampanyName = oSystemParameter.omodel.WMS_CampanyName;
                 SourceQtyCtl = oSystemParameter.omodel.BarCode_SourceQtyCtl;
+                PrintQty = oSystemParameter.omodel.BarCode_PrintQty;
+                PrintQtyCtl = oSystemParameter.omodel.BarCode_PrintQtyCtl;
+                UpdatePrintQtyCtl = oSystemParameter.omodel.BarCode_UpdatePrintQtyCtl;
             }
 
             cmbHWorksNumber.Items.Clear();
@@ -2707,9 +2713,10 @@
         #region  //鎵撳嵃璁剧疆
 
         GridppReport Report;
+        int CurRows = 0;
+        string sBarCodeItemID = ""; //鏉$爜鑷鍒�
 
         //棰勮
-        int CurRows = 0;
         private void yl_Click(object sender, EventArgs e)
         {
             //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
@@ -2738,32 +2745,68 @@
             }
         }
 
-        //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+        //鎵撳嵃
+        private void dy_Click(object sender, EventArgs e)
+        {
+            //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
+            if (DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value) == "")
+            {
+                MessageBox.Show("鏉$爜鏈敓鎴愶紝璇峰厛鐢熸垚鏉$爜鍚庡啀鎵撳嵃锛�");
+                return;
+            }
+
+            //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+            if (ReportPrintBegin())
+            {
+                return;
+            }
+
+            //閫夋嫨鎵撳嵃妯℃澘
+            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
+            oFrm.sBillName = ModName;
+            oFrm.sBillModel = ModCaption;
+            oFrm.ShowDialog();
+            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+            {
+                //寰幆閫変腑琛�
+                Sub_SetReport(oFrm.sOpenTmp);
+                Report.Print(true);
+                Thread.Sleep(1000);
+            }
+        }
+
+        ////鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+        //private bool ReportPrintBegin()
+        //{
+        //    string sRelQty = "";
+
+        //    if (oBar.Set_BPrintQty(DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value), ref sRelQty))
+        //    {
+        //        MessageBox.Show("鏉$爜宸茬粡鎵撳嵃杩囷紝涓嶅彲閲嶅鎵撳嵃锛�");
+        //        return true;
+        //    }
+        //    else
+        //    {
+        //        return false;
+        //    }
+        //}
+
+        //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹁秴杩囧厑璁稿彲鎵撳嵃娆℃暟
         private bool ReportPrintBegin()
         {
-            string sRelQty = "";
-
-            if (oBar.Set_BPrintQty(DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value), ref sRelQty))
+            string sHRemark = "";
+            if (PrintQtyCtl == "Y")
             {
-                MessageBox.Show("鏉$爜宸茬粡鎵撳嵃杩囷紝涓嶅彲閲嶅鎵撳嵃锛�");
-                return true;
+                if (oBar.Set_CheckPrintQty_SD(HInterID, PrintQty, ref sHRemark))
+                {
+                    MessageBox.Show(sHRemark);
+                    return true;
+                }
+                return false;
             }
             else
             {
                 return false;
-            }
-        }
-
-        //鎵撳嵃缁撴潫鍚庡洖濉潯鐮佹墦鍗版鏁�
-        private void ReportPrintEnd()
-        {
-            try
-            {
-                oCn.RunProc("update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0)+1 where HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
-            }
-            catch (Exception e)
-            {
-                MessageBox.Show("鎵撳嵃澶辫触!鎵撳嵃缁撴潫 锛�" + e.Message);
             }
         }
 
@@ -2773,26 +2816,6 @@
             for (int i = 0; i < grdList.Rows.Count; i++)
             {
                 grdList.Rows[i].Cells[0].Value = "*";
-            }
-            //
-            Report = new GridppReport();
-            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf");  //here .
-            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
-            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
-            Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
-        }
-
-
-        private void Sub_SetReportView(string sOpenTmp)
-        {
-            //鍒ゆ柇琛屾暟
-            for (int i = 0; i < grdList.Rows.Count; i++)
-            {
-                grdList.Rows[i].Cells[0].Value = "";
-            }
-            for (int i = 0; i < grdList.SelectedRows.Count; i++)
-            {
-                grdList.Rows[grdList.SelectedRows[i].Index].Cells[0].Value = "*";
             }
             //
             Report = new GridppReport();
@@ -2824,11 +2847,7 @@
             }
         }
 
-        private Int32 Fun_GetCol(string sCol)
-        {
-            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdList);
-        }
-
+        //濉叆鍗曟嵁琛ㄤ綋淇℃伅
         private void ReportFetchRecordByDataTable()
         {
             try
@@ -2842,17 +2861,40 @@
             }
         }
 
-        private void dy_Click(object sender, EventArgs e)
+        ////鎵撳嵃缁撴潫鍚庡洖濉潯鐮佹墦鍗版鏁�
+        //private void ReportPrintEnd()
+        //{
+        //    try
+        //    {
+        //        oCn.RunProc("update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0)+1 where HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        MessageBox.Show("鎵撳嵃澶辫触!鎵撳嵃缁撴潫 锛�" + e.Message);
+        //    }
+        //}
+
+        //鎵撳嵃缁撴潫鍚庡洖濉潯鐮佹墦鍗版鏁�
+        private void ReportPrintEnd()
+        {
+            if (UpdatePrintQtyCtl == "Y")
+            {
+                oBar.Set_UpdatePrintQty_SD(HInterID);
+            }
+        }
+
+        //璇曟墦鍗�
+        private void sdy_Click(object sender, EventArgs e)
         {
             //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
             if (DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value) == "")
             {
-                MessageBox.Show("鏉$爜鏈敓鎴愶紝璇峰厛鐢熸垚鏉$爜鍚庡啀鎵撳嵃锛�");
+                MessageBox.Show("鏉$爜鏈敓鎴愶紝璇峰厛鐢熸垚鏉$爜鍚庡啀棰勮锛�");
                 return;
             }
 
             //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
-            if (ReportPrintBegin())
+            if (ReportPrintBegin_SDY())
             {
                 return;
             }
@@ -2864,12 +2906,71 @@
             oFrm.ShowDialog();
             if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
             {
-                //寰幆閫変腑琛�
-                Sub_SetReport(oFrm.sOpenTmp);
-                Report.Print(true);
+                Sub_SetReportView(oFrm.sOpenTmp);
+                Report.PrintPreview(false);
                 Thread.Sleep(1000);
             }
         }
+
+        //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹁秴杩囧厑璁稿彲鎵撳嵃娆℃暟
+        private bool ReportPrintBegin_SDY()
+        {
+            string sHRemark = "";
+            sBarCodeItemID = "";
+            for (int i = 0; i < grdList.SelectedRows.Count; i++)
+            {
+                sBarCodeItemID = sBarCodeItemID + "," + DBUtility.ClsPub.isLong(grdList.Rows[grdList.SelectedRows[i].Index].Cells[Fun_GetCol("HItemID")].Value).ToString();
+            }
+            sBarCodeItemID = sBarCodeItemID.Remove(0, 1);
+
+            if (PrintQtyCtl == "Y")
+            {
+                if (oBar.Set_CheckPrintQty(sBarCodeItemID, PrintQty, ref sHRemark))
+                {
+                    MessageBox.Show(sHRemark);
+                    return true;
+                }
+                return false;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        private void Sub_SetReportView(string sOpenTmp)
+        {
+            //鍒ゆ柇琛屾暟
+            for (int i = 0; i < grdList.Rows.Count; i++)
+            {
+                grdList.Rows[i].Cells[0].Value = "";
+            }
+            for (int i = 0; i < grdList.SelectedRows.Count; i++)
+            {
+                grdList.Rows[grdList.SelectedRows[i].Index].Cells[0].Value = "*";
+            }
+            //
+            Report = new GridppReport();
+            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf");  //here .
+            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
+            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
+            Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd_SDY);
+        }
+
+        //鎵撳嵃缁撴潫鍚庡洖濉潯鐮佹墦鍗版鏁�
+        private void ReportPrintEnd_SDY()
+        {
+            if (UpdatePrintQtyCtl == "Y")
+            {
+                oBar.Set_UpdatePrintQty(sBarCodeItemID);
+            }
+        }
+
+        private Int32 Fun_GetCol(string sCol)
+        {
+            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdList);
+        }
+
 
         #endregion
 
@@ -3200,33 +3301,6 @@
             }
         }
 
-        private void sdy_Click(object sender, EventArgs e)
-        {
-            //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
-            if (DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value) == "")
-            {
-                MessageBox.Show("鏉$爜鏈敓鎴愶紝璇峰厛鐢熸垚鏉$爜鍚庡啀棰勮锛�");
-                return;
-            }
-
-            //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
-            if (ReportPrintBegin())
-            {
-                return;
-            }
-
-            //閫夋嫨鎵撳嵃妯℃澘
-            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
-            oFrm.sBillName = ModName;
-            oFrm.sBillModel = ModCaption;
-            oFrm.ShowDialog();
-            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
-            {
-                Sub_SetReportView(oFrm.sOpenTmp);
-                Report.PrintPreview(false);
-                Thread.Sleep(1000);
-            }
-        }
 
         //鐢熸垚澶栫鐮�
         private void wxm_Click(object sender, EventArgs e)

--
Gitblit v1.9.1