Parcourir la source

优化SN绑定内容

callm il y a 1 mois
Parent
commit
3b9111513f

+ 78 - 23
UAS_MES_ZT/FunctionCode/Special/Special_ReSNBD.Designer.cs

@@ -35,15 +35,19 @@
             this.sn_code_label = new System.Windows.Forms.Label();
             this.sncode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SnCollectionBox();
             this.sncode_label = new System.Windows.Forms.Label();
+            this.Lock = new UAS_MES_NEW.CustomControl.CustomCheckBox.LockCheckBox();
+            this.ma_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.MaCodeSearchTextBox();
+            this.ma_code_label = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).BeginInit();
             this.SuspendLayout();
             // 
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OperateResult.Location = new System.Drawing.Point(12, 81);
+            this.OperateResult.Location = new System.Drawing.Point(16, 108);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(1014, 351);
+            this.OperateResult.Size = new System.Drawing.Size(1351, 467);
             this.OperateResult.TabIndex = 3;
             this.OperateResult.Text = "";
             // 
@@ -52,11 +56,11 @@
             this.ChangeResult.AllPower = "ifall";
             this.ChangeResult.AutoSize = true;
             this.ChangeResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ChangeResult.Location = new System.Drawing.Point(407, 537);
-            this.ChangeResult.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.ChangeResult.Location = new System.Drawing.Point(543, 716);
+            this.ChangeResult.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.ChangeResult.Name = "ChangeResult";
             this.ChangeResult.Power = "ifspecial";
-            this.ChangeResult.Size = new System.Drawing.Size(136, 35);
+            this.ChangeResult.Size = new System.Drawing.Size(178, 45);
             this.ChangeResult.TabIndex = 152;
             this.ChangeResult.Text = "重新转换";
             this.ChangeResult.UseVisualStyleBackColor = true;
@@ -66,10 +70,10 @@
             // 
             this.ClearSn_code.Cursor = System.Windows.Forms.Cursors.Hand;
             this.ClearSn_code.Image = global::UAS_MES_NEW.Properties.Resources.bindingNavigatorDeleteItem_Image;
-            this.ClearSn_code.Location = new System.Drawing.Point(407, 495);
-            this.ClearSn_code.Margin = new System.Windows.Forms.Padding(4);
+            this.ClearSn_code.Location = new System.Drawing.Point(543, 660);
+            this.ClearSn_code.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
             this.ClearSn_code.Name = "ClearSn_code";
-            this.ClearSn_code.Size = new System.Drawing.Size(24, 24);
+            this.ClearSn_code.Size = new System.Drawing.Size(32, 32);
             this.ClearSn_code.TabIndex = 151;
             this.ClearSn_code.TabStop = false;
             this.ClearSn_code.Click += new System.EventHandler(this.ClearSn_code_Click);
@@ -81,11 +85,11 @@
             this.show_sncode.Enabled = false;
             this.show_sncode.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.show_sncode.ID = null;
-            this.show_sncode.Location = new System.Drawing.Point(133, 491);
-            this.show_sncode.Margin = new System.Windows.Forms.Padding(4);
+            this.show_sncode.Location = new System.Drawing.Point(177, 655);
+            this.show_sncode.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
             this.show_sncode.Name = "show_sncode";
             this.show_sncode.Power = null;
-            this.show_sncode.Size = new System.Drawing.Size(238, 34);
+            this.show_sncode.Size = new System.Drawing.Size(316, 43);
             this.show_sncode.Str = null;
             this.show_sncode.Str1 = null;
             this.show_sncode.Str2 = null;
@@ -95,10 +99,10 @@
             // 
             this.sn_code_label.AutoSize = true;
             this.sn_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sn_code_label.Location = new System.Drawing.Point(13, 491);
-            this.sn_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.sn_code_label.Location = new System.Drawing.Point(17, 655);
+            this.sn_code_label.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
             this.sn_code_label.Name = "sn_code_label";
-            this.sn_code_label.Size = new System.Drawing.Size(86, 31);
+            this.sn_code_label.Size = new System.Drawing.Size(114, 41);
             this.sn_code_label.TabIndex = 149;
             this.sn_code_label.Text = "序列号";
             // 
@@ -108,11 +112,11 @@
             this.sncode.BackColor = System.Drawing.Color.White;
             this.sncode.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.sncode.ID = null;
-            this.sncode.Location = new System.Drawing.Point(133, 541);
-            this.sncode.Margin = new System.Windows.Forms.Padding(4);
+            this.sncode.Location = new System.Drawing.Point(177, 721);
+            this.sncode.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
             this.sncode.Name = "sncode";
             this.sncode.Power = "ifread";
-            this.sncode.Size = new System.Drawing.Size(238, 34);
+            this.sncode.Size = new System.Drawing.Size(316, 43);
             this.sncode.Str = null;
             this.sncode.Str1 = null;
             this.sncode.Str2 = null;
@@ -124,18 +128,65 @@
             // 
             this.sncode_label.AutoSize = true;
             this.sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sncode_label.Location = new System.Drawing.Point(13, 543);
-            this.sncode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.sncode_label.Location = new System.Drawing.Point(17, 724);
+            this.sncode_label.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
             this.sncode_label.Name = "sncode_label";
-            this.sncode_label.Size = new System.Drawing.Size(86, 31);
+            this.sncode_label.Size = new System.Drawing.Size(114, 41);
             this.sncode_label.TabIndex = 147;
             this.sncode_label.Text = "录入框";
             // 
+            // Lock
+            // 
+            this.Lock.AutoSize = true;
+            this.Lock.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Lock.LeaveEvent = false;
+            this.Lock.Location = new System.Drawing.Point(505, 33);
+            this.Lock.Margin = new System.Windows.Forms.Padding(5);
+            this.Lock.Name = "Lock";
+            this.Lock.Size = new System.Drawing.Size(94, 35);
+            this.Lock.TabIndex = 185;
+            this.Lock.Text = "锁定";
+            this.Lock.UseVisualStyleBackColor = true;
+            // 
+            // ma_code
+            // 
+            this.ma_code.AllPower = null;
+            this.ma_code.Caller = null;
+            this.ma_code.Condition = null;
+            this.ma_code.DBTitle = null;
+            this.ma_code.FormName = null;
+            this.ma_code.Location = new System.Drawing.Point(201, 30);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(4);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Power = null;
+            this.ma_code.ReturnData = null;
+            this.ma_code.SelectField = null;
+            this.ma_code.SetValueField = null;
+            this.ma_code.Size = new System.Drawing.Size(277, 43);
+            this.ma_code.TabIndex = 184;
+            this.ma_code.TableName = null;
+            this.ma_code.Tag = "ma_code";
+            this.ma_code.TextBoxEnable = true;
+            // 
+            // ma_code_label
+            // 
+            this.ma_code_label.AutoSize = true;
+            this.ma_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_code_label.Location = new System.Drawing.Point(17, 30);
+            this.ma_code_label.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
+            this.ma_code_label.Name = "ma_code_label";
+            this.ma_code_label.Size = new System.Drawing.Size(146, 41);
+            this.ma_code_label.TabIndex = 183;
+            this.ma_code_label.Text = "归属工单";
+            // 
             // Special_ReSNBD
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1038, 602);
+            this.ClientSize = new System.Drawing.Size(1384, 803);
+            this.Controls.Add(this.Lock);
+            this.Controls.Add(this.ma_code);
+            this.Controls.Add(this.ma_code_label);
             this.Controls.Add(this.ChangeResult);
             this.Controls.Add(this.ClearSn_code);
             this.Controls.Add(this.show_sncode);
@@ -144,13 +195,14 @@
             this.Controls.Add(this.sncode_label);
             this.Controls.Add(this.OperateResult);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Name = "Special_ReSNBD";
             this.Tag = "Special!ReSNBD";
             this.Text = "返修SN采集";
             this.Load += new System.EventHandler(this.Special_BoxSplit_Load);
             this.SizeChanged += new System.EventHandler(this.Special_ReSNBD_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).EndInit();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
@@ -163,5 +215,8 @@
         private System.Windows.Forms.Label sn_code_label;
         private CustomControl.TextBoxWithIcon.SnCollectionBox sncode;
         private System.Windows.Forms.Label sncode_label;
+        private CustomControl.CustomCheckBox.LockCheckBox Lock;
+        private CustomControl.TextBoxWithIcon.MaCodeSearchTextBox ma_code;
+        private System.Windows.Forms.Label ma_code_label;
     }
 }

+ 39 - 13
UAS_MES_ZT/FunctionCode/Special/Special_ReSNBD.cs

@@ -19,6 +19,8 @@ namespace UAS_MES_NEW.Special
 
         string bsncode = "";//序列号录入框值
 
+        DataTable Dbfind;
+
         LogStringBuilder sql = new LogStringBuilder();
 
         public Special_ReSNBD()
@@ -30,11 +32,25 @@ namespace UAS_MES_NEW.Special
         {
             asc.controllInitializeSize(this);
             dh = SystemInf.dh;
+            ma_code.TableName = "make left join product on ma_prodcode=pr_code ";
+            ma_code.SelectField = "ma_code # 工单号,ma_prodcode # 产品编号,pr_orispeccode # 型号,ma_inqty # 投入数,ma_craftcode # 工艺路线,ma_craftcode # 工艺路线";
+            ma_code.FormName = Name;
+            ma_code.DBTitle = "工单查询";
+            ma_code.SetValueField = new string[] { "ma_code", "ma_prodcode", "pr_orispeccode", "ma_craftcode" };
+            ma_code.Condition = "ma_statuscode='STARTED' order by ma_auditdate desc";
+            ma_code.DbChange += Ma_code_DbChange;
+            ma_code.SetLockCheckBox(Lock);
+            Lock.GetMakeCodeCtl(ma_code);
             sncode.Focus();
             OperateResult.AppendText(">>请输入返修SN号\n", Color.Black);
         }
 
-      
+        private void Ma_code_DbChange(object sender, EventArgs e)
+        {
+            Dbfind = ma_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+        }
+
 
         private void ClearSn_code_Click(object sender, EventArgs e)
         {
@@ -42,7 +58,7 @@ namespace UAS_MES_NEW.Special
             if (ChangeResult.Checked)
             {
                 //勾选的时候提示输入TSN
-                OperateResult.AppendText(">>请输入待转换新SN号\n", Color.Black,show_sncode);
+                OperateResult.AppendText(">>请输入待转换新SN号\n", Color.Black, show_sncode);
             }
             else
             {
@@ -83,7 +99,7 @@ namespace UAS_MES_NEW.Special
                             }
                             else
                             {
-                                DataTable dt = (DataTable)dh.ExecuteSql("select * from makeserial left join product on ms_prodcode  = pr_code where ms_sncode = '"+sncode.Text+"' order by ms_id desc", "select");
+                                DataTable dt = (DataTable)dh.ExecuteSql("select * from makeserial left join product on ms_prodcode  = pr_code where ms_sncode = '" + sncode.Text + "' order by ms_id desc", "select");
                                 makecode = dt.Rows[0]["ms_makecode"].ToString();
                                 prodcode = dt.Rows[0]["ms_prodcode"].ToString();
                                 orispeccode = dt.Rows[0]["pr_orispeccode"].ToString();
@@ -93,7 +109,7 @@ namespace UAS_MES_NEW.Special
                             if (dh.CheckExist("returnsnbd", "rsb_oldsn = '" + sncode.Text + "'"))
                             {
                                 string newsn = dh.getFieldDataByCondition("returnsnbd", "rsb_newsn", "rsb_oldsn = '" + sncode.Text + "'").ToString();
-                                OperateResult.AppendText(">>返修SN" + sncode.Text + "已关联SN"+newsn+",无法直接采集,需转换\n", Color.Red, sncode);
+                                OperateResult.AppendText(">>返修SN" + sncode.Text + "已关联SN" + newsn + ",无法直接采集,需转换\n", Color.Red, sncode);
                                 return;
                             }
                             bsncode = sncode.Text;
@@ -133,11 +149,20 @@ namespace UAS_MES_NEW.Special
                                 OperateResult.AppendText(">>采集新SN:" + sncode.Text + "已关联返修SN:" + oldsn + ",无法采集\n", Color.Red, sncode);
                                 return;
                             }
-                            dh.ExecuteSql("insert into returnsnbd (rsb_id,rsb_newsn,rsb_oldsn,RSB_MAKECODE,RSB_PRODCODE,RSB_ORISPECCODE) values (returnsnbd_seq.nextval,'" + sncode.Text + "','"+ show_sncode.Text + "','"+makecode+"','"+prodcode+"','"+orispeccode+"') ", "insert");
-                            dh.ExecuteSql("update makeserial set ms_othcode1='" + othcode1 + "' where ms_sncode='" + sncode.Text + "'","update");
-                            bsncode = "";
-                            ChangeResult.Enabled = true;
-                            OperateResult.AppendText(">>返修SN:" + show_sncode.Text + "与新SN:"+ sncode.Text + "关联成功\n", Color.LawnGreen, sncode, show_sncode);
+                            string oMakeCode = "";
+                            string oMSID = "";
+                            string oError = "";
+                            if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMSID, out oError))
+                            {
+                                if (LogicHandler.SetStepFinish(oMakeCode, User.UserSourceCode, sncode.Text, "", "OK", User.UserSourceCode, out oError))
+                                {
+                                    dh.ExecuteSql("insert into returnsnbd (rsb_id,rsb_newsn,rsb_oldsn,RSB_MAKECODE,RSB_PRODCODE,RSB_ORISPECCODE) values (returnsnbd_seq.nextval,'" + sncode.Text + "','" + show_sncode.Text + "','" + makecode + "','" + prodcode + "','" + orispeccode + "') ", "insert");
+                                    dh.ExecuteSql("update makeserial set ms_othcode1='" + othcode1 + "' where ms_sncode='" + sncode.Text + "'", "update");
+                                    bsncode = "";
+                                    ChangeResult.Enabled = true;
+                                    OperateResult.AppendText(">>返修SN:" + show_sncode.Text + "与新SN:" + sncode.Text + "关联成功\n", Color.LawnGreen, sncode, show_sncode);
+                                }
+                            }
                             return;
                         }
                         else
@@ -148,7 +173,7 @@ namespace UAS_MES_NEW.Special
                                 OperateResult.AppendText(">>采集新SN:" + sncode.Text + "已关联返修SN:" + oldsn + ",无法采集\n", Color.Red, sncode);
                                 return;
                             }
-                            dh.ExecuteSql(" update returnsnbd set rsb_newsn = '"+ sncode.Text + "' where rsb_newsn = '"+show_sncode.Text+"'  ", "update");
+                            dh.ExecuteSql(" update returnsnbd set rsb_newsn = '" + sncode.Text + "' where rsb_newsn = '" + show_sncode.Text + "'  ", "update");
                             bsncode = "";
                             ChangeResult.Enabled = true;
                             OperateResult.AppendText(">>待转换新SN:" + show_sncode.Text + "更换至新SN:" + sncode.Text + "成功\n", Color.LawnGreen, sncode, show_sncode);
@@ -161,8 +186,8 @@ namespace UAS_MES_NEW.Special
                     OperateResult.AppendText("<<序列号不能为空\n", Color.Red);
                 }
             }
-       }
-        
+        }
+
 
         private void ChangeResult_CheckedChanged(object sender, EventArgs e)
         {
@@ -171,7 +196,8 @@ namespace UAS_MES_NEW.Special
                 //勾选的时候提示输入TSN
                 OperateResult.AppendText(">>请输入待转换新SN号\n", Color.Black);
             }
-            else {
+            else
+            {
                 OperateResult.AppendText(">>请输入返修SN号\n", Color.Black);
             }
         }