private void simpleButtonAppendOut_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { Model.InvoiceCFDetail detail = new Book.Model.InvoiceCFDetail(); detail.InvoiceCFDetailId = Guid.NewGuid().ToString(); detail.Invoice = this.invoice; detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.InvoiceCFDetailKind = "O"; detail.InvoiceCFDetailNote = ""; detail.InvoiceCFDetailQuantity = 1; detail.InvoiceCFDetailPrice = 0; detail.InvoiceCFDetailZongji = 0; this.invoice.DetailsOut.Clear(); this.invoice.DetailsOut.Add(detail); this.gridControlOut.RefreshDataSource(); //detail.InvoiceProductUnit = detail.Product.ProductBaseUnit; this.simpleButtonAppendOut.Enabled = false; this.bindingSourceOut.Position = this.bindingSourceOut.IndexOf(detail); this.bindingSource1.DataSource = this.productManager.Select(); } }
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 simpleButton1_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this._customerPackage.detail.Count == 1 && string.IsNullOrEmpty(this._customerPackage.detail[0].Product.ProductId)) { this._customerPackage.detail.Remove(this._customerPackage.detail[0]); } Model.CustomerPackageDetail detail = new Book.Model.CustomerPackageDetail(); detail.CustomerPackageDetailId = Guid.NewGuid().ToString(); detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.ConsumeRate = 0; detail.Quantity = 1; detail.CustomerPackage = this._customerPackage; if (this._customerPackage != null) { detail.CustomerPackageId = this._customerPackage.CustomerPackageId; } detail.Description = ""; detail.ExpiringDate = global::Helper.DateTimeParse.EndDate; detail.EffectsDate = DateTime.Now;; this._customerPackage.detail.Add(detail); this.gridControl1.RefreshDataSource(); this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); } }
private void btn_Add_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { Model.ProductScrapDetail model; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { model = new Book.Model.ProductScrapDetail(); model.ProductScrapDetailId = Guid.NewGuid().ToString(); model.ProductScrapId = this._productScrap.ProductScrapId; model.ProductId = product.ProductId; model.Product = product; this._productScrap.Details.Add(model); } } else if (f.SelectedItem != null) { model = new Book.Model.ProductScrapDetail(); model.ProductScrapDetailId = Guid.NewGuid().ToString(); model.ProductScrapId = this._productScrap.ProductScrapId; model.ProductId = (f.SelectedItem as Model.Product).ProductId; model.Product = f.SelectedItem as Model.Product; this._productScrap.Details.Add(model); } } this.gridControl1.RefreshDataSource(); }
private void simpleButtonAppend_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { Model.InvoiceCTDetail detail = new Book.Model.InvoiceCTDetail(); detail.Invoice = this.invoice; //detail.InvoiceId = this.invoice.InvoiceId; detail.InvoiceCTDetailId = Guid.NewGuid().ToString(); detail.InvoiceCTDetailDisount = decimal.Zero; detail.Inumber = this.invoice.Details.Count + 1; detail.InvoiceCTDetailDiscountRate = 0; detail.InvoiceCTDetailMoney0 = decimal.Zero; detail.InvoiceCTDetailMoney1 = decimal.Zero; detail.InvoiceCTDetailNote = ""; detail.InvoiceCTDetailPrice = decimal.Zero; detail.InvoiceCTDetailQuantity = 1; detail.InvoiceCTDetailTax = decimal.Zero; detail.InvoiceCTDetailTaxRate = 0; detail.InvoiceCTDetailZS = false; detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.InvoiceProductUnit = detail.Product.MainUnit == null ? "" : detail.Product.MainUnit.CnName; this.invoice.Details.Add(detail); this.gridControl1.RefreshDataSource(); this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail); } }
private void buttonEditProduct2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { ChooseProductForm form = new ChooseProductForm(); if (form.ShowDialog() == DialogResult.OK) { this.buttonEditProduct2.EditValue = form.SelectedItem as Model.Product; } }
private void buttonEdit1_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { this.btne_Product.EditValue = f.SelectedItem; } }
private void StartProductId_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { ChooseProductForm form = new ChooseProductForm(); if (form.ShowDialog() == DialogResult.OK) { this.StartProductId.EditValue = form.SelectedItem; this.EndProductId.EditValue = form.SelectedItem; } }
private void simpleButtonAppend_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this.invoice.Details.Count > 0 && string.IsNullOrEmpty(this.invoice.Details[0].ProductId)) { this.invoice.Details.RemoveAt(0); } Model.InvoicePODetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.InvoicePODetail(); detail.Invoice = this.invoice; detail.InvoicePODetailId = Guid.NewGuid().ToString(); detail.Product = product; detail.ProductId = product.ProductId; detail.InvoicePODetailJCQuantity = 0; detail.InvoicePODetailWHQuantity = 0; detail.InvoicePODetailYHQuantity = 0; detail.InvoicePODetailNote = ""; if (detail.Product.DepotUnit != null) { detail.InvoiceProductUnit = detail.Product.DepotUnit.ToString(); } this.invoice.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.InvoicePODetail(); detail.InvoicePODetailId = Guid.NewGuid().ToString(); detail.Product = f.SelectedItem as Model.Product;; detail.ProductId = detail.Product.ProductId; detail.InvoicePODetailJCQuantity = 0; detail.InvoicePODetailWHQuantity = 0; detail.InvoicePODetailYHQuantity = 0; detail.InvoicePODetailNote = ""; if (detail.Product.DepotUnit != null) { detail.InvoiceProductUnit = detail.Product.DepotUnit.ToString(); } this.invoice.Details.Add(detail); } this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); this.gridControl1.RefreshDataSource(); } f.Dispose(); GC.Collect(); }
private void simpleButtonAppend_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this.invoice.Details.Count > 0 && this.invoice.Details[0] != null && string.IsNullOrEmpty(this.invoice.Details[0].ProductId)) { this.invoice.Details.RemoveAt(0); } Model.InvoiceCJDetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.InvoiceCJDetail(); detail.Inumber = this.invoice.Details.Count + 1; detail.InvoiceCJDetailId = Guid.NewGuid().ToString(); detail.Invoice = this.invoice; detail.Product = product; detail.ProductId = product.ProductId; detail.InvoiceCJDetailQuantity = 1; detail.InvoiceCJDetailPrice = detail.Product.NewestCost == null ? 0 : detail.Product.NewestCost.Value; detail.InvoiceCJDetailMoney = detail.InvoiceCJDetailPrice; detail.InvoiceCJDetailNote = ""; detail.InvoiceProductUnit = detail.Product.DepotUnit == null ? null : detail.Product.DepotUnit.CnName; this.invoice.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.InvoiceCJDetail(); detail.Inumber = this.invoice.Details.Count + 1; detail.InvoiceCJDetailId = Guid.NewGuid().ToString(); detail.Invoice = this.invoice; detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.InvoiceCJDetailQuantity = 1; detail.InvoiceCJDetailPrice = detail.Product.NewestCost == null ? 0 : detail.Product.NewestCost.Value; detail.InvoiceCJDetailMoney = detail.InvoiceCJDetailPrice; detail.InvoiceCJDetailNote = ""; detail.InvoiceProductUnit = detail.Product.DepotUnit == null ? null : detail.Product.DepotUnit.CnName; this.invoice.Details.Add(detail); } this.gridControl1.RefreshDataSource(); this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); // this.bindingSource2.DataSource = this.productManager.Select(); } f.Dispose(); System.GC.Collect(); }
//"+" private void simpleButton1_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this.produceOtherExitMaterial.Details.Count > 0 && this.produceOtherExitMaterial.Details[0] != null && string.IsNullOrEmpty(this.produceOtherExitMaterial.Details[0].ProductId)) { this.produceOtherExitMaterial.Details.RemoveAt(0); } Model.ProduceOtherExitDetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.ProduceOtherExitDetail(); detail.ProduceOtherExitDetailId = Guid.NewGuid().ToString(); detail.Product = product; detail.ProductId = product.ProductId; detail.ProductSpecification = product.ProductSpecification; detail.ProductUnit = product.ProduceUnit == null ? null : product.ProduceUnit.CnName; detail.ProduceQuantity = 0; detail.ProduceAllUserQuantity = 0; detail.CriterionUserQuantity = 0; detail.ProductStock = product.StocksQuantity; this.produceOtherExitMaterial.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { Model.Product product = f.SelectedItem as Model.Product; detail = new Book.Model.ProduceOtherExitDetail(); detail.ProduceOtherExitDetailId = Guid.NewGuid().ToString(); detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.ProductSpecification = (f.SelectedItem as Model.Product).ProductSpecification; detail.ProductUnit = detail.Product.ProduceUnit == null ? null : detail.Product.ProduceUnit.CnName; detail.ProduceQuantity = 0; detail.ProduceAllUserQuantity = 0; detail.CriterionUserQuantity = 0; detail.ProductStock = (f.SelectedItem as Model.Product).StocksQuantity; this.produceOtherExitMaterial.Details.Add(detail); } this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); this.gridControl1.RefreshDataSource(); //this.bindingSourceProductId.DataSource = productManager.Select(); } }
//快速查询选择商品 private void btnEdit_SearchALLProduct_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { this._QuickSearchProduct = f.SelectedItem as Model.Product; if (this._QuickSearchProduct != null) { this.btnEdit_SearchALLProduct.EditValue = this._QuickSearchProduct; this.bsQuickSearch.DataSource = this._SupplierProductManager.SelectALLRefProduct(this._QuickSearchProduct.ProductId); } } }
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(); }
private void simple_Append_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this._produceOtherReturnMaterial.Details.Count > 0 && this._produceOtherReturnMaterial.Details[0] != null && string.IsNullOrEmpty(this._produceOtherReturnMaterial.Details[0].ProductId)) { this._produceOtherReturnMaterial.Details.RemoveAt(0); } Model.ProduceOtherReturnDetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.ProduceOtherReturnDetail(); detail.ProduceOtherReturnDetailId = Guid.NewGuid().ToString(); detail.ProduceOtherReturnMaterialId = this._produceOtherReturnMaterial.ProduceOtherReturnMaterialId; detail.Product = this.productManager.Get(product.ProductId); detail.ProductId = product.ProductId; detail.ProductUnit = product.DepotUnit.ToString(); detail.Quantity = 0; this._produceOtherReturnMaterial.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.ProduceOtherReturnDetail(); detail.ProduceOtherReturnDetailId = Guid.NewGuid().ToString(); detail.ProduceOtherReturnMaterialId = this._produceOtherReturnMaterial.ProduceOtherReturnMaterialId; detail.Product = this.productManager.Get((f.SelectedItem as Model.Product).ProductId); detail.ProductId = detail.Product.ProductId; detail.ProductUnit = (f.SelectedItem as Model.Product).DepotUnit.ToString(); detail.Quantity = 0; this._produceOtherReturnMaterial.Details.Add(detail); } this.bindingSourceProduceOtherReturnDetail.Position = this.bindingSourceProduceOtherReturnDetail.IndexOf(detail); this.gridControl1.RefreshDataSource(); } f.Dispose(); System.GC.Collect(); }
private void simpleButton1_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { Model.Product product = f.SelectedItem as Model.Product; Model.ProduceTransferDetail detail = new Book.Model.ProduceTransferDetail(); detail.ProduceTransferDetailId = Guid.NewGuid().ToString(); detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.ProductUnit = (f.SelectedItem as Model.Product).ProduceUnit.CnName; detail.ScrapQuantity = 0; detail.TransferQuantity = 0; this.produceTransfer.Details.Add(detail); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); this.gridControl1.RefreshDataSource(); } }
private void simpleButtonAppend_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { Model.StockCheckDetail detail = new Book.Model.StockCheckDetail(); detail.StockCheckDetailId = Guid.NewGuid().ToString(); detail.StockCheckId = _stockCheck.StockCheckId; detail.StockCheck = _stockCheck; detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.StockCheckQuantity = 1; detail.ProductUnitName = (f.SelectedItem as Model.Product).DepotUnit == null ? null : (f.SelectedItem as Model.Product).DepotUnit.CnName; _stockCheck.Details.Add(detail); this.bindingSourceStockCheckDetail.Position = this.bindingSourceStockCheckDetail.IndexOf(detail); this.gridControl1.RefreshDataSource(); } }
private void simpleButtonAppend_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { Model.PronoteProceduresAbilityDetail detail = new Book.Model.PronoteProceduresAbilityDetail(); detail.PronoteProceduresAbilityDetailId = Guid.NewGuid().ToString(); detail.PronoteProceduresAbility = this._pronoteProceduresAbility; detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.TimeConsuming = 0; detail.UnitOutput = 0; detail.ProductUnit = detail.Product.ProduceUnit == null ? "" : detail.Product.ProduceUnit.CnName; this._pronoteProceduresAbility.Details.Add(detail); this.gridControl1.RefreshDataSource(); this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); } }
private void simpleButtonAppend_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { //报损项 Model.InvoiceBSDetail detail = new Book.Model.InvoiceBSDetail(); detail.InvoiceBSDetailId = Guid.NewGuid().ToString(); detail.Product = f.SelectedItem as Model.Product; detail.ProductId = (f.SelectedItem as Model.Product).ProductId; detail.InvoiceBSDetailNote = ""; detail.InvoiceBSDetailQuantity = 1; //detail.InvoiceProductUnit = detail.Product.ProductBaseUnit; this.invoice.Details.Add(detail); this.gridControl1.RefreshDataSource(); this.bindingSourceInvoiceBSDetail.Position = this.bindingSourceInvoiceBSDetail.IndexOf(detail); this.bindingSourceProduct.DataSource = this.productManager.Select(); } }
//商品选择商品 private void btnEditProcProduct_Click(object sender, EventArgs e) { if (this.action != "view") { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { this._SupplierProduct.Product = f.SelectedItem as Model.Product; if (this._SupplierProduct.Product != null) { this._SupplierProduct.ProductId = this._SupplierProduct.Product.ProductId; } this._SupplierProduct.Supplier = this._CurrentSupplier; if (this._SupplierProduct.Supplier != null) { this._SupplierProduct.SupplierId = this._SupplierProduct.Supplier.SupplierId; } foreach (Model.SupplierProduct sp in this.bsSupplierProduct.DataSource as IList <Model.SupplierProduct> ) { if (this._SupplierProduct.SupplierId == sp.SupplierId && this._SupplierProduct.ProductId == sp.ProductId) { MessageBox.Show("有重複商品輸入", "提示"); break; } } this._SupplierProduct.IsNewTemp = true; //临时 this._SupplierProduct.SupplierProductPriceRange = "1/999999999999/0"; this.btnEditProcProduct.EditValue = this._SupplierProduct.Product; this.AnalyzePriceRange(this._SupplierProduct.SupplierProductPriceRange); this.bsPriceAndRange.DataSource = this._priceRangeList; this.grdConSupProductPric.RefreshDataSource(); } } }
private void btn_Add_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { foreach (Model.Product item in ChooseProductForm.ProductList) { if (this._productClassify.Details.Any(D => D.ProductId == item.ProductId)) { MessageBox.Show("商品:" + item.ProductName + " 已添加", this.Text, MessageBoxButtons.OK); continue; } else { Model.ProductClassifyDetail detail = this._detailManager.GetByProductId(item.ProductId); if (detail == null) { detail = new Book.Model.ProductClassifyDetail(); detail.ProductClassifyDetailId = Guid.NewGuid().ToString(); detail.ProductClassifyId = this._productClassify.ProductClassifyId; detail.ProductId = item.ProductId; detail.Product = item; detail.Inumber = (this._productClassify.Details.Count + 1).ToString(); this._productClassify.Details.Add(detail); } else { MessageBox.Show("商品:" + item.ProductName + " 已属于关键字 " + detail.ProductClassify.KeyWord, this.Text, MessageBoxButtons.OK); continue; } } } this.gridControl1.RefreshDataSource(); } }
private void simpleButton1_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this._produceOtherInDepot.Details.Count > 0 && this._produceOtherInDepot.Details[0] != null && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId)) { this._produceOtherInDepot.Details.RemoveAt(0); } Model.ProduceOtherInDepotDetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.ProduceOtherInDepotDetail(); detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString(); // detail.Inumber = this._produceMaterial.Details.Count + 1; detail.Product = this.productManager.Get(product.ProductId); detail.ProductId = detail.Product.ProductId; detail.ProductGuige = (f.SelectedItem as Model.Product).ProductSpecification; detail.ProduceQuantity = 0; detail.ProducePrice = 0; detail.ProduceMoney = 0; detail.ProcessPrice = 0; detail.ProduceInDepotQuantity = 0; detail.ProduceTransferQuantity = 0; if (detail.Product.DepotUnit != null) { detail.ProductUnit = detail.Product.DepotUnit.CnName; } this._produceOtherInDepot.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.ProduceOtherInDepotDetail(); Model.Product product = f.SelectedItem as Model.Product; // detail.Inumber = this._produceOtherInDepot.Details.Count + 1; detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString(); detail.Product = this.productManager.Get(product.ProductId); detail.ProductId = detail.Product.ProductId; detail.ProductGuige = detail.Product.ProductSpecification; detail.ProduceQuantity = 0; detail.ProducePrice = 0; detail.ProduceMoney = 0; detail.ProcessPrice = 0; detail.ProduceInDepotQuantity = 0; detail.ProduceTransferQuantity = 0; if (detail.Product.DepotUnit != null) { detail.ProductUnit = detail.Product.DepotUnit.CnName; } this._produceOtherInDepot.Details.Add(detail); //this.bindingSourceProductId.DataSource = productManager.Select(); } this.gridControl1.RefreshDataSource(); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); f.Dispose(); GC.Collect(); } }
private void simpleButton1_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this._produceOtherCompact.Details.Count > 0 && this._produceOtherCompact.Details[0] != null && string.IsNullOrEmpty(this._produceOtherCompact.Details[0].ProductId)) { this._produceOtherCompact.Details.RemoveAt(0); } Model.ProduceOtherCompactDetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.ProduceOtherCompactDetail(); detail.OtherCompactDetailId = Guid.NewGuid().ToString(); detail.Product = this.productManager.Get(product.ProductId); detail.ProductId = product.ProductId; detail.OtherCompactCount = 0; detail.OtherCompactPrice = 0; detail.InDepotCount = 0; detail.ProductUnit = product.DepotUnit == null ? null : product.DepotUnit.CnName; detail.OtherCompactMoney = 0; Model.BomParentPartInfo bompar = this.bomParentPartInfoManager.Get(product); if (bompar != null) { foreach (Model.BomComponentInfo comm in this.bomComponentInfoManager.Select(bompar)) { Model.ProduceOtherCompactMaterial mater = new Model.ProduceOtherCompactMaterial(); mater.ProduceOtherCompactMaterialId = Guid.NewGuid().ToString(); mater.Product = comm.Product; mater.ProductId = comm.ProductId; mater.ProductUnit = comm.Unit; mater.ProduceQuantity = 0; mater.ParentProduct = product; mater.ParentProductId = product.ProductId; this._produceOtherCompact.DetailMaterial.Add(mater); } } // detail.Inumber = this._produceOtherMaterial.Details.Count + 1; //detail.ProductUnit = detail.Product.MainUnit == null ? null : detail.Product.MainUnit.CnName; detail.ProductSpecification = product.ProductSpecification; detail.Inumber = this._produceOtherCompact.Details.Count + 1; this._produceOtherCompact.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.ProduceOtherCompactDetail(); detail.OtherCompactDetailId = Guid.NewGuid().ToString(); detail.Product = this.productManager.Get((f.SelectedItem as Model.Product).ProductId); detail.ProductId = detail.Product.ProductId; detail.OtherCompactCount = 0; detail.OtherCompactPrice = 0; detail.InDepotCount = 0; detail.OtherCompactMoney = 0; detail.ProductUnit = detail.Product.DepotUnit == null ? null : detail.Product.DepotUnit.CnName; Model.BomParentPartInfo bompar = this.bomParentPartInfoManager.Get(detail.Product); if (bompar != null) { foreach (Model.BomComponentInfo comm in this.bomComponentInfoManager.Select(bompar)) { Model.ProduceOtherCompactMaterial mater = new Model.ProduceOtherCompactMaterial(); mater.ProduceOtherCompactMaterialId = Guid.NewGuid().ToString(); mater.Product = comm.Product; mater.ProductId = comm.ProductId; mater.ProductUnit = comm.Unit; mater.ProduceQuantity = 0; mater.ParentProduct = product; mater.ParentProductId = product.ProductId; this._produceOtherCompact.DetailMaterial.Add(mater); } } // detail.Inumber = this._produceOtherMaterial.Details.Count + 1; //detail.ProductUnit = detail.Product.MainUnit == null ? null : detail.Product.MainUnit.CnName; detail.ProductSpecification = (f.SelectedItem as Model.Product).ProductSpecification; detail.Inumber = this._produceOtherCompact.Details.Count + 1; this._produceOtherCompact.Details.Add(detail); } this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); //this.bindingSourceMaterial.Position = this.bindingSourceMaterial.IndexOf(detail); this.gridControl1.RefreshDataSource(); this.gridControl2.RefreshDataSource(); } f.Dispose(); System.GC.Collect(); //if (f.ShowDialog(this) == DialogResult.OK) //{ // Model.Product product = f.SelectedItem as Model.Product; // Model.ProduceOtherCompactDetail detail = new Book.Model.ProduceOtherCompactDetail(); // detail.OtherCompactDetailId = Guid.NewGuid().ToString(); // detail.Product = f.SelectedItem as Model.Product; // detail.ProductId = (f.SelectedItem as Model.Product).ProductId; // detail.OtherCompactCount = 0; // detail.OtherCompactPrice = 0; // detail.InDepotCount = 0; // detail.OtherCompactMoney = 0; // //detail.ProductUnit = detail.Product.MainUnit == null ? null : detail.Product.MainUnit.CnName; // detail.ProductSpecification = (f.SelectedItem as Model.Product).ProductSpecification; // this._produceOtherCompact.Details.Add(detail); // this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); // this.gridControl1.RefreshDataSource(); //} }
private void simpleButtonAppend_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this.invoice.Details.Count > 0 && string.IsNullOrEmpty(this.invoice.Details[0].ProductId)) { this.invoice.Details.RemoveAt(0); } Model.InvoiceXTDetail detail = null; if (Book.UI.Invoices.ChooseProductForm.ProductList != null || Book.UI.Invoices.ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in Book.UI.Invoices.ChooseProductForm.ProductList) { detail = new Book.Model.InvoiceXTDetail(); detail.InvoiceXTDetailId = Guid.NewGuid().ToString(); detail.Product = product; detail.ProductId = product.ProductId; detail.Invoice = this.invoice; detail.Inumber = this.invoice.Details.Count + 1; //detail.InvoiceId = this.invoice.InvoiceId; detail.InvoiceXTDetailDiscount = decimal.Zero; detail.InvoiceXTDetailDiscountRate = 0; detail.InvoiceXTDetailMoney0 = decimal.Zero; detail.InvoiceXTDetailMoney1 = decimal.Zero; detail.InvoiceXTDetailNote = ""; detail.InvoiceXTDetailPrice = decimal.Zero; detail.InvoiceXTDetailQuantity = 1; detail.InvoiceXTDetailTax = decimal.Zero; detail.InvoiceXTDetailTaxRate = 0; detail.InvoiceXTDetailZS = false; detail.InvoiceProductUnit = detail.Product.SellUnit == null ? null : detail.Product.SellUnit.CnName; this.invoice.Details.Add(detail); } } if (Book.UI.Invoices.ChooseProductForm.ProductList == null || Book.UI.Invoices.ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.InvoiceXTDetail(); detail.InvoiceXTDetailId = Guid.NewGuid().ToString(); Model.Product product = f.SelectedItem as Model.Product; detail.Product = product; detail.ProductId = product.ProductId; detail.Invoice = this.invoice; detail.Inumber = this.invoice.Details.Count + 1; //detail.InvoiceId = this.invoice.InvoiceId; detail.InvoiceXTDetailDiscount = decimal.Zero; detail.InvoiceXTDetailDiscountRate = 0; detail.InvoiceXTDetailMoney0 = decimal.Zero; detail.InvoiceXTDetailMoney1 = decimal.Zero; detail.InvoiceXTDetailNote = ""; detail.InvoiceXTDetailPrice = decimal.Zero; detail.InvoiceXTDetailQuantity = 1; detail.InvoiceXTDetailTax = decimal.Zero; detail.InvoiceXTDetailTaxRate = 0; detail.InvoiceXTDetailZS = false; detail.InvoiceProductUnit = detail.Product.SellUnit == null ? null : detail.Product.SellUnit.CnName; this.invoice.Details.Add(detail); } this.gridControl1.RefreshDataSource(); this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); f.Dispose(); System.GC.Collect(); } }
private void simpleButton1_Click_1(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this._produceOtherMaterial.Details.Count > 0 && this._produceOtherMaterial.Details[0] != null && string.IsNullOrEmpty(this._produceOtherMaterial.Details[0].ProductId)) { this._produceOtherMaterial.Details.RemoveAt(0); } Model.ProduceOtherMaterialDetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.ProduceOtherMaterialDetail(); detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(); detail.Product = this.productManager.Get(product.ProductId); detail.ProductId = product.ProductId; detail.ProductSpecification = detail.Product.ProductSpecification; detail.OtherMaterialQuantity = 0; detail.OtherMaterialALLUserQuantity = 0; detail.ProductStock = detail.Product.StocksQuantity; if (!detail.Product.ProduceMaterialDistributioned.HasValue) { detail.Product.ProduceMaterialDistributioned = 0; } if (!detail.Product.OtherMaterialDistributioned.HasValue) { detail.Product.OtherMaterialDistributioned = 0; } detail.Distributioned = detail.Product.ProduceMaterialDistributioned + detail.Product.OtherMaterialDistributioned; detail.Inumber = this._produceOtherMaterial.Details.Count + 1; this._produceOtherMaterial.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.ProduceOtherMaterialDetail(); detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(); detail.Product = this.productManager.Get((f.SelectedItem as Model.Product).ProductId); detail.ProductId = detail.Product.ProductId; detail.ProductSpecification = detail.Product.ProductSpecification; detail.OtherMaterialQuantity = 0; detail.OtherMaterialALLUserQuantity = 0; detail.ProductStock = detail.Product.StocksQuantity; if (!detail.Product.ProduceMaterialDistributioned.HasValue) { detail.Product.ProduceMaterialDistributioned = 0; } if (!detail.Product.OtherMaterialDistributioned.HasValue) { detail.Product.OtherMaterialDistributioned = 0; } detail.Distributioned = detail.Product.ProduceMaterialDistributioned + detail.Product.OtherMaterialDistributioned; detail.Inumber = this._produceOtherMaterial.Details.Count + 1; this._produceOtherMaterial.Details.Add(detail); } this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); this.gridControl1.RefreshDataSource(); } f.Dispose(); System.GC.Collect(); }