|
|
@@ -405,8 +405,8 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
else
|
|
|
{
|
|
|
sql.Clear();
|
|
|
- sql.Append("select cn,outqty,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_pdid='" + PDID + "'),0)ungetqty from");
|
|
|
- sql.Append("(select nvl(sum(pd_outqty),0) outqty ,count(1)cn from prodiodetail where pd_piid=" + pi_id.Text + " and pd_id='" + PDID + "')");
|
|
|
+ sql.Append("select cn,outqty,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_pdid='" + PDID + "' and pim_prodcode='" + dtms.Rows[0]["ma_prodcode"].ToString() + "'),0)ungetqty from");
|
|
|
+ sql.Append("(select nvl(sum(pd_outqty),0) outqty ,count(1)cn from prodiodetail where pd_piid=" + pi_id.Text + " and pd_id='" + PDID + "' and pd_prodcode='" + dtms.Rows[0]["ma_prodcode"].ToString() + "')");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows[0]["cn"].ToString() == "0")
|
|
|
{
|
|
|
@@ -425,6 +425,16 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
}
|
|
|
}
|
|
|
int palletnum = int.Parse(dh.getFieldDataByCondition("prodiomac", " count(distinct pim_outboxcode)", "pim_inoutno='" + pi_inoutno.Text + "' and PIM_TYPE='PALLET' ").ToString());
|
|
|
+ if (pa_standardqty.Text == "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("请输入栈板容量\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (pi_palletnum.Text == "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("请输入栈板数量\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (palletnum >= int.Parse(pi_palletnum.Text))
|
|
|
{
|
|
|
OperateResult.AppendText("当前栈板数量" + palletnum + ",超出设置栈板数" + pi_palletnum.Text + "\n", Color.Red, input);
|
|
|
@@ -513,6 +523,20 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
}
|
|
|
if (CombineCust.Checked)
|
|
|
{
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select cn,outqty,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_prodcode='" + dtms.Rows[0]["ma_prodcode"].ToString() + "'),0)ungetqty from");
|
|
|
+ sql.Append("(select nvl(sum(pd_outqty),0) outqty ,count(1)cn from prodiodetail where pd_piid=" + pi_id.Text + " and pd_prodcode='" + dtms.Rows[0]["ma_prodcode"].ToString() + "')");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows[0]["cn"].ToString() == "0")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "所属产品:" + dtms.Rows[0]["ma_prodcode"].ToString() + ",不在出货单" + pi_inoutno.Text + "中\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (int.Parse(dt.Rows[0]["ungetqty"].ToString()) < int.Parse(PA_TOTALQTY))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("当前栈板数量" + PA_TOTALQTY + ",超出待采集数量\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
sql.Clear();
|
|
|
sql.Append("select cn,outqty,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_custprodcode='" + dtms.Rows[0]["ma_custprodcode"].ToString() + "'),0)ungetqty from");
|
|
|
sql.Append("(select nvl(sum(pd_outqty),0) outqty ,count(1)cn from prodiodetail where pd_piid=" + pi_id.Text + " and pd_custprod='" + dtms.Rows[0]["ma_custprodcode"].ToString() + "')");
|
|
|
@@ -536,8 +560,8 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
else
|
|
|
{
|
|
|
sql.Clear();
|
|
|
- sql.Append("select cn,outqty,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_pdid='" + PDID + "'),0)ungetqty from");
|
|
|
- sql.Append("(select nvl(sum(pd_outqty),0) outqty ,count(1)cn from prodiodetail where pd_piid=" + pi_id.Text + " and pd_id='" + PDID + "')");
|
|
|
+ sql.Append("select cn,outqty,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_pdid='" + PDID + "' and pim_prodcode='" + dtms.Rows[0]["ma_prodcode"].ToString() + "'),0)ungetqty from");
|
|
|
+ sql.Append("(select nvl(sum(pd_outqty),0) outqty ,count(1)cn from prodiodetail where pd_piid=" + pi_id.Text + " and pd_id='" + PDID + "' and pd_prodcode='" + dtms.Rows[0]["ma_prodcode"].ToString() + "')");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows[0]["cn"].ToString() == "0")
|
|
|
{
|
|
|
@@ -549,6 +573,7 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
OperateResult.AppendText("出货单产品" + dtms.Rows[0]["ma_prodcode"].ToString() + "已经完成出货采集\n", Color.Red, input);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
if (int.Parse(dt.Rows[0]["ungetqty"].ToString()) < int.Parse(PA_TOTALQTY))
|
|
|
{
|
|
|
OperateResult.AppendText("当前栈板数量" + PA_TOTALQTY + ",超出待采集数量\n", Color.Red, input);
|
|
|
@@ -571,6 +596,10 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
"(" + pa_id + ",'" + pa_outboxcode.Text + "',case when nvl('" + pr_packrule + "',' ')<>'MIX' then '" + pa_prodcode + "' ELSE''END,3,0,0,case when '" + pr_packrule + "'='MAKE' THEN '" + pa_makecode + "' ELSE '' END, 0,SYSDATE,case when '" + pr_packrule + "'='SALE' " +
|
|
|
"then '" + pa_salecode + "' else ''end,3,0,'" + pr_packrule + "','" + pa_standardqty.Text + "','" + User.UserSourceCode + "','" + pi_inoutno.Text + "')", "insert");
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update package set pa_outno='" + pi_inoutno.Text + "' where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
|
|
|
+ }
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_makecode,pd_prodcode,pd_innerboxcode, pd_innerqty,pd_builddate)");
|
|
|
sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + pa_makecode + "','" + pa_prodcode + "','" + input.Text + "' ");
|
|
|
@@ -716,7 +745,7 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
pim_mac.Add(datatable.Rows[i]["pim_mac"].ToString());
|
|
|
pim_prodcode.Add(datatable.Rows[i]["pim_prodcode"].ToString());
|
|
|
}
|
|
|
- dh.BatchInsert("update makeserial set ms_outno='' where ms_sncode = :pim_mac and ms_prodcode = :pim_prodcode and ms_outno = '" + pi_inoutno.Text + "'", new string[] { "pim_mac", "pim_prodcode" }, pim_mac.ToArray(), pim_prodcode.ToArray());
|
|
|
+ dh.BatchInsert("update makeserial set ms_outno='' where ms_sncode = :pim_mac and ms_outno = '" + pi_inoutno.Text + "'", new string[] { "pim_mac" }, pim_mac.ToArray());
|
|
|
dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='PALLET' and pim_inorout='OUT' AND pim_class='出货'", "delete");
|
|
|
dh.UpdateByCondition("package", "pa_outno=''", "pa_outboxcode='" + input.Text + "'");
|
|
|
OperateResult.AppendText("栈板号" + input.Text + "取消备货成功\n", Color.Black, input);
|
|
|
@@ -775,7 +804,7 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
pim_mac.Add(datatable.Rows[i]["pim_mac"].ToString());
|
|
|
pim_prodcode.Add(datatable.Rows[i]["pim_prodcode"].ToString());
|
|
|
}
|
|
|
- dh.BatchInsert("update makeserial set ms_outno='' where ms_sncode = :pim_mac and ms_prodcode = :pim_prodcode and ms_outno = '" + pi_inoutno.Text + "'", new string[] { "pim_mac", "pim_prodcode" }, pim_mac.ToArray(), pim_prodcode.ToArray());
|
|
|
+ dh.BatchInsert("update makeserial set ms_outno='' where ms_sncode = :pim_mac and ms_outno = '" + pi_inoutno.Text + "'", new string[] { "pim_mac" }, pim_mac.ToArray());
|
|
|
dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='BOX' and pim_inorout='OUT' AND pim_class='出货'", "delete");
|
|
|
OperateResult.AppendText("箱号" + input.Text + "取消备货成功\n", Color.Black, input);
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "取消出货备货", "箱号" + input.Text + "取消出货备货成功", input.Text, "");
|
|
|
@@ -817,8 +846,8 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
}
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into prodiomac(pim_id,pim_inoutno,pim_piid,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type,pim_outboxcode,pim_inorout,pim_class,pim_custpo,pim_custdetno,pim_pdid,pim_custprodcode)");
|
|
|
- sql.Append("select prodiomac_seq.nextval,'" + pi_inoutno.Text + "','" + pi_id.Text + "',v_prodcode,ms_sncode,sysdate,'" + User.UserCode + "','" + pib_type + "','" + iBox + "','OUT','出货','" + custpo + "','" + custpodetno + "','" + PDID + "',ma_custprodcode " +
|
|
|
- " from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode left join make on ma_code=ms_makecode where v_outboxcode='" + iBox + "' and ms_outno is null");
|
|
|
+ sql.Append("select prodiomac_seq.nextval,'" + pi_inoutno.Text + "','" + pi_id.Text + "',ms_prodcode,ms_sncode,sysdate,'" + User.UserCode + "','" + pib_type + "','" + iBox + "','OUT','出货','" + custpo + "','" + custpodetno + "','" + PDID + "',ma_custprodcode " +
|
|
|
+ " from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode left join make on ma_code=ms_makecode where v_outboxcode='" + iBox + "' and (v_prodcode,ms_sncode) not in (select PIM_PRODCODE, PIM_MAC from prodiomac)");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
}
|
|
|
|