//選取委外合同 private void btn_SelectProduceOther_Click(object sender, EventArgs e) { ProduceOtherCompact.ChooseOutContract f = new Book.UI.produceManager.ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) == DialogResult.OK) { foreach (var item in f.key) { Model.PCFlameRetardantDetail detail = new Book.Model.PCFlameRetardantDetail(); detail.PCFlameRetardantDetailId = Guid.NewGuid().ToString(); detail.Number = this._pCFlameRetardant.Details.Count + 1; detail.Product = item.Product; detail.ProductId = item.ProductId; detail.EmployeeId = BL.V.ActiveOperator.EmployeeId; detail.InvoiceXOId = item.ProduceOtherCompact.InvoiceXOId; detail.ProduceOtherCompactId = item.ProduceOtherCompactId; if (string.IsNullOrEmpty(this.Pihao)) { Model.InvoiceXO xo = invoiceXOManager.Get(detail.InvoiceXOId); if (xo != null) { detail.Pihao = xo.CustomerLotNumber; } } else { detail.Pihao = this.Pihao; } this._pCFlameRetardant.Details.Add(detail); } this.gridControl1.RefreshDataSource(); } }
//选择采购单 private void btn_SelectCO_Click(object sender, EventArgs e) { Invoices.CG.CGForm form = new Book.UI.Invoices.CG.CGForm(); if (form.ShowDialog() == DialogResult.OK) { if (form.key.Count == 0) { return; } foreach (var item in form.key) { Model.PCFlameRetardantDetail detail = new Book.Model.PCFlameRetardantDetail(); detail.PCFlameRetardantDetailId = Guid.NewGuid().ToString(); detail.Number = this._pCFlameRetardant.Details.Count + 1; detail.Product = item.Product; detail.ProductId = item.ProductId; detail.EmployeeId = BL.V.ActiveOperator.EmployeeId; detail.InvoiceXOId = item.Invoice.InvoiceXOId; detail.InvoiceCOId = item.InvoiceId; if (string.IsNullOrEmpty(this.Pihao)) { Model.InvoiceXO xo = invoiceXOManager.Get(detail.InvoiceXOId); if (xo != null) { detail.Pihao = xo.CustomerLotNumber; } } else { detail.Pihao = this.Pihao; } this._pCFlameRetardant.Details.Add(detail); } this.gridControl1.RefreshDataSource(); } form.Dispose(); GC.Collect(); }
private void btn_Add_Click(object sender, EventArgs e) { Invoices.ChooseProductForm f = new Invoices.ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (Invoices.ChooseProductForm.ProductList != null && Invoices.ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in Invoices.ChooseProductForm.ProductList) { Model.PCFlameRetardantDetail detail = new Book.Model.PCFlameRetardantDetail(); detail.PCFlameRetardantDetailId = Guid.NewGuid().ToString(); detail.Number = this._pCFlameRetardant.Details.Count + 1; detail.Product = product; detail.ProductId = product.ProductId; detail.EmployeeId = BL.V.ActiveOperator.EmployeeId; detail.Pihao = this.Pihao; this._pCFlameRetardant.Details.Add(detail); this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail); } } else if (Invoices.ChooseProductForm.ProductList == null || Invoices.ChooseProductForm.ProductList.Count == 0) { Model.PCFlameRetardantDetail detail = new Book.Model.PCFlameRetardantDetail(); detail.PCFlameRetardantDetailId = Guid.NewGuid().ToString(); detail.Number = this._pCFlameRetardant.Details.Count + 1; detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.EmployeeId = BL.V.ActiveOperator.EmployeeId; detail.Pihao = this.Pihao; this._pCFlameRetardant.Details.Add(detail); this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail); } this.gridControl1.RefreshDataSource(); } }