From a97a624c1fb269a059f97629076433c46b4e8b4c Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 13 8月 2025 14:42:08 +0800 Subject: [PATCH] //如果是连续打印,则不调用打印服务,解决重复打印的问题 【Editby shaocx,2025-08-13】 --- LA24030_LuLiPackageLine_Print/LA24030_LuLiPackageLine_PrintService/WindowsFormsApplication1/Form1.cs | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) diff --git a/LA24030_LuLiPackageLine_Print/LA24030_LuLiPackageLine_PrintService/WindowsFormsApplication1/Form1.cs b/LA24030_LuLiPackageLine_Print/LA24030_LuLiPackageLine_PrintService/WindowsFormsApplication1/Form1.cs index 03a8218..65ff232 100644 --- a/LA24030_LuLiPackageLine_Print/LA24030_LuLiPackageLine_PrintService/WindowsFormsApplication1/Form1.cs +++ b/LA24030_LuLiPackageLine_Print/LA24030_LuLiPackageLine_PrintService/WindowsFormsApplication1/Form1.cs @@ -24,6 +24,7 @@ { public partial class Form1 : Form { + public static string prePrintSuccessPackage = "";//涓婁竴涓墦鍗版垚鍔熺殑鍖呭彿 //鑷姩鎵撳嵃绾跨▼ Thread AutoPrint, Colors; @@ -252,7 +253,7 @@ this.tb_Msg.Text = "鍑虹幇寮傚父:" + ex.Message; Log4NetHelper.WriteErrorLog(LogType.Print, "Print 鍑虹幇寮傚父锛�" + ex.Message, ex); } - Thread.Sleep(2 * 1000);//浼戠湢2绉� + Thread.Sleep(10 * 1000);//浼戠湢10绉� 锛�2绉掓敼涓�10绉� 銆怑ditby shaocx,2025-08-05銆� } } @@ -376,14 +377,24 @@ //璋冪敤鎵撳嵃鎺ュ彛 bool isSuccess = false; - using (iWarePrintService.PrintBaseService.PrintWcfServiceClient client = new iWarePrintService.PrintBaseService.PrintWcfServiceClient()) - { - //isSuccess = client.Print3(data, 1, @"D:\鎵撳嵃绋嬪簭\璺熻釜鐮佹墦鍗版ā鏉縗璺熻釜鐮佹墦鍗版ā鏉縚涓�缁寸爜.btw", "ZDesigner ZD888-203dpi ZPL", out errMsg); - //isSuccess = client.Print3(data, 1, @"D:\鎵撳嵃绋嬪簭\璺熻釜鐮佹墦鍗版ā鏉縗璺熻釜鐮佹墦鍗版ā鏉縚浜岀淮鐮�.btw", "ZDesigner ZD888-203dpi ZPL", out errMsg); - isSuccess = client.Print3(data, item.PrintSheetNum, printConfig.PrintTemplateAddr, _PrinterName, out errMsg); + if (prePrintSuccessPackage == item.PackageCode) + {//濡傛灉鏄繛缁墦鍗帮紝鍒欎笉璋冪敤鎵撳嵃鏈嶅姟锛岃В鍐抽噸澶嶆墦鍗扮殑闂 銆怑ditby shaocx,2025-08-13銆� + isSuccess = true;//寮哄埗璁や负鎵撳嵃鎴愬姛锛� } + else + { + using (iWarePrintService.PrintBaseService.PrintWcfServiceClient client = new iWarePrintService.PrintBaseService.PrintWcfServiceClient()) + { + //isSuccess = client.Print3(data, 1, @"D:\鎵撳嵃绋嬪簭\璺熻釜鐮佹墦鍗版ā鏉縗璺熻釜鐮佹墦鍗版ā鏉縚涓�缁寸爜.btw", "ZDesigner ZD888-203dpi ZPL", out errMsg); + //isSuccess = client.Print3(data, 1, @"D:\鎵撳嵃绋嬪簭\璺熻釜鐮佹墦鍗版ā鏉縗璺熻釜鐮佹墦鍗版ā鏉縚浜岀淮鐮�.btw", "ZDesigner ZD888-203dpi ZPL", out errMsg); + isSuccess = client.Print3(data, item.PrintSheetNum, printConfig.PrintTemplateAddr, _PrinterName, out errMsg); + } + } + if (isSuccess) { + prePrintSuccessPackage = item.PackageCode; + item.PrintStatus = 1;//鎵撳嵃鐘舵��(0锛氭湭鎵撳嵃 1锛氬凡鎵撳嵃) item.PrintNum = (item.PrintNum) + 1; -- Gitblit v1.9.3