|
|
@@ -50,6 +50,10 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
DataTable Dbfind;
|
|
|
|
|
|
+ string ms_paststep = "";
|
|
|
+
|
|
|
+ string ma_bomversion = "";
|
|
|
+
|
|
|
public Make_Repair67F()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
@@ -192,7 +196,7 @@ namespace UAS_MES_NEW.Make
|
|
|
sql.Append("select ms_sncode,ms_status,ms_outboxcode,ms_paststep,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework from makeserial left join make ");
|
|
|
sql.Append("on ms_makecode=ma_code where ms_sncode = '" + GetSNCode.Text + "' or ms_firstsn='" + GetSNCode.Text + "' order by ms_id desc");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- string ms_paststep = "";
|
|
|
+
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
GetSNCode.Text = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
@@ -282,7 +286,7 @@ namespace UAS_MES_NEW.Make
|
|
|
BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
//判断是否当前工单途程的上料记录
|
|
|
firstsn = dt.Rows[0]["ms_firstsn"].ToString();
|
|
|
- string ma_bomversion = dt.Rows[0]["ma_bomversion"].ToString();
|
|
|
+ ma_bomversion = dt.Rows[0]["ma_bomversion"].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 ");
|
|
|
@@ -570,40 +574,34 @@ namespace UAS_MES_NEW.Make
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- //查询拆解的物料
|
|
|
+
|
|
|
+
|
|
|
sql.Clear();
|
|
|
- sql.Append("select distinct cm_soncode,pr_detail from craftmaterial left join product on pr_code=cm_fsoncode where cm_sncode in (select '" + firstsn + "' from dual union ");
|
|
|
- sql.Append("select sn from makesnrelation where firstsn='" + firstsn + "') and nvl(pr_prodtype,' ')<>'包装物料' and cm_craftcode='" + cr_code.Text + "' and cm_makecode='" + ms_makecode.Text + "' and cm_status=-1 ");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ sql.Append("select max(pr_lightbox)pr_lightbox,sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
|
|
|
+ sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
|
|
|
+ sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
|
|
|
+ sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");
|
|
|
+ sql.Append("sp_bomversion='" + ma_bomversion + "' and sp_craftcode='" + cr_code.Text + "' and instr('" + ms_paststep + "',sp_stepcode)>0 ");
|
|
|
+ sql.Append("And sp_mothercode ='" + ms_prodcode.Text + "' and sp_tracekind=1 and nvl(pr_prodtype,' ')<>'包装物料' and not exists(select 1 from craftmaterial where ");
|
|
|
+ sql.Append("cm_sncode in (select '" + firstsn + "' from dual union select sn from makesnrelation where firstsn='" + firstsn + "') and cm_makecode='" + ms_makecode.Text + "' and cm_fsoncode=");
|
|
|
+ sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id order by SP_DETNO asc");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+
|
|
|
+ //查询拆解的物料
|
|
|
+ //sql.Clear();
|
|
|
+ //sql.Append("select distinct cm_soncode,pr_detail from craftmaterial left join product on pr_code=cm_fsoncode where cm_sncode in (select '" + firstsn + "' from dual union ");
|
|
|
+ //sql.Append("select sn from makesnrelation where firstsn='" + firstsn + "') and nvl(pr_prodtype,' ')<>'包装物料' and cm_craftcode='" + cr_code.Text + "' and cm_makecode='" + ms_makecode.Text + "' and cm_status=-1 ");
|
|
|
+ //dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
////如果含有序列号物料有被拆解过
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- string soncode = "";
|
|
|
string prdetail = "";
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
- soncode += "'" + dt.Rows[i][0].ToString() + "',";
|
|
|
- prdetail += "'" + dt.Rows[i][1].ToString() + "',";
|
|
|
- }
|
|
|
- //查询对应的上料记录
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select cm_soncode,pr_detail from craftmaterial left join product on pr_code=cm_fsoncode where cm_sncode in (select '" + firstsn + "' from dual union select sn from ");
|
|
|
- sql.Append(" makesnrelation where firstsn='" + firstsn + "')and nvl(pr_prodtype,' ')<>'包装物料' and cm_status=0 and cm_soncode in (" + soncode.Substring(0, soncode.Length - 1) + ")");
|
|
|
- DataTable LoadSoncode = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- //查询的结果不相等表示未完成上料
|
|
|
- if (dt.Rows.Count != LoadSoncode.Rows.Count)
|
|
|
- {
|
|
|
- for (int i = 0; i < LoadSoncode.Rows.Count; i++)
|
|
|
- {
|
|
|
- if (soncode.Contains(LoadSoncode.Rows[i][0].ToString()))
|
|
|
- {
|
|
|
- soncode = soncode.Replace(LoadSoncode.Rows[i][0].ToString(), "");
|
|
|
- prdetail = prdetail.Replace(LoadSoncode.Rows[i][1].ToString(), "");
|
|
|
- }
|
|
|
- }
|
|
|
- OperatResult.AppendText(">>" + prdetail.Replace("'", "") + "物料尚未备料,不允许回流\n", Color.Red);
|
|
|
- return;
|
|
|
+ prdetail += "'" + dt.Rows[i]["pr_detail"].ToString() + "',";
|
|
|
}
|
|
|
+ OperatResult.AppendText(">>" + prdetail.Replace("'", "") + "物料尚未备料,不允许回流\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)
|