private void AddDataRows() { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { Model.PCPGOnlineCheckDetail detail = null; foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.PCPGOnlineCheckDetail(); detail.PCPGOnlineCheckDetailId = Guid.NewGuid().ToString(); detail.PCPGOnlineCheckId = this._pcpgoc.PCPGOnlineCheckId; detail.Product = new BL.ProductManager().Get(product.ProductId); detail.ProductId = product.ProductId; detail.PCPGOnlineCheckDetailDate = DateTime.Now; detail.PCPGOnlineCheckDetailTime = DateTime.Now; this._pcpgoc.Details.Add(detail); } this.bsPCPGOnlineCheckDetail.Position = this.bsPCPGOnlineCheckDetail.IndexOf(detail); this.gridControl1.RefreshDataSource(); } } f.Dispose(); System.GC.Collect(); }
private void btn_AutoClean_Click(object sender, EventArgs e) { List <PropertyInfo> listProInfo = new List <PropertyInfo>(); foreach (CheckedListBoxItem item in this.ccob_AutoFillColumn.Properties.Items) { if (item.CheckState == CheckState.Checked) { PropertyInfo pi = new Book.Model.PCPGOnlineCheckDetail().GetType().GetProperty(item.Value.ToString()); if (pi != null) { listProInfo.Add(pi); } } } var detailList = this.bsPCPGOnlineCheckDetail.DataSource as IList <Model.PCPGOnlineCheckDetail>; if (detailList != null && detailList.Count > 0) { foreach (var detail in detailList) { foreach (var item in listProInfo) { item.SetValue(detail, null, null); } } this.gridControl1.RefreshDataSource(); } }
//加工单 private void btnGetPronoteHeader_Click(object sender, EventArgs e) { Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm pronoForm = new Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm(this.nccWorkHouse.EditValue as Model.WorkHouse, 0); if (pronoForm.ShowDialog(this) == DialogResult.OK) { //this._pcpgoc.Details.Clear(); foreach (var SelectModel in PronoteHeader.ChoosePronoteHeaderDetailsForm._pronoteHeaderList) { if (SelectModel != null) { this._pcpgoc.PCPGOnlineCheckType = -1; Model.InvoiceXO xo = new BL.InvoiceXOManager().Get(SelectModel.InvoiceXOId); if (xo != null) { this._pcpgoc.InvoiceCusXOId = xo.CustomerInvoiceXOId; //this._pcpgoc.FromPCId = SelectModel.PronoteHeaderID; if (SelectModel.InvoiceXOId != null) { this._pcpgoc.Customer = xo.xocustomer; } } //this._pcpgoc.CustomerId = this._pcpgoc.Customer == null ? "" : this._pcpgoc.CustomerId; //this._pcpgoc.Product = new BL.ProductManager().Get(SelectModel.ProductId); //this._pcpgoc.ProductId = SelectModel.ProductId; //this._pcpgoc.InvoiceXOQuantity = SelectModel.InvoiceXODetailQuantity; //Controls this.txtInvoiceCusXOId.Text = this._pcpgoc.InvoiceCusXOId; //this.nccCHCustomer.EditValue = this._pcpgoc.Customer; //this.txtDatnJuBianHao.Text = this._pcpgoc.FromPCId; //this.txtCheckStandard.Text = this._pcpgoc.Customer == null ? "" : this._pcpgoc.Customer.CheckedStandard; //this.txtProductName.Text = this._pcpgoc.Product == null ? "" : this._pcpgoc.Product.ToString(); //this.calcInvoiceXOQuantity.EditValue = this._pcpgoc.InvoiceXOQuantity; //this.txtProductDescription.Rtf = this._pcpgoc.Product == null ? "" : this._pcpgoc.Product.ProductDescription; //Detail Model.PCPGOnlineCheckDetail d = new Book.Model.PCPGOnlineCheckDetail(); d.PCPGOnlineCheckDetailId = Guid.NewGuid().ToString(); d.PCPGOnlineCheckId = this._pcpgoc.PCPGOnlineCheckId; d.InvoiceCusXOId = xo == null ? "" : xo.CustomerInvoiceXOId; d.PCPGOnlineCheckDetailDate = DateTime.Now; //d.PCPGOnlineCheckDetailTime = DateTime.Now; d.ProductId = SelectModel.ProductId; d.Product = new BL.ProductManager().Get(d.ProductId); d.CheckQuantity = Convert.ToInt32(SelectModel.DetailsSum); d.FromInvoiceId = SelectModel.PronoteHeaderID; if (this._pcpgoc.Customer != null) { d.CheckedStandard = this._pcpgoc.Customer.CheckedStandard; } this._pcpgoc.Details.Add(d); } } this.gridControl1.RefreshDataSource(); } pronoForm.Dispose(); GC.Collect(); }
//加工单 private void btnGetPronoteHeader_Click(object sender, EventArgs e) { Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm pronoForm = new Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm(this.nccWorkHouse.EditValue as Model.WorkHouse, 0); if (pronoForm.ShowDialog(this) == DialogResult.OK) { Model.PronoteHeader SelectModel = pronoForm.SelectItem; if (SelectModel != null) { //清空数据 //if (this._pcpgoc.PCPGOnlineCheckType > 0) //{ this._pcpgoc.Details.Clear(); //} this._pcpgoc.PCPGOnlineCheckType = -1; this.layoutDanJuBianHao.Text = "加工單編號:"; this._pcpgoc.InvoiceCusXOId = SelectModel.InvoiceCusId; this._pcpgoc.FromPCId = SelectModel.PronoteHeaderID; if (SelectModel.InvoiceXOId != null) { Model.InvoiceXO xo = new BL.InvoiceXOManager().Get(SelectModel.InvoiceXOId); this._pcpgoc.Customer = xo.xocustomer; this._pcpgoc.InvoiceXOId = SelectModel.InvoiceXOId; this.txtInvoiceCusXOId.Text = xo.CustomerInvoiceXOId; } this._pcpgoc.CustomerId = this._pcpgoc.Customer == null ? "" : this._pcpgoc.CustomerId; this._pcpgoc.Product = new BL.ProductManager().Get(SelectModel.ProductId); this._pcpgoc.ProductId = SelectModel.ProductId; this._pcpgoc.InvoiceXOQuantity = SelectModel.InvoiceXODetailQuantity; //Controls //this.txtInvoiceCusXOId.Text = this._pcpgoc.InvoiceCusXOId; this.nccCHCustomer.EditValue = this._pcpgoc.Customer; this.txtDatnJuBianHao.Text = this._pcpgoc.FromPCId; this.txtCheckStandard.Text = this._pcpgoc.Customer == null ? "" : this._pcpgoc.Customer.CheckedStandard; this.txtProductName.Text = this._pcpgoc.Product == null ? "" : this._pcpgoc.Product.ToString(); this.calcInvoiceXOQuantity.EditValue = this._pcpgoc.InvoiceXOQuantity; this.txtProductDescription.Rtf = this._pcpgoc.Product == null ? "" : this._pcpgoc.Product.ProductDescription; //Detail Model.PCPGOnlineCheckDetail d = new Book.Model.PCPGOnlineCheckDetail(); d.PCPGOnlineCheckDetailId = Guid.NewGuid().ToString(); d.PCPGOnlineCheckId = this._pcpgoc.PCPGOnlineCheckId; d.PCPGOnlineCheckDetailDate = DateTime.Now; d.PCPGOnlineCheckDetailTime = DateTime.Now; //d.Product = SelectModel.Product; //d.ProductId = d.Product == null ? "" : d.Product.ProductId; d.CheckQuantity = SelectModel.DetailsSum.HasValue ? int.Parse(SelectModel.DetailsSum.Value.ToString()) : 0; //d.FromInvoiceId = SelectModel.PronoteHeaderID; this._pcpgoc.Details.Add(d); this.gridControl1.RefreshDataSource(); } } pronoForm.Dispose(); GC.Collect(); }
//采购单 private void btn_invoiceCO_Click(object sender, EventArgs e) { Invoices.CG.CGForm f = new Book.UI.Invoices.CG.CGForm(); if (f.ShowDialog(this) == DialogResult.OK) { //this._pcpgoc.Details.Clear(); foreach (var SelectModel in f.key) { if (SelectModel != null) { this._pcpgoc.PCPGOnlineCheckType = 0; Model.InvoiceXO xo = null; if (SelectModel.Invoice.InvoiceXOId != null) { xo = new BL.InvoiceXOManager().Get(SelectModel.Invoice.InvoiceXOId); this._pcpgoc.Customer = xo == null ? null : xo.xocustomer; this._pcpgoc.InvoiceCusXOId = xo == null ? "" : xo.CustomerInvoiceXOId; } this.txtInvoiceCusXOId.Text = this._pcpgoc.InvoiceCusXOId; //Detail Model.PCPGOnlineCheckDetail d = new Book.Model.PCPGOnlineCheckDetail(); d.PCPGOnlineCheckDetailId = Guid.NewGuid().ToString(); d.PCPGOnlineCheckId = this._pcpgoc.PCPGOnlineCheckId; if (SelectModel.Invoice.InvoiceXOId != null) { d.InvoiceCusXOId = xo == null ? "" : xo.CustomerInvoiceXOId; } d.PCPGOnlineCheckDetailDate = DateTime.Now; //d.PCPGOnlineCheckDetailTime = DateTime.Now; d.ProductId = SelectModel.ProductId; d.Product = SelectModel.Product; d.CheckQuantity = Convert.ToInt32(SelectModel.OrderQuantity); d.FromInvoiceId = SelectModel.InvoiceId; if (this._pcpgoc.Customer != null) { d.CheckedStandard = this._pcpgoc.Customer.CheckedStandard; } this._pcpgoc.Details.Add(d); } } this.gridControl1.RefreshDataSource(); } f.Dispose(); GC.Collect(); }
//委外单 private void btnGetOtherPacmt_Click(object sender, EventArgs e) { ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) != DialogResult.OK) { return; } Model.ProduceOtherCompact OtherCompact = f.SelectItem as Model.ProduceOtherCompact; if (OtherCompact != null) { //this._pcpgoc.Details.Clear(); foreach (var item in f.key) { this._pcpgoc.PCPGOnlineCheckType = 1; //this.layoutDanJuBianHao.Text = "委外單編號:"; this._pcpgoc.FromPCId = OtherCompact.ProduceOtherCompactId; this._pcpgoc.Customer = OtherCompact.Customer; //this._pcpgoc.CustomerId = OtherCompact.CustomerId; this._pcpgoc.InvoiceCusXOId = OtherCompact.InvoiceXO == null ? "" : OtherCompact.InvoiceXO.CustomerInvoiceXOId; //this._pcpgoc.Product = f.key[0].Product; //this._pcpgoc.ProductId = f.key[0].ProductId; //对控件进行赋值 this.txtInvoiceCusXOId.Text = OtherCompact.InvoiceXOId; //this.nccCHCustomer.EditValue = this._pcpgoc.Customer; //this.txtDatnJuBianHao.Text = OtherCompact.ProduceOtherCompactId; //this.txtCheckStandard.Text = this._pcpgoc.Customer == null ? "" : this._pcpgoc.Customer.CheckedStandard; //this.txtProductName.Text = this._pcpgoc.Product == null ? "" : this._pcpgoc.Product.ToString(); //this.txtProductDescription.Rtf = this._pcpgoc.Product == null ? "" : this._pcpgoc.Product.ProductDescription; //foreach (Model.ProduceOtherCompactDetail item in f.key) //{ Model.PCPGOnlineCheckDetail d = new Book.Model.PCPGOnlineCheckDetail(); d.PCPGOnlineCheckDetailId = Guid.NewGuid().ToString(); d.PCPGOnlineCheckId = this._pcpgoc.PCPGOnlineCheckId; d.InvoiceCusXOId = OtherCompact.InvoiceXO == null ? "" : OtherCompact.InvoiceXO.CustomerInvoiceXOId; d.PCPGOnlineCheckDetailDate = DateTime.Now; d.PCPGOnlineCheckDetailTime = DateTime.Now; d.ProductId = item.ProductId; d.Product = new BL.ProductManager().Get(d.ProductId); //d.ProductDesc = item.Product.ProductDescription; //d.ProductXingHao = item.Product.ProductSpecification; d.CheckQuantity = Convert.ToInt32(item.OtherCompactCount); d.FromInvoiceId = item.ProduceOtherCompactId; d.CheckedStandard = this._pcpgoc.Customer == null ? "" : this._pcpgoc.Customer.CheckedStandard; this._pcpgoc.Details.Add(d); //} } this.gridControl1.RefreshDataSource(); } f.Dispose(); GC.Collect(); #region 委外入库 //ProduceOtherInDepot.ChooseProduceOtherInDepotForPCO f = new Book.UI.produceManager.ProduceOtherInDepot.ChooseProduceOtherInDepotForPCO(); //if (f.ShowDialog(this) != DialogResult.OK) return; //Model.ProduceOtherInDepotDetail detail = f.SelectItems.Count > 0 ? f.SelectItems[0] : null; //if (detail != null) //{ // //清空数据 // //if (this._pcpgoc.PCPGOnlineCheckType < 0) // //{ // this._pcpgoc.Details.Clear(); // //} // this._pcpgoc.PCPGOnlineCheckType = 1; // this.layoutDanJuBianHao.Text = "委外入庫單編號:"; // this._pcpgoc.FromPCId = detail.ProduceOtherInDepotId; //来源单据 // this._pcpgoc.Customer = detail.Customer; // this._pcpgoc.CustomerId = detail.CustomerId; // this._pcpgoc.InvoiceCusXOId = detail.InvoiceCusId; //取得头里的客户订单编号 // this._pcpgoc.Product = detail.Product; // this._pcpgoc.ProductId = detail.ProductId; // //对控件进行赋值 // this.txtInvoiceCusXOId.Text = this._pcpgoc.InvoiceCusXOId; // this.nccCHCustomer.EditValue = this._pcpgoc.Customer; // this.txtDatnJuBianHao.Text = this._pcpgoc.FromPCId; //来源单据编号.委外入库详细头编号 // this.txtCheckStandard.Text = this._pcpgoc.Customer == null ? "" : this._pcpgoc.Customer.CheckedStandard; // this.txtProductName.Text = this._pcpgoc.Product == null ? "" : this._pcpgoc.Product.ToString(); // //赋值详细 // Model.PCPGOnlineCheckDetail d = new Book.Model.PCPGOnlineCheckDetail(); // d.PCPGOnlineCheckDetailId = Guid.NewGuid().ToString(); // d.PCPGOnlineCheckId = this._pcpgoc.PCPGOnlineCheckId; // d.InvoiceCusXOId = detail.InvoiceCusId; // d.PCPGOnlineCheckDetailDate = DateTime.Now; // d.PCPGOnlineCheckDetailTime = DateTime.Now; // //d.Product = detail.Product; // //d.ProductId = detail.ProductId; // //d.ProductDesc = item.Product.ProductDescription; // //d.ProductXingHao = item.Product.ProductSpecification; // d.CheckQuantity = detail.ProduceInDepotQuantity.HasValue ? int.Parse(detail.ProduceInDepotQuantity.Value.ToString()) : 0; // d.FromInvoiceId = detail.ProduceOtherInDepotId; // this._pcpgoc.Details.Add(d); // this.gridControl1.RefreshDataSource(); //} //f.Dispose(); //GC.Collect(); #endregion }
private void btn_invoiceCO_Click(object sender, EventArgs e) { Invoices.CG.CGForm f = new Book.UI.Invoices.CG.CGForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (f.key.Count == 0) { return; } this._pcpgoc.Details.Clear(); this._pcpgoc.PCPGOnlineCheckType = 2; this.layoutDanJuBianHao.Text = "采购单编号:"; this._pcpgoc.FromPCId = f.key[0].InvoiceId; this._pcpgoc.Customer = f.key[0].Invoice.Customer; this._pcpgoc.CustomerId = f.key[0].Invoice.CustomerId; this._pcpgoc.InvoiceCusXOId = f.key[0].Invoice.InvoiceCustomXOId; this._pcpgoc.Product = f.key[0].Product; this._pcpgoc.ProductId = f.key[0].ProductId; this._pcpgoc.InvoiceXOQuantity = f.key[0].OrderQuantity; this._pcpgoc.InvoiceXOId = f.key[0].Invoice.InvoiceXOId; if (!string.IsNullOrEmpty(f.key[0].Invoice.InvoiceXOId)) { Model.InvoiceXO xo = new BL.InvoiceXOManager().Get(f.key[0].Invoice.InvoiceXOId); this.txtInvoiceCusXOId.Text = xo == null ? "" : xo.CustomerInvoiceXOId; } this.nccCHCustomer.EditValue = this._pcpgoc.Customer; this.txtDatnJuBianHao.Text = this._pcpgoc.FromPCId; this.txtCheckStandard.Text = this._pcpgoc.Customer == null ? "" : this._pcpgoc.Customer.CheckedStandard; this.txtProductName.Text = this._pcpgoc.Product == null ? "" : this._pcpgoc.Product.ToString(); this.calcInvoiceXOQuantity.EditValue = this._pcpgoc.InvoiceXOQuantity; this.txtProductDescription.Rtf = this._pcpgoc.Product == null ? "" : this._pcpgoc.Product.ProductDescription; foreach (var SelectModel in f.key) { if (SelectModel != null) { //Detail Model.PCPGOnlineCheckDetail d = new Book.Model.PCPGOnlineCheckDetail(); d.PCPGOnlineCheckDetailId = Guid.NewGuid().ToString(); d.PCPGOnlineCheckId = this._pcpgoc.PCPGOnlineCheckId; d.PCPGOnlineCheckDetailDate = DateTime.Now; d.PCPGOnlineCheckDetailTime = DateTime.Now; //d.PCPGOnlineCheckDetailTime = DateTime.Now; //d.ProductId = SelectModel.ProductId; //d.Product = SelectModel.Product; d.CheckQuantity = Convert.ToInt32(SelectModel.OrderQuantity); d.FromInvoiceId = SelectModel.InvoiceId; //if (this._pcpgoc.Customer != null) // d.CheckedStandard = this._pcpgoc.Customer.CheckedStandard; this._pcpgoc.Details.Add(d); } } this.gridControl1.RefreshDataSource(); } f.Dispose(); GC.Collect(); }