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 Core.Mes.Client.Comm.Control; using Pur.configure; using Pur.Entity; using Pur.Entity.configureEntity; using Pur.PublicTools; namespace Pur.require_plan { public partial class FrmPurRequireProcessQuery : FrmPmsBase { private string req_org_id = ""; public FrmPurRequireProcessQuery() { InitializeComponent(); } private void FrmPurRequireProcessQuery_Load(object sender, EventArgs e) { GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { }); PurmatclassEntity mat = new PurmatclassEntity(); mat.DeleteUserid = "1"; mat.DeleteName = "1"; ck_instock.Checked = true; ck_isNotice.Checked = true; DataTable dt2 = this.execute("com.hnshituo.pur.configure.service.MatClassService", "getMatClass", new object[] { mat }); publicPms.FilComboboxAdd(txt_ItemClass, dt2, "baseCode", "baseName", "", true, "/", ""); txt_ItemClass.SelectedIndex = 0; PhysicSeatEntity Phouse = new PhysicSeatEntity(); Phouse.Validflag = "1"; Phouse.DeleteUserid = "1"; DataTable dt3 = this.execute("com.hnshituo.pur.configure.service.ActualSeatService", "getActualSeat", new object[] { Phouse, 0, 0 }); publicPms.FilComboboxAdd(txt_InvPhysic, dt3, "INVPHYSIC", "INVPHYSICNAME", "", true, "/", ""); txt_InvPhysic.SelectedIndex = 0; txt_REQ_ORG.Text = UserInfo.GetDepartment(); req_org_id = UserInfo.GetDeptid(); } private void txt_REQ_ORG_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { frmdepartment frm = new frmdepartment(this.ob); //frm.StartPosition = FormStartPosition.Manual; //frm.Location = publicPms.getShowLocation(frm); frm.ShowDialog(); String strdeptId = frm.BuyerUnitCode; String strDeptName = frm.Fulltext; txt_REQ_ORG.Text = strDeptName; req_org_id = strdeptId; } /// /// toolbar /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey)//菜单toolbar按钮 { switch (ToolbarKey) { case "Query": getUserPlan(); break; case "Quit"://退出 this.Close(); break; case "doExcel"://退出 //doExcel(); break; } } private void getUserPlan() { dataSet1.Clear(); EntityPurPlanD pd = new EntityPurPlanD(); pd.UpdateName = req_org_id; if (txt_ItemClass.SelectedIndex != -1 && txt_ItemClass.SelectedIndex != 0) { pd.ItemDescE = txt_ItemClass.Value.ToString().Trim(); } if (txt_InvPhysic.SelectedIndex != -1 && txt_InvPhysic.SelectedIndex != 0) { pd.DeleteName = txt_InvPhysic.Value.ToString().Trim(); } pd.ItemCode = txt_itemCode.Text.Trim(); pd.ItemName = txt_itemName.Text.Trim(); pd.ItemDesc = txt_mrId.Text.Trim(); pd.DeleteUserid = ck_instock.Checked == true ? "1" : "0"; pd.UpdateUserid = ck_isNotice.Checked == true ? "1" : "0"; DataTable dt = this.execute("com.hnshituo.pur.purplan.service.PurPlanDService", "getCanOutBillPlanRe", new object[] { pd }); GridHelper.CopyDataToDatatable(dt, dataTable1, true); foreach (DataRow rowq in dataTable1.Rows) { double QtyPur = 0; double QtyInstock = 0; double QtyReq = 0; double QtyUse = 0; double QtyWill = 0; double.TryParse(rowq["qty"].ToString(), out QtyPur);//采购计划数量 double.TryParse(rowq["qtyYcUseable"].ToString(), out QtyInstock);//库存量 double.TryParse(rowq["qtyYc"].ToString(), out QtyReq);//通知发货量---生产厂 double.TryParse(rowq["qtyYcUsed"].ToString(), out QtyUse);//已经领用量(所有部门) double.TryParse(rowq["QTYPURED"].ToString(), out QtyWill);//待领用量(所有部门) double canUseQty = QtyInstock;//-----供应部可全部编制 canUseQty = Math.Min(Math.Min(QtyPur, (QtyInstock - QtyWill)), (QtyReq - QtyUse - QtyWill));//------生产厂只能部分编制 if (canUseQty <= 0) { rowq["canUseQty"] = 0; } else { rowq["canUseQty"] = canUseQty; } if (rowq["itemuom"].ToString() == "基吨") { rowq["itemuom"] = "吨"; } } GridHelper.RefreshAndAutoSize(ultraGrid1); } } }