|
|
@@ -234,27 +234,39 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void RepairComplete_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- int RejectNum = int.Parse(dh.getFieldDataByCondition("makebad", "count(0) cn", "mb_sncode='" + GetSNCode.Text + "' and mb_status not in (1,-1)").ToString());
|
|
|
- if (RejectNum > 0)
|
|
|
- OperatResult.AppendText(">>维修结果必须为已维修或无不良\n", Color.Red);
|
|
|
+ if (ms_sncode.Text == "")
|
|
|
+ {
|
|
|
+ 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");
|
|
|
+ string ErrorMessage = "";
|
|
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (dt.Rows[i]["mb_id"].ToString() != dt.Rows[i]["mbr_mbid"].ToString())
|
|
|
+ ErrorMessage += "【" + dt.Rows[i]["bc_name"].ToString() + "】";
|
|
|
+ }
|
|
|
+ if (ErrorMessage != "")
|
|
|
+ {
|
|
|
+ OperatResult.AppendText(">>" + ErrorMessage + "未维护不良原因\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cr_id from craft where cr_statuscode='AUDITED' and cr_code='" + cr_code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count == 0)
|
|
|
+ OperatResult.AppendText(">>回流工序不存在\n", Color.Red);
|
|
|
else
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select cr_id from craft where cr_statuscode='AUDITED' and cr_code='" + cr_code.Text + "'", "select");
|
|
|
+ string cr_id = dt.Rows[0]["cr_id"].ToString();
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cd_ifinput from craftdetail left join step on st_code=cd_stepcode where cd_crid='" + cr_id + "' and cd_stepcode='" + cd_stepcode.Text + "' and st_statuscode='AUDITED'", "select");
|
|
|
if (dt.Rows.Count == 0)
|
|
|
- OperatResult.AppendText(">>回流工序不存在\n", Color.Red);
|
|
|
+ OperatResult.AppendText(">>回流工序不在回流工艺中\n", Color.Red);
|
|
|
else
|
|
|
{
|
|
|
- string cr_id = dt.Rows[0]["cr_id"].ToString();
|
|
|
- dt = (DataTable)dh.ExecuteSql("select cd_ifinput from craftdetail left join step on st_code=cd_stepcode where cd_crid='" + cr_id + "' and cd_stepcode='" + cd_stepcode.Text + "' and st_statuscode='AUDITED'", "select");
|
|
|
- if (dt.Rows.Count == 0)
|
|
|
- OperatResult.AppendText(">>回流工序不在回流工艺中\n", Color.Red);
|
|
|
- else
|
|
|
- {
|
|
|
- dh.UpdateByCondition("makeserial", "ms_nextstepcode='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1", "ms_sncode='" + ms_sncode.Text + "'");
|
|
|
- dh.ExecuteSql(insert_makeprocess.Replace("#", "完成维修"), "insert", ms_sncode.Text, User.CurrentStepCode);
|
|
|
- OperatResult.AppendText(">>" + ms_sncode.Text + " 序列号回流成功\n", Color.Green);
|
|
|
- GetSNCode.Clear();
|
|
|
- }
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_nextstepcode='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1", "ms_sncode='" + ms_sncode.Text + "'");
|
|
|
+ dh.ExecuteSql(insert_makeprocess.Replace("#", "完成维修"), "insert", ms_sncode.Text, User.CurrentStepCode);
|
|
|
+ OperatResult.AppendText(">>" + ms_sncode.Text + " 序列号回流成功\n", Color.Green);
|
|
|
+ GetSNCode.Clear();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -306,13 +318,16 @@ namespace UAS_MES.Make
|
|
|
if (dt.Rows[i]["mbp_id"].ToString() == "")
|
|
|
prodcode.Add(dt.Rows[i]["mbp_part"].ToString());
|
|
|
}
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into makebadrspart(mbp_id,mbp_mbrid,mbp_part,mbp_badcode,");
|
|
|
- sql.Append("mbp_brcode,mbp_sncode,mbp_makecode,mbp_indate,mbp_inman)");
|
|
|
- sql.Append("select makebadrspart_seq.nextval," + mbr_id + ",:prodcode,");
|
|
|
- sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
|
|
|
- sql.Append("sysdate,'" + User.UserCode + "' from dual");
|
|
|
- dh.BatchInsert(sql.GetString(), new string[] { "prodcode" }, prodcode.ToArray());
|
|
|
+ if (prodcode.Count > 0)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into makebadrspart(mbp_id,mbp_mbrid,mbp_part,mbp_badcode,");
|
|
|
+ sql.Append("mbp_brcode,mbp_sncode,mbp_makecode,mbp_indate,mbp_inman)");
|
|
|
+ sql.Append("select makebadrspart_seq.nextval," + mbr_id + ",:prodcode,");
|
|
|
+ sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
|
|
|
+ sql.Append("sysdate,'" + User.UserCode + "' from dual");
|
|
|
+ dh.BatchInsert(sql.GetString(), new string[] { "prodcode" }, prodcode.ToArray());
|
|
|
+ }
|
|
|
//保存不良位置
|
|
|
dt = (DataTable)mbl_locdgv.DataSource;
|
|
|
List<string> location = new List<string>();
|
|
|
@@ -321,13 +336,16 @@ namespace UAS_MES.Make
|
|
|
if (dt.Rows[i]["mbl_id"].ToString() == "")
|
|
|
location.Add(dt.Rows[i]["mbl_loc"].ToString());
|
|
|
}
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into makebadrsloc(mbl_id,mbl_mbrid,mbl_loc,mbl_badcode,mbl_brcode,");
|
|
|
- sql.Append("mbl_sncode,mbl_makecode,mbl_indate ,mbl_inman) select makebadrsloc_seq.nextval," + mbr_id);
|
|
|
- sql.Append(",:location,'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
|
|
|
- sql.Append("sysdate,'" + User.UserCode + "' from dual");
|
|
|
- dh.BatchInsert(sql.GetString(), new string[] { "location" }, location.ToArray());
|
|
|
- OperatResult.AppendText(">>保存成功\n", Color.Red);
|
|
|
+ if (location.Count > 0)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into makebadrsloc(mbl_id,mbl_mbrid,mbl_loc,mbl_badcode,mbl_brcode,");
|
|
|
+ sql.Append("mbl_sncode,mbl_makecode,mbl_indate ,mbl_inman) select makebadrsloc_seq.nextval," + mbr_id);
|
|
|
+ sql.Append(",:location,'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
|
|
|
+ sql.Append("sysdate,'" + User.UserCode + "' from dual");
|
|
|
+ dh.BatchInsert(sql.GetString(), new string[] { "location" }, location.ToArray());
|
|
|
+ }
|
|
|
+ OperatResult.AppendText(">>保存成功\n", Color.Green);
|
|
|
}
|
|
|
|
|
|
private void DeleteRepairInf_Click(object sender, EventArgs e)
|
|
|
@@ -352,7 +370,7 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
else OperatResult.AppendText(">>必须选择不良原因\n", Color.Red);
|
|
|
}
|
|
|
- else OperatResult.AppendText(">>序列号错误,不存在或者不处于维修状态\n", Color.Red);
|
|
|
+ else OperatResult.AppendText(">>" + GetSNCode.Text + "序列号错误,不存在或者不处于维修状态\n", Color.Red);
|
|
|
}
|
|
|
|
|
|
private void SaveBadLocation_Click(object sender, EventArgs e)
|
|
|
@@ -373,7 +391,7 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
else OperatResult.AppendText(">>不良位置不能为空\n", Color.Red);
|
|
|
}
|
|
|
- else OperatResult.AppendText(">>序列号错误,不存在或者不处于维修状态\n", Color.Red);
|
|
|
+ else OperatResult.AppendText(">>" + GetSNCode.Text + "序列号错误,不存在或者不处于维修状态\n", Color.Red);
|
|
|
}
|
|
|
|
|
|
private void mbl_loc_TextChanged(object sender, EventArgs e)
|