|
|
@@ -72,46 +72,50 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (ma_code.Text != "")
|
|
|
{
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select cr_code from craft left join craftdetail on cd_crid=cr_id where cr_code in (" + craftcode_condition + ") ");
|
|
|
- sql.Append("and cr_prodcode='" + ma_prodcode.Text + "' and cr_statuscode='AUDITED' and cd_stepcode='" + User.CurrentStepCode + "'");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- dt = (DataTable)dh.ExecuteSql("select bar_remain,bar_prodcode from barcode inner join product on pr_code=bar_prodcode where bar_code ='" + pr_batchnum.Text + "' and bar_status = 1 ", "select");
|
|
|
+ string ErrMessage = "";
|
|
|
+ if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrMessage)) {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select cr_code from craft left join craftdetail on cd_crid=cr_id where cr_code in (" + craftcode_condition + ") ");
|
|
|
+ sql.Append("and cr_prodcode='" + ma_prodcode.Text + "' and cr_statuscode='AUDITED' and cd_stepcode='" + User.CurrentStepCode + "'");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- string bar_remain = dt.Rows[0]["bar_remain"].ToString();
|
|
|
- string bar_prodcode = dt.Rows[0]["bar_prodcode"].ToString();
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select * from stepproduct inner join product on pr_code=sp_soncode left join makematerial on mm_prodcode=sp_soncode where ");
|
|
|
- sql.Append("sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_soncode='" + bar_prodcode + "' and pr_tracekind=2 ");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select bar_remain,bar_prodcode from barcode inner join product on pr_code=bar_prodcode where bar_code ='" + pr_batchnum.Text + "' and bar_status = 1 ", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- string mm_oneuseqty = dt.Rows[0]["mm_oneuseqty"].ToString();
|
|
|
- string mm_prodcode = dt.Rows[0]["mm_prodcode"].ToString();
|
|
|
- if (dh.getRowCount("makesourcestock", "mss_makecode='" + ma_code.Text + "' and mss_prodcode='" + mm_prodcode + "' and mss_barcode='" + pr_batchnum.Text + "'") == 0)
|
|
|
+ string bar_remain = dt.Rows[0]["bar_remain"].ToString();
|
|
|
+ string bar_prodcode = dt.Rows[0]["bar_prodcode"].ToString();
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select * from stepproduct inner join product on pr_code=sp_soncode left join makematerial on mm_prodcode=sp_soncode where ");
|
|
|
+ sql.Append("sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_soncode='" + bar_prodcode + "' and pr_tracekind=2 ");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into makesourcestock (mss_id,mss_makecode,mss_linecode ,mss_craftcode,");
|
|
|
- sql.Append("mss_stepcode,mss_barcode,mss_fprodcode,mss_indate,mss_inman,mss_qty,");
|
|
|
- sql.Append("mss_remain,mss_baseqty,mss_prodcode,mss_maid) values(makesourcestock_seq.nextval,'" + ma_code.Text + "','" + User.UserLineCode + "',");
|
|
|
- sql.Append("'"+ma_craftcode.Text+"','" + sc_stepcode.Text + "','" + pr_batchnum.Text + "','" + mm_prodcode + "',");
|
|
|
- sql.Append("sysdate,'" + User.UserCode + "','" + bar_remain + "','" + bar_remain + "','" + mm_oneuseqty + "','" + bar_prodcode + "','" + ma_id + "')");
|
|
|
- dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
- dh.UpdateByCondition("barcode", "bar_place='" + ma_code.Text + "'", "bar_code='" + pr_batchnum.Text + "'");
|
|
|
- //数据插入成功后加载Grid的数据
|
|
|
- FillDataGridView();
|
|
|
- OperateResult.AppendText(">>批次号" + pr_batchnum.Text + "备料成功\n", Color.Green, pr_batchnum);
|
|
|
+ string mm_oneuseqty = dt.Rows[0]["mm_oneuseqty"].ToString();
|
|
|
+ string mm_prodcode = dt.Rows[0]["mm_prodcode"].ToString();
|
|
|
+ if (dh.getRowCount("makesourcestock", "mss_makecode='" + ma_code.Text + "' and mss_prodcode='" + mm_prodcode + "' and mss_barcode='" + pr_batchnum.Text + "'") == 0)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into makesourcestock (mss_id,mss_makecode,mss_linecode ,mss_craftcode,");
|
|
|
+ sql.Append("mss_stepcode,mss_barcode,mss_fprodcode,mss_indate,mss_inman,mss_qty,");
|
|
|
+ sql.Append("mss_remain,mss_baseqty,mss_prodcode,mss_maid) values(makesourcestock_seq.nextval,'" + ma_code.Text + "','" + User.UserLineCode + "',");
|
|
|
+ sql.Append("'" + ma_craftcode.Text + "','" + sc_stepcode.Text + "','" + pr_batchnum.Text + "','" + mm_prodcode + "',");
|
|
|
+ sql.Append("sysdate,'" + User.UserCode + "','" + bar_remain + "','" + bar_remain + "','" + mm_oneuseqty + "','" + bar_prodcode + "','" + ma_id + "')");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
+ dh.UpdateByCondition("barcode", "bar_place='" + ma_code.Text + "'", "bar_code='" + pr_batchnum.Text + "'");
|
|
|
+ //数据插入成功后加载Grid的数据
|
|
|
+ FillDataGridView();
|
|
|
+ OperateResult.AppendText(">>批次号" + pr_batchnum.Text + "备料成功\n", Color.Green, pr_batchnum);
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>批次号" + pr_batchnum.Text + "的物料已分配\n", Color.Red, pr_batchnum);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>批次号" + pr_batchnum.Text + "的物料已分配\n", Color.Red, pr_batchnum);
|
|
|
+ else OperateResult.AppendText(">>批次" + pr_batchnum.Text + "对应的物料不是当前工单当前工序需要备的物料\n", Color.Red, pr_batchnum);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>批次" + pr_batchnum.Text + "对应的物料不是当前工单当前工序需要备的物料\n", Color.Red, pr_batchnum);
|
|
|
+ else OperateResult.AppendText(">>批号:" + pr_batchnum.Text + "不存在,或者状态无效\n", Color.Red, pr_batchnum);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>批号:" + pr_batchnum.Text + "不存在,或者状态无效\n", Color.Red, pr_batchnum);
|
|
|
+ else OperateResult.AppendText(">>当前岗位资源工序不在工单对应的途程中\n", Color.Red);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>当前岗位资源工序不在工单对应的途程中\n", Color.Red);
|
|
|
+ else OperateResult.AppendText(">>"+ErrMessage+"\n", Color.Red);
|
|
|
}
|
|
|
else OperateResult.AppendText(">>工单号不能为空\n", Color.Red, pr_batchnum);
|
|
|
}
|