From 9167264eeb081fdbb94d8a1d2f76f35a6ccdd5fe Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期三, 06 四月 2022 11:02:33 +0800
Subject: [PATCH] nothing

---
 WarM/条码打印/Gy_BarCodeBillList.cs |  151 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 113 insertions(+), 38 deletions(-)

diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs"
index e3fd2c9..f9f460f 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs"
@@ -10,6 +10,7 @@
 using DBUtility;
 using System.Threading;
 using System.IO;
+using Pub_Class;
 
 namespace WarM
 {
@@ -28,10 +29,15 @@
         public const string ModRightNameCheck = ModRightName + "_Check";
         public const string ModRightNameClose = ModRightName + "_Close";
         public const string ModRightNameDelete = ModRightName + "_Delete";
+        public const string ModRightNamePrint = ModRightName + "_Print";    //鎵撳嵃
         //DAL.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill();
         //public  Gy_ICBomBill oFrm;
+        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
         public int selectRow = 0;
         public int selectRow2 = 0;
+        public long PrintQty = 0;               //鍏佽鏉$爜鎵撳嵃娆℃暟
+        public string PrintQtyCtl = "";         //鏉$爜鎵撳嵃娆℃暟鎺у埗
+        public string UpdatePrintQtyCtl = "";   //鏉$爜鎵撳嵃娆℃暟鏇存柊
         //
         private void initGrid()
         {
@@ -135,6 +141,25 @@
             this.Text = ModCaption;
             lblCaption.Text = ModCaption;
             initGrid();
+            Sub_GetSystemParameter();
+        }
+
+        //鑾峰彇绯荤粺鍙傛暟淇℃伅
+        private void Sub_GetSystemParameter()
+        {
+            //鑾峰彇绯荤粺鍙傛暟
+            ClsXt_SystemParameter oSystemParameter = new ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo) == false)
+            {
+                MessageBox.Show("鑾峰彇绯荤粺鍙傛暟澶辫触锛佸師鍥�:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず");
+                return;
+            }
+            else
+            {
+                PrintQty = oSystemParameter.omodel.BarCode_PrintQty;
+                PrintQtyCtl = oSystemParameter.omodel.BarCode_PrintQtyCtl;
+                UpdatePrintQtyCtl = oSystemParameter.omodel.BarCode_UpdatePrintQtyCtl;
+            }
         }
 
         private void grdMain_DblClick(object sender, EventArgs e)
@@ -390,11 +415,23 @@
         #region  //鎵撳嵃璁剧疆
 
         GridppReport Report;
+        int CurRows = 0;
+        string sBarCodeItemID = ""; //鏉$爜鑷鍒�
 
         //棰勮
-        int CurRows = 0;
         private void yl_Click(object sender, EventArgs e)
         {
+            //鎵撳嵃棰勮鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log(ModRightNamePrint, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                return;
+            }
+            //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹁秴杩囧厑璁稿彲鎵撳嵃娆℃暟
+            if (ReportPrintBegin())
+            {
+                return;
+            }
+
             //閫夋嫨鎵撳嵃妯℃澘
             BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
             oFrm.sBillName = ModName;
@@ -405,6 +442,60 @@
                 Sub_SetReport(oFrm.sOpenTmp);
                 Report.PrintPreview(false);
                 Thread.Sleep(1000);
+            }
+        }
+
+        //鎵撳嵃
+        private void dy_Click(object sender, EventArgs e)
+        {
+            //鎵撳嵃棰勮鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log(ModRightNamePrint, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                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(false);
+                Thread.Sleep(1000);
+            }
+        }
+
+        //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹁秴杩囧厑璁稿彲鎵撳嵃娆℃暟
+        private bool ReportPrintBegin()
+        {
+            DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
+            string sHRemark = "";
+            sBarCodeItemID = "";
+            for (int i = 0; i < grdMain.SelectedRows.Count; i++)
+            {
+                sBarCodeItemID = sBarCodeItemID + "," + DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.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;
             }
         }
 
@@ -424,6 +515,7 @@
             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);
         }
 
         //濉叆鍗曟嵁琛ㄥご淇℃伅
@@ -453,6 +545,8 @@
             }
             //CurRows = CurRows + 1;
         }
+
+        //濉叆鍗曟嵁琛ㄤ綋淇℃伅
         private void ReportFetchRecordByDataTable()
         {
             try
@@ -466,47 +560,19 @@
             }
         }
 
-        #endregion
-        //
-        private void grdMain_Paint(object sender, PaintEventArgs e)
-        {
-            GraphicsGrid();
-        }
-
-        private void dy_Click(object sender, EventArgs e)
+        //鎵撳嵃缁撴潫鍚庡洖濉潯鐮佹墦鍗版鏁�
+        private void ReportPrintEnd()
         {
             DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
-            //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
-            string sBarCode = "";
-            string sRelQty = "";
-            for (int i = 0; i < grdMain.SelectedRows.Count; i++)
+            if (UpdatePrintQtyCtl == "Y")
             {
-                sBarCode = sBarCode + "," + DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value);
+                oBar.Set_UpdatePrintQty(sBarCodeItemID);
             }
-            //if (oBar.Set_BPrintQty(sBarCode.Substring(1), ref sRelQty))
-            //{
-            //    MessageBox.Show(sRelQty);
-            //    return;
-            //}
-
-            //閫夋嫨鎵撳嵃妯℃澘
-            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
-            //DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
-            oFrm.sBillName = ModName;
-            oFrm.sBillModel = ModCaption;
-            oFrm.ShowDialog();
-            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
-            {
-                Sub_SetReport(oFrm.sOpenTmp);
-                Report.Print(false);
-                //oBar.Set_PrintQty(DBUtility.ClsPub.isStrNull(grdMain.Rows[CurRows].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value));
-                Thread.Sleep(1000);
-            }
-
-            //鎵归噺鏇存柊鏉$爜鎵撳嵃娆℃暟
-            oBar.Set_EPrintQty(sBarCode.Substring(1));
         }
 
+
+
+        //杩炴墦
         private void dy2_Click(object sender, EventArgs e)
         {
             //閫夋嫨鎵撳嵃妯℃澘
@@ -537,6 +603,15 @@
                     i++;
                 }
             }
+        }
+
+        #endregion
+
+
+        //
+        private void grdMain_Paint(object sender, PaintEventArgs e)
+        {
+            GraphicsGrid();
         }
 
         private void yc_Click(object sender, EventArgs e)
@@ -633,7 +708,7 @@
         private void zf_Click(object sender, EventArgs e)
         {
             //Sub_AbandonCheck();
-            if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
+            if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
             {
                 return;
             }
@@ -661,7 +736,7 @@
         private void fzf_Click(object sender, EventArgs e)
         {
             //this.Sub_CheckBill();
-            if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
+            if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
             {
                 return;
             }

--
Gitblit v1.9.1