|
|
@@ -1577,16 +1577,35 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (DiffCustOutBoxCode.Checked)
|
|
|
{
|
|
|
+ //执行本地SQL,获取需要更新的DataCode
|
|
|
DataTable dt = (DataTable)sdh.ExecuteSql(BaseUtil.GetOutBoxSQL(OutFormat, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2, cu_print_outprod.Checked, cu_print_outpo.Checked, cu_print_outdc.Checked, cu_print_outlotno.Checked, cu_print_ordercode.Checked), "select");
|
|
|
+ //大于1行表示有需要分组的数据
|
|
|
if (dt.Rows.Count > 1)
|
|
|
{
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
GetCustRule();
|
|
|
string custoutboxcode = LogicHandler.BarcodeMethod1(Prefix, Suffix, SerialNumIndex, SerialNumLength, Radix);
|
|
|
- if (cu_print_outdc.Checked)
|
|
|
+ //勾选了这些参数并且打印的时候需要才进行更新
|
|
|
+ if (cu_print_outdc.Checked && dt.Columns.Contains("pib_datecode"))
|
|
|
{
|
|
|
- dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pib_datecode='" + dt.Rows[i]["pib_datecode"].ToString() + "'", "update");
|
|
|
+ dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pib_datecode='" + dt.Rows[i]["pib_datecode"].ToString() + "')", "update");
|
|
|
+ }
|
|
|
+ if (cu_print_outlotno.Checked && dt.Columns.Contains("pib_lotno"))
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pib_lotno='" + dt.Rows[i]["pib_lotno"].ToString() + "')", "update");
|
|
|
+ }
|
|
|
+ if (cu_print_ordercode.Checked && dt.Columns.Contains("pd_ordercode"))
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pd_ordercode='" + dt.Rows[i]["pd_ordercode"].ToString() + "')", "update");
|
|
|
+ }
|
|
|
+ if (cu_print_outprod.Checked && dt.Columns.Contains("pd_custprodcode"))
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pd_custprodcode='" + dt.Rows[i]["pd_custprodcode"].ToString() + "')", "update");
|
|
|
+ }
|
|
|
+ if (cu_print_outpo.Checked && dt.Columns.Contains("pd_pocode"))
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pd_pocode='" + dt.Rows[i]["pd_pocode"].ToString() + "')", "update");
|
|
|
}
|
|
|
dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
|
|
|
}
|