//private void AddDataRows() //{ // Model.PCOtherCheckDetail pcocDetail = new Book.Model.PCOtherCheckDetail(); // pcocDetail.PCOtherCheckDetailId = Guid.NewGuid().ToString(); // pcocDetail.PCOtherCheckId = this._PCOtherCheck.PCOtherCheckId; // this._PCOtherCheck.Detail.Add(pcocDetail); // this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(pcocDetail); //} #endregion //选择采购入库单据 private void btnSelectCaiGou_Click(object sender, EventArgs e) { Book.UI.Invoices.CG.SearchCGDetail cgform = new Book.UI.Invoices.CG.SearchCGDetail(); if (cgform.ShowDialog() == DialogResult.OK) { if (cgform.selectItems.Count > 0) { BL.InvoiceCOManager mCOM = new Book.BL.InvoiceCOManager(); //Model.InvoiceCO co = cgform.Invoice; //清空数据 if (this._PCOtherCheck.FromPCType < 0) { this._PCOtherCheck.Detail.Clear(); } this._PCOtherCheck.FromPCType = 1; //this.lcDanJuId.Text = "採購入庫單編號:"; //对控件进行赋值 //this.textInvoiceCusXOId.Text = mCOM.Get(cgform.selectItems[0].InvoiceCOId) == null ? "" : mCOM.Get(cgform.selectItems[0].InvoiceCOId).InvoiceCustomXOId;//客户订单编号 this.Ncc_Supplier.EditValue = cgform.selectItems[0].Invoice == null ? null : cgform.selectItems[0].Invoice.Supplier;//厂商 //this.textInvoiceCusXOId.Text = cgform.key[0].Invoice.InvoiceCustomXOId; //客户订单编号 //this.Ncc_Supplier.EditValue = cgform.key[0].Invoice.Supplier; //厂商 Model.InvoiceCO co = new Book.Model.InvoiceCO(); foreach (Model.InvoiceCGDetail item in cgform.selectItems) { Model.PCOtherCheckDetail detail = new Model.PCOtherCheckDetail(); //详细 detail.PCOtherCheckDetailId = Guid.NewGuid().ToString(); //详细本身编号 detail.PCOtherCheckId = this._PCOtherCheck.PCOtherCheckId; //头编号 detail.FromInvoiceDetailID = item.InvoiceCGDetailId; //来源详细本身编号 detail.FromInvoiceID = item.InvoiceId; //来源详细头编号 detail.ProceduresId = null; //工序编号 detail.Procedures = null; //加工 detail.ProductId = item.ProductId; //商品编号 detail.Product = item.Product; //品名 detail.PCOtherCheckDetailDesc = item.Product == null ? "" : item.Product.ProductDescription; //说明 detail.PCOtherCheckDetailQuantity = 0; //数量 detail.ProductUnit = item.InvoiceProductUnit; //单位 co = mCOM.Get(item.InvoiceCOId); if (co == null) { detail.PerspectiveRate = ""; detail.DeliveryDate = null; } else { try { detail.PerspectiveRate = co.Customer == null ? "" : mCOM.Get(cgform.selectItems[0].InvoiceCOId).Customer.CheckedStandard;//透视率 } catch { detail.PerspectiveRate = ""; } detail.DeliveryDate = co.InvoiceYjrq;//交期 } detail.InQuantity = item.InvoiceCGDetailQuantity; //进厂数量 detail.OutQuantity = 0; //出厂数量 detail.Determinant = ""; //判定 detail.PCOtherCheckDetailFromPC = "1"; //来源于 采购入库订单 //客户订单编号 detail.InvoiceCusXOId = co == null ? "" : co.InvoiceCustomXOId; this._PCOtherCheck.Detail.Add(detail); } this.gridControl1.RefreshDataSource(); } } cgform.Dispose(); GC.Collect(); }
public EditForm(IList <Model.InvoiceCGDetail> list) : this() { this.AddNew(); BL.InvoiceCOManager mCOM = new Book.BL.InvoiceCOManager(); this._PCOtherCheck.FromPCType = 1; //this.Ncc_Supplier.EditValue = list[0].Invoice == null ? null : list[0].Invoice.Supplier;//厂商 this._PCOtherCheck.Supplier = list[0].Invoice == null ? null : list[0].Invoice.Supplier; //this.textInvoiceCusXOId.Text = cgform.key[0].Invoice.InvoiceCustomXOId; //客户订单编号 //this.Ncc_Supplier.EditValue = cgform.key[0].Invoice.Supplier; //厂商 Model.InvoiceCO co = new Book.Model.InvoiceCO(); foreach (Model.InvoiceCGDetail item in list) { Model.PCOtherCheckDetail detail = new Model.PCOtherCheckDetail(); //详细 detail.PCOtherCheckDetailId = Guid.NewGuid().ToString(); //详细本身编号 detail.PCOtherCheckId = this._PCOtherCheck.PCOtherCheckId; //头编号 detail.FromInvoiceDetailID = item.InvoiceCGDetailId; //来源详细本身编号 detail.FromInvoiceID = item.InvoiceId; //来源详细头编号 detail.PCOtherCheckDetailDesc1 = item.InvoiceCOId; detail.ProceduresId = null; //工序编号 detail.Procedures = null; //加工 detail.ProductId = item.ProductId; //商品编号 detail.Product = item.Product; //品名 //detail.PCOtherCheckDetailDesc = item.Product == null ? "" : item.Product.ProductDescription;//说明 detail.PCOtherCheckDetailQuantity = 0; //数量 detail.ProductUnit = item.InvoiceProductUnit; //单位 co = mCOM.Get(item.InvoiceCOId); if (co == null) { detail.PerspectiveRate = ""; detail.DeliveryDate = null; } else { try { detail.PerspectiveRate = co.Customer == null ? "" : mCOM.Get(list[0].InvoiceCOId).Customer.CheckedStandard;//透视率 } catch { detail.PerspectiveRate = ""; } detail.DeliveryDate = co.InvoiceYjrq;//交期 } detail.InQuantity = item.InvoiceCGDetailQuantity; //进厂数量 detail.OutQuantity = 0; //出厂数量 detail.Determinant = ""; //判定 detail.PCOtherCheckDetailFromPC = "1"; //来源于 采购入库订单 //客户订单编号 detail.InvoiceCusXOId = co == null ? "" : co.InvoiceCustomXOId; this._PCOtherCheck.Detail.Add(detail); } this.tag = 1; this.action = "insert"; }