瀏覽代碼

拆解更换时按上料步骤检验批号

Hcsy 8 年之前
父節點
當前提交
db909a416e
共有 1 個文件被更改,包括 44 次插入0 次删除
  1. 44 0
      UAS-MES/FunctionCode/Make/Make_Decompose.cs

+ 44 - 0
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -18,6 +18,10 @@ namespace UAS_MES.Make
 
         DataTable dt;
 
+        DataTable dt1;
+
+        DataTable dtbar;
+
         LogStringBuilder sql = new LogStringBuilder();
 
         DataHelper dh;
@@ -26,6 +30,9 @@ namespace UAS_MES.Make
         //采集计数
         int count;
 
+        //Bom版本
+        string ma_bomversion;
+
         int rowindex;
 
         //记录当前输入框的值
@@ -76,6 +83,7 @@ namespace UAS_MES.Make
                         else {
                             LoadData(dt.Rows[0][6].ToString(),sender,e);
                         }
+                        GetItem();
                     }
                     else
                     {
@@ -97,6 +105,19 @@ namespace UAS_MES.Make
             }
         }
 
+        private void GetItem()
+        {
+            dt1 = new DataTable();
+            sql.Clear();
+            sql.Append("select ma_bomversion from makeserial left join make on ma_code=ms_makecode ");
+            sql.Append("left join product on ms_prodcode=pr_code where ms_sncode='" + ms_sncode.Text + "' order by ms_id desc");
+            dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            if (dt1.Rows.Count > 0)
+            {
+                ma_bomversion = dt1.Rows[0][0].ToString();
+            }
+        }
+
         //加载此序列号上料记录
         private void LoadData(string sncode,object sender,KeyEventArgs e)
         {
@@ -218,6 +239,29 @@ namespace UAS_MES.Make
                     {
                         if ((Boolean)LabelDataGridView.Rows[i].Cells["Choose"].Value == true)
                         {
+
+                            dtbar = new DataTable();
+                            sql.Clear();
+                            sql.Append("select sp_id,sp_tracekind,sp_barcoderule,sp_prefix,sp_ifuseregex,sp_ifforsn,sp_length,sp_description,sp_soncode,pr_detail,pr_spec,");
+                            sql.Append("sp_repcode,pr_id,sp_type,case when (sp_type='物料' and sp_soncode=pr_code) then '已采集' else '未采集' end sp_ifpick ,sp_prefix,");
+                            sql.Append("sp_length,sp_regex,sp_ifforsn from stepproduct left join product on pr_code=sp_soncode where sp_bomversion='" + ma_bomversion + "' and ");
+                            sql.Append("sp_craftcode='" + ms_craftcode.Text + "'and sp_mothercode ='" + ms_prodcode.Text + "' and sp_soncode = '"+ LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "' ");
+                            sql.Append("and((sp_type = '物料' and( sp_tracekind <> 2 or sp_tracekind is null))or sp_type <> '物料') order by SP_DETNO asc");
+                            dtbar = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+
+                            String ErrorMessage;
+                            string sp_soncode = dtbar.Rows[0]["sp_soncode"].ToString();
+                            string sp_prefix = dtbar.Rows[0]["sp_prefix"].ToString();
+                            string sp_regex = dtbar.Rows[0]["sp_regex"].ToString();
+                            string length = dtbar.Rows[0]["sp_length"].ToString();
+                            string sp_ifforsn = dtbar.Rows[0]["sp_ifforsn"].ToString();
+                            string sp_tracekind = dtbar.Rows[0]["sp_tracekind"].ToString();
+                            string sp_barcoderule = dtbar.Rows[0]["sp_barcoderule"].ToString();
+                            if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
+                            {
+                                OperateResult.AppendText(">>物料" + LabelDataGridView.Rows[i].Cells["cm_barcode"].Value+" s"+ErrorMessage + "\n", Color.Red);
+                                return;
+                            }
                             sql.Clear();
                             sql.Append("update craftmaterial set cm_status=-1,cm_dropman='" + User.UserName + "',");
                             sql.Append("cm_dropdate =sysdate,cm_dropstep='" + User.CurrentStepName + "',");