瀏覽代碼

添加上料包含字符判定

callm 6 年之前
父節點
當前提交
2d9974640e

+ 4 - 3
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -139,8 +139,8 @@ namespace UAS_MES.Make
                             sql.Clear();
                             sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,sp_fsoncode,max(sp_barcoderule)");
                             sql.Append("sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
-                            sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
-                            sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
+                            sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)sp_regex,max(sp_instr)sp_instr");
+                            sql.Append(",max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
                             sql.Append("sp_bomversion='" + ms_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
                             sql.Append("And sp_mothercode ='" + pr_code.Text + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where  ");
                             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_soncode=");
@@ -217,7 +217,8 @@ namespace UAS_MES.Make
                         string sp_barcoderule = ListA.Rows[RemainIndex]["sp_barcoderule"].ToString();
                         string sp_checkbarcode = ListA.Rows[RemainIndex]["sp_checkbarcode"].ToString();
                         string sp_checksalecode = ListA.Rows[RemainIndex]["sp_checksalecode"].ToString();
-                        if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, out ErrorMessage))
+                        string sp_instr = ListA.Rows[RemainIndex]["sp_instr"].ToString();
+                        if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_instr, sp_checksalecode, out ErrorMessage))
                         {
                             //判断采集的条码和本次采集的也不能重复
                             if (CollectData.Contains(code.Text) && sp_ifrepeat != "-1")

+ 3 - 2
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -263,7 +263,7 @@ namespace UAS_MES.Make
                             }
                             dtbar = new DataTable();
                             sql.Clear();
-                            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,sp_fsoncode,max(sp_barcoderule)");
+                            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,max(sp_instr)sp_instr,min(sp_ifrepeat)sp_ifrepeat,sp_fsoncode,max(sp_barcoderule)");
                             sql.Append("sp_barcoderule, min(sp_checksalecode)sp_checksalecode,sp_tracekind,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
                             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
                             sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
@@ -283,10 +283,11 @@ namespace UAS_MES.Make
                                 string sp_ifrepeat = dtbar.Rows[0]["sp_ifrepeat"].ToString();
                                 string sp_barcoderule = dtbar.Rows[0]["sp_barcoderule"].ToString();
                                 string sp_checksalecode = dtbar.Rows[0]["sp_checksalecode"].ToString();
+                                string sp_instr = dtbar.Rows[0]["sp_instr"].ToString();
                                 if (sp_tracekind == "1")
                                 {
                                     //上料校验规则判断
-                                    if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, out ErrorMessage))
+                                    if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_instr, sp_checksalecode, out ErrorMessage))
                                     {
                                         OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                                         LoadData(sncode_1, sender, new KeyEventArgs(Keys.Enter));

+ 3 - 2
UAS-MES/FunctionCode/Make/Make_Decompose_Ex.cs

@@ -263,7 +263,7 @@ namespace UAS_MES.Make
                             }
                             dtbar = new DataTable();
                             sql.Clear();
-                            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,sp_fsoncode,max(sp_barcoderule)");
+                            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,max(sp_instr)sp_instr,min(sp_ifrepeat)sp_ifrepeat,sp_fsoncode,max(sp_barcoderule)");
                             sql.Append("sp_barcoderule, min(sp_checksalecode)sp_checksalecode,sp_tracekind,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
                             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
                             sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
@@ -283,10 +283,11 @@ namespace UAS_MES.Make
                                 string sp_ifrepeat = dtbar.Rows[0]["sp_ifrepeat"].ToString();
                                 string sp_barcoderule = dtbar.Rows[0]["sp_barcoderule"].ToString();
                                 string sp_checksalecode = dtbar.Rows[0]["sp_checksalecode"].ToString();
+                                string sp_instr = dtbar.Rows[0]["sp_instr"].ToString();
                                 if (sp_tracekind == "1")
                                 {
                                     //上料校验规则判断
-                                    if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, out ErrorMessage))
+                                    if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_instr, sp_checksalecode, out ErrorMessage))
                                     {
                                         OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                                         LoadData(sncode_1, sender, new KeyEventArgs(Keys.Enter));

+ 4 - 3
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -156,7 +156,8 @@ namespace UAS_MES.Make
                             string sp_barcoderule = dt1.Rows[RemainIndex]["sp_barcoderule"].ToString();
                             string sp_checkbarcode = dt1.Rows[RemainIndex]["sp_checkbarcode"].ToString();
                             string sp_checksalecode = dt1.Rows[RemainIndex]["sp_checksalecode"].ToString();
-                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, out ErrorMessage))
+                            string sp_instr= dt1.Rows[RemainIndex]["sp_instr"].ToString();
+                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_instr, sp_checksalecode, out ErrorMessage))
                             {
                                 //判断采集的条码和本次采集的也不能重复
                                 if (CollectData.Contains(code.Text) && sp_ifrepeat != "-1")
@@ -368,8 +369,8 @@ namespace UAS_MES.Make
             sql.Clear();
             sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
             sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
-            sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
-            sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
+            sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)sp_regex,max(sp_instr)sp_instr");
+            sql.Append(",max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
             sql.Append("sp_bomversion='" + ms_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
             sql.Append("And sp_mothercode ='" + ma_prodcode.Text + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where ");
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_fsoncode=");

+ 17 - 2
UAS-MES/PublicMethod/LogicHandler.cs

@@ -1082,7 +1082,7 @@ namespace UAS_MES.PublicMethod
             return param[4];
         }
 
-        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, string iChecksalecode, out string ErrMessage)
+        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, string iInstr, string iChecksalecode, out string ErrMessage)
         {
             DataTable dt;
             ErrMessage = "";
@@ -1183,11 +1183,26 @@ namespace UAS_MES.PublicMethod
                         //进行长度匹配
                         if (iSN.Length == sp_length || sp_length == 0)
                         {
-                            return true;
+
                         }
                         else ErrMessage = iSN + "长度不匹配";
                     }
                     else ErrMessage = iSN + "前缀不匹配";
+                    if (ErrMessage != "")
+                    {
+                        return false;
+                    }
+                    if (iInstr != "")
+                    {
+                        if (!iSN.Contains(iInstr))
+                        {
+                            ErrMessage = "不包含字符" + iInstr;
+                        }
+                    }
+                    if (ErrMessage == "")
+                    {
+                        return true;
+                    }
                     break;
                 default:
                     break;