Kaynağa Gözat

修改测试采集界面已执行的问题

callm 13 saat önce
ebeveyn
işleme
16c2eb96a4
1 değiştirilmiş dosya ile 45 ekleme ve 37 silme
  1. 45 37
      UAS_MES_ZT/FunctionCode/Make/Make_TestCollection.cs

+ 45 - 37
UAS_MES_ZT/FunctionCode/Make/Make_TestCollection.cs

@@ -56,7 +56,7 @@ namespace UAS_MES_NEW.Make
 
         ApplicationClass lbl;
         Thread thread;
-       // Document doc;
+        // Document doc;
 
         public Make_TestCollection()
         {
@@ -77,9 +77,9 @@ namespace UAS_MES_NEW.Make
             labelname = System.Windows.Forms.Application.StartupPath + @"\badsn.lab";
 
             //thread = new Thread(NewPrint);
-           // SetLoadingWindow stw = new SetLoadingWindow(thread, "初始化打印程序");
+            // SetLoadingWindow stw = new SetLoadingWindow(thread, "初始化打印程序");
             //BaseUtil.SetFormCenter(stw);
-           // stw.ShowDialog();
+            // stw.ShowDialog();
 
             //工单号放大镜配置
             ma_code.TableName = "make left join product on ma_prodcode=pr_code";
@@ -205,7 +205,7 @@ namespace UAS_MES_NEW.Make
                 if (ms_sncode.Text.Contains("EMPLOYEE:"))
                 {
                     biduisn.Text = ms_sncode.Text.Split(':')[1];
-                    OperateResult.AppendText(">>采集人员编号"+ biduisn.Text+"\n", Color.Green, ms_sncode);
+                    OperateResult.AppendText(">>采集人员编号" + biduisn.Text + "\n", Color.Green, ms_sncode);
                     return;
                 }
                 if (ms_sncode.Text.Contains("CHANGE:"))
@@ -215,7 +215,7 @@ namespace UAS_MES_NEW.Make
                     OperateResult.AppendText(">>切换良品不良采集\n", Color.Black, ms_sncode);
                     return;
                 }
-                if (bidui.Checked && biduisn.Text =="")
+                if (bidui.Checked && biduisn.Text == "")
                 {
                     OperateResult.AppendText(">>勾选人员采集需先采集人员\n", Color.Red, ms_sncode);
                     return;
@@ -250,6 +250,7 @@ namespace UAS_MES_NEW.Make
                         }
                         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,ms_craftcode from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
                         string status = dt.Rows[0]["ms_status"].ToString();
+                        string nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
                         reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
                         string stepcode = dt.Rows[0]["ms_stepcode"].ToString();
                         string ifrepair = dt.Rows[0]["st_ifrepair"].ToString();
@@ -268,22 +269,28 @@ namespace UAS_MES_NEW.Make
                         ifrework = dt.Rows[0]["ms_ifrework"].ToString();
                         if (GoodProduct.Checked)
                         {
-                            if (ifrework != "0")
+                            if (nextstepcode != User.CurrentStepCode)
                             {
-                                if (stepcode == User.CurrentStepCode && (reworkstatus == "1" || reworkstatus == "2") && ifrepair == "0")
-                                {
-                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepName + "工序,采集结果为良品\n", Color.Red, ms_sncode);
-                                    return;
-                                }
-                            }
-                            else
-                            {
-                                if (stepcode == User.CurrentStepCode && (status == "1" || status == "2") && ifrepair == "0")
-                                {
-                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepName + "工序,采集结果为良品\n", Color.Red, ms_sncode);
-                                    return;
-                                }
+                                string stname = dh.getFieldDataByCondition("step", "st_name", "st_code='" + nextstepcode + "'").ToString();
+                                OperateResult.AppendText("<<序列号:" + ms_sncode.Text + "下一工序是" + stname + ",不是当前岗位的工序\n", Color.Red, ms_sncode);
+                                return;
                             }
+                            //if (ifrework != "0")
+                            //{
+                            //    if (stepcode == User.CurrentStepCode && (reworkstatus == "1" || reworkstatus == "2") && ifrepair == "0")
+                            //    {
+                            //        OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepName + "工序,采集结果为良品\n", Color.Red, ms_sncode);
+                            //        return;
+                            //    }
+                            //}
+                            //else
+                            //{
+                            //    if (stepcode == User.CurrentStepCode && (status == "1" || status == "2") && ifrepair == "0")
+                            //    {
+                            //        OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepName + "工序,采集结果为良品\n", Color.Red, ms_sncode);
+                            //        return;
+                            //    }
+                            //}
                         }
                         SetCollectResult();
                     }
@@ -369,14 +376,14 @@ namespace UAS_MES_NEW.Make
                     lvi.SubItems.Add(dt.Rows[i][j].ToString());
                 ChoosedRejectList.Items.Add(lvi);
             }
-            if (!dh.CheckExist("makebad", "mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "'")&&(User.CurrentStepCode== "JIFMA"|| User.CurrentStepCode == "MOFMA"))
+            if (!dh.CheckExist("makebad", "mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "'") && (User.CurrentStepCode == "JIFMA" || User.CurrentStepCode == "MOFMA"))
             {
                 sql.Clear();
                 sql.Append("select as_bgname||':'||as_bgcode bg_code,as_badcode bc_code,as_badname bc_name,'' mb_badremark from RETURNSNBD  join AFSALES on rsb_oldsn = as_sn where rsb_newsn  = '" + ms_sncode.Text + "' ");
 
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt.Rows.Count > 0)
-                { 
+                {
                     for (int i = 0; i < dt.Rows.Count; i++)
                     {
                         ListViewItem lvi = new ListViewItem();
@@ -394,7 +401,7 @@ namespace UAS_MES_NEW.Make
             {
                 ChoosedRejectList.EndUpdate();
             }
-            
+
         }
 
         /// <summary>
@@ -483,7 +490,7 @@ namespace UAS_MES_NEW.Make
                             }
                         }
                         //良品信息采集
-                        if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, ms_sncode.Text, "良品采集", "检测合格", biduisn.Text==""?User.UserCode: biduisn.Text, out ErrorMessage))
+                        if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, ms_sncode.Text, "良品采集", "检测合格", biduisn.Text == "" ? User.UserCode : biduisn.Text, out ErrorMessage))
                         {
                             //if (WriteSoftWare.Checked)
                             //{
@@ -492,13 +499,13 @@ namespace UAS_MES_NEW.Make
                             //}
                             //提示正确返回时传递的信息
                             if (ErrorMessage.Contains("AFTERSUCCESS"))
-                                OperateResult.AppendText(">>" + ErrorMessage + "\n",Color.Red);
+                                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                             ////恢复出厂设置
                             //if (AutoBadCode.Checked)
                             //    BaseUtil.GetDataFromDevice("RESET");
                             if (oth.Text != "")
                             {
-                                dh.ExecuteSql(" update makeserial set MS_OTHCODE1 = '"+oth.Text+"' where ms_sncode = '"+ms_sncode.Text+"' ", "update");
+                                dh.ExecuteSql(" update makeserial set MS_OTHCODE1 = '" + oth.Text + "' where ms_sncode = '" + ms_sncode.Text + "' ", "update");
                             }
                             LastSncode = ms_sncode.Text;
                             LogicHandler.DoCommandLog(Tag.ToString(), biduisn.Text == "" ? User.UserCode : biduisn.Text, ma_code.Text, User.UserLineCode, User.UserSourceCode, "采集良品", "采集良品成功", LastSncode, ob_checkno.Text);
@@ -542,7 +549,7 @@ namespace UAS_MES_NEW.Make
             LoadCollectedNum();
             LoadCheckQTY();
         }
-            
+
         private void 测试采集_SizeChanged(object sender, EventArgs e)
         {
             asc.controlAutoSize(this);
@@ -626,7 +633,7 @@ namespace UAS_MES_NEW.Make
                     }
                 }
 
-            
+
 
                 //如果之前是良品的
                 dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_checkno", "ms_outboxcode" }, "ms_id='" + oMSID + "' and ms_stepcode='" + User.CurrentStepCode + "'");
@@ -690,7 +697,7 @@ namespace UAS_MES_NEW.Make
                             sql.Append("'" + ms_sncode.Text + "','" + ma_code.Text + "',sysdate,'" + User.UserCode + "','" + bgd_brname + "','" + bgd_solutionname + "','" + bcname[i] + "','" + bgd_brgname + "','" + bgd_dutyname + "' from dual");
                             dh.ExecuteSql(sql.GetString(), "insert");
                         }
-                   }
+                    }
 
                     OperateResult.AppendText(">>" + ms_sncode.Text + "成功采集为不良\n", Color.OrangeRed);
                     lastsn.Text = ms_sncode.Text;
@@ -763,7 +770,7 @@ namespace UAS_MES_NEW.Make
                 condition += " and ob_salecode='" + ma_salecode.Text + "'";
             }
             sql.Append("select ob_batchqty,ob_nowcheckqty,ob_checkno from oqcbatch where ");
-            sql.Append("ob_linecode='" + User.UserLineCode + "' and  ob_inman = '"+User.UserCode+"' and ob_prodcode='" + ma_prodcode.Text + "' and ");
+            sql.Append("ob_linecode='" + User.UserLineCode + "' and  ob_inman = '" + User.UserCode + "' and ob_prodcode='" + ma_prodcode.Text + "' and ");
             sql.Append("ob_stepcode='" + User.CurrentStepCode + "' " + condition);
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             if (dt.Rows.Count > 0)
@@ -819,7 +826,7 @@ namespace UAS_MES_NEW.Make
             {
                 ms_sncode.Focus();
             }
-            if (khcheck.Checked&& GoodProduct.Checked)
+            if (khcheck.Checked && GoodProduct.Checked)
             {
                 oth.Focus();
             }
@@ -879,16 +886,17 @@ namespace UAS_MES_NEW.Make
             dh.Dispose();
         }
 
-     
+
 
         private void ma_prodcode_TextChanged(object sender, EventArgs e)
         {
             LoadBadGroupData();
-            if (dh.CheckExist("product", "pr_code = '" + ma_prodcode.Text + "' and pr_trydays = -1")&&dh.CheckExist("step","st_code = '"+User.CurrentStepCode+ "' and st_ifspc = -1"))
+            if (dh.CheckExist("product", "pr_code = '" + ma_prodcode.Text + "' and pr_trydays = -1") && dh.CheckExist("step", "st_code = '" + User.CurrentStepCode + "' and st_ifspc = -1"))
             {
                 khcheck.Checked = true;
-            }else
-                {
+            }
+            else
+            {
                 khcheck.Checked = false;
             }
         }
@@ -1119,9 +1127,9 @@ namespace UAS_MES_NEW.Make
                 {
                     ms_sncode.Text = ssn;
                     ms_code_KeyDown(this, new KeyEventArgs(Keys.Enter));
-                    if (imei!="")
+                    if (imei != "")
                     {
-                        dh.ExecuteSql("update makeserial set ms_imei = '"+imei+"' where ms_sncode = '"+ ssn + "' and ms_makecode = '"+ma_code.Text+"'", "update");
+                        dh.ExecuteSql("update makeserial set ms_imei = '" + imei + "' where ms_sncode = '" + ssn + "' and ms_makecode = '" + ma_code.Text + "'", "update");
                     }
                     if (imei1 != "")
                     {
@@ -1160,7 +1168,7 @@ namespace UAS_MES_NEW.Make
         {
             if (e.KeyCode == Keys.Enter)
             {
-                if (bidui.Checked&&biduisn.Text!="")
+                if (bidui.Checked && biduisn.Text != "")
                 {
                     ms_sncode.Focus();
                     ms_sncode.SelectAll();