callm 2 недель назад
Родитель
Сommit
3a4d9053c8

+ 17 - 17
UAS_MES_ZT/FunctionCode/Make/Make_SeqTransform3.Designer.cs

@@ -75,7 +75,7 @@
             this.beforeTransSNPre = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
             this.sncode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SnCollectionBox();
-            this.ma_endremark1 = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SnCollectionBox();
+            this.ma_custcode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SnCollectionBox();
             this.label2 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).BeginInit();
             this.SuspendLayout();
@@ -661,20 +661,20 @@
             this.sncode.Tag = "IfRead";
             this.sncode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.sncode_KeyDown);
             // 
-            // ma_endremark1
-            // 
-            this.ma_endremark1.AllPower = null;
-            this.ma_endremark1.BackColor = System.Drawing.Color.White;
-            this.ma_endremark1.ID = null;
-            this.ma_endremark1.Location = new System.Drawing.Point(1423, 819);
-            this.ma_endremark1.Margin = new System.Windows.Forms.Padding(5);
-            this.ma_endremark1.Name = "ma_endremark1";
-            this.ma_endremark1.Power = null;
-            this.ma_endremark1.Size = new System.Drawing.Size(108, 35);
-            this.ma_endremark1.Str = null;
-            this.ma_endremark1.Str1 = null;
-            this.ma_endremark1.Str2 = null;
-            this.ma_endremark1.TabIndex = 241;
+            // ma_custcode
+            // 
+            this.ma_custcode.AllPower = null;
+            this.ma_custcode.BackColor = System.Drawing.Color.White;
+            this.ma_custcode.ID = null;
+            this.ma_custcode.Location = new System.Drawing.Point(1423, 819);
+            this.ma_custcode.Margin = new System.Windows.Forms.Padding(5);
+            this.ma_custcode.Name = "ma_custcode";
+            this.ma_custcode.Power = null;
+            this.ma_custcode.Size = new System.Drawing.Size(108, 35);
+            this.ma_custcode.Str = null;
+            this.ma_custcode.Str1 = null;
+            this.ma_custcode.Str2 = null;
+            this.ma_custcode.TabIndex = 241;
             // 
             // label2
             // 
@@ -692,7 +692,7 @@
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1699, 933);
-            this.Controls.Add(this.ma_endremark1);
+            this.Controls.Add(this.ma_custcode);
             this.Controls.Add(this.label2);
             this.Controls.Add(this.SendCheck);
             this.Controls.Add(this.ob_sendqty);
@@ -800,7 +800,7 @@
         private CustomControl.ValueLabel.ValueLabel ob_nowcheckqty;
         private System.Windows.Forms.Label ob_nowcheckqty_label;
         private CustomControl.ButtonUtil.NormalButton SendCheck;
-        private CustomControl.TextBoxWithIcon.SnCollectionBox ma_endremark1;
+        private CustomControl.TextBoxWithIcon.SnCollectionBox ma_custcode;
         private System.Windows.Forms.Label label2;
     }
 }

+ 26 - 19
UAS_MES_ZT/FunctionCode/Make/Make_SeqTransform3.cs

@@ -249,11 +249,11 @@ namespace UAS_MES_NEW.Make
                             //else//判断产品防呆
                             //{
                             //判断用户是否锁定输入转换后序列号长度,
-                            if (!checkLengthOrPre(afterTransSNLength_checkBox, afterTransSNLength, "长度"))
-                                return;
-                            //判断用户是否锁定输入转换后序列号前缀,
-                            if (!checkLengthOrPre(afterTransSNPre_checkBox, afterTransSNPre, "前缀"))
-                                return;
+                            //if (!checkLengthOrPre(afterTransSNLength_checkBox, afterTransSNLength, "长度"))
+                            //    return;
+                            ////判断用户是否锁定输入转换后序列号前缀,
+                            //if (!checkLengthOrPre(afterTransSNPre_checkBox, afterTransSNPre, "前缀"))
+                            //    return;
                             //如果 ma_endremark1 不为空,校验 NoRule 中是否存在对应客户代码的条码规则
 
                             //}
@@ -311,7 +311,7 @@ namespace UAS_MES_NEW.Make
                                     string updateSql = "";
                                     //查询NoRule规则表,循环匹配转号后的条码规则,命中第一条则取客户代码
                                     string custCode = "";
-                                    DataTable nrDt = (DataTable)dh.ExecuteSql("select nrd_prefix,nrd_length,nrd_custcode from NoRule left join NORULEDETAIL on nr_id=nrd_nrid where nr_prodcode='" + ma_prodcode.Text + "'", "select");
+                                    DataTable nrDt = (DataTable)dh.ExecuteSql("select nrd_prefix,nrd_length,nrd_custcode,nrd_starttime,nrd_qty from NoRule left join NORULEDETAIL on nr_id=nrd_nrid where nr_prodcode='" + ma_prodcode.Text + "' and nvl(nrd_prefix,' ')<>' '", "select");
                                     if (nrDt != null && nrDt.Rows.Count > 0)
                                     {
                                         for (int i = 0; i < nrDt.Rows.Count; i++)
@@ -334,24 +334,31 @@ namespace UAS_MES_NEW.Make
                                         {
                                             ma_endremark.Text = custCode;
                                         }
-                                        else
-                                        {
-                                            OperateResult.AppendText("<<条码规则未匹配对应客户代码,必须输入客户代码\n", Color.Red, sncode);
-                                            return;
-                                        }
                                     }
                                     if (custCode == "")
                                     {
-                                        if (ma_endremark1.Text == "")
+                                        nrDt = (DataTable)dh.ExecuteSql("select nrd_length,nrd_custcode,nrd_starttime,nrd_qty from NoRule left join NORULEDETAIL on nr_id=nrd_nrid where nr_prodcode='" + ma_prodcode.Text + "' and nvl(nrd_prefix,' ')=' '", "select");
+                                        if (nrDt != null && nrDt.Rows.Count > 0)
                                         {
-                                            OperateResult.AppendText("<<条码规则未匹配对应客户代码,必须输入客户代码\n", Color.Red, sncode);
-                                            return;
-                                        }
-                                        if (ma_endremark1.Text != "")
-                                        {
-                                            if (!dh.CheckExist("NoRule left join NORULEDETAIL on nr_id=nrd_nrid", "nr_prodcode='" + ma_prodcode.Text + "' and nrd_custcode='" + ma_endremark1.Text + "'"))
+                                            for (int i = 0; i < nrDt.Rows.Count; i++)
+                                            {
+                                                string nrdLengthStr = nrDt.Rows[i]["nrd_length"].ToString();
+                                                int nrdLength = 0;
+                                                int.TryParse(nrdLengthStr, out nrdLength);
+                                                //判断转号后的条码是否符合规则:前缀匹配且长度匹配
+                                                bool lengthMatch = nrdLength <= 0 || sncode.Text.Length == nrdLength;
+                                                if (lengthMatch)
+                                                {
+                                                    if (nrDt.Rows[i]["nrd_custcode"].ToString() == ma_custcode.Text) {
+                                                        custCode = nrDt.Rows[i]["nrd_custcode"].ToString();
+                                                        break;
+                                                    }
+                                                }
+                                            }
+                                            //匹配到客户代码则赋值到 ma_endremark
+                                            if (custCode == "")
                                             {
-                                                OperateResult.AppendText("<<未查询到产品编号" + ma_prodcode.Text + "对应客户代码" + ma_endremark1.Text + "的条码规则,不允许转号\n", Color.Red, sncode);
+                                                OperateResult.AppendText("<<条码规则未匹配对应客户代码,必须输入客户代码\n", Color.Red, sncode);
                                                 return;
                                             }
                                         }