void btnAdd_Click(object sender, EventArgs e) { if (this.ValidateData() == false) { return; } this.SetComputeControl(false); while (this.tabMain.TabCount > 1) { this.tabMain.TabPages.RemoveAt(1); } FrmMsg.Show("正在计算物料....."); CtrlOutSrcSupplyRequireOper ctrlRequire; TabPage page; foreach (DataRow drow in this.dtblOrderItems.Rows) { Application.DoEvents(); if (drow["ManufQty"] == DBNull.Value) { continue; } ctrlRequire = new CtrlOutSrcSupplyRequireOper(); ctrlRequire.New((long)drow["ItemID"], (decimal)drow["ManufQty"]); ctrlRequire.Dock = DockStyle.Fill; page = new TabPage(); page.Text = drow["PONo"].ToString() + "[" + string.Format("{0:0.####}", drow["ManufQty"]) + "]"; page.Controls.Add(ctrlRequire); this.tabMain.TabPages.Add(page); this.ctrlOutSrcSupplyItemOper.AppendItems(ctrlRequire.GetItems(), true); } FrmMsg.Hide(); }
private void LoadItems() { DataTable dtblTmp = this.accSupplyPlans.GetDataOutSrcSupplyPlansByNoteID(NoteID).Tables[0]; this.dtblOrderItems = this.accOrderItems.GetDataOutSrcOrderItemsForSupplyBOM(CompanyID, this.NoteID).Tables[0]; this.dtblOrderItems.Columns.Add("ManufQty", typeof(decimal)); while (this.tabMain.TabCount > 1) { this.tabMain.TabPages.RemoveAt(1); } DataRow[] drowItems; CtrlOutSrcSupplyRequireOper ctrlRequire; TabPage page; foreach (DataRow drowTmp in dtblTmp.Rows) { drowItems = this.dtblOrderItems.Select("ItemID=" + drowTmp["OutSrcOrderItemID"].ToString()); if (drowItems.Length > 0) { drowItems[0]["ManufQty"] = drowTmp["Quantity"]; drowItems[0]["BOMNonFinishedQty"] = (decimal)drowTmp["Quantity"] + (decimal)drowItems[0]["BOMNonFinishedQty"]; } ctrlRequire = new CtrlOutSrcSupplyRequireOper(); ctrlRequire.Edit((long)drowTmp["OutSrcSupplyPlanID"]); ctrlRequire.Dock = DockStyle.Fill; page = new TabPage(); page.Text = drowTmp["PONo"].ToString() + "[" + string.Format("{0:0.####}", drowTmp["Quantity"]) + "]"; page.Controls.Add(ctrlRequire); this.tabMain.TabPages.Add(page); } this.dgrdvOrder.DataSource = this.dtblOrderItems; this.ctrlOutSrcSupplyItemOper.CompanyID = CompanyID; this.ctrlOutSrcSupplyItemOper.ClearItems(); this.ctrlOutSrcSupplyItemOper.Edit(this.NoteID); }