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

+ 35 - 1
UAS_MES_ZT/FunctionCode/Make/Make_SeqTransform3.Designer.cs

@@ -75,6 +75,8 @@
             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.label2 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).BeginInit();
             this.SuspendLayout();
             // 
@@ -516,7 +518,7 @@
             // StepCount
             // 
             this.StepCount.LineCode = null;
-            this.StepCount.Location = new System.Drawing.Point(1363, 816);
+            this.StepCount.Location = new System.Drawing.Point(1292, 760);
             this.StepCount.Margin = new System.Windows.Forms.Padding(5);
             this.StepCount.Name = "StepCount";
             this.StepCount.Size = new System.Drawing.Size(176, 44);
@@ -659,11 +661,41 @@
             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;
+            this.ma_endremark1.Visible = false;
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(1286, 819);
+            this.label2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(127, 36);
+            this.label2.TabIndex = 240;
+            this.label2.Text = "客户代码";
+            this.label2.Visible = false;
+            // 
             // Make_SeqTransform3
             // 
             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.label2);
             this.Controls.Add(this.SendCheck);
             this.Controls.Add(this.ob_sendqty);
             this.Controls.Add(this.label12);
@@ -770,5 +802,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 System.Windows.Forms.Label label2;
     }
 }

+ 30 - 2
UAS_MES_ZT/FunctionCode/Make/Make_SeqTransform3.cs

@@ -307,6 +307,34 @@ namespace UAS_MES_NEW.Make
                                     string firstsn = "";
                                     string nowsn = "";
                                     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");
+                                    if (nrDt != null && nrDt.Rows.Count > 0)
+                                    {
+                                        for (int i = 0; i < nrDt.Rows.Count; i++)
+                                        {
+                                            string nrdPrefix = nrDt.Rows[i]["nrd_prefix"].ToString();
+                                            string nrdLengthStr = nrDt.Rows[i]["nrd_length"].ToString();
+                                            int nrdLength = 0;
+                                            int.TryParse(nrdLengthStr, out nrdLength);
+                                            //判断转号后的条码是否符合规则:前缀匹配且长度匹配
+                                            bool prefixMatch = string.IsNullOrEmpty(nrdPrefix) || sncode.Text.StartsWith(nrdPrefix);
+                                            bool lengthMatch = nrdLength <= 0 || sncode.Text.Length == nrdLength;
+                                            if (prefixMatch && lengthMatch)
+                                            {
+                                                custCode = nrDt.Rows[i]["nrd_custcode"].ToString();
+                                                break;
+                                            }
+                                        }
+                                        //匹配到客户代码则赋值到 ma_endremark
+                                        if (custCode != "")
+                                        {
+                                            ma_endremark.Text = custCode;
+                                        }
+                                    }
+                                    //匹配到客户代码时,updateSql 同步更新 ms_endremark 字段
+                                    string endremarkUpdate = custCode != "" ? ", ms_endremark='" + custCode + "'" : "";
                                     //勾选了修改转换结果
                                     if (ChangeResult.Checked)
                                     {
@@ -314,7 +342,7 @@ namespace UAS_MES_NEW.Make
                                         firstsn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", "ms_id='" + oMsId + "' and  ms_beforesn='" + bsncode + "'").ToString();
                                         nowsn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "ms_id='" + oMsId + "' and  ms_beforesn='" + bsncode + "'").ToString();
                                         //记录本次修改,存入makesnrelation表中
-                                        updateSql = "update makeserial set ms_sncode='" + sncode.Text + "' where ms_id='" + oMsId + "' and  ms_beforesn='" + bsncode + "'";
+                                        updateSql = "update makeserial set ms_sncode='" + sncode.Text + "'" + endremarkUpdate + " where ms_id='" + oMsId + "' and  ms_beforesn='" + bsncode + "'";
                                         //删除最近一条转换记录
                                         dh.ExecuteSql("delete from makesnrelation where BEFORESN='" + bsncode + "' and makecode='" + ma_code.Text + "'", "delete");
                                         dh.ExecuteSql(" update oqcbatchdetail set obd_sncode = '"+sncode.Text+ "' where obd_sncode = '"+nowsn+"' ", "update");
@@ -325,7 +353,7 @@ namespace UAS_MES_NEW.Make
                                         //查询ms_firstsn
                                         firstsn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", "ms_id='" + oMsId + "' and  ms_sncode='" + bsncode + "'").ToString();
                                         //记录本次修改,存入makesnrelation表中
-                                        updateSql = "update makeserial set ms_sncode='" + sncode.Text + "', ms_beforesn='" + bsncode + "' where ms_id='" + oMsId + "' and  ms_sncode='" + bsncode + "'";
+                                        updateSql = "update makeserial set ms_sncode='" + sncode.Text + "', ms_beforesn='" + bsncode + "'" + endremarkUpdate + " where ms_id='" + oMsId + "' and  ms_sncode='" + bsncode + "'";
                                         dh.ExecuteSql(" update oqcbatchdetail set obd_sncode = '" + sncode.Text + "' where obd_sncode = '" + bsncode + "' and obd_makecode = '"+ ma_code.Text+ "'", "update");
                                     }
                                     string insertSql = "insert into  makesnrelation (BEFORESN,SN,FIRSTSN,MAKECODE,msr_indate, msr_inman)values('" + bsncode + "','" + sncode.Text + "','" + firstsn + "','" + ma_code.Text + "', sysdate ,'" + User.UserCode + "')";