Browse Source

自定义标签打印打印方法修改

Hcsy 8 years ago
parent
commit
46c6ca7953
1 changed files with 12 additions and 6 deletions
  1. 12 6
      UAS-MES/FunctionCode/Make/Make_CustomLabelPrint.cs

+ 12 - 6
UAS-MES/FunctionCode/Make/Make_CustomLabelPrint.cs

@@ -150,14 +150,17 @@ namespace UAS_MES.Make
                         if (PrintFile == null)
                         {
                             MessageBox.Show("打印文件不存在");
-                            return ;
+                            return;
                         }
-                        if (PrintFile.LastWriteTime.ToString() != filelastwritetime)
+                        string filechangetime = PrintFile.LastWriteTime.ToString();
+                        if (filechangetime != filelastwritetime)
                         {
                             lbl.Quit();
                             lbl = new ApplicationClass();
                             BaseUtil.WriteLbl();
-                            dh.UpdateByCondition("label", "la_lastwritetime = to_date('" + PrintFile.LastWriteTime.ToString() + "', 'yyyy-mm-dd hh24:mi:ss') ", "la_id = '" + listA.Rows[PrintLabel.SelectedIndex]["la_id"].ToString() + "'");
+                            filechangetime = PrintFile.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
+                            string update = "la_lastwritetime = to_date((regexp_substr('" + filechangetime + "','\\d+.+\\d+')),'yyyy-mm-dd hh24:mi:ss')";
+                            dh.UpdateByCondition("label", update, "la_id = '" + listA.Rows[PrintLabel.SelectedIndex]["la_id"].ToString() + "'");
                         }
                         doc = lbl.Documents.Open(listA.Rows[PrintLabel.SelectedIndex]["la_url"].ToString(), true);
                     }
@@ -270,14 +273,17 @@ namespace UAS_MES.Make
                     MessageBox.Show("打印文件不存在");
                     return;
                 }
-                if (PrintFile.LastWriteTime.ToString() != filelastwritetime)
+                string filechangetime = PrintFile.LastWriteTime.ToString();
+                if (filechangetime != filelastwritetime)
                 {
                     lbl.Quit();
                     lbl = new ApplicationClass();
                     BaseUtil.WriteLbl();
-                    dh.UpdateByCondition("label", "la_lastwritetime = to_date('" + PrintFile.LastWriteTime.ToString() + "', 'yyyy-mm-dd hh24:mi:ss') ", "la_id = '" + listA.Rows[PrintLabel.SelectedIndex]["la_id"].ToString() + "'");
+                    filechangetime = PrintFile.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
+                    string update = "la_lastwritetime = to_date((regexp_substr('" + filechangetime + "','\\d+.+\\d+')),'yyyy-mm-dd hh24:mi:ss')";
+                    dh.UpdateByCondition("label", update, "la_id = '" + listA.Rows[PrintLabel.SelectedIndex]["la_id"].ToString() + "'");
                 }
-                doc = lbl.Documents.Open(listA.Rows[PrintLabel.SelectedIndex]["la_url"].ToString());
+                doc = lbl.Documents.Open(listA.Rows[PrintLabel.SelectedIndex]["la_url"].ToString(),true);
                 sb = new StringBuilder();
                 //将值赋到doc对应的变量
                 for (int i = 0; i < doc.Variables.FormVariables.Count; i++)