From cf3e135b3441adcc3d58e13bcacecdde12c62a7c Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期三, 25 六月 2025 09:35:10 +0800
Subject: [PATCH] 凯贝超聚变客户条码生成、客户条码列表模块打印预览功能增加只允许打印一次控制

---
 WarM/条码打印/Gy_CusBarCodeBill_KaiBei.cs |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 56 insertions(+), 4 deletions(-)

diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei.cs"
index f429a08..9ab3a30 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei.cs"
@@ -81,6 +81,7 @@
         public string sYear4 = "";         //骞达紙4浣嶏級
         public string sPeriod = "";        //鏈�
         public string sDay = "";           //鏃�
+        public string HBarCodeType = "瓒呰仛鍙樺唴鏍囩";   //鏉$爜绫诲瀷
 
 
         #region 鍥哄畾浠g爜
@@ -514,7 +515,6 @@
                 HCode2 = HCode2.ToUpper();
                 string HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);                 // 鐗堟湰鍙�
                 string HBatchNoNumber = "";                                                                         // 鎵规鐢熸垚鍓嶇紑
-                string HBarCodeType = "瓒呰仛鍙樺唴鏍囩";                                                               // 鏉$爜绫诲瀷
                 string HInnerBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HInnerBillNoCol].Value);     // 瀹㈡埛璁㈠崟鍙�
 
                 if (HMaterID != 0)
@@ -604,7 +604,6 @@
 
                 Int64 HEntryID = 0;
                 string HBarCode = "";       //鏉″舰鐮� 
-                string HBarCodeType = "";   //鏉$爜绫诲瀷
                 Int64 HMaterID = 0;         //鐗╂枡ID
                 Int64 HUnitID = 0;          //璁¢噺鍗曚綅ID
                 Int64 HAuxPropID = 0;       //杈呭姪灞炴�D
@@ -682,7 +681,6 @@
 
                             HEntryID = j + 1;
                             HBarCode = TM.ToUpper();
-                            HBarCodeType = "瓒呰仛鍙樺唴鏍囩";
                             HMaterID = ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value);
                             HUnitID = ClsPub.isLong(grdMain.Rows[j].Cells[HUnitIDCol].Value);
                             HAuxPropID = ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value);
@@ -998,10 +996,17 @@
                                         grdMain.Rows[sRow].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber;
                                         grdMain.Rows[sRow].Cells[HMaterNameCol].Value = oMater.omodel.HName;
                                         grdMain.Rows[sRow].Cells[HMaterModelCol].Value = oMater.omodel.HModel;
-                                        grdMain.Rows[sRow].Cells[HMinQtyCol].Value = oMater.omodel.HQtyMin;
                                         grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0;
                                         grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = "";
                                         grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = "";
+                                        if (HBarCodeType == "瓒呰仛鍙樺唴鏍囩")
+                                        {
+                                            grdMain.Rows[sRow].Cells[HMinQtyCol].Value =1;
+                                        }
+                                        else
+                                        {
+                                            grdMain.Rows[sRow].Cells[HMinQtyCol].Value = oMater.omodel.HQtyMin;
+                                        }
                                         if (oUnit.GetInfoByID(oMater.omodel.HUnitID))
                                         {
                                             grdMain.Rows[sRow].Cells[HUnitIDCol].Value = oUnit.omodel.HItemID.ToString();
@@ -1385,6 +1390,12 @@
                 return;
             }
 
+            //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+            if (ReportPrintBegin())
+            {
+                return;
+            }
+
             //閫夋嫨鎵撳嵃妯℃澘
             BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
             oFrm.sBillName = ModName;
@@ -1410,6 +1421,12 @@
                 return;
             }
 
+            //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+            if (ReportPrintBegin())
+            {
+                return;
+            }
+
             //閫夋嫨鎵撳嵃妯℃澘
             BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
             oFrm.sBillName = ModName;
@@ -1426,6 +1443,30 @@
 
         #endregion
 
+        //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹁秴杩囧厑璁稿彲鎵撳嵃娆℃暟
+        private bool ReportPrintBegin()
+        {
+            DataSet DS;
+            if (HBarCodeType == "瓒呰仛鍙樺唴鏍囩")
+            {
+                DS = oCn.RunProcReturn("select top 1 1 from Gy_BarCodeBill_Cus with(nolock) where HPrintQty >=1 and HInterID = " + HInterID, "Gy_BarCodeBill_Cus");
+                if (DS == null || DS.Tables[0].Rows.Count == 0)
+                {
+                    return false;
+                }
+                else
+                {
+                    MessageBox.Show("鏉$爜宸叉墦鍗帮紝涓嶅厑璁稿啀娆℃墦鍗帮紒");
+                    return true;
+                }
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+
         private void Sub_SetReport(string sOpenTmp)
         {
             //鍒ゆ柇琛屾暟
@@ -1438,6 +1479,7 @@
             Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf");  //here .
             Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
             Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
+            Report.PrintBegin += new _IGridppReportEvents_PrintBeginEventHandler(ReportPrintBegin2);
             Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
         }
 
@@ -1468,6 +1510,16 @@
             }
         }
 
+        //鎵撳嵃寮�濮嬪墠鍒ゆ柇
+        private void ReportPrintBegin2()
+        {
+            //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+            if (ReportPrintBegin())
+            {
+                Report.AbortPrint();
+            }
+        }
+
         //鎵撳嵃缁撴潫鍚庡洖濉潯鐮佹墦鍗版鏁�
         private void ReportPrintEnd()
         {

--
Gitblit v1.9.1