فهرست منبع

清除打印日志修改

callm 6 ماه پیش
والد
کامیت
d96f2e1723

+ 1 - 1
UAS_MES_YD/FunctionCode/Make/Make_Decompose.cs

@@ -279,7 +279,7 @@ namespace UAS_MES_NEW.Make
                             sql.Append("sp_bomversion='" + ma_bomversion + "' and  sp_craftcode='" + LabelDataGridView.Rows[i].Cells["cm_craftcode"].Value + "'and sp_mothercode ='" + LabelDataGridView.Rows[i].Cells["cm_maprodcode"].Value + "'");
                             sql.Append(" group by sp_fsoncode,sp_tracekind  order by SP_DETNO asc");
                             dtbar = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                            DataRow[] dtrows = dtbar.Select("sp_soncode like '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "'");
+                            DataRow[] dtrows = dtbar.Select("sp_soncode like '%"+ LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "%'");
                             dtbar = BaseUtil.ToDataTable(dtrows);
                             if (dtbar.Rows.Count > 0)
                             {

+ 13 - 0
UAS_MES_YD/FunctionCode/Make/Make_SeqTransform.cs

@@ -50,6 +50,19 @@ namespace UAS_MES_NEW.Make
             {
                 if (sncode.Text != "")
                 {
+                    dt = (DataTable)dh.ExecuteSql("select ms_sncode from makeserial where ms_code='" + sncode.Text + "' or  ms_imei1='" + sncode.Text + "' order by ms_id desc", "select");
+                    if (dt.Rows.Count > 0)
+                    {
+                        sncode.Text = dt.Rows[0]["ms_sncode"].ToString();
+                    }
+                    else
+                    {
+                        dt = (DataTable)dh.ExecuteSql("select ms_sncode from makeserial where ms_imei2='" + sncode.Text + "' order by ms_id desc", "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            sncode.Text = dt.Rows[0]["ms_sncode"].ToString();
+                        }
+                    }
                     if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out errorMessage))
                     {
                         OperateResult.AppendText(">>" + sncode.Text + "\n", Color.Black);

+ 23 - 20
UAS_MES_YD/PublicMethod/Print.cs

@@ -223,7 +223,7 @@ namespace UAS_MES_NEW.PublicMethod
                 }
                 if (LabelType == "卡通箱标" || LabelType == "大箱标" || LabelType == "栈板标" || LabelType == "彩盒标")
                 {
-                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_makecode='"+MakeCode+"' and lpl_type='" + LabelType + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");
+                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_makecode='" + MakeCode + "' and lpl_type='" + LabelType + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");
                 }
                 else
                 {
@@ -248,16 +248,19 @@ namespace UAS_MES_NEW.PublicMethod
                 return false;
             }
             string filechangetime = PrintFile.LastWriteTime.ToString();
-            if (filechangetime != filelastwritetime)
+            //if (filechangetime != filelastwritetime)
+            //{
+            //    lbl.Stop();
+            //    lbl = new Engine(true);
+            //    BaseUtil.WriteLbl();
+            //    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 = '" + LaID + "'");
+            //}
+            if (format == null || format.FileName != LabelName)
             {
-                lbl.Stop();
-                lbl = new Engine(true);
-                BaseUtil.WriteLbl();
-                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 = '" + LaID + "'");
+                format = lbl.Documents.Open(LabelName);
             }
-            format = lbl.Documents.Open(LabelName);
             if (format == null)
             {
                 MessageBox.Show("标签文件打开失败");
@@ -306,7 +309,7 @@ namespace UAS_MES_NEW.PublicMethod
             }
             LogManager.DoLog(sb.ToString());
             //保存本次赋值进行打印
-            format.PrintSetup.PrinterName = PrinterName;    
+            format.PrintSetup.PrinterName = PrinterName;
             format.PrintSetup.IdenticalCopiesOfLabel = PrintNum;
             format.Print();
             LogicHandler.DoCommandLog(iCaller, User.UserCode, "", User.UserLineCode, User.UserSourceCode, "打印", "成功打印", SnCode, "");
@@ -318,7 +321,7 @@ namespace UAS_MES_NEW.PublicMethod
             return true;
         }
 
-        public static bool BarTender(string iCaller, ref Engine lbl, string LabelName, string LaID, string PrinterName,string pd_pdno, string SnCode, int PrintNum, string MakeCode, string ProdCode, string LabelType, string IfRePrint, out string ErrorMessage)
+        public static bool BarTender(string iCaller, ref Engine lbl, string LabelName, string LaID, string PrinterName, string pd_pdno, string SnCode, int PrintNum, string MakeCode, string ProdCode, string LabelType, string IfRePrint, out string ErrorMessage)
         {
             ErrorMessage = "";
             DataTable dt = new DataTable();
@@ -355,15 +358,15 @@ namespace UAS_MES_NEW.PublicMethod
                 return false;
             }
             string filechangetime = PrintFile.LastWriteTime.ToString();
-            if (filechangetime != filelastwritetime)
-            {
-                lbl.Stop();
-                lbl = new Engine(true);
-                BaseUtil.WriteLbl();
-                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 = '" + LaID + "'");
-            }
+            //if (filechangetime != filelastwritetime)
+            //{
+            //    lbl.Stop();
+            //    lbl = new Engine(true);
+            //    BaseUtil.WriteLbl();
+            //    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 = '" + LaID + "'");
+            //}
             format = lbl.Documents.Open(LabelName);
             if (format == null)
             {

+ 2 - 1
UAS_MES_YDCY/PublicMethod/Print.cs

@@ -431,7 +431,8 @@ namespace UAS_MES_NEW.PublicMethod
             {
                 for (int k = 0; k < format.SubStrings.Count; k++)
                 {
-                    format.SubStrings[k].Value = null;
+                    if (format.SubStrings[k].Value != null)
+                        format.SubStrings[k].Value = "";
                 }
             }
             catch (Exception)