Browse Source

返修必须维护不了代码,只有状态0和3的可以返修

章政 8 years ago
parent
commit
70d6f5fe68
1 changed files with 23 additions and 4 deletions
  1. 23 4
      UAS-MES/FunctionCode/Make/Make_Repair.cs

+ 23 - 4
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -39,6 +39,10 @@ namespace UAS_MES.Make
 
         string msid = "";
 
+        string ifrework = "";
+
+        string reworkstatus = "";
+
         string dbtable1 = "(select distinct nvl(dsl_prodcode,msl_prodcode)prodcode from ReduceStepRecord left join devsmtlocation on dsl_linecode=rsd_linecode and dsl_makecode=rsd_macode left join makesmtlocation on msl_linecode=rsd_linecode and msl_makecode=rsd_macode where rsd_macode=':macode'  and rsd_sncode=':sncode') left join product on pr_code=prodcode";
 
         string dbtable2 = "(select distinct nvl(dsl_prodcode,msl_prodcode)prodcode from ReduceStepRecord left join devsmtlocation on dsl_linecode=rsd_linecode and dsl_makecode=rsd_macode left join makesmtlocation on msl_linecode=rsd_linecode and msl_makecode=rsd_macode where rsd_macode=':macode'  and rsd_sncode=':sncode' and ((dsl_location=':msl_location' and dsl_validtime<sysdate and sysdate<dsl_invalidtime) ) or (msl_location=':msl_location' and msl_validtime<sysdate and sysdate<msl_invalidtime)) left join product on pr_code=prodcode";
@@ -89,8 +93,8 @@ namespace UAS_MES.Make
                 if (dt.Rows.Count > 0)
                 {
                     string ms_status = dt.Rows[0]["ms_status"].ToString();
-                    string ifrework = dt.Rows[0]["ms_ifrework"].ToString();
-                    string reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
+                    ifrework = dt.Rows[0]["ms_ifrework"].ToString();
+                    reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
                     //如果不是返修序列号执行原来的步骤
                     if (ifrework == "0")
                     {
@@ -118,6 +122,13 @@ namespace UAS_MES.Make
                             BadCodeTree.Nodes.Clear();
                             return;
                         }
+                        if (reworkstatus != "0"&& reworkstatus != "3")
+                        {
+                            OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "不处于维修状态\n", Color.Red);
+                            BaseUtil.CleanForm(this);
+                            BadCodeTree.Nodes.Clear();
+                            return;
+                        }
                     }
                 }
                 else
@@ -281,8 +292,16 @@ namespace UAS_MES.Make
                 OperatResult.AppendText(">>序列号不允许为空\n", Color.Red);
                 return;
             }
+            if (ifrework != "0" && reworkstatus == "0")
+            {
+                if (dh.getRowCount("Makebad", "mb_sncode='"+ms_sncode.Text+"' and mb_status=0") == 0)
+                {
+                    OperatResult.AppendText(">>维修必须维护不良代码\n", Color.Red);
+                    return;
+                }
+            }
             //判断是否所有的不良信息都有维护不良原因
-            DataTable dt = (DataTable)dh.ExecuteSql("select mb_id,bc_name,mbr_mbid from makebad left join makebadreason on mbr_mbid=mb_id left join badcode on mb_badcode=bc_code where mb_sncode='" + ms_sncode.Text + "'", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select mb_id,bc_name,mbr_mbid from makebad left join makebadreason on mbr_mbid=mb_id left join badcode on mb_badcode=bc_code where mb_sncode='" + ms_sncode.Text + "' and mb_status=0", "select");
             string ErrorMessage = "";
             for (int i = 0; i < dt.Rows.Count; i++)
             {
@@ -554,7 +573,7 @@ namespace UAS_MES.Make
 
         private void cr_code_UserControlTextChanged(object sender, EventArgs e)
         {
-            cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='"+ms_prodcode.Text+"'";
+            cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "'";
         }
 
         private void Clean_Click(object sender, EventArgs e)