|
|
@@ -271,18 +271,20 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
string outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_sncode = '" + input.Text + "'").ToString();
|
|
|
string pa_makecode = "";
|
|
|
string pa_prodcode = "";
|
|
|
+ string pr_packrule = "";
|
|
|
if (outboxcode != "")
|
|
|
{
|
|
|
input.Text = outboxcode;
|
|
|
}
|
|
|
sql.Clear();
|
|
|
- sql.Append("select pa_id,pr_palletqty,pa_outboxcode,pa_makecode,pa_status,nvl(pa_iostatus,0) pa_iostatus,nvl(pa_downstatus,0)pa_downstatus,pa_prodcode,pa_outno, pa_mothercode from package left join product on pr_code=pa_prodcode where pa_outboxcode='" + input.Text + "' and pa_type in(1,2)");
|
|
|
+ sql.Append("select pa_id,pr_palletqty,pr_packrule,pa_outboxcode,pa_makecode,pa_status,nvl(pa_iostatus,0) pa_iostatus,nvl(pa_downstatus,0)pa_downstatus,pa_prodcode,pa_outno, pa_mothercode from package left join product on pr_code=pa_prodcode where pa_outboxcode='" + input.Text + "' and pa_type in(1,2)");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
|
|
|
pa_prodcode = dt.Rows[0]["pa_prodcode"].ToString();
|
|
|
pa_standardqty.Text= dt.Rows[0]["pr_palletqty"].ToString();
|
|
|
+ pr_packrule= dt.Rows[0]["pr_packrule"].ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -293,6 +295,23 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
{
|
|
|
pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PALLET", pa_makecode, pa_prodcode, User.UserCode);
|
|
|
}
|
|
|
+ //插入新的栈板号和箱号
|
|
|
+ string pa_id=dh.GetSEQ("package_seq");
|
|
|
+ dh.ExecuteSql("insert into package(PA_ID, PA_OUTBOXCODE,PA_PRODCODE,PA_LEVEL,PA_PACKAGEQTY,PA_TOTALQTY,PA_MAKECODE,PA_STATUS,PA_INDATE,PA_SALECODE,PA_TYPE,PA_CURRENTQTY,PA_PACKTYPE,PA_STANDARDQTY,PA_SCCODE)values" +
|
|
|
+ "("+ 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 v_ms_salecode else ''end,1,0,"+ pr_packrule + ","+ pa_standardqty.Text + ",v_i_sourcecode)", "insert");
|
|
|
+ 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 + "' ");
|
|
|
+ sql.Append(",(select nvl(sum(pd_innerqty),0) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode=");
|
|
|
+ sql.Append("'" + input.Text + "'),sysdate from package where pa_outboxcode='" + input.Text + "'");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
+ //从之前的栈板号里面移除出来
|
|
|
+ dh.ExecuteSql("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "' and pd_innerboxcode='" + input.Text + "'","delete");
|
|
|
+ //减少箱内容量
|
|
|
+ dh.ExecuteSql("update package set pa_packageqty=pa_packageqty-1,pa_totalqty=pa_totalqty-(select pa_totalqty from package where pa_outboxcode='" + input.Text + "'),pa_currentqty=pa_currentqty-1,pa_status=0 where pa_outboxcode='" + pa_outboxcode.Text + "'","update");
|
|
|
+ dh.ExecuteSql("update package set pa_mothercode='' where pa_outboxcode='" + input.Text + "'","update");
|
|
|
+
|
|
|
if (!checkinsertprodiomac("箱号"))
|
|
|
return;
|
|
|
//更新箱号对应的出货单号
|