using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using UAS_MES.DataOperate; using UAS_MES.PublicMethod; namespace UAS_MES.Warehouse { public partial class Warehouse_FinishedProductOut : Form { DataTable dbfind; AutoSizeFormClass asc = new AutoSizeFormClass(); LogStringBuilder sql = new LogStringBuilder(); DataTable dt; DataHelper dh; public Warehouse_FinishedProductOut() { InitializeComponent(); } private void Warehouse_FinishedProductOut_Load(object sender, EventArgs e) { pi_inoutno.TableName = "prodinout"; pi_inoutno.DBTitle = "出货单查询"; pi_inoutno.SelectField = "pi_id # ID,pi_title # 客户名称,pi_inoutno # 出货单号,pi_type # 出货类型"; pi_inoutno.SetValueField = new string[] { "pi_title", "pi_inoutno", "pi_id" }; pi_inoutno.FormName = Name; pi_inoutno.Condition = "pi_pdastatus<>'已出库' and pi_class='出货单'"; pi_inoutno.DbChange += Pi_inoutno_DbChange; dh = new DataHelper(); asc.controllInitializeSize(this); } private void Pi_inoutno_DbChange(object sender, EventArgs e) { dbfind = pi_inoutno.ReturnData; BaseUtil.SetFormValue(this.Controls, dbfind); LoadFormData(); LoadGridData(); } /// /// j加载Form数据 /// private void LoadFormData() { sql.Clear(); sql.Append("select outqty,getqty,boxqty,outqty-getqty ungetqty from (select sum(pd_outqty) "); sql.Append("outqty,nvl((select count(1)cn from prodiomac where pim_inoutno=pd_inoutno),0) "); sql.Append("getqty,nvl(select sum(CASE WHEN pim_type='BOX' then 1 else nvl((select "); sql.Append("pa_packageqty from package where pa_outboxcode=pim_outboxcode),0)end) from prodiomac"); sql.Append("where pim_inoutno='233233' and NVL(PIM_OUTBOXCODE,' ')<>' ' AND pim_type "); sql.Append("in('BOX','PALLET')),0) boxqty from prodiodetail where pd_piid='" + pi_id.Text + "')"); dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select"); if (dt.Rows.Count > 0) { BaseUtil.SetFormValue(this.Controls, dt); } } /// /// 加载Grid数据 /// private void LoadGridData() { sql.Clear(); sql.Append("select pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac "); sql.Append("left join product on pr_code=pim_prodcode where pim_inoutno='" + pi_inoutno.Text + "'"); DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select"); BaseUtil.FillDgvWithDataTable(InOutDetailDGV, dt); } private void Warehouse_FinishedProductOut_SizeChanged(object sender, EventArgs e) { asc.controlAutoSize(this); } private void NewProdInOut_Click(object sender, EventArgs e) { Warehouse_NewPiInOut newpi = new Warehouse_NewPiInOut(); BaseUtil.SetFormCenter(newpi); newpi.ShowDialog(); } } }