فهرست منبع

标签打印方法修改

Hcsy 8 سال پیش
والد
کامیت
75a21471d4
3فایلهای تغییر یافته به همراه10 افزوده شده و 4 حذف شده
  1. 2 2
      UAS-MES/FunctionCode/Make/Make_RePrintLabel.cs
  2. 6 1
      UAS-MES/PublicMethod/BaseUtil.cs
  3. 2 1
      UAS-MES/PublicMethod/Print.cs

+ 2 - 2
UAS-MES/FunctionCode/Make/Make_RePrintLabel.cs

@@ -222,7 +222,7 @@ namespace UAS_MES.Make
                 }
                 //判定通过进行打印
                 //doc = lbl.Documents.Open(PrintLabel.Text);
-                if (Print.CodeSoft(Tag.ToString(), lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text),ms_makecode.Text,pr_code.Text,giftBox.Checked?"彩盒标":"机身标","-1",out errorMessage))
+                if (Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text),ms_makecode.Text,pr_code.Text,giftBox.Checked?"彩盒标":"机身标","-1",out errorMessage))
                 {
                     //按照打印张数打印
                     OperateResult.AppendText("<<打印成功\n", Color.Green);
@@ -254,7 +254,7 @@ namespace UAS_MES.Make
                     return;
                 }
                 //doc = lbl.Documents.Open(PrintLabel.Text);
-                if (Print.CodeSoft(Tag.ToString(), lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text),ms_makecode.Text,pr_code.Text,"卡通箱标","-1",out errorMessage))
+                if (Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text),ms_makecode.Text,pr_code.Text,"卡通箱标","-1",out errorMessage))
                 {
                     //判断通过,打印
                     OperateResult.AppendText("<<打印成功\n", Color.Green);

+ 6 - 1
UAS-MES/PublicMethod/BaseUtil.cs

@@ -1006,7 +1006,12 @@ namespace UAS_MES.PublicMethod
             int PID = 0;
             for (int i = 0; i < processes.Length; i++)
             {
-                ProInf.Add(processes[i].StartTime.ToString(), processes[i].Id);
+                try
+                {
+                    ProInf.Add(processes[i].StartTime.ToString(), processes[i].Id);
+                }
+                catch {
+                }
             }
             var temp = ProInf.Keys.Max();
             String str = SystemInf.ProcessesID + "|" + ProInf[temp];

+ 2 - 1
UAS-MES/PublicMethod/Print.cs

@@ -120,7 +120,7 @@ namespace UAS_MES.PublicMethod
         }
 
 
-        public static bool CodeSoft(string iCaller, ApplicationClass lbl, string LabelName, string LaID, string PrinterName, string SnCode, int PrintNum, string MakeCode, string ProdCode, string LabelType, string IfRePrint, out string ErrorMessage)
+        public static bool CodeSoft(string iCaller, ref ApplicationClass lbl, string LabelName, string LaID, string PrinterName, string SnCode, int PrintNum, string MakeCode, string ProdCode, string LabelType, string IfRePrint, out string ErrorMessage)
         {
             ErrorMessage = "";
             DataTable dt = new DataTable();
@@ -154,6 +154,7 @@ namespace UAS_MES.PublicMethod
             }
             if (PrintFile.LastWriteTime.ToString() != filelastwritetime)
             {
+                lbl.Quit();
                 lbl = new ApplicationClass();
                 BaseUtil.WriteLbl(lbl);
                 dh.UpdateByCondition("label", "la_lastwritetime = to_date('"+PrintFile.LastWriteTime.ToString()+"', 'yyyy-mm-dd hh24:mi:ss') ", "la_id = '"+ LaID + "'");