Browse Source

添加完整性管控

callm 1 month ago
parent
commit
0e389156dd

+ 15 - 9
UAS_MES_YD/FunctionCode/Query/Query_SOP.cs

@@ -62,12 +62,14 @@ namespace UAS_MES_NEW.Query
 
 
         private void Print_Click(object sender, EventArgs e)
         private void Print_Click(object sender, EventArgs e)
         {
         {
-            string makecode = dh.getFieldDataByCondition("package_view", "pa_makecode", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
-            if (makecode != "")
+            DataTable dt = dh.getFieldsDataByCondition("package_view", new string[] { "pa_makecode", "pa_prodcode" }, "pa_outboxcode='" + pa_outboxcode.Text + "'");
+            string pr_code = "";
+            if (dt.Rows.Count > 0)
             {
             {
-                ma_code.Text = makecode;
+                ma_code.Text = dt.Rows[0]["pa_makecode"].ToString();
+                pr_code = dt.Rows[0]["pa_prodcode"].ToString();
             }
             }
-            DataTable dt = (DataTable)dh.ExecuteSql("select * from package_view where pa_makecode='" + ma_code.Text + "'", "select");
+            dt = (DataTable)dh.ExecuteSql("select * from package_view where pa_makecode='" + ma_code.Text + "'", "select");
             string ErrorMessage = "";
             string ErrorMessage = "";
             string outboxcode = "";
             string outboxcode = "";
             if (dt.Rows.Count == 0)
             if (dt.Rows.Count == 0)
@@ -86,11 +88,15 @@ namespace UAS_MES_NEW.Query
             }
             }
             if (pa_outboxcode.Text != "")
             if (pa_outboxcode.Text != "")
             {
             {
-                DataTable dt1 = (DataTable)dh.ExecuteSql("select * from packagedetail left join make on PD_MAKECODE||'-1'=ma_code left join craftmaterial on cm_sncode=pd_barcode where CM_PRDETAIL='CPU' and pd_makecode='" + ma_code.Text + "' and pd_outboxcode='" + pa_outboxcode.Text + "' and ma_prodcode in (select PC_CODE from pcba_cust) and cm_barcode is null", "select");
-                if (dt1.Rows.Count > 0)
+                string WorkProcess = dh.getFieldDataByCondition("configs", "data", "CODE='WorkProcess' and caller='MESSetting'").ToString();
+                if (WorkProcess == "1")
                 {
                 {
-                    OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "CPU关键物料绑定不完整,不允许打印\n", Color.Black);
-                    return;
+                    string Err = "";
+                    if (!LogicHandler.CheckSNInfo(pa_outboxcode.Text, pr_code, ma_code.Text.Replace("-1", ""), "客户端", out Err))
+                    {
+                        OperateResult.AppendText(">>" + Err + "\n", Color.Black);
+                        return;
+                    }
                 }
                 }
             }
             }
             for (int i = 0; i < dt.Rows.Count; i++)
             for (int i = 0; i < dt.Rows.Count; i++)
@@ -99,7 +105,7 @@ namespace UAS_MES_NEW.Query
                 if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, outboxcode, 1, "", "", "卡通箱标", "0", out ErrorMessage))
                 if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, outboxcode, 1, "", "", "卡通箱标", "0", out ErrorMessage))
                 {
                 {
                     OperateResult.AppendText(">>开始打印箱号" + outboxcode + "\n", Color.Black);
                     OperateResult.AppendText(">>开始打印箱号" + outboxcode + "\n", Color.Black);
-                    LogicHandler.DoCommandLog("LabelPrint", User.UserCode, makecode, User.UserLineCode, User.UserSourceCode, "包装标签打印", "打印成功", outboxcode, "");
+                    LogicHandler.DoCommandLog("LabelPrint", User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "包装标签打印", "打印成功", outboxcode, "");
                 }
                 }
             }
             }
         }
         }

+ 14 - 0
UAS_MES_YD/PublicMethod/LogicHandler.cs

@@ -70,6 +70,20 @@ namespace UAS_MES_NEW.PublicMethod
             SerialNum = param[2];
             SerialNum = param[2];
         }
         }
 
 
+
+        public static bool CheckSNInfo(string iBox, string iPrcode, string iMacode, string iSource, out string Err)
+        {
+            Err = "";
+            string[] param = new string[] { iBox, iPrcode, iMacode, "客户端", Err };
+            dh.CallProcedure("SP_SNBIND_CHECK", ref param);
+            Err = param[4];
+            if (Err == null || Err == "" || Err == "null")
+            {
+                return true;
+            }
+            return false;
+        }
+
         /// <summary>
         /// <summary>
         /// 验证用户身份信息
         /// 验证用户身份信息
         /// </summary>
         /// </summary>