|
|
@@ -37,8 +37,6 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
AutoSizeFormClass asc = new AutoSizeFormClass();
|
|
|
|
|
|
- string macode;
|
|
|
-
|
|
|
string msid = "";
|
|
|
|
|
|
string ifrework = "";
|
|
|
@@ -80,6 +78,13 @@ namespace UAS_MES_NEW.Make
|
|
|
bd_soncode.DBTitle = "不良零件";
|
|
|
bd_soncode.DbChange += Prodcode_DbChange;
|
|
|
|
|
|
+ ma_code.TableName = "make left join product on ma_prodcode=pr_code";
|
|
|
+ ma_code.SelectField = "ma_code # 工单号,pr_code # 产品编号,ma_qty # 工单数量,pr_spec # 产品规格,pr_detail # 产品名称,ma_salecode # 销售单号,pr_sendchecktype # 产品送检方式,pr_pcbacount # 拼版数";
|
|
|
+ ma_code.FormName = Name;
|
|
|
+ ma_code.SetValueField = new string[] { "ma_code", "pr_code", "ma_qty", "pr_spec", "pr_detail", "ma_salecode", "nvl(pr_sendchecktype,'LineCode')pr_sendchecktype", "pr_pcbacount" };
|
|
|
+ ma_code.Condition = "ma_statuscode='STARTED'";
|
|
|
+ ma_code.DbChange += Prodcode_DbChange;
|
|
|
+
|
|
|
//nrg_name.BringToFront();
|
|
|
nrg_name.TableName = "QUA_NGREASONGROUP";
|
|
|
nrg_name.Field = "nrg_name";
|
|
|
@@ -122,7 +127,7 @@ namespace UAS_MES_NEW.Make
|
|
|
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 + ",'" + bd_soncode.Text + "',");
|
|
|
- sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
|
|
|
+ sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + ma_code.Text + "',");
|
|
|
sql.Append("sysdate,'" + User.UserCode + "' from dual");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select mbp_id,mbp_part from makebadrspart where mbp_mbrid=" + mbr_id, "select");
|
|
|
@@ -157,196 +162,8 @@ namespace UAS_MES_NEW.Make
|
|
|
BadCodeTree.Nodes.Clear();
|
|
|
return;
|
|
|
}
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select ms_status,ms_outboxcode,ms_paststep,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework,ms_makecode from makeserial left join make ");
|
|
|
- sql.Append("on ms_makecode=ma_code where ms_sncode = '" + GetSNCode.Text + "' order by ms_id desc");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- string ms_paststep = "";
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- string ms_status = dt.Rows[0]["ms_status"].ToString();
|
|
|
- ms_paststep = dt.Rows[0]["ms_paststep"].ToString();
|
|
|
- ifrework = dt.Rows[0]["ms_ifrework"].ToString();
|
|
|
- reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
|
|
|
- string ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
- if (dt.Rows[0]["ms_outboxcode"].ToString() != "")
|
|
|
- {
|
|
|
- OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "已装箱,请先进行拆箱\n", Color.Red);
|
|
|
- BaseUtil.CleanForm(this);
|
|
|
- BadCodeTree.Nodes.Clear();
|
|
|
- return;
|
|
|
- }
|
|
|
- if (checkBox1.Checked)
|
|
|
- {
|
|
|
- if (ms_status == "3")
|
|
|
- {
|
|
|
- OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "处于维修状态\n", Color.Red);
|
|
|
- BaseUtil.CleanForm(this);
|
|
|
- BadCodeTree.Nodes.Clear();
|
|
|
- return;
|
|
|
- }
|
|
|
- string ErrorMessage1 = " ";
|
|
|
- string sp_id = dh.getFieldDataByCondition("steppassed", "max(sp_id)", "sp_makecode = '" + ms_makecode + "' and sp_sncode = '" + GetSNCode.Text + "' and sp_result = '良品'").ToString();
|
|
|
- if (sp_id != "")
|
|
|
- {
|
|
|
- string usecode = dh.getFieldDataByCondition("steppassed", "sp_sccode", "sp_id = " + sp_id + "").ToString();
|
|
|
- string stepcpde = dh.getFieldDataByCondition("steppassed", "sp_stepcode", "sp_id = " + sp_id + "").ToString();
|
|
|
- dh.UpdateByCondition("steppassed", "sp_result='不良品',sp_ifng=-1,sp_ymd=to_char(sysdate,'yyyymmdd'),sp_hm=to_char(sysdate,'hh24miss')", "sp_id=" + sp_id + "");
|
|
|
- dh.UpdateByCondition("makecraftdetail", "mcd_okqty=mcd_okqty-1", "mcd_macode='" + ms_makecode + "' and mcd_stepcode='" + stepcpde + "'");
|
|
|
-
|
|
|
- }
|
|
|
- LogicHandler.SetTestNGDetail(GetSNCode.Text, ms_makecode, User.UserCode, User.UserSourceCode, "检查未通过", out ErrorMessage1);
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "采集成不良", "维修采集不良", GetSNCode.Text, "");
|
|
|
- OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "不良采集成功\n", Color.Green, GetSNCode);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //如果不是返修序列号执行原来的步骤
|
|
|
- if (ifrework == "0")
|
|
|
- {
|
|
|
- if (ms_status == "4")
|
|
|
- {
|
|
|
- OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "已处于报废状态\n", Color.Red);
|
|
|
- BaseUtil.CleanForm(this);
|
|
|
- BadCodeTree.Nodes.Clear();
|
|
|
- return;
|
|
|
- }
|
|
|
- if (ms_status != "3")
|
|
|
- {
|
|
|
- OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "不处于维修状态\n", Color.Red);
|
|
|
- BaseUtil.CleanForm(this);
|
|
|
- BadCodeTree.Nodes.Clear();
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (reworkstatus == "4")
|
|
|
- {
|
|
|
- OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "已处于报废状态\n", Color.Red);
|
|
|
- BaseUtil.CleanForm(this);
|
|
|
- BadCodeTree.Nodes.Clear();
|
|
|
- return;
|
|
|
- }
|
|
|
- if (reworkstatus != "0" && reworkstatus != "3")
|
|
|
- {
|
|
|
- OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "不处于维修状态\n", Color.Red);
|
|
|
- BaseUtil.CleanForm(this);
|
|
|
- BadCodeTree.Nodes.Clear();
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "不存在\n", Color.Red);
|
|
|
- BaseUtil.CleanForm(this);
|
|
|
- BadCodeTree.Nodes.Clear();
|
|
|
- return;
|
|
|
- }
|
|
|
- //dt = (DataTable)dh.ExecuteSql("select mb_stepcode from makebad where mb_sncode='" + GetSNCode.Text + "' and mb_status=0 order by mb_id desc", "select");
|
|
|
- ////打不良的资源和当前资源相等可以快速维修,无须登录维修资源
|
|
|
- //bool QuickRepair = false;
|
|
|
- //if (dt.Rows.Count > 0)
|
|
|
- //{
|
|
|
- // if (dt.Rows[0]["mb_stepcode"].ToString() == User.CurrentStepCode)
|
|
|
- // {
|
|
|
- // QuickRepair = true;
|
|
|
- // }
|
|
|
- //}
|
|
|
- string ErrorMessage = "";
|
|
|
- //验证工序是否正确
|
|
|
- if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
|
|
|
- {
|
|
|
- BadInf_1.Clear();
|
|
|
- string oStatus = "";
|
|
|
- if (LogicHandler.GetMakeInfo(GetSNCode.Text, out macode, out oStatus, out ErrorMessage))
|
|
|
- {
|
|
|
- //验证makeserial或者ms_firstsn表序列号是否存在
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select max(ms_id) ms_id,ms_makecode,ma_craftcode,ms_stepcode,ms_firstsn,ms_prodcode,ms_sncode,pr_detail,ms_craftcode,ms_checkno,ms_ifrework,ms_reworkcheckno ");
|
|
|
- sql.Append("from makeserial left join make on ms_makecode=ma_code left join product on pr_code=ms_prodcode where ms_makecode ='" + macode + "' and ms_sncode in(");
|
|
|
- sql.Append("select '" + GetSNCode.Text + "' from dual union select firstsn from makesnrelation where ");
|
|
|
- sql.Append("sn='" + GetSNCode.Text + "') group by ms_makecode,ms_stepcode,ms_prodcode,ma_craftcode,ms_sncode,pr_detail,ms_firstsn,ms_craftcode,ms_checkno,ms_ifrework,ms_reworkcheckno");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- msid = dt.Rows[0]["ms_id"].ToString();
|
|
|
- ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
|
|
|
- BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
- //判断是否当前工单途程的上料记录
|
|
|
- firstsn = dt.Rows[0]["ms_firstsn"].ToString();
|
|
|
- string cdstepcode = "";
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select cm_craftcode,cm_stepcode,cm_soncode,min(cm_indate)cm_indate,sum(case when cm_status=-1 ");
|
|
|
- sql.Append("then 0 else 1 end)qty from craftmaterial left join product on pr_code=cm_soncode where(cm_sncode ");
|
|
|
- sql.Append("in (select sn from makesnrelation where firstsn='" + firstsn + "' union select '" + firstsn + "' from dual)) ");
|
|
|
- sql.Append("and cm_craftcode='" + cr_code.Text + "'and nvl(cm_lastdeco,0)<>0 group by cm_craftcode,cm_stepcode,cm_soncode having ");
|
|
|
- sql.Append("sum(case when cm_status=-1 then 0 else 1 end)=0 order by cm_indate");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- //如果本工序包含老化则默认选择本工序,否则选择上料的后一道工序
|
|
|
- if (dh.getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid", "nvl(cd_ifburnin,0)", "cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "' and cd_stepcode='" + dt.Rows[0]["cm_stepcode"].ToString() + "'").ToString() != "0")
|
|
|
- cdstepcode = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
- else
|
|
|
- {
|
|
|
- string nextstep = LogicHandler.GetNextStep(dt.Rows[0]["cm_craftcode"].ToString(), dt.Rows[0]["cm_stepcode"].ToString(), ms_prodcode.Text);
|
|
|
- if (ms_paststep.Contains(nextstep))
|
|
|
- {
|
|
|
- cdstepcode = nextstep;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- cdstepcode = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select cm_craftcode,cm_stepcode,cm_soncode,min(cm_indate)cm_indate,sum(case when cm_status=-1 ");
|
|
|
- sql.Append("then 0 else 1 end)qty from craftmaterial left join product on pr_code=cm_soncode where(cm_sncode ");
|
|
|
- sql.Append("in (select sn from makesnrelation where firstsn='" + firstsn + "' union select '" + firstsn + "' from dual)) ");
|
|
|
- sql.Append("and cm_craftcode='" + cr_code.Text + "' group by cm_craftcode,cm_stepcode,cm_soncode having ");
|
|
|
- sql.Append("sum(case when cm_status=-1 then 0 else 1 end)=0 order by cm_indate");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- cdstepcode = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- if (cdstepcode == "")
|
|
|
- {
|
|
|
- //序号小于等于当前不良的序号
|
|
|
- string currentdetno = dh.getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid", "cd_detno", "cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "' and cd_stepcode='" + ms_stepcode + "'").ToString();
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select cd_stepcode from craft left join craftdetail on cr_id =cd_crid where ");
|
|
|
- sql.Append("cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "' and ");
|
|
|
- sql.Append("nvl(cd_ifburnin,0)<>0 and cd_detno <='" + currentdetno + "'");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- cdstepcode = dt.Rows[0][0].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- //如果ms_stepcode和扣料工序均没有查到返修的工序
|
|
|
- if (cdstepcode == "")
|
|
|
- {
|
|
|
- cdstepcode = ms_stepcode;
|
|
|
- }
|
|
|
- cd_stepcode.Text = cdstepcode;
|
|
|
- if (dh.getFieldDataByCondition("craftdetail left JOIN craft on cr_id = cd_crid", "nvl(cd_ifinput,0)cd_ifinput", "cr_code= '" + cr_code.Text + "' and cr_prodcode = '" + ms_prodcode.Text + "' and cd_stepcode = '" + cd_stepcode.Text + "'").ToString() == "-1")
|
|
|
- cd_stepcode.Enabled = false;
|
|
|
- else
|
|
|
- cd_stepcode.Enabled = true;
|
|
|
- LoadBadInfTree(sender, e);
|
|
|
- }
|
|
|
- else OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
- }
|
|
|
- else OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
- }
|
|
|
- else OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
+ LoadBadInfTree(sender, e);
|
|
|
+ ms_sncode.Text = GetSNCode.Text;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -418,14 +235,14 @@ namespace UAS_MES_NEW.Make
|
|
|
//不是返工工单时的取当前工单
|
|
|
sql.Append("select mb_id,mb_sncode,mb_badcode,mb_bgcode,nvl(bc_name,mb_badcode) bc_name,nvl(bg_name,mb_bgcode) bg_name,");
|
|
|
sql.Append("mb_badremark from makebad left join badcode on bc_code=mb_badcode left join badgroup ");
|
|
|
- sql.Append("on bg_code=mb_bgcode where mb_sncode='" + (GetSNCode.Text == "" ? ms_sncode.Text : GetSNCode.Text) + "' and mb_makecode='" + macode + "' and mb_status=0");
|
|
|
+ sql.Append("on bg_code=mb_bgcode where mb_sncode='" + (GetSNCode.Text == "" ? ms_sncode.Text : GetSNCode.Text) + "' and mb_makecode='" + ma_code.Text + "' and mb_status=0");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count == 0)
|
|
|
{
|
|
|
sql.Clear();
|
|
|
sql.Append("select mb_id,mb_sncode,mb_badcode,mb_bgcode,nvl(bc_name,mb_badcode) bc_name,nvl(bg_name,mb_bgcode) bg_name, ");
|
|
|
sql.Append("mb_badremark from makebad left join badcode on bc_code=mb_badcode left join badgroup on bg_code=mb_bgcode ");
|
|
|
- sql.Append("left join make on ma_code=mb_makecode where mb_sncode='" + (GetSNCode.Text == "" ? ms_sncode.Text : GetSNCode.Text) + "' and mb_makecode<>'" + macode + "' and mb_status=0");
|
|
|
+ sql.Append("left join make on ma_code=mb_makecode where mb_sncode='" + (GetSNCode.Text == "" ? ms_sncode.Text : GetSNCode.Text) + "' and mb_makecode<>'" + ma_code.Text + "' and mb_status=0");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
}
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
@@ -518,14 +335,14 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
|
if (ifrework != "0" && reworkstatus == "0")
|
|
|
{
|
|
|
- if (dh.getRowCount("Makebad", "mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ms_makecode.Text + "' and mb_status=0") == 0)
|
|
|
+ if (dh.getRowCount("Makebad", "mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.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 + "' and mb_makecode='" + ms_makecode.Text + "' and mb_status=0", "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_makecode='" + ma_code.Text + "' and mb_status=0", "select");
|
|
|
string ErrorMessage = "";
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
@@ -540,7 +357,7 @@ namespace UAS_MES_NEW.Make
|
|
|
//查询拆解的物料
|
|
|
sql.Clear();
|
|
|
sql.Append("select distinct cm_soncode from craftmaterial where cm_sncode in (select '" + firstsn + "' from dual union ");
|
|
|
- sql.Append("select sn from makesnrelation where firstsn='" + firstsn + "') and cm_craftcode<>'" + cr_code.Text + "' and cm_makecode<>'" + ms_makecode.Text + "' and cm_status=-1 ");
|
|
|
+ sql.Append("select sn from makesnrelation where firstsn='" + firstsn + "') and cm_craftcode<>'" + cr_code.Text + "' and cm_makecode<>'" + ma_code.Text + "' and cm_status=-1 ");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
//如果含有序列号物料有被拆解过
|
|
|
if (dt.Rows.Count > 0)
|
|
|
@@ -580,7 +397,7 @@ namespace UAS_MES_NEW.Make
|
|
|
OperatResult.AppendText(">>回流工序不在回流工艺中\n", Color.Red);
|
|
|
else
|
|
|
{
|
|
|
- dt = dh.getFieldsDataByCondition("makeserial", new string[] { "nvl(ms_ifrework,0) ms_ifrework", "ms_paststep" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
|
|
|
+ dt = dh.getFieldsDataByCondition("makeserial", new string[] { "nvl(ms_ifrework,0) ms_ifrework", "ms_paststep" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + ma_code.Text + "'");
|
|
|
List<string> SQLS = new List<string>();
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
@@ -597,12 +414,12 @@ namespace UAS_MES_NEW.Make
|
|
|
else
|
|
|
SQLS.Add("update makeserial set ms_checkno='',ms_paststep = ms_paststep || case when instr(','||ms_paststep||',','" + User.CurrentStepCode + "')=0 then ','||'" + User.CurrentStepCode + "' end , ms_nextstepcode ='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_reworkstatus=1 where ms_id='" + msid + "'");
|
|
|
}
|
|
|
- SQLS.Add("update makebad set mb_status=-1 where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ms_makecode.Text + "'");
|
|
|
+ SQLS.Add("update makebad set mb_status=-1 where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "'");
|
|
|
//取消最近拆解部件
|
|
|
- SQLS.Add("update craftmaterial set cm_lastdeco=0 where cm_sncode='" + ms_sncode.Text + "' and cm_makecode='" + ms_makecode.Text + "' and nvl(cm_lastdeco,0)<>0");
|
|
|
+ SQLS.Add("update craftmaterial set cm_lastdeco=0 where cm_sncode='" + ms_sncode.Text + "' and cm_makecode='" + ma_code.Text + "' and nvl(cm_lastdeco,0)<>0");
|
|
|
dh.ExecuteSQLTran(SQLS.ToArray());
|
|
|
- LogicHandler.InsertMakeProcess(ms_sncode.Text, ms_makecode.Text, User.UserSourceCode, "回流工序", "完成维修回流", User.UserCode);
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, macode, User.UserLineCode, User.UserSourceCode, "回流工序", "完成维修回流", ms_sncode.Text, ms_checkno.Text);
|
|
|
+ LogicHandler.InsertMakeProcess(ms_sncode.Text, ma_code.Text, User.UserSourceCode, "回流工序", "完成维修回流", User.UserCode);
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "回流工序", "完成维修回流", ms_sncode.Text, ms_checkno.Text);
|
|
|
OperatResult.AppendText(">>序列号" + ms_sncode.Text + "回流成功\n", Color.Green);
|
|
|
cd_stepcode.Enabled = true;
|
|
|
BaseUtil.CleanForm(this);
|
|
|
@@ -626,29 +443,29 @@ namespace UAS_MES_NEW.Make
|
|
|
string confirm = MessageBox.Show(this.ParentForm, "此操作不可撤销,是否确认报废", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk).ToString();
|
|
|
if (confirm == "Yes")
|
|
|
{
|
|
|
- DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "nvl(ms_ifrework,0)ms_ifrework", "ms_reworkcode" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
|
|
|
+ DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "nvl(ms_ifrework,0)ms_ifrework", "ms_reworkcode" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + ma_code.Text + "'");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
string ms_ifrework = dt.Rows[0]["ms_ifrework"].ToString();
|
|
|
string reworkcode = dt.Rows[0]["ms_reworkcode"].ToString();
|
|
|
if (ms_ifrework == "0")
|
|
|
{
|
|
|
- dh.UpdateByCondition("makeserial", "ms_paststep = ms_paststep ||'," + User.CurrentStepCode + "',ms_status=4,ms_nextstepcode='',ms_stepcode='" + User.CurrentStepCode + "'", "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_paststep = ms_paststep ||'," + User.CurrentStepCode + "',ms_status=4,ms_nextstepcode='',ms_stepcode='" + User.CurrentStepCode + "'", "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + ma_code.Text + "'");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sqls.Clear();
|
|
|
- sqls.Add("update makeserial set ms_paststep = ms_paststep ||'," + User.CurrentStepCode + "',ms_status=4,ms_reworkstatus= 4,ms_nextstepcode='',ms_stepcode='" + User.CurrentStepCode + "' where ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
|
|
|
+ sqls.Add("update makeserial set ms_paststep = ms_paststep ||'," + User.CurrentStepCode + "',ms_status=4,ms_reworkstatus= 4,ms_nextstepcode='',ms_stepcode='" + User.CurrentStepCode + "' where ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + ma_code.Text + "'");
|
|
|
sqls.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + ms_reworkcheckno.Text + "'");
|
|
|
sqls.Add("delete from oqcbatchdetail where obd_sncode='" + ms_sncode.Text + "' and obd_checkno='" + ms_reworkcheckno.Text + "'");
|
|
|
sqls.Add("update ReworkDetail set rd_rwstatus='报废' where rd_reid=(select re_id from rework where re_code='" + reworkcode + "') and rd_sncode='" + reworkcode + "'");
|
|
|
dh.ExecuteSQLTran(sqls.ToArray());
|
|
|
}
|
|
|
}
|
|
|
- dh.UpdateByCondition("makecraftdetail", "mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1", "mcd_macode='" + ms_makecode.Text + "' and mcd_stepcode='" + ms_stepcode + "'");
|
|
|
- dh.UpdateByCondition("make", "MA_NGMADEQTY=nvl(MA_NGMADEQTY,0)+1", "ma_code='" + macode + "'");
|
|
|
- LogicHandler.InsertMakeProcess(ms_sncode.Text, ms_makecode.Text, User.UserSourceCode, "报废", "序列号报废", User.UserCode);
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, macode, User.UserLineCode, User.UserSourceCode, "报废", "序列号报废", ms_sncode.Text, ms_checkno.Text);
|
|
|
+ dh.UpdateByCondition("makecraftdetail", "mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1", "mcd_macode='" + ma_code.Text + "' and mcd_stepcode='" + ms_stepcode + "'");
|
|
|
+ dh.UpdateByCondition("make", "MA_NGMADEQTY=nvl(MA_NGMADEQTY,0)+1", "ma_code='" + ma_code.Text + "'");
|
|
|
+ LogicHandler.InsertMakeProcess(ms_sncode.Text, ma_code.Text, User.UserSourceCode, "报废", "序列号报废", User.UserCode);
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "报废", "序列号报废", ms_sncode.Text, ms_checkno.Text);
|
|
|
OperatResult.AppendText(">>报废成功\n", Color.Green);
|
|
|
GetSNCode.Clear();
|
|
|
BaseUtil.CleanForm(this);
|
|
|
@@ -661,13 +478,13 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
private void NewBadCode_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- if (GetSNCode.Text == "" || macode == null || macode == "")
|
|
|
+ if (GetSNCode.Text == "" || ma_code.Text == "")
|
|
|
{
|
|
|
OperatResult.AppendText(">>序列号和工单号不允许为空\n", Color.Red);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Make_NewBadCode badcode = new Make_NewBadCode(GetSNCode.Text, macode);
|
|
|
+ Make_NewBadCode badcode = new Make_NewBadCode(GetSNCode.Text, ma_code.Text);
|
|
|
badcode.FormClosed += LoadBadInfTree;
|
|
|
BaseUtil.SetFormCenter(badcode);
|
|
|
badcode.ShowDialog();
|
|
|
@@ -742,7 +559,7 @@ namespace UAS_MES_NEW.Make
|
|
|
sql.Append("mbr_dutycode,mbr_brgcode,mbr_badcode,mbr_sncode,mbr_makecode,mbr_indate,");
|
|
|
sql.Append("mbr_inman,mbr_brname,mbr_solutionname,mbr_badname,mbr_brgname,mbr_dutyname) select '" + mb_id + "','" + mbr_id + "','" + nr_code.Text + "',");
|
|
|
sql.Append("'" + so_code.Text + "','" + mbr_dutyname.Text + "','" + nrg_code.Text + "','" + bc_code.Text + "',");
|
|
|
- sql.Append("'" + ms_sncode.Text + "','" + ms_makecode.Text + "',sysdate,'" + User.UserCode + "','" + nr_name.Text + "','" + so_name.Text + "','" + bc_name.Text + "','" + nrg_name.Text + "','" + mbr_dutyname.Text + "' from dual");
|
|
|
+ sql.Append("'" + ms_sncode.Text + "','" + ma_code.Text + "',sysdate,'" + User.UserCode + "','" + nr_name.Text + "','" + so_name.Text + "','" + bc_name.Text + "','" + nrg_name.Text + "','" + mbr_dutyname.Text + "' from dual");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
if (mbc_component.Text != "")
|
|
|
{
|
|
|
@@ -750,7 +567,7 @@ namespace UAS_MES_NEW.Make
|
|
|
sql.Append("insert into makebadrscom (mbc_id,mbc_mbrid,mbc_component,mbc_badcode,");
|
|
|
sql.Append("mbc_brcode,mbc_sncode,mbc_makecode,mbc_indate,mbc_inman ) values ");
|
|
|
sql.Append("(makebadrscom_seq.nextval,'" + mbr_id + "' ,'" + mbc_component.Text + "',");
|
|
|
- sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + ms_sncode.Text + "','" + ms_makecode.Text + "',sysdate,'" + User.UserCode + "')");
|
|
|
+ sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + ms_sncode.Text + "','" + ma_code.Text + "',sysdate,'" + User.UserCode + "')");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
}
|
|
|
OperatResult.AppendText(">>不良原因保存成功\n", Color.Green);
|
|
|
@@ -797,14 +614,14 @@ namespace UAS_MES_NEW.Make
|
|
|
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(",'" + mbl_loc.Text.ToUpper() + "','" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
|
|
|
+ sql.Append(",'" + mbl_loc.Text.ToUpper() + "','" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + ma_code.Text + "',");
|
|
|
sql.Append("sysdate,'" + User.UserCode + "' from dual");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
dt = (DataTable)dh.ExecuteSql("select mbl_id,mbl_loc from makebadrsloc where mbl_mbrid=" + mbr_id, "select");
|
|
|
BaseUtil.FillDgvWithDataTable(mbl_locdgv, dt);
|
|
|
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='" + ms_prodcode.Text + "' connect by bo_mothercode= prior bd_soncode) ");
|
|
|
+ sql.Append(" start with bo_mothercode='" + pr_code.Text + "' connect by bo_mothercode= prior bd_soncode) ");
|
|
|
sql.Append("select bd_soncode from temp1 where instr(','||bd_location||',','," + mbl_loc.Text.ToUpper() + ",')>0");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
@@ -813,7 +630,7 @@ namespace UAS_MES_NEW.Make
|
|
|
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 + ",'" + dt.Rows[0][0].ToString() + "',");
|
|
|
- sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
|
|
|
+ sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + ma_code.Text + "',");
|
|
|
sql.Append("sysdate,'" + User.UserCode + "' from dual");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
dt = (DataTable)dh.ExecuteSql("select mbp_id,mbp_part from makebadrspart where mbp_mbrid=" + mbr_id, "select");
|
|
|
@@ -856,7 +673,7 @@ namespace UAS_MES_NEW.Make
|
|
|
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 + ",'" + bd_soncode.Text + "',");
|
|
|
- sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
|
|
|
+ sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + ma_code.Text + "',");
|
|
|
sql.Append("sysdate,'" + User.UserCode + "' from dual");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select mbp_id,mbp_part from makebadrspart where mbp_mbrid=" + mbr_id, "select");
|
|
|
@@ -870,7 +687,7 @@ namespace UAS_MES_NEW.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 + "' order by cd_stepno";
|
|
|
+ cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='" + pr_code.Text + "' order by cd_stepno";
|
|
|
}
|
|
|
|
|
|
private void Clean_Click(object sender, EventArgs e)
|
|
|
@@ -911,13 +728,13 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
private void ms_prodcode_TextChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
- if (ms_prodcode.Text != "")
|
|
|
- cr_code.Condition = "cr_prodcode='" + ms_prodcode.Text + "'";
|
|
|
+ if (pr_code.Text != "")
|
|
|
+ cr_code.Condition = "cr_prodcode='" + pr_code.Text + "'";
|
|
|
else
|
|
|
cr_code.Condition = "";
|
|
|
- bd_soncode.Condition = "bd_mothercode='" + ms_prodcode.Text + "' and NVL(bd_usestatus,' ')<>'DISABLE'";
|
|
|
+ bd_soncode.Condition = "bd_mothercode='" + pr_code.Text + "' and NVL(bd_usestatus,' ')<>'DISABLE'";
|
|
|
//设置工序的条件
|
|
|
- cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "' order by cd_stepno";
|
|
|
+ cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='" + pr_code.Text + "' order by cd_stepno";
|
|
|
}
|
|
|
|
|
|
public void RefreshData()
|
|
|
@@ -998,7 +815,7 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
private void LoadBadcodeGroup()
|
|
|
{
|
|
|
- string pr_code = dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'").ToString();
|
|
|
+ string pr_code = dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + ma_code.Text + "'").ToString();
|
|
|
sql.Clear();
|
|
|
sql.Append("select bg_code,bg_name from product left join productkind on pr_kind =pk_name ");
|
|
|
sql.Append("left join productbadgroup on pb_kindcode= pk_code left join badgroup on ");
|
|
|
@@ -1048,8 +865,6 @@ namespace UAS_MES_NEW.Make
|
|
|
WaitRejectList.Items.Add(lvi);
|
|
|
}
|
|
|
WaitRejectList.EndUpdate();
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void badgroup_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
@@ -1122,12 +937,12 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
|
}
|
|
|
sql.Clear();
|
|
|
- sql.Append("insert when (not exists(select 1 from makebad where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + macode + "' and ");
|
|
|
+ sql.Append("insert when (not exists(select 1 from makebad where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "' and ");
|
|
|
sql.Append("mb_status=0 and mb_badcode=:bc_code)) then into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,");
|
|
|
sql.Append("mb_indate,mb_stepcode,mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_status)");
|
|
|
sql.Append("select DISTINCT :id,ma_code,ms_code,ms_sncode,'" + User.UserCode + "' t1,sysdate,'" + User.CurrentStepCode + "' t2,ms_sourcecode,:bd_code,:bg_code,'' t3,");
|
|
|
sql.Append("'0' from make left join makeSerial on ms_makecode=ma_code ");
|
|
|
- sql.Append(" where ms_sncode='" + ms_sncode.Text + "' and ms_makecode = '" + macode + "'");
|
|
|
+ sql.Append(" where ms_sncode='" + ms_sncode.Text + "' and ms_makecode = '" + ma_code.Text + "'");
|
|
|
dh.BatchInsert(sql.GetString(), new string[] { "bc_code", "id", "bd_code", "bg_code" }, bccode, id, bccode, bgcode);
|
|
|
OperatResult.AppendText(">>不良插入成功\n", Color.Green);
|
|
|
LoadBadInfTree(sender, e);
|