|
|
@@ -234,31 +234,38 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void RepairComplete_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- //
|
|
|
- if (dh.CheckExist("makeserial", "ms_status=3 and ms_sncode='" + ms_sncode.Text + "'"))
|
|
|
+ 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++)
|
|
|
{
|
|
|
- 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 (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
|
|
|
+ {
|
|
|
+ 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
|
|
|
{
|
|
|
- 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
|
|
|
- {
|
|
|
- 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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -325,13 +332,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)
|