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

+ 28 - 44
UAS_MES_YDCY/FunctionCode/Make/Make_TestCollectionOnlyGood.Designer.cs

@@ -108,8 +108,8 @@ namespace UAS_MES_NEW.Make
             this.RePrint = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.IfTest = new UAS_MES_NEW.CustomControl.CustomCheckBox.ReSetCheckBox();
             this.ReleaseSN = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.SourceCode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SnCollectionBox();
-            this.label11 = new System.Windows.Forms.Label();
+            this.timer1 = new System.Windows.Forms.Timer(this.components);
+            this.RestTime = new System.Windows.Forms.Label();
             this.panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.BadInfSource)).BeginInit();
             this.SuspendLayout();
@@ -129,7 +129,7 @@ namespace UAS_MES_NEW.Make
             // 
             this.ms_sncode_label.AutoSize = true;
             this.ms_sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_sncode_label.Location = new System.Drawing.Point(183, 996);
+            this.ms_sncode_label.Location = new System.Drawing.Point(428, 996);
             this.ms_sncode_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.ms_sncode_label.Name = "ms_sncode_label";
             this.ms_sncode_label.Size = new System.Drawing.Size(114, 41);
@@ -174,10 +174,9 @@ namespace UAS_MES_NEW.Make
             // 
             this.GoodProduct.AutoSize = true;
             this.GoodProduct.Checked = true;
-            this.GoodProduct.Enabled = false;
             this.GoodProduct.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.GoodProduct.ForeColor = System.Drawing.Color.Blue;
-            this.GoodProduct.Location = new System.Drawing.Point(23, 989);
+            this.GoodProduct.Location = new System.Drawing.Point(12, 990);
             this.GoodProduct.Margin = new System.Windows.Forms.Padding(6);
             this.GoodProduct.Name = "GoodProduct";
             this.GoodProduct.Size = new System.Drawing.Size(129, 54);
@@ -192,7 +191,7 @@ namespace UAS_MES_NEW.Make
             this.Reject.AutoSize = true;
             this.Reject.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Reject.ForeColor = System.Drawing.Color.Red;
-            this.Reject.Location = new System.Drawing.Point(396, 272);
+            this.Reject.Location = new System.Drawing.Point(176, 990);
             this.Reject.Margin = new System.Windows.Forms.Padding(6);
             this.Reject.Name = "Reject";
             this.Reject.Size = new System.Drawing.Size(167, 54);
@@ -731,7 +730,7 @@ namespace UAS_MES_NEW.Make
             this.Save.DownImage = ((System.Drawing.Image)(resources.GetObject("Save.DownImage")));
             this.Save.Image = null;
             this.Save.IsShowBorder = true;
-            this.Save.Location = new System.Drawing.Point(609, 986);
+            this.Save.Location = new System.Drawing.Point(954, 994);
             this.Save.Margin = new System.Windows.Forms.Padding(4);
             this.Save.MoveImage = ((System.Drawing.Image)(resources.GetObject("Save.MoveImage")));
             this.Save.Name = "Save";
@@ -916,11 +915,11 @@ namespace UAS_MES_NEW.Make
             this.ms_sncode.BackColor = System.Drawing.Color.White;
             this.ms_sncode.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.ms_sncode.ID = null;
-            this.ms_sncode.Location = new System.Drawing.Point(315, 996);
+            this.ms_sncode.Location = new System.Drawing.Point(560, 996);
             this.ms_sncode.Margin = new System.Windows.Forms.Padding(6);
             this.ms_sncode.Name = "ms_sncode";
             this.ms_sncode.Power = null;
-            this.ms_sncode.Size = new System.Drawing.Size(284, 40);
+            this.ms_sncode.Size = new System.Drawing.Size(358, 40);
             this.ms_sncode.Str = null;
             this.ms_sncode.Str1 = null;
             this.ms_sncode.Str2 = null;
@@ -932,7 +931,7 @@ namespace UAS_MES_NEW.Make
             // 
             this.WriteSoftWare.AutoSize = true;
             this.WriteSoftWare.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.WriteSoftWare.Location = new System.Drawing.Point(1277, 1001);
+            this.WriteSoftWare.Location = new System.Drawing.Point(1157, 1002);
             this.WriteSoftWare.Margin = new System.Windows.Forms.Padding(4);
             this.WriteSoftWare.Name = "WriteSoftWare";
             this.WriteSoftWare.Size = new System.Drawing.Size(128, 35);
@@ -1011,7 +1010,7 @@ namespace UAS_MES_NEW.Make
             this.ReleaseSN.DownImage = ((System.Drawing.Image)(resources.GetObject("ReleaseSN.DownImage")));
             this.ReleaseSN.Image = null;
             this.ReleaseSN.IsShowBorder = true;
-            this.ReleaseSN.Location = new System.Drawing.Point(1418, 989);
+            this.ReleaseSN.Location = new System.Drawing.Point(1298, 990);
             this.ReleaseSN.Margin = new System.Windows.Forms.Padding(4);
             this.ReleaseSN.MoveImage = ((System.Drawing.Image)(resources.GetObject("ReleaseSN.MoveImage")));
             this.ReleaseSN.Name = "ReleaseSN";
@@ -1023,34 +1022,20 @@ namespace UAS_MES_NEW.Make
             this.ReleaseSN.UseVisualStyleBackColor = false;
             this.ReleaseSN.Click += new System.EventHandler(this.ReleaseSN_Click);
             // 
-            // SourceCode
-            // 
-            this.SourceCode.AllPower = "ifall";
-            this.SourceCode.BackColor = System.Drawing.Color.White;
-            this.SourceCode.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SourceCode.ID = null;
-            this.SourceCode.Location = new System.Drawing.Point(1035, 993);
-            this.SourceCode.Margin = new System.Windows.Forms.Padding(6);
-            this.SourceCode.Name = "SourceCode";
-            this.SourceCode.Power = null;
-            this.SourceCode.Size = new System.Drawing.Size(218, 40);
-            this.SourceCode.Str = null;
-            this.SourceCode.Str1 = null;
-            this.SourceCode.Str2 = null;
-            this.SourceCode.TabIndex = 203;
-            this.SourceCode.Tag = "IfRead";
-            // 
-            // label11
-            // 
-            this.label11.AutoSize = true;
-            this.label11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label11.ForeColor = System.Drawing.Color.Black;
-            this.label11.Location = new System.Drawing.Point(749, 992);
-            this.label11.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label11.Name = "label11";
-            this.label11.Size = new System.Drawing.Size(274, 41);
-            this.label11.TabIndex = 204;
-            this.label11.Text = "不良工序岗位资源";
+            // timer1
+            // 
+            this.timer1.Interval = 1000;
+            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+            // 
+            // RestTime
+            // 
+            this.RestTime.AutoSize = true;
+            this.RestTime.ForeColor = System.Drawing.Color.Red;
+            this.RestTime.Location = new System.Drawing.Point(12, 267);
+            this.RestTime.Name = "RestTime";
+            this.RestTime.Size = new System.Drawing.Size(118, 24);
+            this.RestTime.TabIndex = 203;
+            this.RestTime.Text = "剩余时间:";
             // 
             // Make_TestCollectionOnlyGood
             // 
@@ -1058,8 +1043,7 @@ namespace UAS_MES_NEW.Make
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.SystemColors.Control;
             this.ClientSize = new System.Drawing.Size(1724, 1070);
-            this.Controls.Add(this.label11);
-            this.Controls.Add(this.SourceCode);
+            this.Controls.Add(this.RestTime);
             this.Controls.Add(this.ReleaseSN);
             this.Controls.Add(this.IfTest);
             this.Controls.Add(this.RePrint);
@@ -1116,7 +1100,7 @@ namespace UAS_MES_NEW.Make
             this.Margin = new System.Windows.Forms.Padding(6);
             this.Name = "Make_TestCollectionOnlyGood";
             this.Tag = "Make!TestCollection";
-            this.Text = " ";
+            this.Text = " ";    
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Make_TestCollection_FormClosing);
             this.Load += new System.EventHandler(this.TestCollection_Load);
             this.SizeChanged += new System.EventHandler(this.测试采集_SizeChanged);
@@ -1206,7 +1190,7 @@ namespace UAS_MES_NEW.Make
         private CustomControl.ButtonUtil.NormalButton RePrint;
         private ReSetCheckBox IfTest;
         private CustomControl.ButtonUtil.NormalButton ReleaseSN;
-        private CustomControl.TextBoxWithIcon.SnCollectionBox SourceCode;
-        private System.Windows.Forms.Label label11;
+        private System.Windows.Forms.Timer timer1;
+        private System.Windows.Forms.Label RestTime;
     }
 }

+ 65 - 32
UAS_MES_YDCY/FunctionCode/Make/Make_TestCollectionOnlyGood.cs

@@ -62,7 +62,7 @@ namespace UAS_MES_NEW.Make
 
         private void TestCollection_Load(object sender, EventArgs e)
         {
-
+            GoodProduct.Checked = true;
             asc.controllInitializeSize(this);
             ms_sncode.Focus();
             //设置锁定工单
@@ -80,7 +80,7 @@ namespace UAS_MES_NEW.Make
             ma_code.DbChange += Ma_code_DbChange;
             dh = SystemInf.dh;
             StepCount.StepCode = User.CurrentStepCode;
-            StepCount.Source = SourceCode.Text;
+            StepCount.Source = User.UserSourceCode;
             StepCount.LineCode = User.UserLineCode;
             StepCount.Dh = dh;
             StepCount.Start();
@@ -91,7 +91,7 @@ namespace UAS_MES_NEW.Make
                 {
                     //engine = new Engine();
                     //engine.Start();
-                    format = engine.Documents.Open(Application.StartupPath + "/BadCode.btw");
+                    //format = engine.Documents.Open(Application.StartupPath + "/BadCode.btw");
                     EnablePrint = true;
                 }
                 catch (Exception)
@@ -201,7 +201,7 @@ namespace UAS_MES_NEW.Make
         {
             OperateResult.Clear();
         }
-
+        int resttime;
         private void ms_code_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Enter)
@@ -209,16 +209,23 @@ namespace UAS_MES_NEW.Make
                 ChoosedRejectList.Items.Clear();
                 WaitList.Clear();
                 ChoosedList.Clear();
-                if (LogicHandler.CheckStepAttribute(Tag.ToString(), SourceCode.Text, out ErrorMessage))
+                if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
+                    dt = (DataTable)dh.ExecuteSql("select ms_sncode from makeserial where ms_firstsn='" + ms_sncode.Text + "' order by ms_id desc", "select");
+                    if (dt.Rows.Count > 0)
+                    {
+                        ms_sncode.Text = dt.Rows[0]["ms_sncode"].ToString();
+                    }
                     bool NoteAlready = LogicHandler.CheckDiffMakeCodeBeforeStepCheck(ms_sncode.Text, ma_code.Text, NoteForChange.Checked, out oMakeCode, out ErrorMessage);
                     if (!NoteAlready)
                     {
                         OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
                         return;
                     }
-                    if (LogicHandler.CheckStepSNAndMacode(oMakeCode, SourceCode.Text, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
+                    resttime = int.Parse(dh.getFieldDataByCondition("STEPHOUR", "nvl(max(ST_TIME),0)", "ST_STEPCODE='" + User.CurrentStepCode + "' and ST_MACODE='" + oMakeCode + "'").ToString());
+                    if (LogicHandler.CheckStepSNAndMacode(oMakeCode, User.UserSourceCode, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
                     {
+                        timer1.Stop();
                         //是否提示过工单切换框,检测前后执行
                         if (!LogicHandler.CheckDiffMakeCodeAfterStepCheck(ms_sncode.Text, oMakeCode, NoteForChange.Checked, NoteAlready, ma_code, out ErrorMessage))
                         {
@@ -234,17 +241,19 @@ namespace UAS_MES_NEW.Make
                                 LockMakeCode.Checked = true;
                             }
                         }
-                        dt = (DataTable)dh.ExecuteSql("select ms_nextstepcode,ms_sncode,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework,ms_stepcode,ms_status,nvl(st_ifrepair,0) st_ifrepair from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
+                        dt = (DataTable)dh.ExecuteSql("select ms_nextstepcode,ms_prodcode,ms_craftcode,ms_sncode,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework,ms_stepcode,ms_status,nvl(st_ifrepair,0) st_ifrepair from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
                         string status = dt.Rows[0]["ms_status"].ToString();
                         reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
                         string stepcode = dt.Rows[0]["ms_stepcode"].ToString();
                         string ifrepair = dt.Rows[0]["st_ifrepair"].ToString();
                         string sncode = dt.Rows[0]["ms_sncode"].ToString();
-                        if (sncode != ms_sncode.Text)
-                        {
-                            OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过转号,不允许使用TSN采集\n", Color.Red, ms_sncode);
-                            return;
-                        }
+                        string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                        string ms_craftcode = dt.Rows[0]["ms_craftcode"].ToString();
+                        //if (sncode != ms_sncode.Text)
+                        //{
+                        //    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过转号,不允许使用TSN采集\n", Color.Red, ms_sncode);
+                        //    return;
+                        //}
                         ifrework = dt.Rows[0]["ms_ifrework"].ToString();
                         if (GoodProduct.Checked)
                         {
@@ -288,7 +297,7 @@ namespace UAS_MES_NEW.Make
             sql.Append("select bg_code||':'||bg_name bg_name,bg_code from badgroup left join (select pb_badgroup,pr_kind ");
             sql.Append("from product left join productkind on pk_name=pr_kind ");
             sql.Append("left join productbadgroup on pk_code=PB_KINDCODE where pr_code='" + ma_prodcode.Text + "')");
-            sql.Append("on pb_badgroup=bg_code where bg_statuscode='AUDITED' and instr(BG_FLOOR,'" + User.Floor + "')>0   order by case when bg_code='" + User.DefaultBadGroup + "' then 0 else 1 end");
+            sql.Append("on pb_badgroup=bg_code where bg_statuscode='AUDITED' and instr(BG_FLOOR,'" + User.Floor + "')>0 order by case when bg_code='" + User.DefaultBadGroup + "' then 0 else 1 end");
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             bc_groupcode.DisplayMember = "bg_name";
             bc_groupcode.ValueMember = "bg_code";
@@ -386,12 +395,13 @@ namespace UAS_MES_NEW.Make
                     else
                     {
                         //良品信息采集
-                        if (LogicHandler.SetStepResult(ma_code.Text, SourceCode.Text, ms_sncode.Text, "良品采集", "检测合格", User.UserCode, out ErrorMessage))
+                        if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, ms_sncode.Text, "良品采集", "检测合格", User.UserCode, out ErrorMessage))
                         {
                             if (IfTest.Checked)
                             {
                                 dh.ExecuteSql("update makeserial set ms_iftest=-1 where ms_id='" + oMSID + "'", "update");
                             }
+                            timer1.Start();
                             //提示正确返回时传递的信息
                             if (ErrorMessage.Contains("AFTERSUCCESS"))
                                 OperateResult.AppendText(">>" + ErrorMessage + "\n");
@@ -399,7 +409,7 @@ namespace UAS_MES_NEW.Make
                             OperateResult.AppendText(">>" + ms_sncode.Text + "良品采集成功\n", Color.Green, ms_sncode);
                             //恢复出厂设置
                             //记录操作日志
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, SourceCode.Text, "采集良品", "采集良品成功", LastSncode, ob_checkno.Text);
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "采集良品", "采集良品成功", LastSncode, ob_checkno.Text);
                         }
                         else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
                     }
@@ -408,7 +418,7 @@ namespace UAS_MES_NEW.Make
                 {
                     if (reworkstatus != "3")
                     {
-                        if (LogicHandler.SetStepResult(ma_code.Text, SourceCode.Text, ms_sncode.Text, "良品采集", "检测合格", User.UserCode, out ErrorMessage))
+                        if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, ms_sncode.Text, "良品采集", "检测合格", User.UserCode, out ErrorMessage))
                         {
                             //提示正确返回时传递的信息
                             if (ErrorMessage.Contains("AFTERSUCCESS"))
@@ -416,7 +426,7 @@ namespace UAS_MES_NEW.Make
                             LastSncode = ms_sncode.Text;
                             OperateResult.AppendText(">>" + ms_sncode.Text + "成功采集为良品\n", Color.Green, ms_sncode);
                             //记录操作日志
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, SourceCode.Text, "采集良品", "采集良品成功", LastSncode, ob_checkno.Text);
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "采集良品", "采集良品成功", LastSncode, ob_checkno.Text);
                         }
                         else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
                     }
@@ -438,7 +448,7 @@ namespace UAS_MES_NEW.Make
 
         private void LoadCollectedNum()
         {
-            dt = (DataTable)dh.ExecuteSql("select mcd_inqty,ma_qty-mcd_inqty mcd_remainqty,mcd_ngqty,mcd_okqty,mcd_totalng from make left join makecraftdetail_view on mcd_macode=ma_code where ma_code='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'", "select");
+            dt = (DataTable)dh.ExecuteSql("select mcd_inqty,ma_qty-mcd_inqty mcd_remainqty,mcd_ngqty,mcd_okqty,mcd_totalng from make left join makecraftdetail on mcd_macode=ma_code where ma_code='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'", "select");
             BaseUtil.SetFormValue(Controls, dt);
         }
 
@@ -456,7 +466,7 @@ namespace UAS_MES_NEW.Make
                 ms_code_KeyDown(sender, new KeyEventArgs(Keys.Enter));
             else if (Reject.Checked)
             {
-                if (LogicHandler.CheckStepAttribute(Tag.ToString(), SourceCode.Text, out ErrorMessage))
+                if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
                     //判断界面工单是否为空时的序列号是否自动归属工单
                     string oStatus = "";
@@ -468,7 +478,7 @@ namespace UAS_MES_NEW.Make
                             return;
                         }
                     }
-                    if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? oMakeCode : ma_code.Text, SourceCode.Text, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
+                    if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? oMakeCode : ma_code.Text, User.UserSourceCode, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
                     {
                         dt = (DataTable)dh.ExecuteSql("select ma_code,ma_prodcode,nvl(ma_softversion,ms_softversion)ma_softversion,substr(pr_spec,0,50)pr_spec,ma_qty from makeserial left join make on ms_makecode=ma_code left join product on ma_prodcode=pr_code where ms_id='" + oMSID + "'", "select");
                         if (dt.Rows.Count > 0)
@@ -523,23 +533,29 @@ namespace UAS_MES_NEW.Make
                     return;
                 }
                 //如果之前是良品的
-                dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_checkno", "ms_outboxcode" }, "ms_id='" + oMSID + "' and ms_stepcode='" + User.CurrentStepCode + "'");
+                dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_checkno", "ms_outboxcode", "ms_isactive" }, "ms_id='" + oMSID + "' and ms_stepcode='" + User.CurrentStepCode + "'");
                 if (dt.Rows.Count > 0)
                 {
                     string status = dt.Rows[0]["ms_status"].ToString();
+                    string ms_isactive = dt.Rows[0]["ms_isactive"].ToString();
                     ms_outboxcode = dt.Rows[0]["ms_outboxcode"].ToString();
                     if (ms_outboxcode != "")
                     {
                         OperateResult.AppendText(">>" + ms_sncode.Text + "已装箱" + ms_outboxcode + ",请先取消装箱\n", Color.Green);
                         return;
                     }
+                    if (ms_isactive == "-1")
+                    {
+                        OperateResult.AppendText(">>" + ms_sncode.Text + "已激活,不允许采集不良\n", Color.Green);
+                        return;
+                    }
                     if (status == "1" || status == "2")
                     {
-                        dh.UpdateByCondition("steppassed", "sp_result='不良品',sp_ifng=-1,sp_ymd=to_char(sysdate,'yyyymmdd'),sp_hm=to_char(sysdate,'hh24miss')", "sp_id=(select max(sp_id) from steppassed where sp_sncode='" + ms_sncode.Text + "')");
+                        dh.UpdateByCondition("steppassed", "sp_result='不良品',sp_ifng=-1,sp_date=sysdate,sp_ymd=to_char(sysdate,'yyyymmdd'),sp_hm=to_char(sysdate,'hh24miss')", "sp_id=(select max(sp_id) from steppassed where sp_sncode='" + ms_sncode.Text + "')");
                         dh.UpdateByCondition("makecraftdetail", "mcd_okqty=mcd_okqty-1", "mcd_macode='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
                         dh.UpdateByCondition("makeserial", "ms_nextstepcode='',ms_badtimes=nvl(ms_badtimes,0)+1", "ms_id='" + oMSID + "'");
-                        LogicHandler.InsertMakeProcess(ms_sncode.Text, ma_code.Text, SourceCode.Text, "良品采集成不良", "测试不良", User.UserCode);
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, SourceCode.Text, "测试不良", "良品采集成不良", ms_sncode.Text, ob_checkno.Text);
+                        LogicHandler.InsertMakeProcess(ms_sncode.Text, ma_code.Text, User.UserSourceCode, "良品采集成不良", "测试不良", User.UserCode);
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "测试不良", "良品采集成不良", ms_sncode.Text, ob_checkno.Text);
                     }
                     string checkno = dt.Rows[0]["ms_checkno"].ToString();
                     //存在抽检批次更新为空
@@ -548,12 +564,12 @@ namespace UAS_MES_NEW.Make
                 }
                 else
                 {
-                    LogicHandler.InsertMakeProcess(ms_sncode.Text, ma_code.Text, SourceCode.Text, "采集成不良", "测试不良", User.UserCode);
-                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, SourceCode.Text, "采集成不良", "测试不良", ms_sncode.Text, ob_checkno.Text);
+                    LogicHandler.InsertMakeProcess(ms_sncode.Text, ma_code.Text, User.UserSourceCode, "采集成不良", "测试不良", User.UserCode);
+                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "采集成不良", "测试不良", ms_sncode.Text, ob_checkno.Text);
                 }
                 //不良信息采集,mb_status<>0的是之前维修保存的,不能删除
                 dh.ExecuteSql("delete from makebad where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "' and nvl(mb_status,0)=0", "delete");
-                if (LogicHandler.SetTestNGDetail(ms_sncode.Text, ma_code.Text, User.UserCode, SourceCode.Text, "检查未通过", bgcode, bccode, bgname, bcname, bcremark, out ErrorMessage))
+                if (LogicHandler.SetTestNGDetail(ms_sncode.Text, ma_code.Text, User.UserCode, User.UserSourceCode, "检查未通过", bgcode, bccode, bgname, bcname, bcremark, out ErrorMessage))
                 {
                     //存在的不良代码和
                     dt = (DataTable)dh.ExecuteSql("select sr_badcode from STEPRETURN where sr_stepcode='" + User.CurrentStepCode + "'", "select");
@@ -577,7 +593,7 @@ namespace UAS_MES_NEW.Make
                         {
                             dh.UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "' and mb_stepcode='" + User.CurrentStepCode + "'");
                             dh.UpdateByCondition("makeserial", "ms_stepcode='',ms_status=1,ms_nextstepcode='" + User.CurrentStepCode + "'", "ms_id='" + oMSID + "'");
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, SourceCode.Text, "快速维修成功", "快速维修", "", ob_checkno.Text);
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "快速维修成功", "快速维修", "", ob_checkno.Text);
                             OperateResult.AppendText(">>本次采集不良代码" + badname + "存在于本工序" + User.CurrentStepCode + "中,请解除故障后重新测试本站\n", Color.Black);
                         }
                         else OperateResult.AppendText(">>" + ms_sncode.Text + "成功采集为不良\n", Color.Green);
@@ -736,9 +752,9 @@ namespace UAS_MES_NEW.Make
             SendCheck.Enabled = false;
             OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.Blue);
             ms_sncode.Focus();
-            LogicHandler.InsertMakeProcess(LastSncode, ma_code.Text, SourceCode.Text, "手动送检", "手动送检成功", User.UserCode);
+            LogicHandler.InsertMakeProcess(LastSncode, ma_code.Text, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
             //记录操作日志
-            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, SourceCode.Text, "手动送检", "手动送检成功", "", ob_checkno.Text);
+            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
             ob_checkno.Text = "";
         }
 
@@ -875,8 +891,10 @@ namespace UAS_MES_NEW.Make
                 string ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
                 dh.ExecuteSql("delete from sninfo where si_sn='" + ms_sncode + "'", "delete");
                 dh.ExecuteSql("delete from makesnrelation where sn='" + ms_sncode + "' and makecode='" + ms_makecode + "'", "delete");
-                dh.ExecuteSql("update makeserial set ms_sncode=ms_firstsn,ms_imei1='',ms_mac='',ms_bt='',ms_netcode='',ms_imei2='',ms_beforesn='' where ms_sncode='" + ms_sncode + "' and ms_makecode='" + ma_code.Text + "'", "update");
-                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, SourceCode.Text, "解绑", "解绑成功", ms_sncode, ob_checkno.Text);
+                dh.ExecuteSql("update makeserial set ms_sncode=ms_firstsn,ms_imei1='',ms_imei3='',ms_imei4='',ms_mac='',ms_bt='',ms_netcode='',ms_imei2='',ms_beforesn='' where ms_sncode='" + ms_sncode + "' and ms_makecode='" + ma_code.Text + "'", "update");
+                dh.ExecuteSql("update makeaddresslist set mal_sncode='',mal_status=0 where mal_sncode='" + ms_sncode + "' and mal_makecode='" + ms_makecode + "'", "update");
+                dh.ExecuteSql("update makeimeilist set mil_sncode='',mil_status=0 where mil_sncode='" + ms_sncode + "' and mil_makecode='" + ms_makecode + "'", "update");
+                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "解绑", "解绑成功", ms_sncode, ob_checkno.Text);
                 OperateResult.AppendText(">>" + ms_sncode + "解绑成功\n", Color.Green);
             }
             else
@@ -884,5 +902,20 @@ namespace UAS_MES_NEW.Make
                 OperateResult.AppendText(">>" + ms_sncode.Text + "没有需要解绑的内容\n", Color.Red);
             }
         }
+
+        private void timer1_Tick(object sender, EventArgs e)
+        {
+            if (resttime > 0)
+            {
+                resttime--;
+            }
+            UpdateTimeDisplay();
+        }
+
+        private void UpdateTimeDisplay()
+        {
+            // 显示为 00:00 格式
+            RestTime.Text = "剩余时间:" + resttime; ;
+        }
     }
 }

+ 5 - 2
UAS_MES_YDCY/FunctionCode/Make/Make_TestCollectionOnlyGood.resx

@@ -259,7 +259,7 @@
         RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
         lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
         f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
-        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDQAACw0B7QfALAAACdNJREFUeF7t3dtOW4cW
+        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDwAACw8BkvkDpQAACdNJREFUeF7t3dtOW4cW
         heFe9VUibakv1/eoVGk/TFedps2hnCGAjTnYnAlgbGNzJpUqza2xgL2zmSlL4oqV8V98Fx2q190/YxwC
         30XEdwA8pQGAjzQA8JEGAD7SAMBHGgD4SAMAH2kA4CMNAHykAYCPNADwkQYAPtIAwEcaAPhIAwAfaQDg
         Iw0AfKQBgI80APCRBgA+0gDARxoA+EgDAB9pAOAjDQB8pAGAjzQA8JEGAD7SAMBHGgD4SAMAH2kA4CMN
@@ -426,7 +426,7 @@
         RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
         lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
         f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
-        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDQAACw0B7QfALAAACdNJREFUeF7t3dtOW4cW
+        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDwAACw8BkvkDpQAACdNJREFUeF7t3dtOW4cW
         heFe9VUibakv1/eoVGk/TFedps2hnCGAjTnYnAlgbGNzJpUqza2xgL2zmSlL4oqV8V98Fx2q190/YxwC
         30XEdwA8pQGAjzQA8JEGAD7SAMBHGgD4SAMAH2kA4CMNAHykAYCPNADwkQYAPtIAwEcaAPhIAwAfaQDg
         Iw0AfKQBgI80APCRBgA+0gDARxoA+EgDAB9pAOAjDQB8pAGAjzQA8JEGAD7SAMBHGgD4SAMAH2kA4CMN
@@ -536,4 +536,7 @@
         42a73eNQWtiN/XCAB+GhVilVVUrFSqlfSikrMOzG/u+H6/+yQ4jdXN8e9AAAAABJRU5ErkJggg==
 </value>
   </data>
+  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>454, 17</value>
+  </metadata>
 </root>