|
|
@@ -76,27 +76,43 @@ namespace UAS_MES.Warehouse
|
|
|
{
|
|
|
BaseUtil.SetFormValue(this.Controls, dtpi);
|
|
|
}
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select nvl((select sum(pd_outqty) from prodiodetail where pd_piid="+pi_id.Text+"),0)outqty,nvl((select count(1)cn from prodiomac where pim_inoutno=pd_inoutno),0) getqty ");
|
|
|
- sql.Append(" from prodiodetail where pd_piid='" + pi_id.Text + "' ");
|
|
|
- dtform = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dtform.Rows.Count > 0)
|
|
|
- {
|
|
|
- int boxqtycount = 0;
|
|
|
- BaseUtil.SetFormValue(this.Controls, dtform);
|
|
|
- ungetqty.Text = (int.Parse(dtform.Rows[0]["outqty"].ToString()) - int.Parse(dtform.Rows[0]["getqty"].ToString())).ToString();
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select pim_type,pim_outboxcode from prodiomac where pim_inoutno='"+pi_inoutno.Text+ "' and NVL(PIM_OUTBOXCODE,' ')<>' ' AND pim_type ='BOX' GROUP BY pim_outboxcode,pim_type");
|
|
|
- DataTable dtout = (DataTable)dh.ExecuteSql(sql.GetString(),"select");
|
|
|
- boxqtycount += dtout.Rows.Count;
|
|
|
- boxqtycount += int.Parse(dh.getFieldDataByCondition("package", "nvl(sum(pa_packageqty),0)", " pa_outboxcode in (select pim_outboxcode from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and NVL(PIM_OUTBOXCODE,' ')<>' ' AND pim_type ='PALLET' GROUP BY pim_outboxcode)").ToString());
|
|
|
- boxqty.Text = boxqtycount.ToString();
|
|
|
- }
|
|
|
+
|
|
|
if (pi_type.Text == "按订单出货")
|
|
|
{
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select nvl((select sum(pd_outqty) from prodiodetail where pd_piid=" + pi_id.Text + "),0)outqty,nvl((select count(1)cn from prodiomac where pim_inoutno=pd_inoutno),0) getqty ");
|
|
|
+ sql.Append(" from prodiodetail where pd_piid='" + pi_id.Text + "' ");
|
|
|
+ dtform = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dtform.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ int boxqtycount = 0;
|
|
|
+ BaseUtil.SetFormValue(this.Controls, dtform);
|
|
|
+ ungetqty.Text = (int.Parse(dtform.Rows[0]["outqty"].ToString()) - int.Parse(dtform.Rows[0]["getqty"].ToString())).ToString();
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pim_type,pim_outboxcode from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and NVL(PIM_OUTBOXCODE,' ')<>' ' AND pim_type ='BOX' GROUP BY pim_outboxcode,pim_type");
|
|
|
+ DataTable dtout = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ boxqtycount += dtout.Rows.Count;
|
|
|
+ boxqtycount += int.Parse(dh.getFieldDataByCondition("package", "nvl(sum(pa_packageqty),0)", " pa_outboxcode in (select pim_outboxcode from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and NVL(PIM_OUTBOXCODE,' ')<>' ' AND pim_type ='PALLET' GROUP BY pim_outboxcode)").ToString());
|
|
|
+ boxqty.Text = boxqtycount.ToString();
|
|
|
+ }
|
|
|
pi_type_check.Checked = true;
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select count(1)getqty from prodiomac where pim_inoutno = '" + pi_inoutno.Text + "'");
|
|
|
+ dtform = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dtform.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ int boxqtycount = 0;
|
|
|
+ BaseUtil.SetFormValue(this.Controls, dtform);
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pim_type,pim_outboxcode from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and NVL(PIM_OUTBOXCODE,' ')<>' ' AND pim_type ='BOX' GROUP BY pim_outboxcode,pim_type");
|
|
|
+ DataTable dtout = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ boxqtycount += dtout.Rows.Count;
|
|
|
+ boxqtycount += int.Parse(dh.getFieldDataByCondition("package", "nvl(sum(pa_packageqty),0)", " pa_outboxcode in (select pim_outboxcode from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and NVL(PIM_OUTBOXCODE,' ')<>' ' AND pim_type ='PALLET' GROUP BY pim_outboxcode)").ToString());
|
|
|
+ boxqty.Text = boxqtycount.ToString();
|
|
|
+ }
|
|
|
pi_type_check.Checked = false;
|
|
|
}
|
|
|
}
|
|
|
@@ -288,7 +304,7 @@ namespace UAS_MES.Warehouse
|
|
|
OperateResult.AppendText("序列号" + input.Text + "处于下地状态,不允许出货\n", Color.Red, input);
|
|
|
return;
|
|
|
}
|
|
|
- if (dtms.Rows[0]["ms_iostatus"].ToString() != "0")
|
|
|
+ if (dtms.Rows[0]["ms_iostatus"].ToString() != "1")
|
|
|
{
|
|
|
OperateResult.AppendText("序列号" + input.Text + "已经被出货单:" + dh.getFieldDataByCondition("makeserial left JOIN prodiomac on pim_mac=ms_sncode", "pim_inoutno", "ms_id='" + ms_id + "' order by pim_indate desc").ToString() + "出货\n", Color.Red, input);
|
|
|
return;
|