|
@@ -221,34 +221,18 @@ namespace UAS_LabelMachine
|
|
|
ArrayList<string> barcode = new ArrayList<string>();
|
|
|
ArrayList<string> custbarcode = new ArrayList<string>();
|
|
|
int restqty1 = 0;
|
|
|
- int restqty2 = 0;
|
|
|
- int restqty3 = 0;
|
|
|
- if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "0")
|
|
|
+ if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
|
|
|
{
|
|
|
- string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+1", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
|
|
|
- int.TryParse(ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString(), out restqty1);
|
|
|
- barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
- custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
|
|
|
- midcode.Add(mid_code);
|
|
|
- pib_inqty.Add(restqty1.ToString());
|
|
|
- }
|
|
|
- if (ProdIoInfDGV.Rows[i].Cells["pib_restqty2"].Value.ToString() != "0")
|
|
|
- {
|
|
|
- string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+1", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
|
|
|
- int.TryParse(ProdIoInfDGV.Rows[i].Cells["pib_restqty2"].Value.ToString(), out restqty2);
|
|
|
- barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
- custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
|
|
|
- midcode.Add(mid_code);
|
|
|
- pib_inqty.Add(restqty2.ToString());
|
|
|
- }
|
|
|
- if (ProdIoInfDGV.Rows[i].Cells["pib_restqty3"].Value.ToString() != "0")
|
|
|
- {
|
|
|
- string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+1", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
|
|
|
- int.TryParse(ProdIoInfDGV.Rows[i].Cells["pib_restqty3"].Value.ToString(), out restqty3);
|
|
|
- barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
- custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
|
|
|
- midcode.Add(mid_code);
|
|
|
- pib_inqty.Add(restqty3.ToString());
|
|
|
+ string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
|
|
|
+ for (int k = 0; k < restqty.Length; k++)
|
|
|
+ {
|
|
|
+ string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+1", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
|
|
|
+ int.TryParse(restqty[k], out restqty1);
|
|
|
+ barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
+ custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
|
|
|
+ midcode.Add(mid_code);
|
|
|
+ pib_inqty.Add(restqty1.ToString());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
for (int j = 0; j < mid_num; j++)
|
|
@@ -284,10 +268,10 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_CUSTBARCODE,PIB_PDNO,");
|
|
|
- sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,PIB_PRODID,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO,pib_orderdetno)");
|
|
|
+ sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,PIB_PRODID,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO,pib_orderdetno)");
|
|
|
sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "',sysdate,'" + pi_inoutno.Text + "'," + pi_id + ",'" + pr_brand + "',:barcode,:custbarcode,'" + pd_pdno + "','" + pd_id + "',");
|
|
|
- sql.Append("'" + pi_class.Text + "',:pib_inqty,'" + pr_id + "',:midcode,0,0,'" + pd_ordercode + "','','" + pd_orderdetno + "')");
|
|
|
- dh.BatchInsert(sql.ToString(), new string[] { "barcode", "custbarcode", "pib_inqty", "midcode" }, barcode.ToArray(), custbarcode.ToArray(), pib_inqty.ToArray(), midcode.ToArray());
|
|
|
+ sql.Append("'" + pi_class.Text + "',:pib_inqty,'" + pr_id + "',0,0,'" + pd_ordercode + "','','" + pd_orderdetno + "')");
|
|
|
+ dh.BatchInsert(sql.ToString(), new string[] { "barcode", "custbarcode", "pib_inqty", "midcode" }, barcode.ToArray(), custbarcode.ToArray(), pib_inqty.ToArray());
|
|
|
|
|
|
dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
|
|
|
}
|
|
@@ -384,7 +368,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position));
|
|
|
if (e.ColumnIndex > 0)
|
|
|
- if (ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pr_zxbzs" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pd_qty" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "mid_qty" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pib_restqty1" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pib_restqty2" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pib_restqty3")
|
|
|
+ if (ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pr_zxbzs" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pd_qty" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "mid_qty" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pib_restqty1")
|
|
|
{
|
|
|
SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
|
|
|
e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);
|
|
@@ -408,19 +392,15 @@ namespace UAS_LabelMachine
|
|
|
object mid_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_qty"].Value;
|
|
|
object pd_totalqty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_totalqty"].Value;
|
|
|
int restqty1 = 0;
|
|
|
- int restqty2 = 0;
|
|
|
- int restqty3 = 0;
|
|
|
- if (ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString() != "0")
|
|
|
- {
|
|
|
- int.TryParse(ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString(), out restqty1);
|
|
|
- }
|
|
|
- if (ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty2"].Value.ToString() != "0")
|
|
|
+ if (ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString() != "")
|
|
|
{
|
|
|
- int.TryParse(ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty2"].Value.ToString(), out restqty2);
|
|
|
- }
|
|
|
- if (ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty3"].Value.ToString() != "0")
|
|
|
- {
|
|
|
- int.TryParse(ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty3"].Value.ToString(), out restqty3);
|
|
|
+ string[] restqty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString().Split(',');
|
|
|
+ for (int k = 0; k < restqty.Length; k++)
|
|
|
+ {
|
|
|
+ int qty = 0;
|
|
|
+ int.TryParse(restqty[k], out qty);
|
|
|
+ restqty1 += qty;
|
|
|
+ }
|
|
|
}
|
|
|
if (pr_zxbzs != null && pd_qty != null && mid_qty != null)
|
|
|
{
|
|
@@ -441,36 +421,32 @@ namespace UAS_LabelMachine
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- int mid_num = (本次数量 - restqty1 - restqty2 - restqty3) / (最小包装量 * 中盘容量);
|
|
|
+ int mid_num = (本次数量 - restqty1) / (最小包装量 * 中盘容量);
|
|
|
|
|
|
- if (((本次数量 - restqty1 - restqty2 - restqty3)) % (最小包装量 * 中盘容量) == 0)
|
|
|
+ if (((本次数量 - restqty1)) % (最小包装量 * 中盘容量) == 0)
|
|
|
ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_num"].Value = mid_num;
|
|
|
else
|
|
|
ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_num"].Value = mid_num + 1;
|
|
|
- ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_remain"].Value = 本次数量 - restqty1 - restqty2 - restqty3 - mid_num * 最小包装量 * 中盘容量;
|
|
|
+ ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_remain"].Value = 本次数量 - restqty1 - mid_num * 最小包装量 * 中盘容量;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
private void SetMidCapacity_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
for (int i = 0; i < ProdIoInfDGV.Rows.Count; i++)
|
|
|
{
|
|
|
int restqty1 = 0;
|
|
|
- int restqty2 = 0;
|
|
|
- int restqty3 = 0;
|
|
|
- if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "0")
|
|
|
+ if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
|
|
|
{
|
|
|
- int.TryParse(ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString(), out restqty1);
|
|
|
- }
|
|
|
- if (ProdIoInfDGV.Rows[i].Cells["pib_restqty2"].Value.ToString() != "0")
|
|
|
- {
|
|
|
- int.TryParse(ProdIoInfDGV.Rows[i].Cells["pib_restqty2"].Value.ToString(), out restqty2);
|
|
|
- }
|
|
|
- if (ProdIoInfDGV.Rows[i].Cells["pib_restqty3"].Value.ToString() != "0")
|
|
|
- {
|
|
|
- int.TryParse(ProdIoInfDGV.Rows[i].Cells["pib_restqty3"].Value.ToString(), out restqty3);
|
|
|
+ string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
|
|
|
+ for (int k = 0; k < restqty.Length; k++)
|
|
|
+ {
|
|
|
+ int qty = 0;
|
|
|
+ int.TryParse(restqty[k], out qty);
|
|
|
+ restqty1 += qty;
|
|
|
+ }
|
|
|
}
|
|
|
ProdIoInfDGV.Rows[i].Cells["mid_qty"].Value = MidCapacity.Text;
|
|
|
if (ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].Value.ToString() != "" && ProdIoInfDGV.Rows[i].Cells["pd_qty"].Value.ToString() != "" && ProdIoInfDGV.Rows[i].Cells["mid_qty"].Value.ToString() != "" && ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].Value.ToString() != "0")
|
|
@@ -486,13 +462,13 @@ namespace UAS_LabelMachine
|
|
|
int 本次数量 = int.Parse(pd_qty.ToString());
|
|
|
int 总数 = int.Parse(pd_totalqty.ToString());
|
|
|
|
|
|
- int mid_num = (本次数量 - restqty1 - restqty2 - restqty3) / (最小包装量 * 中盘容量);
|
|
|
+ int mid_num = (本次数量 - restqty1) / (最小包装量 * 中盘容量);
|
|
|
|
|
|
- if (((本次数量 - restqty1 - restqty2 - restqty3)) % (最小包装量 * 中盘容量) == 0)
|
|
|
+ if (((本次数量 - restqty1)) % (最小包装量 * 中盘容量) == 0)
|
|
|
ProdIoInfDGV.Rows[i].Cells["mid_num"].Value = mid_num;
|
|
|
else
|
|
|
ProdIoInfDGV.Rows[i].Cells["mid_num"].Value = mid_num + 1;
|
|
|
- ProdIoInfDGV.Rows[i].Cells["mid_remain"].Value = (本次数量 - restqty1 - restqty2 - restqty3) - mid_num * 最小包装量 * 中盘容量;
|
|
|
+ ProdIoInfDGV.Rows[i].Cells["mid_remain"].Value = (本次数量 - restqty1) - mid_num * 最小包装量 * 中盘容量;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -511,7 +487,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
dt = (DataTable)dh.ExecuteSql("select ds_inorout from documentsetup where ds_name='" + pi_class.Text + "'", "select");
|
|
|
sql.Clear();
|
|
|
- sql.Append("select 0 pib_restqty1,0 pib_restqty2,0 pib_restqty3,pd_piid,pd_id,pr_id,pr_brand,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty pd_totalqty,pd_ordercode,pd_orderdetno,pd_pdno, ");
|
|
|
+ sql.Append("select '' pib_restqty1,pd_piid,pd_id,pr_id,pr_brand,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty pd_totalqty,pd_ordercode,pd_orderdetno,pd_pdno, ");
|
|
|
sql.Append("pd_prodcode,pd_piclass,pd_qty from (select pd_piid,pd_id,pr_id,pr_brand,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty,pd_ordercode,pd_orderdetno,pd_pdno,pd_prodcode,pd_piclass,");
|
|
|
sql.Append("outqty-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID=pd_piid and pib_pdno=pd_pdno),0)pd_qty from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty, ");
|
|
|
sql.Append("pd_ordercode,pd_orderdetno,pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass from prodiodetail where pd_piclass='出货单' group by pd_piid,pd_ordercode,pd_orderdetno,pd_pdno)T ");
|