//选择委外合同 private void simpleButtonOther_Click_1(object sender, EventArgs e) { ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.key == null || f.key.Count == 0) { return; } Model.ProduceOtherCompact OtherCompact = f.key[0].ProduceOtherCompact; if (this._produceOtherInDepot.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId)) { this._produceOtherInDepot.Details.RemoveAt(0); } this.newChooseContorlSipu.EditValue = OtherCompact.Supplier; //this.textEditCusXOId.Text = OtherCompact.CustomerInvoiceXOId; //if (!string.IsNullOrEmpty(OtherCompact.MRSHeaderId)) //{ // Model.MRSHeader mrsHeader = this.mRSHeaderManager.Get(OtherCompact.MRSHeaderId); // if (mrsHeader != null) // { // Model.MPSheader mPSheader = this.mPSheaderManager.Get(mrsHeader.MPSheaderId); // if (mPSheader != null) // { // Model.InvoiceXO invoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId); // this.textEditCusXOId.Text = invoiceXO == null ? string.Empty : invoiceXO.CustomerInvoiceXOId; // } // } //} foreach (Model.ProduceOtherCompactDetail item in f.key) { Model.ProduceOtherInDepotDetail detail = new Model.ProduceOtherInDepotDetail(); detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString(); detail.ProduceOtherCompactDetailId = item.OtherCompactDetailId; detail.CustomerId = item.ProduceOtherCompact.CustomerId; detail.InvoiceCusId = item.CustomInvoiceXOId; detail.Product = item.Product; detail.ProductId = item.ProductId; detail.ProductUnit = item.ProductUnit; detail.ProduceQuantity = item.OtherCompactCount - Convert.ToDouble(item.InDepotCount); detail.ProduceInDepotQuantity = 0; detail.ProduceTransferQuantity = 0; detail.ProcessPrice = 0; detail.Description = item.Description; detail.ProduceOtherCompactId = item.ProduceOtherCompactId; detail.HandbookId = item.HandbookId; detail.HandbookProductId = item.HandbookProductId; //客户订单编号 detail.InvoiceCusId = item.CustomInvoiceXOId; this._produceOtherInDepot.Details.Add(detail); } this.gridControl1.RefreshDataSource(); }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.key == null || f.key.Count == 0) { return; } this.newChooseSupplier.EditValue = f.key[0].ProduceOtherCompact.Supplier; if (this._produceOtherReturnMaterial.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherReturnMaterial.Details[0].ProductId)) { this._produceOtherReturnMaterial.Details.RemoveAt(0); } foreach (Model.ProduceOtherCompactDetail item in f.key) { Model.ProduceOtherReturnDetail detail = new Model.ProduceOtherReturnDetail(); detail.ProduceOtherReturnDetailId = Guid.NewGuid().ToString(); detail.ProduceOtherReturnMaterialId = this._produceOtherReturnMaterial.ProduceOtherReturnMaterialId; detail.Product = item.Product; detail.ProductId = item.ProductId; detail.ProductUnit = item.ProductUnit; detail.ProduceOtherCompactId = item.ProduceOtherCompactId; detail.ProduceOtherCompactDetailId = item.OtherCompactDetailId; //detail.Quantity = 0; //item.ProduceQuantity;// - (item.AlreadyOutQuantity == null ? 0 : item.AlreadyOutQuantity); // detail.ProcessPrice = 0; // detail.ProduceOtherReturnDetailDesc = item.Description; //detail.Inumber = this._produceOtherMaterial.Details.Count + 1; detail.Quantity = this.PCOtherCheckDetailManager.SelectReturnQuantity(item.OtherCompactDetailId); detail.Price = item.OtherCompactPrice; detail.Amount = detail.Price * Convert.ToDecimal(detail.Quantity); this._produceOtherReturnMaterial.Details.Add(detail); } this.gridControl1.RefreshDataSource(); decimal?d = 0; foreach (Model.ProduceOtherReturnDetail detail in this._produceOtherReturnMaterial.Details) { d += detail.Amount; } this.txt_AmountMoney.Text = d.ToString(); this.txt_Tax.Text = (Convert.ToDouble(d) * 0.05).ToString(); this.txt_TotalMoney.Text = (Convert.ToDouble(d) * 0.05 + Convert.ToDouble(d)).ToString(); f.Dispose(); GC.Collect(); }
//选择委外合同 private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract(1); if (f.ShowDialog(this) == DialogResult.OK) { // this.newChooseContorlDepot.EditValue = form.ProduceMaterialExit.Depot; if (this.produceOtherExitMaterial.Details.Count > 0 && this.produceOtherExitMaterial.Details[0] != null && string.IsNullOrEmpty(this.produceOtherExitMaterial.Details[0].ProductId)) { this.produceOtherExitMaterial.Details.RemoveAt(0); } if (f.keyMaterial != null && f.keyMaterial.Count > 0) { this.newChooseContorlSipu.EditValue = f.keyMaterial[0].ProduceOtherCompact.Supplier; this.textEditCompact.EditValue = f.keyMaterial[0].ProduceOtherCompact.ProduceOtherCompactId; //if (f.keyMaterial[0].ProduceOtherCompact.InvoiceXOId != null) //{ // Model.InvoiceXO xo = this.invoiceXOManager.Get(f.keyMaterial[0].ProduceOtherCompact.InvoiceXOId); // if (xo != null) this.textEditCusXOId.EditValue = f.keyMaterial[0].ProduceOtherCompact.CustomerInvoiceXOId; //} //else // this.textEditCusXOId.Text = null; foreach (Model.ProduceOtherCompactMaterial item in f.keyMaterial) { Model.ProduceOtherExitDetail temp = new Book.Model.ProduceOtherExitDetail(); temp.ProduceOtherExitDetailId = Guid.NewGuid().ToString(); temp.ProduceOtherExitMaterialId = item.ProduceOtherCompactMaterialId; temp.ProductId = item.ProductId; temp.Product = item.Product; temp.ProduceQuantity = 0; //temp.ProduceRepayQuantity = 0; temp.ProductStock = item.Product.StocksQuantity; // temp.InvoiceXOId = item.InvoiceXOId; //temp.InvoiceXODetailId = item.InvoiceXODetailId; temp.ProductUnit = item.ProductUnit; temp.HandbookId = item.HandbookId; temp.HandbookProductId = item.HandbookProductId; this.produceOtherExitMaterial.Details.Add(temp); } this.bindingSourceDetails.DataSource = this.produceOtherExitMaterial.Details; this.gridControl1.RefreshDataSource(); } } }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.key == null || f.key.Count == 0) { return; } this.newChooseSupplier.EditValue = f.key[0].ProduceOtherCompact.Supplier; if (this._produceOtherReturnMaterial.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherReturnMaterial.Details[0].ProductId)) { this._produceOtherReturnMaterial.Details.RemoveAt(0); } foreach (Model.ProduceOtherCompactDetail item in f.key) { Model.ProduceOtherReturnDetail detail = new Model.ProduceOtherReturnDetail(); detail.ProduceOtherReturnDetailId = Guid.NewGuid().ToString(); detail.ProduceOtherReturnMaterialId = this._produceOtherReturnMaterial.ProduceOtherReturnMaterialId; detail.Product = item.Product; detail.ProductId = item.ProductId; detail.ProductUnit = item.ProductUnit; detail.ProduceOtherCompactId = item.ProduceOtherCompactId; detail.ProduceOtherCompactDetailId = item.OtherCompactDetailId; detail.Quantity = 0; //item.ProduceQuantity;// - (item.AlreadyOutQuantity == null ? 0 : item.AlreadyOutQuantity); detail.HandbookId = item.HandbookId; detail.HandbookProductId = item.HandbookProductId; // detail.ProcessPrice = 0; // detail.ProduceOtherReturnDetailDesc = item.Description; //detail.Inumber = this._produceOtherMaterial.Details.Count + 1; this._produceOtherReturnMaterial.Details.Add(detail); } 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 simpleButtonOther_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) { return; } if (this._produceOtherMaterial.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherMaterial.Details[0].ProductId)) { this._produceOtherMaterial.Details.RemoveAt(0); } this._produceOtherMaterial.Details.Clear(); this.textEditOtherCompact.Text = OtherCompact.ProduceOtherCompactId; this.newChooseContorlSipu.EditValue = OtherCompact.Supplier; this.textEditCusXOId.Text = string.Empty; if (!string.IsNullOrEmpty(OtherCompact.MRSHeaderId)) { Model.MRSHeader mrsHeader = this.mRSHeaderManager.Get(OtherCompact.MRSHeaderId); if (mrsHeader != null) { Model.MPSheader mPSheader = this.mPSheaderManager.Get(mrsHeader.MPSheaderId); if (mPSheader != null) { Model.InvoiceXO invoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId); this.textEditCusXOId.Text = invoiceXO == null ? string.Empty : invoiceXO.CustomerInvoiceXOId; } } } //if (ProduceOtherCompact.ChooseOutContract._OtherCompactDetailList.Count == 0) return; //if (this._produceOtherInDepot.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId)) // this._produceOtherInDepot.Details.RemoveAt(0); //this._produceOtherInDepot.Details.Clear(); //this.textEditOtherCompact.Text = ProduceOtherCompact.ChooseOutContract._OtherCompactDetailList[0].ProduceOtherCompactId; //this._produceOtherMaterial.Details = (from p in this.OtherCompactMaterialManager.Select(OtherCompact) // group p by new { p.ProductId, p.ProductUnit } into b // select new Model.ProduceOtherMaterialDetail() // { // ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(), // ProduceOtherCompactMaterialId = (from p in b select p.ProduceOtherCompactMaterialId).ToString(), // ProductId = b.Key.ProductId, // Product = new BL.ProductManager().Get(b.Key.ProductId), // ProductUnit =b.Key.ProductUnit, // OtherMaterialQuantity = (from p in b select p.ProduceQuantity).Sum(), // Description = (from p in b select p.Description).ToString(), // }).ToList(); foreach (Model.ProduceOtherCompactMaterial item in this.OtherCompactMaterialManager.Select(OtherCompact)) { Model.ProduceOtherMaterialDetail detail = new Model.ProduceOtherMaterialDetail(); detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(); detail.ProduceOtherCompactMaterialId = item.ProduceOtherCompactMaterialId; detail.Product = this.productManager.Get(item.ProductId); detail.ProductId = item.ProductId; detail.ProductUnit = item.ProductUnit; detail.OtherMaterialQuantity = item.ProduceQuantity;// - (item.AlreadyOutQuantity == null ? 0 : item.AlreadyOutQuantity); if (detail.OtherMaterialQuantity < 0) { detail.OtherMaterialQuantity = 0; } // detail.ProcessPrice = 0; detail.Description = item.Description; detail.ParentProductId = item.ParentProductId; detail.ParentProduct = item.ParentProduct; 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.OtherMaterialDistributioned + detail.Product.ProduceMaterialDistributioned; detail.Inumber = this._produceOtherMaterial.Details.Count + 1; this._produceOtherMaterial.Details.Add(detail); } this.gridControl1.RefreshDataSource(); }
//选择委外合同 private void simpleButtonOther_Click_1(object sender, EventArgs e) { ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.key == null || f.key.Count == 0) { return; } Model.ProduceOtherCompact OtherCompact = f.key[0].ProduceOtherCompact; if (this._produceOtherInDepot.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId)) { this._produceOtherInDepot.Details.RemoveAt(0); } this.newChooseContorlSipu.EditValue = OtherCompact.Supplier; //this.textEditCusXOId.Text = OtherCompact.CustomerInvoiceXOId; //if (!string.IsNullOrEmpty(OtherCompact.MRSHeaderId)) //{ // Model.MRSHeader mrsHeader = this.mRSHeaderManager.Get(OtherCompact.MRSHeaderId); // if (mrsHeader != null) // { // Model.MPSheader mPSheader = this.mPSheaderManager.Get(mrsHeader.MPSheaderId); // if (mPSheader != null) // { // Model.InvoiceXO invoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId); // this.textEditCusXOId.Text = invoiceXO == null ? string.Empty : invoiceXO.CustomerInvoiceXOId; // } // } //} foreach (Model.ProduceOtherCompactDetail item in f.key) { IList <Model.PCOtherCheckDetail> PCOtherCheckDetailList = this.PCOtherCheckDetailManager.SelectByPOCDetailId(item.OtherCompactDetailId); Model.PCOtherCheckDetail PCOtherCheckDetail = null; if (PCOtherCheckDetailList != null && PCOtherCheckDetailList.Count > 0) { PCOtherCheckDetail = PCOtherCheckDetailList[0]; } if (PCOtherCheckDetail == null) { MessageBox.Show("商品:" + item.Product.ToString() + " 完成進料檢驗的部分已全部入庫,或者未開具進料檢驗單!", this.Text, MessageBoxButtons.OK); continue; } Model.ProduceOtherInDepotDetail detail = new Model.ProduceOtherInDepotDetail(); detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString(); detail.ProduceOtherCompactDetailId = item.OtherCompactDetailId; detail.CustomerId = item.ProduceOtherCompact.CustomerId; detail.InvoiceCusId = item.CustomInvoiceXOId; detail.Product = item.Product; detail.ProductId = item.ProductId; detail.ProductUnit = item.ProductUnit; //detail.ProduceQuantity = item.OtherCompactCount - Convert.ToDouble(item.InDepotCount); detail.ProduceQuantity = PCOtherCheckDetail.PCOtherCheckDetailQuantity; detail.ProduceInDepotQuantity = 0; detail.ProduceTransferQuantity = 0; detail.ProcessPrice = item.OtherCompactPrice; detail.Description = item.Description; detail.ProduceOtherCompactId = item.ProduceOtherCompactId; detail.ProduceMoney = detail.ProcessPrice * Convert.ToDecimal(detail.ProduceQuantity); //客户订单编号 detail.InvoiceCusId = item.CustomInvoiceXOId; detail.PCOtherCheckDetailId = PCOtherCheckDetail.PCOtherCheckDetailId; this._produceOtherInDepot.Details.Add(detail); } this.gridControl1.RefreshDataSource(); decimal d = 0; foreach (Model.ProduceOtherInDepotDetail model in this._produceOtherInDepot.Details) { d += Convert.ToDecimal(model.ProduceMoney); } this.txt_Sum.Text = d.ToString(); this.txt_Tax.Text = (Convert.ToDouble(d) * 0.05).ToString(); this.txt_Total.Text = (Convert.ToDouble(d) * (1.05)).ToString(); }