|
|
@@ -260,16 +260,16 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
if (Combine.Checked)
|
|
|
{
|
|
|
sql.Clear();
|
|
|
- sql.Append("select min(pd_custprod)pd_custprod,min(pd_custpo)pd_custpo,pd_custpodetno,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,pd_custpo,pd_custpodetno");
|
|
|
+ sql.Append("select wm_concat(pd_custpodetno||'|'||pd_custpo||'|'||pd_outqty)pd_outinfo,min(pd_custprod)pd_custprod,min(pd_custpo)pd_custpo,min(pd_custpodetno)pd_custpodetno,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);
|
|
|
}
|
|
|
if (CombineCust.Checked)
|
|
|
{
|
|
|
sql.Clear();
|
|
|
- sql.Append("select pd_custprod,min(pd_custpo)pd_custpo,pd_custpodetno,max(pd_pdno)pd_pdno,max(pd_id)pd_id,wm_concat(pd_prodcode)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_custprod,pd_custpo,pd_custpodetno");
|
|
|
+ sql.Append("select wm_concat(pd_custpodetno||'|'||pd_custpo||'|'||pd_outqty)pd_outinfo,pd_custprod,min(pd_custpo)pd_custpo,min(pd_custpodetno)pd_custpodetno,max(pd_pdno)pd_pdno,max(pd_id)pd_id,wm_concat(pd_prodcode)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_custprod");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
|
|
|
}
|
|
|
@@ -448,12 +448,56 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
//.UpdateByCondition("makeserial", "ms_outno='" + pi_inoutno.Text + "'", "ms_id in (select max(ms_id) from makeserial where ms_sncode in (select v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "') and ms_outno is null GROUP BY ms_sncode)");
|
|
|
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");
|
|
|
+ List<string> v_prodcode = new List<string>();
|
|
|
+ List<string> pd_custpodetno = new List<string>();
|
|
|
+ List<string> pd_custpo = new List<string>();
|
|
|
+ List<string> pd_custprod = new List<string>();
|
|
|
+ DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode,ms_prodcode from MES_PACKAGE_VIEW left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode = '" + input.Text + "'", "select");
|
|
|
+
|
|
|
+ DataTable Cust = (DataTable)dh.ExecuteSql("select pd_outqty-nvl(pim_outqty,0)pd_outqty,pd_custprod,pd_custpodetno,PD_CUSTPO from prodiodetail left join prodinout on pd_piid=pi_id left join (select pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO,count(1)pim_outqty from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' group by pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO)on pim_inoutno=pi_inoutno and PIM_CUSTPO=PD_CUSTPO and PIM_CUSTDETNO=pd_custpodetno where pi_inoutno='" + pi_inoutno.Text + "' and pd_prodcode='" + datatable.Rows[0]["ms_prodcode"].ToString() + "' and pd_outqty-nvl(pim_outqty,0)>0 order by pd_pdno", "select");
|
|
|
+
|
|
|
+ List<int> custQtys = new List<int>();
|
|
|
+ List<string> custDetNos = new List<string>();
|
|
|
+ List<string> custPOs = new List<string>();
|
|
|
+ List<string> custProd = new List<string>();
|
|
|
+
|
|
|
+ foreach (DataRow row in Cust.Rows)
|
|
|
+ {
|
|
|
+ custQtys.Add(Convert.ToInt32(row["pd_outqty"]));
|
|
|
+ custDetNos.Add(row["pd_custpodetno"].ToString());
|
|
|
+ custProd.Add(row["pd_custprod"].ToString());
|
|
|
+ custPOs.Add(row["PD_CUSTPO"].ToString());
|
|
|
+ }
|
|
|
+
|
|
|
+ int totalRows = datatable.Rows.Count;
|
|
|
+ int currentIndex = 0; // 已填充的行索引
|
|
|
+ int custIdx = 0; // 当前使用的 Cust 行索引
|
|
|
+
|
|
|
+ // 按顺序分配,直到填满总行数或 Cust 用完
|
|
|
+ while (currentIndex < totalRows && custIdx < custQtys.Count)
|
|
|
+ {
|
|
|
+ int qty = custQtys[custIdx];
|
|
|
+ // 本次实际填充数量 = min(该行数量, 剩余需要填充的行数)
|
|
|
+ int fillCount = Math.Min(qty, totalRows - currentIndex);
|
|
|
+
|
|
|
+ for (int i = 0; i < fillCount; i++)
|
|
|
+ {
|
|
|
+ pd_custpodetno.Add(custDetNos[custIdx]);
|
|
|
+ pd_custpo.Add(custPOs[custIdx]);
|
|
|
+ pd_custprod.Add(custProd[custIdx]);
|
|
|
+ }
|
|
|
+ currentIndex += fillCount;
|
|
|
+ custIdx++;
|
|
|
+ }
|
|
|
+
|
|
|
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());
|
|
|
+ v_prodcode.Add(datatable.Rows[i]["ms_prodcode"].ToString());
|
|
|
}
|
|
|
+ dh.BatchInsert("update prodiomac set PIM_CUSTPO=:PIM_CUSTPO, PIM_CUSTDETNO=:PIM_CUSTDETNO, PIM_CUSTPRODCODE=:PIM_CUSTPRODCODE where pim_mac = :v_barcode and PIM_PRODCODE = :v_prodcode ", new string[] { "PIM_CUSTPO", "PIM_CUSTDETNO", "PIM_CUSTPRODCODE", "v_barcode", "v_prodcode" }, pd_custpo.ToArray(), pd_custpodetno.ToArray(), pd_custprod.ToArray(), v_barcode.ToArray(), v_prodcode.ToArray());
|
|
|
+
|
|
|
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, "");
|
|
|
PrintPrcode = input.Text;
|
|
|
@@ -626,12 +670,56 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
//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");
|
|
|
+ List<string> v_prodcode = new List<string>();
|
|
|
+ List<string> pd_custpodetno = new List<string>();
|
|
|
+ List<string> pd_custpo = new List<string>();
|
|
|
+ List<string> pd_custprod = new List<string>();
|
|
|
+ DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode,ms_prodcode from MES_PACKAGE_VIEW left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode = '" + input.Text + "'", "select");
|
|
|
+
|
|
|
+ DataTable Cust = (DataTable)dh.ExecuteSql("select pd_outqty-nvl(pim_outqty,0)pd_outqty,pd_custprod,pd_custpodetno,PD_CUSTPO from prodiodetail left join prodinout on pd_piid=pi_id left join (select pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO,count(1)pim_outqty from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' group by pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO)on pim_inoutno=pi_inoutno and PIM_CUSTPO=PD_CUSTPO and PIM_CUSTDETNO=pd_custpodetno where pi_inoutno='" + pi_inoutno.Text + "' and pd_prodcode='" + datatable.Rows[0]["ms_prodcode"].ToString() + "' and pd_outqty-nvl(pim_outqty,0)>0 order by pd_pdno", "select");
|
|
|
+
|
|
|
+ List<int> custQtys = new List<int>();
|
|
|
+ List<string> custDetNos = new List<string>();
|
|
|
+ List<string> custPOs = new List<string>();
|
|
|
+ List<string> custProd = new List<string>();
|
|
|
+
|
|
|
+ foreach (DataRow row in Cust.Rows)
|
|
|
+ {
|
|
|
+ custQtys.Add(Convert.ToInt32(row["pd_outqty"]));
|
|
|
+ custDetNos.Add(row["pd_custpodetno"].ToString());
|
|
|
+ custProd.Add(row["pd_custprod"].ToString());
|
|
|
+ custPOs.Add(row["PD_CUSTPO"].ToString());
|
|
|
+ }
|
|
|
+
|
|
|
+ int totalRows = datatable.Rows.Count;
|
|
|
+ int currentIndex = 0; // 已填充的行索引
|
|
|
+ int custIdx = 0; // 当前使用的 Cust 行索引
|
|
|
+
|
|
|
+ // 按顺序分配,直到填满总行数或 Cust 用完
|
|
|
+ while (currentIndex < totalRows && custIdx < custQtys.Count)
|
|
|
+ {
|
|
|
+ int qty = custQtys[custIdx];
|
|
|
+ // 本次实际填充数量 = min(该行数量, 剩余需要填充的行数)
|
|
|
+ int fillCount = Math.Min(qty, totalRows - currentIndex);
|
|
|
+
|
|
|
+ for (int i = 0; i < fillCount; i++)
|
|
|
+ {
|
|
|
+ pd_custpodetno.Add(custDetNos[custIdx]);
|
|
|
+ pd_custpo.Add(custPOs[custIdx]);
|
|
|
+ pd_custprod.Add(custProd[custIdx]);
|
|
|
+ }
|
|
|
+ currentIndex += fillCount;
|
|
|
+ custIdx++;
|
|
|
+ }
|
|
|
+
|
|
|
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());
|
|
|
+ v_prodcode.Add(datatable.Rows[i]["ms_prodcode"].ToString());
|
|
|
}
|
|
|
+ dh.BatchInsert("update prodiomac set PIM_CUSTPO=:PIM_CUSTPO, PIM_CUSTDETNO=:PIM_CUSTDETNO, PIM_CUSTPRODCODE=:PIM_CUSTPRODCODE where pim_mac = :v_barcode and PIM_PRODCODE = :v_prodcode ", new string[] { "PIM_CUSTPO", "PIM_CUSTDETNO", "PIM_CUSTPRODCODE", "v_barcode", "v_prodcode" }, pd_custpo.ToArray(), pd_custpodetno.ToArray(), pd_custprod.ToArray(), v_barcode.ToArray(), v_prodcode.ToArray());
|
|
|
+
|
|
|
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 (int.Parse(pa_standardqty.Text) == datatable.Rows.Count)
|
|
|
@@ -668,13 +756,58 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
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");
|
|
|
+ List<string> v_prodcode = new List<string>();
|
|
|
+ List<string> pd_custpodetno = new List<string>();
|
|
|
+ List<string> pd_custpo = new List<string>();
|
|
|
+ List<string> pd_custprod = new List<string>();
|
|
|
+ DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode,ms_prodcode from MES_PACKAGE_VIEW left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode = '" + input.Text + "'", "select");
|
|
|
+
|
|
|
+ DataTable Cust = (DataTable)dh.ExecuteSql("select pd_outqty-nvl(pim_outqty,0)pd_outqty,pd_custprod,pd_custpodetno,PD_CUSTPO from prodiodetail left join prodinout on pd_piid=pi_id left join (select pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO,count(1)pim_outqty from prodiomac where pim_inoutno='" + pi_inoutno.Text+ "' group by pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO)on pim_inoutno=pi_inoutno and PIM_CUSTPO=PD_CUSTPO and PIM_CUSTDETNO=pd_custpodetno where pi_inoutno='"+pi_inoutno.Text+"' and pd_prodcode='"+ datatable.Rows[0]["ms_prodcode"].ToString() + "' and pd_outqty-nvl(pim_outqty,0)>0 order by pd_pdno", "select");
|
|
|
+
|
|
|
+ List<int> custQtys = new List<int>();
|
|
|
+ List<string> custDetNos = new List<string>();
|
|
|
+ List<string> custPOs = new List<string>();
|
|
|
+ List<string> custProd = new List<string>();
|
|
|
+
|
|
|
+ foreach (DataRow row in Cust.Rows)
|
|
|
+ {
|
|
|
+ custQtys.Add(Convert.ToInt32(row["pd_outqty"]));
|
|
|
+ custDetNos.Add(row["pd_custpodetno"].ToString());
|
|
|
+ custProd.Add(row["pd_custprod"].ToString());
|
|
|
+ custPOs.Add(row["PD_CUSTPO"].ToString());
|
|
|
+ }
|
|
|
+
|
|
|
+ int totalRows = datatable.Rows.Count;
|
|
|
+ int currentIndex = 0; // 已填充的行索引
|
|
|
+ int custIdx = 0; // 当前使用的 Cust 行索引
|
|
|
+
|
|
|
+ // 按顺序分配,直到填满总行数或 Cust 用完
|
|
|
+ while (currentIndex < totalRows && custIdx < custQtys.Count)
|
|
|
+ {
|
|
|
+ int qty = custQtys[custIdx];
|
|
|
+ // 本次实际填充数量 = min(该行数量, 剩余需要填充的行数)
|
|
|
+ int fillCount = Math.Min(qty, totalRows - currentIndex);
|
|
|
+
|
|
|
+ for (int i = 0; i < fillCount; i++)
|
|
|
+ {
|
|
|
+ pd_custpodetno.Add(custDetNos[custIdx]);
|
|
|
+ pd_custpo.Add(custPOs[custIdx]);
|
|
|
+ pd_custprod.Add(custProd[custIdx]);
|
|
|
+ }
|
|
|
+ currentIndex += fillCount;
|
|
|
+ custIdx++;
|
|
|
+ }
|
|
|
+
|
|
|
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());
|
|
|
+ v_prodcode.Add(datatable.Rows[i]["ms_prodcode"].ToString());
|
|
|
}
|
|
|
+ dh.BatchInsert("update prodiomac set PIM_CUSTPO=:PIM_CUSTPO, PIM_CUSTDETNO=:PIM_CUSTDETNO, PIM_CUSTPRODCODE=:PIM_CUSTPRODCODE where pim_mac = :v_barcode and PIM_PRODCODE = :v_prodcode ", new string[] { "PIM_CUSTPO", "PIM_CUSTDETNO", "PIM_CUSTPRODCODE", "v_barcode", "v_prodcode" }, pd_custpo.ToArray(), pd_custpodetno.ToArray(), pd_custprod.ToArray(), v_barcode.ToArray(), v_prodcode.ToArray());
|
|
|
+
|
|
|
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, "");
|
|
|
}
|
|
|
}
|