private void btn_AutoClean_Click(object sender, EventArgs e) { List <PropertyInfo> listProInfo = new List <PropertyInfo>(); foreach (CheckedListBoxItem item in this.ccob_AutoFillColumns.Properties.Items) { if (item.CheckState == CheckState.Checked) { PropertyInfo pi = new Book.Model.PCImpactCheckDetail().GetType().GetProperty(item.Value.ToString()); if (pi != null) { listProInfo.Add(pi); } } } var detailList = this.bsPCImpactCheckDetail.DataSource as IList <Model.PCImpactCheckDetail>; 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 AddDataRows() { Model.PCImpactCheckDetail pcicDetail = new Book.Model.PCImpactCheckDetail(); pcicDetail.PCImpactCheckDetailId = Guid.NewGuid().ToString(); pcicDetail.PCImpactCheckId = this._PCIC.PCImpactCheckId; pcicDetail.attrDate = DateTime.Now; this._PCIC.Details.Add(pcicDetail); this.bsPCImpactCheckDetail.Position = this.bsPCImpactCheckDetail.IndexOf(pcicDetail); }
//选择加工单据 private void btnGetPronoteHeader_Click(object sender, EventArgs e) { Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm pronoForm = new Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm(null, 0); if (pronoForm.ShowDialog(this) == DialogResult.OK) { if (this._PCIC.Details.Count > 0 && string.IsNullOrEmpty(this._PCIC.Details[0].ProductId)) { this._PCIC.Details.RemoveAt(0); } this._PCIC.PCFromType = -1; //单据类型 //this._PCIC.Details.Clear(); //Model.PronoteHeader currentModel = pronoForm.SelectItem; Model.PCImpactCheckDetail detail; foreach (var item in PronoteHeader.ChoosePronoteHeaderDetailsForm._pronoteHeaderList) { //this._PCIC.PronoteHeaderId = currentModel.PronoteHeaderID; //this._PCIC.InvoiceCusXOId = currentModel.CustomerInvoiceXOId; //this._PCIC.Product = new BL.ProductManager().Get(currentModel.ProductId); //this._PCIC.ProductId = this._PCIC.Product.ProductId; //this._PCIC.mCheckStandard = currentModel.CustomerCheckStandard; //this._PCIC.InvoiceXOQuantity = currentModel.InvoiceXODetailQuantity.HasValue ? currentModel.InvoiceXODetailQuantity.Value : 0; detail = new Book.Model.PCImpactCheckDetail(); detail.PCImpactCheckDetailId = Guid.NewGuid().ToString(); detail.PCImpactCheckId = this._PCIC.PCImpactCheckId; detail.attrDate = DateTime.Now; detail.PronoteHeaderId = item.PronoteHeaderID; detail.Product = new BL.ProductManager().Get(item.ProductId); detail.ProductId = item.ProductId; detail.ProductUnitId = item.ProductUnit; detail.InvoiceCusXOId = item.CustomerInvoiceXOId; detail.mCheckStandard = item.CustomerCheckStandard; detail.InvoiceXOQuantity = item.DetailsSum.HasValue ? item.DetailsSum.Value : 0; this._PCIC.Details.Add(detail); } //this.Refresh(); this.gridControl1.RefreshDataSource(); } pronoForm.Dispose(); GC.Collect(); }
//採購單 private void btn_InvoiceCO_Click(object sender, EventArgs e) { Invoices.CG.CGForm form = new Book.UI.Invoices.CG.CGForm(); if (form.ShowDialog() == DialogResult.OK) { if (this._PCIC.Details.Count > 0 && string.IsNullOrEmpty(this._PCIC.Details[0].ProductId)) { this._PCIC.Details.RemoveAt(0); } if (form.key != null && form.key.Count > 0) { this._PCIC.PCFromType = 2; //单据类型 //this._PCIC.Details.Clear(); Model.PCImpactCheckDetail detail; foreach (var item in form.key) { detail = new Book.Model.PCImpactCheckDetail(); detail.PCImpactCheckDetailId = Guid.NewGuid().ToString(); detail.PCImpactCheckId = this._PCIC.PCImpactCheckId; detail.attrDate = DateTime.Now; detail.PronoteHeaderId = item.InvoiceId; detail.Product = item.Product; detail.ProductId = item.ProductId; detail.ProductUnitId = item.InvoiceProductUnit; detail.InvoiceCusXOId = item.Invoice.InvoiceCustomXOId; if (item.Invoice.Customer != null) { detail.mCheckStandard = item.Invoice.Customer.CheckedStandard; } detail.InvoiceXOQuantity = item.OrderQuantity.HasValue ? item.OrderQuantity.Value : 0; this._PCIC.Details.Add(detail); } } } this.gridControl1.RefreshDataSource(); form.Dispose(); GC.Collect(); }
//选择委外单据 private void btnGetOtherPacmt_Click(object sender, EventArgs e) { ProduceOtherCompact.ChooseOutContract f = new Book.UI.produceManager.ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) == DialogResult.OK) { this._PCIC.PCFromType = 1; //单据类型 //this._PCIC.Details.Clear(); //Model.ProduceOtherCompact currentModel = f.SelectItem as Model.ProduceOtherCompact; //if (currentModel != null) //{ // this._PCIC.PronoteHeaderId = currentModel.PronoteHeaderId; //加工单据编号 // this._PCIC.InvoiceCusXOId = currentModel.CustomerInvoiceXOId; //客户订单编号 // this._PCIC.mCheckStandard = currentModel.Customer.CheckedStandard; //质检标准 // //if (!string.IsNullOrEmpty(currentModel.MRSHeaderId)) //客户订单编号 // //{ // // Model.MRSHeader mrsHeader = new BL.MRSHeaderManager().Get(currentModel.MRSHeaderId); // // if (mrsHeader != null) // // { // // Model.MPSheader mPSheader = new BL.MPSheaderManager().Get(mrsHeader.MPSheaderId); // // if (mPSheader != null) // // { // // Model.InvoiceXO invoiceXo = new BL.InvoiceXOManager().Get(mPSheader.InvoiceXOId); // // this._PCIC.InvoiceCusXOId = invoiceXo == null ? string.Empty : invoiceXo.CustomerInvoiceXOId; // // } // // } // //} // //if (this.OtherCompactDetailManager.Select(currentModel)[0] != null) // //{ // // this._PCIC.Product = this.OtherCompactDetailManager.Select(currentModel)[0].Product; // // this._PCIC.ProductId = this.OtherCompactDetailManager.Select(currentModel)[0].ProductId; // // this._PCIC.PronoteHeaderId = currentModel.ProduceOtherCompactId; // // this._PCIC.PCFromType = 1; //单据类型 // //} if (this._PCIC.Details.Count > 0 && string.IsNullOrEmpty(this._PCIC.Details[0].ProductId)) { this._PCIC.Details.RemoveAt(0); } Model.PCImpactCheckDetail detail; foreach (var item in f.key) { detail = new Book.Model.PCImpactCheckDetail(); detail.PCImpactCheckDetailId = Guid.NewGuid().ToString(); detail.PCImpactCheckId = this._PCIC.PCImpactCheckId; detail.attrDate = DateTime.Now; detail.PronoteHeaderId = item.ProduceOtherCompactId; //if (this.OtherCompactDetailManager.Select(currentModel)[0] != null) //{ // detail.Product = this.OtherCompactDetailManager.Select(currentModel)[0].Product; // detail.ProductId = this.OtherCompactDetailManager.Select(currentModel)[0].ProductId; // detail.ProductUnitId = this.OtherCompactDetailManager.Select(currentModel)[0].ProductUnit; //} detail.Product = item.Product; detail.ProductId = item.ProductId; detail.ProductUnitId = item.ProductUnit; detail.InvoiceCusXOId = item.ProduceOtherCompact.CustomerInvoiceXOId; detail.mCheckStandard = item.ProduceOtherCompact.Customer == null ? null : item.ProduceOtherCompact.Customer.CheckedStandard; detail.InvoiceXOQuantity = item.OtherCompactCount.HasValue ? item.OtherCompactCount.Value : 0; this._PCIC.Details.Add(detail); } //} //this.Refresh(); this.gridControl1.RefreshDataSource(); } f.Dispose(); GC.Collect(); }