|
|
@@ -30,6 +30,8 @@ namespace UAS_MES.Make
|
|
|
|
|
|
string reworkstatus = "";
|
|
|
|
|
|
+ string status = "";
|
|
|
+
|
|
|
LogStringBuilder sql = new LogStringBuilder();
|
|
|
|
|
|
AutoSizeFormClass asc = new AutoSizeFormClass();
|
|
|
@@ -68,7 +70,7 @@ namespace UAS_MES.Make
|
|
|
ControlLockTimer.Tick += ControlLockTimer_Tick;
|
|
|
ControlLockTimer.Interval = 100;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
bd_soncode.FormName = Name;
|
|
|
bd_soncode.TableName = "(with temp1 as (select bd_fsoncode,bd_soncode,bd_location,pr_spec,pr_detail from bomdetail innner join bom on bo_id=bd_bomid left join product on bd_soncode = pr_code start with bo_mothercode = '" + ma_prodcode.Text + "' connect by bo_mothercode = prior bd_soncode)select* from temp1)";
|
|
|
@@ -195,8 +197,9 @@ namespace UAS_MES.Make
|
|
|
dr1["mb_bgcode"] = WaitChooseDGV.Rows[i].Cells["bg_code"].Value.ToString();
|
|
|
choose.Rows.Add(dr1);
|
|
|
}
|
|
|
- else {
|
|
|
- OperateResult.AppendText(">>不良代码"+ WaitChooseDGV.Rows[i].Cells["bc_code"].Value.ToString() + "已存在\n", Color.Red);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>不良代码" + WaitChooseDGV.Rows[i].Cells["bc_code"].Value.ToString() + "已存在\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -233,7 +236,7 @@ namespace UAS_MES.Make
|
|
|
if (LogicHandler.CheckStepSNAndMacode(oMakeCode, User.UserSourceCode, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
|
|
|
{
|
|
|
//是否提示过工单切换框,检测前后执行
|
|
|
- if (!LogicHandler.CheckDiffMakeCodeAfterStepCheck(ms_sncode.Text,oMakeCode, NoteForChange.Checked, NoteAlready, ma_code, out ErrorMessage))
|
|
|
+ if (!LogicHandler.CheckDiffMakeCodeAfterStepCheck(ms_sncode.Text, oMakeCode, NoteForChange.Checked, NoteAlready, ma_code, out ErrorMessage))
|
|
|
{
|
|
|
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
|
|
|
return;
|
|
|
@@ -248,7 +251,7 @@ namespace UAS_MES.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 from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
|
|
|
- ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
|
|
|
+ ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
|
|
|
string status = dt.Rows[0]["ms_status"].ToString();
|
|
|
reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
|
|
|
string stepcode = dt.Rows[0]["ms_stepcode"].ToString();
|
|
|
@@ -296,7 +299,7 @@ namespace UAS_MES.Make
|
|
|
sql.Clear();
|
|
|
sql.Append("select bg_code,bg_name ,bc_code,bc_name,'' bc_remark from badgroupdetail ");
|
|
|
sql.Append("left join badgroup on bg_id=bgd_bgid left join badcode on bgd_badcode=bc_code where ");
|
|
|
- sql.Append("bg_code='"+User.DefaultBadGroup+"' and bg_code is not null order by bgd_detno");
|
|
|
+ sql.Append("bg_code='" + User.DefaultBadGroup + "' and bg_code is not null order by bgd_detno");
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
BadInfSource.DataSource = dt;
|
|
|
BaseUtil.FillDgvWithDataTable(WaitChooseDGV, dt);
|
|
|
@@ -310,7 +313,7 @@ namespace UAS_MES.Make
|
|
|
sql.Clear();
|
|
|
sql.Append("select mb_id,mbr_id,mb_badcode,mb_badname,mbc_component,mb_bgcode,mb_bgname,WM_CONCAT(distinct mbp_part) mbp_part,WM_CONCAT(distinct mbl_loc) mbl_loc ");
|
|
|
sql.Append("from makebad left join makebadreason on mb_id = mbr_mbid left join makebadrscom on mbc_mbrid = mbr_id left join makebadrspart on MBP_MBRID =mbr_id left join makebadrsloc ");
|
|
|
- sql.Append(" on mbl_mbrid = mbr_id where mb_sncode ='"+ ms_sncode.Text + "'AND MB_MAKECODE = '"+ma_code.Text+"' AND MB_STEPCODE = '"+User.CurrentStepCode+"' group by mb_id,mbr_id,mb_sncode,mb_badcode,mb_badname,mbc_component,mb_bgcode,mb_bgname");
|
|
|
+ sql.Append(" on mbl_mbrid = mbr_id where mb_sncode ='" + ms_sncode.Text + "'AND MB_MAKECODE = '" + ma_code.Text + "' AND MB_STEPCODE = '" + User.CurrentStepCode + "' group by mb_id,mbr_id,mb_sncode,mb_badcode,mb_badname,mbc_component,mb_bgcode,mb_bgname");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
BaseUtil.FillDgvWithDataTable(MakeBadView, dt);
|
|
|
}
|
|
|
@@ -439,6 +442,19 @@ namespace UAS_MES.Make
|
|
|
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
|
|
|
return;
|
|
|
}
|
|
|
+ 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");
|
|
|
+ ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ ifrework = dt.Rows[0]["ms_ifrework"].ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -492,7 +508,7 @@ namespace UAS_MES.Make
|
|
|
dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_checkno" }, "ms_id='" + oMSID + "' and ms_stepcode='" + User.CurrentStepCode + "'");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- string status = dt.Rows[0]["ms_status"].ToString();
|
|
|
+ status = dt.Rows[0]["ms_status"].ToString();
|
|
|
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 + "')");
|
|
|
@@ -520,7 +536,7 @@ namespace UAS_MES.Make
|
|
|
for (int i = 0; i < MakeBadView.Rows.Count; i++)
|
|
|
{
|
|
|
//获取当前序列号对应的不良代码编号
|
|
|
- string makebadid = dh.getFieldDataByCondition("makebad", "mb_id", "mb_sncode = '" + ms_sncode.Text + "' and mb_makecode = '"+ma_code.Text+"' and mb_badcode = '"+ MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "'").ToString();
|
|
|
+ string makebadid = dh.getFieldDataByCondition("makebad", "mb_id", "mb_sncode = '" + ms_sncode.Text + "' and mb_makecode = '" + ma_code.Text + "' and mb_badcode = '" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "'").ToString();
|
|
|
//为空插入不良代码表与不良原因表
|
|
|
if (MakeBadView.Rows[i].Cells["mbr_id"].Value.ToString() == "")
|
|
|
{
|
|
|
@@ -563,7 +579,7 @@ namespace UAS_MES.Make
|
|
|
sql.Append("mbl_sncode,mbl_makecode,mbl_indate ,mbl_inman) select makebadrsloc_seq.nextval," + mbr_id);
|
|
|
sql.Append(",:mbl_loc,'" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "','" + bgd_brcode + "','" + ms_sncode.Text + "','" + ma_code.Text + "',");
|
|
|
sql.Append("sysdate,'" + User.UserCode + "' from dual");
|
|
|
- dh.BatchInsert(sql.GetString(),new string[] { "mbl_loc" }, mbl_loc);
|
|
|
+ dh.BatchInsert(sql.GetString(), new string[] { "mbl_loc" }, mbl_loc);
|
|
|
//sql.Clear();
|
|
|
//sql.Append("with temp1 as (select bd_soncode,bd_location from bomdetail,bom where bo_id=bd_bomid ");
|
|
|
//sql.Append(" start with bo_mothercode='" + ma_prodcode.Text + "' connect by bo_mothercode= prior bd_soncode) ");
|
|
|
@@ -607,7 +623,7 @@ namespace UAS_MES.Make
|
|
|
string bgd_solutionname = dh.getFieldDataByCondition("solution", "so_name", "so_code = '" + bgd_solutioncode + "'").ToString();
|
|
|
|
|
|
//删除不良组件,不良位置等信息重新插入
|
|
|
- dh.ExecuteSql("delete makebadrscom where mbc_mbrid = '"+ mbr_id + "'", "delete");
|
|
|
+ dh.ExecuteSql("delete makebadrscom where mbc_mbrid = '" + mbr_id + "'", "delete");
|
|
|
dh.ExecuteSql("delete makebadrsloc where mbl_mbrid = '" + mbr_id + "'", "delete");
|
|
|
dh.ExecuteSql("delete makebadrspart where mbp_mbrid = '" + mbr_id + "'", "delete");
|
|
|
|
|
|
@@ -658,7 +674,7 @@ namespace UAS_MES.Make
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_id","nvl(ms_ifrework,0) ms_ifrework", "ms_paststep" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + ma_code.Text + "' ");
|
|
|
+ dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_id", "nvl(ms_ifrework,0) ms_ifrework", "ms_paststep" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + ma_code.Text + "' ");
|
|
|
string St_ifqccheck = dh.getFieldDataByCondition("source LEFT JOIN STEP on st_code=sc_stepcode", "nvl(St_ifqccheck,0)", "sc_code='" + User.UserSourceCode + "'").ToString();
|
|
|
List<string> SQLS = new List<string>();
|
|
|
if (dt.Rows.Count > 0)
|
|
|
@@ -672,11 +688,14 @@ namespace UAS_MES.Make
|
|
|
else
|
|
|
SQLS.Add("update makeserial set ms_checkno='', ms_nextstepcode ='" + User.CurrentStepCode + "',ms_reworkstatus=1,ms_stepcode='SMT_REPAIR' where ms_id='" + ms_id + "'");
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
if (ms_ifrework == "0")
|
|
|
- SQLS.Add("update makeserial set ms_checkno='', ms_nextstepcode ='" + ms_nextstepcode + "',ms_status=1,ms_stepcode='SMT_REPAIR',ms_paststep = REPLACE(ms_paststep,','||'"+ ms_nextstepcode + "') where ms_id='" + ms_id + "'");
|
|
|
+ SQLS.Add("update makeserial set ms_checkno='', ms_nextstepcode ='" + ms_nextstepcode + "',ms_status=1,ms_stepcode='SMT_REPAIR',ms_paststep = REPLACE(ms_paststep,','||'" + ms_nextstepcode + "') where ms_id='" + ms_id + "'");
|
|
|
else
|
|
|
SQLS.Add("update makeserial set ms_checkno='', ms_nextstepcode ='" + ms_nextstepcode + "',ms_reworkstatus=1,ms_stepcode='SMT_REPAIR',ms_paststep = REPLACE(ms_paststep,','||'" + ms_nextstepcode + "') where ms_id='" + ms_id + "'");
|
|
|
+ if (status == "2")
|
|
|
+ SQLS.Add("update makeserial set ms_status='2' where ms_id='" + ms_id + "'");
|
|
|
}
|
|
|
}
|
|
|
SQLS.Add("update makebad set mb_status=-1 where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "' and MB_STEPCODE = '" + User.CurrentStepCode + "'");
|
|
|
@@ -703,7 +722,7 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void bc_code_KeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void LoadCheckQTY()
|
|
|
@@ -884,7 +903,8 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void Reject_CheckedChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
- if (Reject.Checked) {
|
|
|
+ if (Reject.Checked)
|
|
|
+ {
|
|
|
LoadBadCodeListView();
|
|
|
}
|
|
|
}
|
|
|
@@ -923,7 +943,7 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void bd_soncode_UserControlTextChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void bd_soncode_Load(object sender, EventArgs e)
|
|
|
@@ -939,10 +959,10 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (psl_location.Text != "")
|
|
|
{
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select bd_soncode,bd_location,pr_spec,pr_detail from (with temp1 as (select bd_soncode,bd_location,pr_spec,pr_detail from bomdetail innner join bom on bo_id=bd_bomid left join product on bd_soncode = pr_code start with bo_mothercode= '" + ma_prodcode.Text + "' connect by bo_mothercode= prior bd_soncode)select * from temp1) where bd_location = '" + psl_location.Text.ToUpper() + "' OR bd_location LIKE '" + psl_location.Text.ToUpper() + ",%' OR bd_location LIKE '%," + psl_location.Text.ToUpper() + "' OR bd_location LIKE '%," + psl_location.Text.ToUpper() + ",%'", "select");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select bd_soncode,bd_location,pr_spec,pr_detail from (with temp1 as (select bd_soncode,bd_location,pr_spec,pr_detail from bomdetail innner join bom on bo_id=bd_bomid left join product on bd_soncode = pr_code start with bo_mothercode= '" + ma_prodcode.Text + "' connect by bo_mothercode= prior bd_soncode)select * from temp1) where bd_location = '" + psl_location.Text.ToUpper() + "' OR bd_location LIKE '" + psl_location.Text.ToUpper() + ",%' OR bd_location LIKE '%," + psl_location.Text.ToUpper() + "' OR bd_location LIKE '%," + psl_location.Text.ToUpper() + ",%'", "select");
|
|
|
|
|
|
- if (dt.Rows.Count >0)
|
|
|
- {
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
if (dt.Rows.Count == 1)
|
|
|
{
|
|
|
string psl_prodcode = dt.Rows[0]["bd_soncode"].ToString();
|
|
|
@@ -983,7 +1003,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString() == "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>站位"+ psl_location.Text + "有替代料,需要提前采集不良零件,第" + (i + 1) + "行不良零件为空\n", Color.Red);
|
|
|
+ OperateResult.AppendText(">>站位" + psl_location.Text + "有替代料,需要提前采集不良零件,第" + (i + 1) + "行不良零件为空\n", Color.Red);
|
|
|
}
|
|
|
else if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString().Contains(psl_prodcode))
|
|
|
{
|
|
|
@@ -999,18 +1019,21 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (!ifgetloc) {
|
|
|
+ if (!ifgetloc)
|
|
|
+ {
|
|
|
OperateResult.AppendText(">>站位" + psl_location.Text + "有替代料,需要提前采集不良零件,当前所选行均未采集对应不良零件\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
- else {
|
|
|
- OperateResult.AppendText(">>站位"+ psl_location.Text.ToUpper() + "无对应物料\n", Color.Red, psl_location);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>站位" + psl_location.Text.ToUpper() + "无对应物料\n", Color.Red, psl_location);
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
OperateResult.AppendText(">>不良位置录入不能为空\n", Color.Red);
|
|
|
}
|
|
|
}
|