//选择加工单 private void bar_ChoosePNT_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { produceManager.PronoteHeader.ChoosePronoteHeaderForm f = new Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (produceManager.PronoteHeader.ChoosePronoteHeaderForm._PronotedetailsMaterialList.Count > 0) { if (this._depotIn.Details.Count > 0 && string.IsNullOrEmpty(this._depotIn.Details[0].ProductId)) { this._depotIn.Details.RemoveAt(0); } Model.DepotInDetail detail; foreach (var item in produceManager.PronoteHeader.ChoosePronoteHeaderForm._PronotedetailsMaterialList) { detail = new Book.Model.DepotInDetail(); detail.DepotInDetailId = Guid.NewGuid().ToString(); detail.Inumber = this._depotIn.Details.Count + 1; detail.Product = item.Product; detail.ProductId = item.ProductId; detail.ProductUnit = item.ProductUnit; detail.PronoteHeaderId = item.PronoteHeaderID; detail.DepotInQuantity = item.PronoteQuantity; detail.PronoteHeaderId = item.PronoteHeaderID; detail.PronoteHeaderId = item.PronoteHeaderID; this._depotIn.Details.Add(detail); } this.gridControl1.RefreshDataSource(); } } }
private void simpleButtonExit_Click(object sender, EventArgs e) { produceManager.ProduceMaterialExit.ChooseProduceMaterialExit form = new produceManager.ProduceMaterialExit.ChooseProduceMaterialExit(); if (form.ShowDialog(this) == DialogResult.OK) { if (form.key != null && form.key.Count > 0) { if (this._depotIn.Details.Count > 0 && string.IsNullOrEmpty(this._depotIn.Details[0].ProductId)) { this._depotIn.Details.RemoveAt(0); } //string[] str = (from x in xo.Details select "'" + x.ProductId + "'").Distinct().ToArray(); //this.bindingSourceProduct.DataSource = this.productManager.SelectByProductIds(str.Aggregate<string>((a, b) => a + "," + b)); //this.gridControl1.RefreshDataSource(); //Model.ProduceMaterialExitDetail xo = this.produceMaterialExitDetailManager.Get(form.key[0]); ////invoice.InvoiceXO = xo; //invoice.InvoiceXOId = xo.InvoiceId; //invoice.Customer = xo.Invoice.Customer; //invoice.CustomerId = xo.Invoice.CustomerId; ////invoice.CustomerInvoiceXOId = xo.CustomerInvoiceXOId; //invoice.XSCustomer = xo.Invoice.xocustomer; //if (xo.Invoice.xocustomer != null) // invoice.XSCustomerId = xo.Invoice.xocustomer.CustomerId; //invoice.InvoiceAbstract = xo.Invoice.InvoiceAbstract; //invoice.InvoiceNote = xo.Invoice.InvoiceNote; //invoice.Customer = xo.Customer; //invoice.XSCustomer = xo.xocustomer; // textEditiInvoiceXOId.Text = xo.InvoiceId; Model.DepotInDetail detail; foreach (string keyid in form.key) { Model.ProduceMaterialExitDetail ExitDetail = this.produceMaterialExitDetailManager.Get(keyid); detail = new Book.Model.DepotInDetail(); detail.DepotInDetailId = Guid.NewGuid().ToString(); detail.Inumber = this._depotIn.Details.Count + 1; // detaill.DepotInQuantity = ExitDetail.ProduceQuantity; detail.Product = ExitDetail.Product; detail.ProductId = ExitDetail.ProductId; detail.DepotInQuantity = ExitDetail.ProduceQuantity; detail.ProductUnit = ExitDetail.ProductUnit; // detaill.ProductUnit = ExitDetail.ProductUnit; detail.InvoiceId = ExitDetail.ProduceMaterialExitId; detail.InvoiceDetailId = ExitDetail.ProduceMaterialExitDetailId; detail.HandbookId = ExitDetail.HandbookId; detail.HandbookProductId = ExitDetail.HandbookProductId; this._depotIn.Details.Add(detail); } this.gridControl1.RefreshDataSource(); } form.Dispose(); GC.Collect(); } }
private void simpleButton_Appent_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this._depotIn.Details.Count > 0 && string.IsNullOrEmpty(this._depotIn.Details[0].ProductId)) { this._depotIn.Details.RemoveAt(0); } Model.DepotInDetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.DepotInDetail(); detail.DepotInDetailId = Guid.NewGuid().ToString(); detail.Inumber = this._depotIn.Details.Count + 1; detail.DepotInId = this._depotIn.DepotInId; detail.Product = product; detail.ProductId = product.ProductId; detail.ProductUnit = product.DepotUnit == null ? "" : product.DepotUnit.CnName; detail.Description = product.ProductDescription; this._depotIn.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.DepotInDetail(); detail.DepotInDetailId = Guid.NewGuid().ToString(); detail.Inumber = this._depotIn.Details.Count + 1; detail.DepotInId = this._depotIn.DepotInId; detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.ProductUnit = (f.SelectedItem as Model.Product).DepotUnit == null ? "" : (f.SelectedItem as Model.Product).DepotUnit.CnName; detail.Description = (f.SelectedItem as Model.Product).ProductDescription; this._depotIn.Details.Add(detail); } this.gridControl1.RefreshDataSource(); this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail); } f.Dispose(); System.GC.Collect(); }