|
|
@@ -201,13 +201,14 @@ namespace UAS_MES.Warehouse
|
|
|
{
|
|
|
sql.Clear();
|
|
|
sql.Append("select DISTINCT pd_outboxcode from PACKAGEDETAIL where pd_barcode in (select pim_mac from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_inorout='OUT' and PIM_TYPE = ' ')");
|
|
|
- DataTable datatable = (DataTable)dh.ExecuteSql(sql.GetString(),"select");
|
|
|
+ DataTable datatable = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (datatable.Rows.Count > 0)
|
|
|
{
|
|
|
for (int i = 0; i < datatable.Rows.Count; i++)
|
|
|
{
|
|
|
- if (dh.getFieldDataByCondition("makeserial left join PACKAGEDETAIL on pd_barcode = ms_sncode and pd_makecode = ms_makecode", "count(1)", "pd_outboxcode = '" + datatable.Rows[i]["pd_outboxcode"].ToString() + "' and ms_outno is null").ToString() == "0") {
|
|
|
- dh.UpdateByCondition("package", "pa_iostatus=2", "pa_outboxcode = '"+ datatable.Rows[i]["pd_outboxcode"].ToString() + "'");
|
|
|
+ if (dh.getFieldDataByCondition("makeserial left join PACKAGEDETAIL on pd_barcode = ms_sncode and pd_makecode = ms_makecode", "count(1)", "pd_outboxcode = '" + datatable.Rows[i]["pd_outboxcode"].ToString() + "' and ms_outno is null").ToString() == "0")
|
|
|
+ {
|
|
|
+ dh.UpdateByCondition("package", "pa_iostatus=2", "pa_outboxcode = '" + datatable.Rows[i]["pd_outboxcode"].ToString() + "'");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -217,7 +218,7 @@ namespace UAS_MES.Warehouse
|
|
|
ExeSQL.Add("update prodinout set pi_pdastatus='已出库' where pi_inoutno='" + pi_inoutno.Text + "'");
|
|
|
ExeSQL.Add("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName + "','确认出货','确认出货成功','ProdInOut!Sale|pi_id=" + pi_id.Text + "')");
|
|
|
dh.ExecuteSQLTran(ExeSQL.ToArray());
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "出货单" + pi_inoutno.Text + "确认出货", "出货单" + pi_inoutno.Text + "确认出货成功", pi_inoutno.Text,"");
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "出货单" + pi_inoutno.Text + "确认出货", "出货单" + pi_inoutno.Text + "确认出货成功", pi_inoutno.Text, "");
|
|
|
OperateResult.AppendText("出货单" + pi_inoutno.Text + "出库成功\n", Color.Black, pi_inoutno);
|
|
|
BaseUtil.CleanDGVData(InOutDetailDGV);
|
|
|
BaseUtil.CleanControls(panel1.Controls);
|
|
|
@@ -290,7 +291,7 @@ namespace UAS_MES.Warehouse
|
|
|
v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
|
|
|
}
|
|
|
dh.BatchInsert("update makeserial set ms_outno='" + pi_inoutno.Text + "' where ms_sncode = :v_barcode and ms_makecode = :v_makecode and ms_outno is null", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "栈板" + input.Text + "出货备货", "栈板" + input.Text + "出货备货成功", input.Text,"");
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "栈板" + input.Text + "出货备货", "栈板" + input.Text + "出货备货成功", input.Text, "");
|
|
|
}
|
|
|
else if (bigboxBtn.Checked)
|
|
|
{
|
|
|
@@ -386,7 +387,7 @@ namespace UAS_MES.Warehouse
|
|
|
v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
|
|
|
}
|
|
|
dh.BatchInsert("update makeserial set ms_outno='" + pi_inoutno.Text + "' where ms_sncode = :v_barcode and ms_makecode = :v_makecode and ms_outno is null", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "出货备货", "箱号" + input.Text + "出货备货成功", input.Text,"");
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "出货备货", "箱号" + input.Text + "出货备货成功", input.Text, "");
|
|
|
}
|
|
|
else if (serBtn.Checked)
|
|
|
{
|
|
|
@@ -474,21 +475,43 @@ namespace UAS_MES.Warehouse
|
|
|
}
|
|
|
if (dta.Rows[0]["pi_type"].ToString() == "按订单出货")
|
|
|
{
|
|
|
- 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]["ms_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_ordercode='" + dtms.Rows[0]["ms_salecode"].ToString() + "' and pd_prodcode='" + dtms.Rows[0]["ms_prodcode"].ToString() + "')");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows[0]["cn"].ToString() == "0")
|
|
|
+ string pr_packrule = dh.getFieldDataByCondition("product", "pr_packrule", "pr_code = '" + dtms.Rows[0]["ms_prodcode"].ToString() + "'").ToString();
|
|
|
+ if (pr_packrule == "SALE")
|
|
|
{
|
|
|
- OperateResult.AppendText("序列号" + input.Text + "所属产品:" + dtms.Rows[0]["ms_prodcode"].ToString() + ",合同号:" + dtms.Rows[0]["ms_salecode"].ToString() + ",不在出货单" + pi_inoutno.Text + "中\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_prodcode='" + dtms.Rows[0]["ms_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_ordercode='" + dtms.Rows[0]["ms_salecode"].ToString() + "' and pd_prodcode='" + dtms.Rows[0]["ms_prodcode"].ToString() + "')");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows[0]["cn"].ToString() == "0")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "所属产品:" + dtms.Rows[0]["ms_prodcode"].ToString() + ",合同号:" + dtms.Rows[0]["ms_salecode"].ToString() + ",不在出货单" + pi_inoutno.Text + "中\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (int.Parse(dt.Rows[0]["cn"].ToString()) > 0 && int.Parse(dt.Rows[0]["ungetqty"].ToString()) <= 0)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("出货单产品" + dtms.Rows[0]["ms_prodcode"].ToString() + "+合同" + dtms.Rows[0]["ms_salecode"].ToString() + ",已经完成出货采集\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ updatesn(ms_id);
|
|
|
}
|
|
|
- else if (int.Parse(dt.Rows[0]["cn"].ToString()) > 0 && int.Parse(dt.Rows[0]["ungetqty"].ToString()) <= 0)
|
|
|
+ else
|
|
|
{
|
|
|
- OperateResult.AppendText("出货单产品" + dtms.Rows[0]["ms_prodcode"].ToString() + "+合同" + dtms.Rows[0]["ms_salecode"].ToString() + ",已经完成出货采集\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_prodcode='" + dtms.Rows[0]["ms_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]["ms_prodcode"].ToString() + "')");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows[0]["cn"].ToString() == "0")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "所属产品:" + dtms.Rows[0]["ms_prodcode"].ToString() + ",不在出货单" + pi_inoutno.Text + "中\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (int.Parse(dt.Rows[0]["cn"].ToString()) > 0 && int.Parse(dt.Rows[0]["ungetqty"].ToString()) <= 0)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("出货单产品" + dtms.Rows[0]["ms_prodcode"].ToString() + "已经完成出货采集\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ updatesn(ms_id);
|
|
|
}
|
|
|
- updatesn(ms_id);
|
|
|
}
|
|
|
else if (dta.Rows[0]["pi_type"].ToString() == "自由出货")
|
|
|
{
|
|
|
@@ -509,7 +532,7 @@ namespace UAS_MES.Warehouse
|
|
|
if (int.Parse(dtform.Rows[0]["outqty"].ToString()) > int.Parse(dtform.Rows[0]["getqty"].ToString()))
|
|
|
{
|
|
|
dh.UpdateByCondition("prodinout", "pi_pdastatus='备货中'", "pi_inoutno='" + pi_inoutno.Text + "'");
|
|
|
- OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功,备货数据:"+input.Text+"\n", Color.Black, input);
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功,备货数据:" + input.Text + "\n", Color.Black, input);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -577,7 +600,7 @@ namespace UAS_MES.Warehouse
|
|
|
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);
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "栈板" + input.Text + "取消出货备货", "栈板" + input.Text + "取消出货备货成功", input.Text,"");
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "栈板" + input.Text + "取消出货备货", "栈板" + input.Text + "取消出货备货成功", input.Text, "");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -751,26 +774,55 @@ namespace UAS_MES.Warehouse
|
|
|
}
|
|
|
if (dta.Rows[0]["pi_type"].ToString() == "按订单出货")
|
|
|
{
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select ms_prodcode,ms_salecode,cn from (select nvl(ms_prodcode,' ') ms_prodcode,nvl(ms_salecode,' ') ms_salecode,count(1)cn from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode='" + input.Text + "' ");
|
|
|
- sql.Append("and ms_outno is null group by ms_prodcode,ms_salecode) left join (select pd_ordercode,pd_prodcode,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_prodcode=pd_prodcode),0)ungetqty");
|
|
|
- sql.Append(" from (select pd_ordercode,pd_prodcode,sum(pd_outqty)outqty from prodiodetail where pd_piid=" + pi_id.Text + " group by pd_prodcode,pd_ordercode)) on 1=1 where ms_prodcode<>pd_prodcode or ms_salecode<>pd_ordercode or (cn>nvl(ungetqty,0))");
|
|
|
- DataTable dtAA = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dtAA.Rows.Count > 0)
|
|
|
+ //获取进行出库的产品的包装规则
|
|
|
+ string pr_packrule = dh.getFieldDataByCondition("product left join package on pr_code = pa_prodcode", "pr_packrule", "pa_outboxcode = '" + input.Text + "'").ToString();
|
|
|
+ if (pr_packrule == "SALE")
|
|
|
{
|
|
|
- string badmessgae = "";
|
|
|
- for (int i = 0; i < dtAA.Rows.Count; i++)
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select ms_prodcode,ms_salecode,cn from (select nvl(ms_prodcode,' ') ms_prodcode,nvl(ms_salecode,' ') ms_salecode,count(1)cn from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode='" + input.Text + "' ");
|
|
|
+ sql.Append("and ms_outno is null group by ms_prodcode,ms_salecode) left join (select pd_ordercode,pd_prodcode,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_prodcode=pd_prodcode),0)ungetqty");
|
|
|
+ sql.Append(" from (select pd_ordercode,pd_prodcode,sum(pd_outqty)outqty from prodiodetail where pd_piid=" + pi_id.Text + " group by pd_prodcode,pd_ordercode)) on 1=1 where ms_prodcode<>pd_prodcode or ms_salecode<>pd_ordercode or (cn>nvl(ungetqty,0))");
|
|
|
+ DataTable dtAA = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dtAA.Rows.Count > 0)
|
|
|
{
|
|
|
- badmessgae += "物料号:" + dtAA.Rows[i]["ms_prodcode"].ToString() + ",订单号:" + dtAA.Rows[i]["ms_salecode"].ToString() + ",数量:" + dtAA.Rows[i]["cn"].ToString() + "\n";
|
|
|
+ string badmessgae = "";
|
|
|
+ for (int i = 0; i < dtAA.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ badmessgae += "产品号:" + dtAA.Rows[i]["ms_prodcode"].ToString() + ",订单号:" + dtAA.Rows[i]["ms_salecode"].ToString() + ",数量:" + dtAA.Rows[i]["cn"].ToString() + "\n";
|
|
|
+ }
|
|
|
+ OperateResult.AppendText(type + input.Text + "内的序列号中的产品+订单不在出货单中或者所装的序列号的数量大于剩余出货数," + badmessgae, Color.Red, input);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //插入prodiomac表
|
|
|
+ insertprodiomac(type);
|
|
|
+ return true;
|
|
|
}
|
|
|
- OperateResult.AppendText(type + input.Text + "内的序列号中的物料+订单不在出货单中或者所装的序列号的数量大于剩余出货数," + badmessgae, Color.Red, input);
|
|
|
- return false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //插入prodiomac表
|
|
|
- insertprodiomac(type);
|
|
|
- return true;
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select ms_prodcode,cn from (select nvl(ms_prodcode,' ') ms_prodcode,count(1)cn from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode='" + input.Text + "' ");
|
|
|
+ sql.Append("and ms_outno is null group by ms_prodcode) left join (select pd_prodcode,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_prodcode=pd_prodcode),0)ungetqty");
|
|
|
+ sql.Append(" from (select pd_prodcode,sum(pd_outqty)outqty from prodiodetail where pd_piid=" + pi_id.Text + " group by pd_prodcode)) on 1=1 where ms_prodcode<>pd_prodcode or (cn>nvl(ungetqty,0))");
|
|
|
+ DataTable dtAA = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dtAA.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string badmessgae = "";
|
|
|
+ for (int i = 0; i < dtAA.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ badmessgae += "产品号:" + dtAA.Rows[i]["ms_prodcode"].ToString() + ",数量:" + dtAA.Rows[i]["cn"].ToString() + "\n";
|
|
|
+ }
|
|
|
+ OperateResult.AppendText(type + input.Text + "内的序列号中的产品不在出货单中或者所装的序列号的数量大于剩余出货数," + badmessgae, Color.Red, input);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //插入prodiomac表
|
|
|
+ insertprodiomac(type);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if (dta.Rows[0]["pi_type"].ToString() == "自由出货")
|
|
|
@@ -794,7 +846,6 @@ namespace UAS_MES.Warehouse
|
|
|
OperateResult.AppendText(type + inputmessage + "已出库,请重新输入\n", Color.Red, input);
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
if (needMakeIn != "0")
|
|
|
{
|
|
|
if (dt.Rows[0]["pa_iostatus"].ToString() != "1" && dt.Rows[0]["pa_mothercode"].ToString() == "")
|