|
@@ -368,7 +368,24 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
{
|
|
|
//如果不是新增插入当前外箱的自定义编号
|
|
//如果不是新增插入当前外箱的自定义编号
|
|
|
CustOutBoxCode = dh.getFieldDataByCondition("prodiobarcode", "pib_custoutboxcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + OutBoxNum.Text + "'").ToString();
|
|
CustOutBoxCode = dh.getFieldDataByCondition("prodiobarcode", "pib_custoutboxcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + OutBoxNum.Text + "'").ToString();
|
|
|
- pib_outboxcode2 = OutBoxNum.Text;
|
|
|
|
|
|
|
+ if (CustOutBoxCode == "")
|
|
|
|
|
+ {
|
|
|
|
|
+ string maxoutbox = dh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode2)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
|
|
|
|
|
+ //如果没有则从开始插入
|
|
|
|
|
+ if (maxoutbox == "")
|
|
|
|
|
+ {
|
|
|
|
|
+ pib_outboxcode2 = "1";
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ pib_outboxcode2 = (int.Parse(maxoutbox) + 1).ToString();
|
|
|
|
|
+ }
|
|
|
|
|
+ OutBoxNum.Text = "新增";
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ pib_outboxcode2 = OutBoxNum.Text;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
//计算当前采集数量
|
|
//计算当前采集数量
|
|
|
string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
|
|
string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
|
|
@@ -1803,5 +1820,30 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void OutBoxNum_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
+ {
|
|
|
|
|
+ AllChecked = false;
|
|
|
|
|
+ sql.Clear();
|
|
|
|
|
+ sql.Append("select pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,pib_datecode1,pib_pdid,pib_piid,");
|
|
|
|
|
+ sql.Append("pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand,pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,");
|
|
|
|
|
+ sql.Append("pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join ");
|
|
|
|
|
+ sql.Append("prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode ");
|
|
|
|
|
+ sql.Append("left join sale on sa_code=pib_ordercode where pib_piid='" + PI_ID + "' and pib_outboxcode2='" + OutBoxNum.Text + "' order by to_number(pib_outboxcode2),pib_id,pd_prodcode");
|
|
|
|
|
+ LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
|
|
+ BaseUtil.FillDgvWithDataTable(LabelInf, LabelInfDataTable);
|
|
|
|
|
+ //有数据的话默认取第一条的品牌去取采集策略
|
|
|
|
|
+ if (LabelInf.Rows.Count > 0)
|
|
|
|
|
+ LabelInf.FirstDisplayedScrollingRowIndex = LabelInf.Rows.Count - 1;
|
|
|
|
|
+ //计算所有的采集数量
|
|
|
|
|
+ for (int i = 0; i < GridPrcode.Rows.Count; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ string CurrentPrCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
|
|
|
|
|
+ string CurrentPDNO = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
|
|
|
|
|
+ string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
|
|
|
|
|
+ GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty;
|
|
|
|
|
+ GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = int.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - int.Parse(collectqty == "" ? "0" : collectqty);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|