|
|
@@ -254,26 +254,12 @@ namespace UAS_MES.Make
|
|
|
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("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)
|
|
|
{
|
|
|
- //如果本工序包含老化则默认选择本工序,否则选择上料的后一道工序
|
|
|
- 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();
|
|
|
- }
|
|
|
- }
|
|
|
+ cdstepcode = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -281,12 +267,26 @@ namespace UAS_MES.Make
|
|
|
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("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)
|
|
|
{
|
|
|
- cdstepcode = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
+ //如果本工序包含老化则默认选择本工序,否则选择上料的后一道工序
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (cdstepcode == "")
|