|
|
@@ -79,13 +79,13 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private string RefreshWeight(string pr_code)
|
|
|
+ private string RefreshWeight(string pr_code, string pa_outboxcode)
|
|
|
{
|
|
|
- string boxweight = dh.getFieldDataByCondition("package", "nvl(sum(pa_weight),0)", "pa_mothercode='" + pa_outboxcode.Text + "'").ToString();
|
|
|
- string pr_Singlelevelqty = dh.getFieldDataByCondition("packagedetail left join product on PD_PRODCODE=pr_code", "nvl(pr_Singlelevelqty,1)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString();
|
|
|
- string palletweight = dh.getFieldDataByCondition("pallet", "nvl(PL_WEIGHT,0)", "PL_CODE=(select PA_PALLETNO from package where pa_outboxcode='" + pa_outboxcode.Text + "')").ToString();
|
|
|
+ string boxweight = dh.getFieldDataByCondition("package", "nvl(sum(pa_weight),0)", "pa_mothercode='" + pa_outboxcode + "'").ToString();
|
|
|
+ string pr_Singlelevelqty = dh.getFieldDataByCondition("packagedetail left join product on PD_PRODCODE=pr_code", "nvl(pr_Singlelevelqty,1)", "pd_outboxcode='" + pa_outboxcode + "'").ToString();
|
|
|
+ string palletweight = dh.getFieldDataByCondition("pallet", "nvl(PL_WEIGHT,0)", "PL_CODE=(select PA_PALLETNO from package where pa_outboxcode='" + pa_outboxcode + "')").ToString();
|
|
|
sumpalletweight.Text = (double.Parse(boxweight)).ToString();
|
|
|
- int packageqty = dh.getRowCount("packagedetail", "pd_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
+ int packageqty = dh.getRowCount("packagedetail", "pd_outboxcode='" + pa_outboxcode + "'");
|
|
|
pr_Singlelevelqty = pr_Singlelevelqty == "" ? "1" : pr_Singlelevelqty;
|
|
|
//根据单层装的数量,自动计算栈板装的层数
|
|
|
int rowcount = 0;
|
|
|
@@ -204,13 +204,13 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
{
|
|
|
sql.Clear();
|
|
|
sql.Append("select pa_outboxcode,PA_TOTALQTY,pa_prodcode,pr_detail,pr_spec from package ");
|
|
|
- sql.Append("left join product on pr_code=pa_prodcode where pa_outno='" + pi_inoutno.Text + "' and pa_type=3 order by pa_outboxcode asc");
|
|
|
+ sql.Append("left join product on pr_code=pa_prodcode where pa_outno='" + pi_inoutno.Text + "' and pa_type in (1,3) order by pa_outboxcode asc");
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
BaseUtil.FillDgvWithDataTable(InOutDetailDGV, dt);
|
|
|
if (Combine.Checked)
|
|
|
{
|
|
|
sql.Clear();
|
|
|
- sql.Append("select max(pd_pdno)pd_pdno,max(pd_id)pd_id,pd_prodcode,sum(pd_outqty)pd_outqty,max(pr_detail)pr_detail,max(pr_spec)pr_spec from prodiodetail left join prodinout ");
|
|
|
+ sql.Append("select max(pd_pdno)pd_pdno,max(pd_id)pd_id,pd_prodcode,sum(nvl(pd_cartons,0))pd_cartons,sum(pd_outqty)pd_outqty,max(pr_detail)pr_detail,max(pr_spec)pr_spec from prodiodetail left join prodinout ");
|
|
|
sql.Append("on pd_piid=pi_id left join product on pd_prodcode=pr_code where pi_inoutno='" + pi_inoutno.Text + "' group by pd_prodcode");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
|
|
|
@@ -218,7 +218,7 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
else
|
|
|
{
|
|
|
sql.Clear();
|
|
|
- sql.Append("select pd_pdno,pd_prodcode,pd_id,pd_outqty,pr_detail,pr_spec from prodiodetail left join prodinout ");
|
|
|
+ sql.Append("select pd_pdno,pd_prodcode,pd_id,pd_outqty,nvl(pd_cartons,0)pd_cartons,pr_detail,pr_spec from prodiodetail left join prodinout ");
|
|
|
sql.Append("on pd_piid=pi_id left join product on pd_prodcode=pr_code where pi_inoutno='" + pi_inoutno.Text + "'");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
|
|
|
@@ -273,8 +273,9 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
{
|
|
|
string pa_makecode = "";
|
|
|
string PA_TOTALQTY = "";
|
|
|
+ string pa_prodcode = "";
|
|
|
sql.Clear();
|
|
|
- sql.Append("select pa_outboxcode,PA_TOTALQTY,pa_status,nvl(pa_iostatus,0) pa_iostatus,pa_makecode,pa_mothercode,nvl(pa_downstatus,0)pa_downstatus,pa_outno from package where pa_outboxcode='" + input.Text + "' and pa_type=3");
|
|
|
+ sql.Append("select pa_outboxcode,PA_TOTALQTY,pa_status,pa_prodcode,nvl(pa_iostatus,0) pa_iostatus,pa_makecode,pa_mothercode,nvl(pa_downstatus,0)pa_downstatus,pa_outno from package where pa_outboxcode='" + input.Text + "' and pa_type=3");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
@@ -282,6 +283,7 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
return;
|
|
|
pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
|
|
|
PA_TOTALQTY = dt.Rows[0]["PA_TOTALQTY"].ToString();
|
|
|
+ pa_prodcode = dt.Rows[0]["pa_prodcode"].ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -308,6 +310,7 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
OperateResult.AppendText("当前栈板数量" + PA_TOTALQTY + ",超出待采集数量\n", Color.Red, input);
|
|
|
return;
|
|
|
}
|
|
|
+ RefreshWeight(pa_prodcode, input.Text);
|
|
|
if (!checkinsertprodiomac("栈板号", input.Text))
|
|
|
return;
|
|
|
//更新箱号对应的出货单号
|
|
|
@@ -353,48 +356,71 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
OperateResult.AppendText("箱号" + input.Text + "不存在,请重新输入\n", Color.Red, input);
|
|
|
return;
|
|
|
}
|
|
|
- if (pa_outboxcode.Text == "" && AutoOutBoxCode.Checked)
|
|
|
+ if (pa_outboxcode.Text == "" && !AutoOutBoxCode.Checked)
|
|
|
{
|
|
|
pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PALLET", pa_makecode, pa_prodcode, User.UserCode);
|
|
|
}
|
|
|
- //插入新的栈板号和箱号
|
|
|
- string pa_id = dh.getFieldDataByCondition("package", "pa_id", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
|
|
|
- if (pa_id == "")
|
|
|
+ //需要打栈板
|
|
|
+ if (pa_outboxcode.Text != "")
|
|
|
{
|
|
|
- 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,PA_OUTNO)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 '" + pa_salecode + "' else ''end,3,0,'" + pr_packrule + "'," + pa_standardqty.Text + ",'" + User.UserSourceCode + "','" + pi_inoutno.Text + "')", "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("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=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
|
|
|
- if (pa_mothercode != "")
|
|
|
- {
|
|
|
- //从之前的栈板号里面移除出来
|
|
|
- dh.ExecuteSql("delete from packagedetail where pd_outboxcode='" + pa_mothercode + "' 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_mothercode + "'", "update");
|
|
|
- dh.ExecuteSql("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + input.Text + "'", "update");
|
|
|
+ //插入新的栈板号和箱号
|
|
|
+ string pa_id = dh.getFieldDataByCondition("package", "pa_id", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
|
|
|
+ if (pa_id == "")
|
|
|
+ {
|
|
|
+ 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,PA_OUTNO)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 '" + pa_salecode + "' else ''end,3,0,'" + pr_packrule + "'," + pa_standardqty.Text + ",'" + User.UserSourceCode + "','" + pi_inoutno.Text + "')", "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("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=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
|
|
|
+ if (pa_mothercode != "")
|
|
|
+ {
|
|
|
+ //从之前的栈板号里面移除出来
|
|
|
+ dh.ExecuteSql("delete from packagedetail where pd_outboxcode='" + pa_mothercode + "' 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_mothercode + "'", "update");
|
|
|
+ dh.ExecuteSql("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + input.Text + "'", "update");
|
|
|
+ }
|
|
|
+ RefreshWeight(pa_prodcode, input.Text);
|
|
|
+ if (!checkinsertprodiomac("栈板", pa_outboxcode.Text))
|
|
|
+ return;
|
|
|
+ //更新箱号对应的出货单号
|
|
|
+ dh.UpdateByCondition("package", "pa_outno = '" + pi_inoutno.Text + "'", "pa_outboxcode = '" + input.Text + "'");
|
|
|
+ List<string> v_barcode = new List<string>();
|
|
|
+ List<string> v_makecode = new List<string>();
|
|
|
+ DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
|
|
|
+ for (int i = 0; i < datatable.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
|
|
|
+ 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, "");
|
|
|
}
|
|
|
- if (!checkinsertprodiomac("栈板", pa_outboxcode.Text))
|
|
|
- return;
|
|
|
- //更新箱号对应的出货单号
|
|
|
- dh.UpdateByCondition("package", "pa_outno = '" + pi_inoutno.Text + "'", "pa_outboxcode = '" + input.Text + "'");
|
|
|
- List<string> v_barcode = new List<string>();
|
|
|
- List<string> v_makecode = new List<string>();
|
|
|
- DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
|
|
|
- for (int i = 0; i < datatable.Rows.Count; i++)
|
|
|
+ else
|
|
|
{
|
|
|
- v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
|
|
|
- v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
|
|
|
+ RefreshWeight(pa_prodcode, input.Text);
|
|
|
+ if (!checkinsertprodiomac("箱号",input.Text))
|
|
|
+ return;
|
|
|
+ //更新箱号对应的出货单号
|
|
|
+ dh.UpdateByCondition("package", "pa_outno = '" + pi_inoutno.Text + "'", "pa_outboxcode = '" + input.Text + "'");
|
|
|
+ List<string> v_barcode = new List<string>();
|
|
|
+ List<string> v_makecode = new List<string>();
|
|
|
+ DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
|
|
|
+ for (int i = 0; i < datatable.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
|
|
|
+ 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, "");
|
|
|
}
|
|
|
- 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, "");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -591,7 +617,7 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
}
|
|
|
else if (type == "箱号")
|
|
|
{
|
|
|
- pib_type = "PALLET";
|
|
|
+ pib_type = "BOX";
|
|
|
}
|
|
|
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)");
|