callm 1 жил өмнө
parent
commit
b7879d904d

+ 2 - 0
UAS_MES_ODLF/FunctionCode/Make/Make_RePrintLabel.cs

@@ -112,6 +112,8 @@ namespace UAS_MES_NEW.Make
                     OperateResult.AppendText("<<输入不能为空\n", Color.Red);
                     return;
                 }
+            
+
                 OperateResult.AppendText(">>" + inputText.Text + "\n", Color.Black);
                 //打印类型为彩盒或者机身标
                 if (giftBox.Checked || fuselagel.Checked || pitao.Checked)

+ 4 - 4
UAS_MES_ODLF/PublicMethod/LogicHandler.cs

@@ -1405,13 +1405,13 @@ namespace UAS_MES_NEW.PublicMethod
         /// <param name="stepcode"></param>
         /// <param name="ifRePrint"></param>
         /// <param name="userCode"></param>
-        public static void doLabelPrintLog(string printValue, string printType, string MakeCode, string prodCode, string sourceCode, string stepcode, string ifRePrint, string userCode)
+        public static void doLabelPrintLog(string printValue, string printType, string MakeCode, string prodCode, string sourceCode, string stepcode, string ifRePrint, string userCode,string filename)
         {
             sql.Clear();
-            sql.Append("insert into labelprintlog(LPL_ID,LPL_VALUE,LPL_TYPE,LPL_MAKECODE,LPL_PRODCODE,LPL_SOURCECODE,LPL_STEPCODE,LPL_IFREPRINT,LPL_INDATE,LPL_INMAN) ");
+            sql.Append("insert into labelprintlog(LPL_ID,LPL_VALUE,LPL_TYPE,LPL_MAKECODE,LPL_PRODCODE,LPL_SOURCECODE,LPL_STEPCODE,LPL_IFREPRINT,LPL_INDATE,LPL_INMAN,lpl_file) ");
             sql.Append("values( labelprintlog_seq.nextval,:lpl_value,:lpl_type,:makecode,:prodcode,");
-            sql.Append(":SourceCode,:stepcode,:ifreprint,sysdate,:inman)");
-            dh.ExecuteSql(sql.ToString(), "insert", printValue, printType, MakeCode, prodCode, sourceCode, stepcode, ifRePrint, userCode);
+            sql.Append(":SourceCode,:stepcode,:ifreprint,sysdate,:inman,:filename)");
+            dh.ExecuteSql(sql.ToString(), "insert", printValue, printType, MakeCode, prodCode, sourceCode, stepcode, ifRePrint, userCode, filename);
         }
     }
 }

+ 27 - 6
UAS_MES_ODLF/PublicMethod/Print.cs

@@ -6,6 +6,8 @@ using System.IO;
 using UAS_MES_NEW.Entity;
 using System.Text.RegularExpressions;
 using System.Windows.Forms;
+using static System.Runtime.CompilerServices.RuntimeHelpers;
+using System.Drawing;
 
 namespace UAS_MES_NEW.PublicMethod
 {
@@ -101,7 +103,7 @@ namespace UAS_MES_NEW.PublicMethod
             {
                 doc.Variables.FormVariables.Item(k + 1).Value = null;
             }
-            LogicHandler.doLabelPrintLog(SnCode, LabelType, MakeCode, ProdCode, User.UserSourceCode, User.CurrentStepCode, IfRePrint, User.UserCode);
+            LogicHandler.doLabelPrintLog(SnCode, LabelType, MakeCode, ProdCode, User.UserSourceCode, User.CurrentStepCode, IfRePrint, User.UserCode, LabelName);
             return true;
         }
 
@@ -110,15 +112,15 @@ namespace UAS_MES_NEW.PublicMethod
         {
             ErrorMessage = "";
             DataTable dt = new DataTable();
-            if (IfRePrint != "-1"&&LabelType!="栈板标")
+            if (IfRePrint != "-1" && LabelType != "栈板标")
             {
-                if (LabelType == "卡通箱标" || LabelType == "大箱标" )
+                if (LabelType == "卡通箱标" || LabelType == "大箱标")
                 {
-                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_type='" + LabelType + LabelName + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");
+                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_type='" + LabelType + "' and lpl_stepcode='" + User.CurrentStepCode + "' and lpl_file='"+LabelName+"'", "select");
                 }
                 else
                 {
-                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_makecode='" + MakeCode + "' and lpl_type='" + LabelType + LabelName + "' 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 + "' and lpl_file='"+LabelName+"'", "select");
                 }
                 ////如果已经打印过了,则不允许再打印
                 if (dt.Rows.Count > 0)
@@ -127,6 +129,25 @@ namespace UAS_MES_NEW.PublicMethod
                     return false;
                 }
             }
+            else
+            {
+                if (LabelType == "卡通箱标" || LabelType == "机身标" || LabelType == "彩盒标")
+                {
+                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_type='" + LabelType + "'", "select");
+                    if (dt.Rows.Count == 0)
+                    {
+                        ErrorMessage = SnCode + LabelType + "未打印,不允许补打";
+                        return false;
+                    }
+                }
+            }
+            string getlabel = @"select la_id,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault from label where la_prodcode='" + ProdCode + "' and la_templatetype='" + LabelType + "' and la_statuscode='AUDITED' order by la_isdefault";
+            DataTable listA = (DataTable)dh.ExecuteSql(getlabel, "select");
+            if (listA.Rows.Count == 0)
+            {
+                MessageBox.Show("产品:" + ProdCode + "未维护" + LabelType + "模板");
+                return false;
+            }
             string filelastwritetime = dh.getFieldDataByCondition("label", "la_lastwritetime", "la_id = '" + LaID + "'").ToString();
             FileInfo PrintFile = new FileInfo(LabelName);
             //打开模板路径
@@ -204,7 +225,7 @@ namespace UAS_MES_NEW.PublicMethod
             {
                 doc.Variables.FormVariables.Item(k + 1).Value = null;
             }
-            LogicHandler.doLabelPrintLog(SnCode, LabelType + LabelName, MakeCode, ProdCode, User.UserSourceCode, User.CurrentStepCode, IfRePrint, User.UserCode);
+            LogicHandler.doLabelPrintLog(SnCode, LabelType, MakeCode, ProdCode, User.UserSourceCode, User.CurrentStepCode, IfRePrint, User.UserCode, LabelName);
             return true;
         }
     }