/// <summary> /// Update a InvoiceXODetail. /// </summary> public void Update(Model.InvoiceXODetail invoiceXODetail) { // // todo: add other logic here. // accessor.Update(invoiceXODetail); }
/// <summary> /// Insert a InvoiceXODetail. /// </summary> public void Insert(Model.InvoiceXODetail invoiceXODetail) { // // todo:add other logic here // accessor.Insert(invoiceXODetail); }
//客户订单 private void BarBtnCutomerOrder_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { createProduce.EditForm f = new Book.UI.produceManager.createProduce.EditForm(false); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.SelectList == null || f.SelectList.Count == 0) { return; } Model.InvoiceXODetail xd = f.SelectList[0]; this._PCExportReportANSI.Customer = xd.Invoice.xocustomer; this._PCExportReportANSI.CustomerId = xd.Invoice.xocustomerId; this._PCExportReportANSI.Specification = xd.Invoice.Customer.CheckedStandard; this._PCExportReportANSI.Product = xd.Product; this._PCExportReportANSI.InvoiceCusXOId = xd.Invoice.CustomerInvoiceXOId; this._PCExportReportANSI.Amount = xd.InvoiceXODetailQuantity.HasValue ? xd.InvoiceXODetailQuantity.Value : 0; this._PCExportReportANSI.ProductUnitId = xd.Product.SellUnitId; //获取质检统计记录 //Model.PCExportReportANSIDetail _PCExportReportANSIDetail = new BL.PCExportReportANSIDetailManager().SelectForExpCSADetailsSUM(xd.Invoice.CustomerInvoiceXOId, xd.Product.ProductId); //if (_PCExportReportANSIDetail != null) //{ #region 测试数量、合格数量 //受测数量默认为订单数量的1/500,无条件进位,最大为12 //int Orderamount = int.Parse(this._PCExportReportANSI.Amount.HasValue ? this._PCExportReportANSI.Amount.ToString() : "0"); //double MustCheck = 0; //if (Orderamount < 500) // MustCheck = 1; //else // MustCheck = Orderamount % 500 == 0 ? Orderamount / 500 : Orderamount / 500 + 1; //this._PCExportReportANSI.AmountTest = MustCheck > 12 ? 12 : MustCheck;//受测数量12个,无条件进位 this._PCExportReportANSI.AmountTest = Common.AutoCalculation.Calculation("csa", Convert.ToInt32(this._PCExportReportANSI.Amount)); //this._PCExportReportANSI.ShouCeShu1 = this._PCExportReportANSI.ShouCeShu2 = this._PCExportReportANSI.ShouCeShu3 = this._PCExportReportANSI.ShouCeShu4 = this._PCExportReportANSI.ShouCeShu5 = this._PCExportReportANSI.ShouCeShu6 = this._PCExportReportANSI.AmountTest; //this._PCExportReportANSI.PanDing0 = _PCExportReportANSIDetail.pCSAGX; //this._PCExportReportANSI.QuYangShu1 = _PCExportReportANSIDetail.qCSAGX; //this._PCExportReportANSI.PanDing1 = _PCExportReportANSIDetail.pCSAQXD; //this._PCExportReportANSI.QuYangShu2 = _PCExportReportANSIDetail.qCSAQXD; //this._PCExportReportANSI.PanDing2 = _PCExportReportANSIDetail.pCSAPGPCL; //this._PCExportReportANSI.QuYangShu3 = _PCExportReportANSIDetail.qCSAPGPCL; //this._PCExportReportANSI.PanDing3 = _PCExportReportANSIDetail.pCSAWDCS; //this._PCExportReportANSI.QuYangShu4 = _PCExportReportANSIDetail.qCSAWDCS; //this._PCExportReportANSI.PanDing4 = _PCExportReportANSIDetail.pCSAKJGTSL; //this._PCExportReportANSI.QuYangShu5 = _PCExportReportANSIDetail.qCSAKJGTSL; //this._PCExportReportANSI.PanDing5 = _PCExportReportANSIDetail.pCSAGSCJCS; //this._PCExportReportANSI.QuYangShu6 = _PCExportReportANSIDetail.qCSAGSCJCS; #endregion //} this.InitControls(); }
private void gridViewDetail_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column.Name == "gridColumnCheck") { Model.InvoiceXODetail detail = this.gridViewDetail.GetRow(e.RowHandle) as Model.InvoiceXODetail; if ((bool)e.Value) { key.Add(detail); // MrsDetails.Add(this.mRSdetailsManager.Get(detail.MRSdetailsId)); } if (!(bool)e.Value) { for (int i = 0; i < key.Count; i++) { if (key[i].InvoiceXODetailId == detail.InvoiceXODetailId) { key.RemoveAt(i); break; } } // MrsDetails.Remove(this.mRSdetailsManager.Get(detail.MRSdetailsId)); } } }
private void _Insert(Model.InvoiceXT invoice) { _ValidateForInsert(invoice); if (invoice.Customer != null) { invoice.CustomerId = invoice.Customer.CustomerId; } //invoice.DepotId = invoice.Depot.DepotId; invoice.Employee0Id = invoice.Employee0 == null ? null : invoice.Employee0.EmployeeId; invoice.Employee1Id = invoice.Employee1.EmployeeId; invoice.Employee2Id = invoice.Employee2 == null ? null : invoice.Employee2.EmployeeId; InvoiceCost(invoice); accessor.Insert(invoice); foreach (Model.InvoiceXTDetail detail in invoice.Details) { if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId)) { continue; } detail.InvoiceId = invoice.InvoiceId; invoiceXTDetailAccessor.Insert(detail); //修改订单 Model.InvoiceXODetail xodetail = invoiceXODetailAccessor.Get(detail.InvoiceXODetailId); if (xodetail != null) { xodetail.DetailsFlag = (int)Helper.DetailsFlag.PartArrived; xodetail.InvoiceXTDetailQuantity = xodetail.InvoiceXTDetailQuantity == null ? 0 : xodetail.InvoiceXTDetailQuantity + Convert.ToDouble(detail.InvoiceXTDetailQuantity); xodetail.InvoiceXODetailQuantity0 = Convert.ToDouble(xodetail.InvoiceXODetailQuantity) - Convert.ToDouble(xodetail.InvoiceXODetailBeenQuantity) + Convert.ToDouble(xodetail.InvoiceXTDetailQuantity); xodetail.InvoiceXODetailQuantity0 = xodetail.InvoiceXODetailQuantity0 < 0 ? 0 : xodetail.InvoiceXODetailQuantity0; //xodetail.InvoiceXODetailBeenQuantity = xodetail.InvoiceXODetailQuantity - xodetail.InvoiceXODetailQuantity0; invoiceXODetailAccessor.Update(xodetail); invoiceXOManager.UpdateInvoiceFlag(xodetail.Invoice); } detail.DepotPosition = new BL.DepotPositionManager().Get(detail.DepotPositionId); stockAccessor.Increment(detail.DepotPosition, detail.Product, detail.InvoiceXTDetailQuantity.Value); //更新产品最近出货日期 this.productManager.UpdateProduct_Stock(detail.Product); } //if ((Helper.InvoiceStatus)invoice.InvoiceStatus.Value == Helper.InvoiceStatus.Normal) //{ // //Model.Depot depot = invoice.Depot; // // 增加库存 // foreach (Model.InvoiceXTDetail detail in invoice.Details) // { // if (detail.PrimaryKey == null || string.IsNullOrEmpty(detail.PrimaryKey.PrimaryKeyId)) continue; // //转换为基本单位后的数量 // //double? xtQuantity = 0; // } //} }
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.InvoiceXODetail> xodetail = this.bindingSource1.DataSource as IList <Model.InvoiceXODetail>; if (xodetail == null || xodetail.Count == 0) { return; } Model.InvoiceXODetail detail = xodetail[e.ListSourceRowIndex]; if (detail.Product != null) { switch (e.Column.Name) { case "gridColumnProductId": e.DisplayText = detail.Product.Id; break; case "gridColumnStock": e.DisplayText = detail.Product.StocksQuantity.ToString(); break; case "gridColumnGuiGe": e.DisplayText = detail.Product.ProductSpecification; break; //case "gridColumnCustomer": // e.DisplayText = detail.Invoice.Customer.CustomerShortName; // break; //case "gridColumnDate": // e.DisplayText = Convert.ToDateTime(detail.Invoice.InvoieDate).ToString("yyyy/MM/dd"); ; // break; case "gridColumnUnit": e.DisplayText = detail.InvoiceProductUnit;; break; //case "gridColumn3": // e.DisplayText = detail.Invoice.InvoiceYjrq == null ? "" : Convert.ToDateTime(detail.Invoice.InvoiceYjrq).ToString("yyyy/MM/dd"); // break; case "gridColumnCustomProduct": e.DisplayText = detail.Product.CustomerProductName; break; case "gridColumnSupplier": e.DisplayText = detail.Product.Supplier == null ? string.Empty : detail.Product.Supplier.ToString(); break; //case "gridColumn2": // e.DisplayText = detail.Invoice.CustomerInvoiceXOId; // break; } } }
protected override Form GetViewForm() { Model.InvoiceXODetail detail = this.bindingSource1.Current as Model.InvoiceXODetail; if (detail != null) { return(new EditForm(detail.InvoiceId)); } // return new ViewForm(invoice.InvoiceId); return(null); }
//客户订单 private void BarBtnCutomerOrder_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { createProduce.EditForm f = new Book.UI.produceManager.createProduce.EditForm(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.SelectList == null || f.SelectList.Count == 0) { return; } Model.InvoiceXODetail xd = f.SelectList[0]; this._PCExportReportANSI.Customer = xd.Invoice.xocustomer; this._PCExportReportANSI.CustomerId = xd.Invoice.xocustomerId; this._PCExportReportANSI.Specification = xd.Invoice.Customer.CheckedStandard; this._PCExportReportANSI.Product = xd.Product; this._PCExportReportANSI.InvoiceCusXOId = xd.Invoice.CustomerInvoiceXOId; this._PCExportReportANSI.Amount = xd.InvoiceXODetailQuantity.HasValue ? xd.InvoiceXODetailQuantity.Value : 0; this._PCExportReportANSI.ProductUnit = this._PCExportReportANSI.Product.ProduceUnit; this._PCExportReportANSI.ProductUnitId = this._PCExportReportANSI.Product.ProduceUnitId; //获取质检统计记录 Model.PCExportReportANSIDetail _PCExportReportANSIDetail = new BL.PCExportReportANSIDetailManager().SelectForExpASDetailsSUM(xd.Invoice.CustomerInvoiceXOId, xd.Product.ProductId); if (_PCExportReportANSIDetail != null) { #region 测试数量、合格数量 //受测数量默认为订单数量的1/500,无条件进位,最大为12 int Orderamount = int.Parse(this._PCExportReportANSI.Amount.HasValue ? this._PCExportReportANSI.Amount.ToString() : "0"); double MustCheck = 0; if (Orderamount < 500) { MustCheck = 1; } else { MustCheck = Orderamount % 500 == 0 ? Orderamount / 500 : Orderamount / 500 + 1; } this._PCExportReportANSI.AmountTest = MustCheck > 12 ? 12 : MustCheck;//受测数量12个,无条件进位 this._PCExportReportANSI.ShouCeShu2 = this._PCExportReportANSI.AmountTest; this._PCExportReportANSI.PanDing2 = _PCExportReportANSIDetail.pASCCSL; this._PCExportReportANSI.QuYangShu2 = _PCExportReportANSIDetail.qASCCSL; #endregion } this.InitControls(); }
private void barBtnChooseInvoiceXO_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { createProduce.EditForm f = new Book.UI.produceManager.createProduce.EditForm(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.SelectList == null || f.SelectList.Count == 0) { return; } Model.InvoiceXODetail xod = f.SelectList[0]; this.calcInvoiceQuantity.EditValue = xod.InvoiceXODetailQuantity; this.btnEditProduct.EditValue = xod.Product; this.nccCustomer.EditValue = xod.Invoice.xocustomer; this.txtInvoiceCusXOId.Text = xod.Invoice.CustomerInvoiceXOId; this._pcExpANSIDetail.InvoiceCusXOId = xod.Invoice.CustomerInvoiceXOId; this._pcExpANSIDetail.ProductId = xod.ProductId; if (!xod.InvoiceXODetailQuantity.HasValue) { xod.InvoiceXODetailBeenQuantity = 0; } int mInvoiceXoDetailQuantity = int.Parse(xod.InvoiceXODetailQuantity.Value.ToString()); double mMustCheck = 0; if (mInvoiceXoDetailQuantity < 500) { mMustCheck = 1; } else { mMustCheck = mInvoiceXoDetailQuantity % 500 == 0 ? mInvoiceXoDetailQuantity / 500 : mInvoiceXoDetailQuantity / 500 + 1; } this.calcMustCheckSum.EditValue = mMustCheck > 12 ? 12 : mMustCheck; //受测数量1/500订单数量,上限12个,无条件进位 this.calcHasCheckSum.EditValue = this.calcMustCheckSum.EditValue; //默认取样数量等于受测数量 this.calcFaildSum.EditValue = this.calcHasCheckSum.EditValue; //if (this._pcExpANSIDetail.InvoiceCusXOId == null || this._pcExpANSIDetail.ProductId == null || this._pcExpANSIDetail.FromPC == null) //{ // this.calcHasCheckSum.EditValue = this.calcMustCheckSum.EditValue; //} //else //{ // int HasCheck = this._pcExpANSIDetailManager.HasCheckSum(this._pcExpANSIDetail.InvoiceCusXOId, this._pcExpANSIDetail.ProductId, this._pcExpANSIDetail.FromPC); // this.calcHasCheckSum.Properties.MaxValue = this._pcExpANSIDetail.MustCheckSum.Value - HasCheck; // this.calcHasCheckSum.Properties.MinValue = 0; // this.calcHasCheckSum.EditValue = mMustCheck - HasCheck; //} }
public float GetCurrentNum(Model.InvoiceXODetail invoiceXODetail) { float currentNum = 0; BL.CustomerProductsManager customerProductsManager = new BL.CustomerProductsManager(); float orderNum = this.GetByInvoiceXODetailId(invoiceXODetail.InvoiceXODetailId); float stockNum = customerProductsManager.GetStocksQuantityById(invoiceXODetail.PrimaryKeyId); if (orderNum < stockNum) { currentNum = orderNum - stockNum; } return currentNum; }
//客户订单 private void BarBtnCutomerOrder_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { createProduce.EditForm f = new Book.UI.produceManager.createProduce.EditForm(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.SelectList == null || f.SelectList.Count == 0) { return; } Model.InvoiceXODetail xd = f.SelectList[0]; this._PCExportReportANSI.Customer = xd.Invoice.xocustomer; this._PCExportReportANSI.CustomerId = xd.Invoice.xocustomer.CustomerId; this._PCExportReportANSI.Specification = xd.Invoice.xocustomer.CheckedStandard; this._PCExportReportANSI.Product = xd.Product; this._PCExportReportANSI.InvoiceCusXOId = xd.Invoice.CustomerInvoiceXOId; this._PCExportReportANSI.Amount = xd.InvoiceXODetailQuantity.HasValue ? xd.InvoiceXODetailQuantity.Value : 0; //获取质检统计记录 //Model.PCExportReportANSIDetail _PCExportReportANSIDetail = new BL.PCExportReportANSIDetailManager().SelectForExpCEENDetailsSUM(xd.Invoice.CustomerInvoiceXOId, xd.Product.ProductId); //if (_PCExportReportANSIDetail != null) //{ #region 测试数量、合格数量 //受测数量默认为订单数量的1/500,无条件进位,最大为12 int Orderamount = int.Parse(this._PCExportReportANSI.Amount.HasValue ? this._PCExportReportANSI.Amount.ToString() : "0"); double MustCheck = 0; if (Orderamount < 500) { MustCheck = 1; } else { MustCheck = Orderamount % 500 == 0 ? Orderamount / 500 : Orderamount / 500 + 1; } this._PCExportReportANSI.AmountTest = MustCheck > 12 ? 12 : MustCheck;//受测数量12个,无条件进位 this._PCExportReportANSI.QuYangShu2 = this._PCExportReportANSI.QuYangShu3 = this._PCExportReportANSI.QuYangShu4 = this._PCExportReportANSI.QuYangShu5 = this._PCExportReportANSI.QuYangShu6 = this._PCExportReportANSI.QuYangShu7 = this._PCExportReportANSI.QuYangShu8 = this._PCExportReportANSI.QuYangShu9 = this._PCExportReportANSI.QuYangShu10 = this._PCExportReportANSI.QuYangShu11 = this._PCExportReportANSI.QuYangShu12 = this._PCExportReportANSI.QuYangShu13 = this._PCExportReportANSI.QuYangShu15 = this._PCExportReportANSI.QuYangShu16 = this._PCExportReportANSI.QuYangShu17 = this._PCExportReportANSI.QuYangShu18 = this._PCExportReportANSI.QuYangShu19 = this._PCExportReportANSI.AmountTest; //2019年12月26日22:17:15:改和上面带一样 //this._PCExportReportANSI.QuYangShu1 = this._PCExportReportANSI.QuYangShu14 = 100; this._PCExportReportANSI.QuYangShu1 = this._PCExportReportANSI.QuYangShu14 = this._PCExportReportANSI.AmountTest; #endregion //} this.InitControls(); }
public void Delete(Model.MPSheader mPSheader) { try { BL.V.BeginTransaction(); foreach (Model.MPSdetails mPSdetails in mPSheader.Details) { Model.InvoiceXODetail xodetail = this.InvoiceXODetailAccessor.Get(mPSdetails.InvoiceXODetailId); if (xodetail != null) { Model.MPSdetails md = MPSdetailsAccessor.Get(mPSdetails.MPSdetailsId); if (xodetail.InvoiceMPSQuantity == null) { xodetail.InvoiceMPSQuantity = 0; } xodetail.InvoiceMPSQuantity = Convert.ToDouble(xodetail.InvoiceMPSQuantity) - Convert.ToDouble(md.MPSdetailssum); xodetail.InvoiceMPSQuantity = xodetail.InvoiceMPSQuantity < 0 ? 0 : xodetail.InvoiceMPSQuantity; if (xodetail.InvoiceMPSQuantity >= xodetail.InvoiceXODetailQuantity) { xodetail.DetailMPSState = 2; } else { if (xodetail.InvoiceMPSQuantity > 0) { xodetail.DetailMPSState = 1; } else { xodetail.DetailMPSState = 0; } } //invoiceXODetail.InvoiceMPSQuantity = Convert.ToDouble(MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId)); invoiceManager.Update(xodetail); UpdateInvoiceXOFlag(xodetail.Invoice); } } accessor.Delete(mPSheader.MPSheaderId); BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column.Name == "gridColumn8") { Model.InvoiceXODetail detail = this.gridView1.GetRow(e.RowHandle) as Model.InvoiceXODetail; if ((bool)e.Value && !this.SelectList.Any(D => D.InvoiceXODetailId == detail.InvoiceXODetailId)) { this.SelectList.Add(detail); } else if (!(bool)e.Value && this.SelectList.Any(D => D.InvoiceXODetailId == detail.InvoiceXODetailId)) { this.SelectList.Remove(SelectList.First(D => D.InvoiceXODetailId == detail.InvoiceXODetailId)); } } }
//选择订单 private void barButtonItemXO_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Invoices.XS.SearcharInvoiceXSForm form = new Invoices.XS.SearcharInvoiceXSForm(); if (form.ShowDialog(this) == DialogResult.OK) { if (form.key != null && form.key.Count > 0) { if (invoice.Details.Count > 0 && string.IsNullOrEmpty(invoice.Details[0].ProductId)) { invoice.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.InvoiceXODetail xo = form.key[0]; //invoice.InvoiceXO = xo; //invoice.invoiceid = xo.InvoiceId; invoice.Customer = xo.Invoice.xocustomer; this.buttonEditCompany.EditValue = invoice.Customer; invoice.CustomerId = invoice.Customer.CustomerId; foreach (Model.InvoiceXODetail xos in form.key) { Model.InvoiceXTDetail xtdetail = new Model.InvoiceXTDetail(); xtdetail.Inumber = invoice.Details.Count + 1; xtdetail.Invoice = invoice; xtdetail.InvoiceId = invoice.InvoiceId; xtdetail.InvoiceXOId = xos.InvoiceId; xtdetail.InvoiceXTDetailId = Guid.NewGuid().ToString(); xtdetail.InvoiceXTDetailPrice = xos.InvoiceXODetailPrice; xtdetail.InvoiceXTDetailQuantity = 0; xtdetail.InvoiceXODetailId = xos.InvoiceXODetailId; xtdetail.InvoiceXODetail = xos; xtdetail.Product = xos.Product; xtdetail.ProductId = xos.Product.ProductId; xtdetail.InvoiceProductUnit = xos.InvoiceProductUnit; xtdetail.HandbookId = xos.HandbookId; xtdetail.HandbookProductId = xos.HandbookProductId; invoice.Details.Add(xtdetail); } this.gridControl1.RefreshDataSource(); } form.Dispose(); GC.Collect(); } }
private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.InvoiceXSDetail> details = this.bindingSource1.DataSource as IList <Model.InvoiceXSDetail>; if (details == null || details.Count < 1) { return; } Model.Product detail = details[e.ListSourceRowIndex].Product; Model.InvoiceXODetail codetail = details[e.ListSourceRowIndex].InvoiceXODetail; switch (e.Column.Name) { case "colProductId": if (detail == null) { return; } e.DisplayText = string.IsNullOrEmpty(detail.Id) ? "" : detail.Id; break; case "gridColumn7": if (codetail != null) { e.DisplayText = (codetail.InvoiceXODetailQuantity0 == null ? 0 : codetail.InvoiceXODetailQuantity0.Value).ToString("0.####"); } break; case "gridColumn6": if (codetail != null) { e.DisplayText = codetail.InvoiceXODetailQuantity.Value.ToString(); } break; case "gridColumn27": if (codetail != null) { e.DisplayText = codetail.Invoice.CustomerInvoiceXOId; } break; } }
private void btn_InvoiceXO_Click(object sender, EventArgs e) { createProduce.EditForm f = new Book.UI.produceManager.createProduce.EditForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (f.SelectList != null && f.SelectList.Count > 0) { Model.InvoiceXODetail model = f.SelectList[0]; this._pcBoxFootCheck.ProductId = model.ProductId; this._pcBoxFootCheck.InvoiceXO = model.Invoice; this._pcBoxFootCheck.InvoiceXOId = model.InvoiceId; this.txt_InvoiceXO.EditValue = model.InvoiceId == null ? null : model.Invoice.CustomerInvoiceXOId; this.txt_Product.EditValue = model.Product == null ? null : model.Product.ToString(); //this._pcBoxFootCheck.InvoiceXOId = model.InvoiceId; this.spinEditGetNum.EditValue = model.InvoiceXODetailQuantity; } } }
/// <summary> /// 已定未出 /// </summary> /// <param name="codetail"></param> /// <param name="quantity"></param> public void UpdateYDWC(Model.InvoiceXODetail xodetail, double quantity)// 已定未出 { //detail1.UpQuantity = detail1.Quantity - beeQuantity; //Model.BGHandbookDetail1 detail1 = bindingSource1.Current as Model.BGHandbookDetail1; Model.BGHandbookDetail1 detail = accessor.SelectBGProduct(xodetail.HandbookId, xodetail.HandbookProductId); if (detail != null) { if (!detail.YdwcQuantity.HasValue) { detail.YdwcQuantity = 0; } //if (!detail.BeeQuantity.HasValue) detail.BeeQuantity = 0; detail.YdwcQuantity = detail.YdwcQuantity + quantity; //detail.UpQuantity = detail.Quantity - detail.BeeQuantity; //detail.UpQuantity = detail.Quantity - detail.BeeQuantity - detail.YdwcQuantity; accessor.Update(detail); } }
//客户订单 private void BarBtnCutomerOrder_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { createProduce.EditForm f = new Book.UI.produceManager.createProduce.EditForm(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.SelectList == null || f.SelectList.Count == 0) { return; } Model.InvoiceXODetail xd = f.SelectList[0]; this._PCExportReportANSI.Customer = xd.Invoice.xocustomer; this._PCExportReportANSI.CustomerId = xd.Invoice.xocustomer.CustomerId; this._PCExportReportANSI.Specification = xd.Invoice.xocustomer.CheckedStandard; this._PCExportReportANSI.Product = xd.Product; this._PCExportReportANSI.InvoiceCusXOId = xd.Invoice.CustomerInvoiceXOId; this._PCExportReportANSI.Amount = xd.InvoiceXODetailQuantity.HasValue ? xd.InvoiceXODetailQuantity.Value : 0; //this._PCExportReportANSI.ProductUnitId = xd.Product.SellUnitId; var unit = UnitList.ToList().FirstOrDefault(D => D.CnName == xd.InvoiceProductUnit); if (unit != null) { this._PCExportReportANSI.ProductUnit = unit; this._PCExportReportANSI.ProductUnitId = unit.ProductUnitId; } //获取质检统计记录 //Model.PCExportReportANSIDetail _PCExportReportANSIDetail = new BL.PCExportReportANSIDetailManager().SelectForExpCEENDetailsSUM(xd.Invoice.CustomerInvoiceXOId, xd.Product.ProductId); //if (_PCExportReportANSIDetail != null) //{ #region 测试数量、合格数量 //受测数量默认为订单数量的1/500,无条件进位,最大为12 //int Orderamount = int.Parse(this._PCExportReportANSI.Amount.HasValue ? this._PCExportReportANSI.Amount.ToString() : "0"); //double MustCheck = 0; //if (Orderamount < 500) // MustCheck = 1; //else // MustCheck = Orderamount % 500 == 0 ? Orderamount / 500 : Orderamount / 500 + 1; //this._PCExportReportANSI.AmountTest = MustCheck > 12 ? 12 : MustCheck;//受测数量12个,无条件进位 this._PCExportReportANSI.AmountTest = Common.AutoCalculation.Calculation("ansi", Convert.ToInt32(this._PCExportReportANSI.Amount)); //this._PCExportReportANSI.QuYangShu2 = this._PCExportReportANSI.QuYangShu3 = this._PCExportReportANSI.QuYangShu4 = this._PCExportReportANSI.QuYangShu5 = this._PCExportReportANSI.QuYangShu6 = this._PCExportReportANSI.QuYangShu7 = this._PCExportReportANSI.QuYangShu8 = this._PCExportReportANSI.QuYangShu9 = this._PCExportReportANSI.QuYangShu10 = this._PCExportReportANSI.QuYangShu11 = this._PCExportReportANSI.QuYangShu12 = this._PCExportReportANSI.QuYangShu13 = this._PCExportReportANSI.QuYangShu15 = this._PCExportReportANSI.QuYangShu16 = this._PCExportReportANSI.QuYangShu17 = this._PCExportReportANSI.QuYangShu18 = this._PCExportReportANSI.PanDing2 = this._PCExportReportANSI.PanDing3 = this._PCExportReportANSI.PanDing4 = this._PCExportReportANSI.PanDing5 = this._PCExportReportANSI.PanDing6 = this._PCExportReportANSI.PanDing7 = this._PCExportReportANSI.PanDing8 = this._PCExportReportANSI.PanDing9 = this._PCExportReportANSI.PanDing10 = this._PCExportReportANSI.PanDing11 = this._PCExportReportANSI.PanDingShu12 = this._PCExportReportANSI.PanDingShu13 = this._PCExportReportANSI.PanDingShu15 = this._PCExportReportANSI.PanDingShu16 = this._PCExportReportANSI.QuYangShu17 = this._PCExportReportANSI.QuYangShu18 = this._PCExportReportANSI.PanDingShu17 = this._PCExportReportANSI.PanDingShu18 = this._PCExportReportANSI.AmountTest; this._PCExportReportANSI.QuYangShu1 = this._PCExportReportANSI.QuYangShu14 = this._PCExportReportANSI.PanDing1 = this._PCExportReportANSI.PanDingShu14 = 100; //2017年9月28日22:58:08 Cindy要求设为固定 this._PCExportReportANSI.QuYangShu2 = this._PCExportReportANSI.PanDing2 = 1; this._PCExportReportANSI.QuYangShu3 = this._PCExportReportANSI.PanDing3 = 0; this._PCExportReportANSI.QuYangShu4 = this._PCExportReportANSI.PanDing4 = 2; this._PCExportReportANSI.QuYangShu5 = this._PCExportReportANSI.PanDing5 = 2; this._PCExportReportANSI.QuYangShu6 = this._PCExportReportANSI.PanDing6 = 2; this._PCExportReportANSI.QuYangShu7 = this._PCExportReportANSI.PanDing7 = 2; this._PCExportReportANSI.QuYangShu8 = this._PCExportReportANSI.PanDing8 = 2; this._PCExportReportANSI.QuYangShu9 = this._PCExportReportANSI.PanDing9 = 1; this._PCExportReportANSI.QuYangShu10 = this._PCExportReportANSI.PanDing10 = 2; this._PCExportReportANSI.QuYangShu11 = this._PCExportReportANSI.PanDing11 = 2; this._PCExportReportANSI.QuYangShu12 = this._PCExportReportANSI.PanDingShu12 = 2; this._PCExportReportANSI.QuYangShu13 = this._PCExportReportANSI.PanDingShu13 = 2; this._PCExportReportANSI.QuYangShu15 = this._PCExportReportANSI.PanDingShu15 = 4; this._PCExportReportANSI.QuYangShu16 = this._PCExportReportANSI.PanDingShu16 = 2; #endregion //} this.InitControls(); }
//客户订单 private void BarBtnCutomerOrder_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { createProduce.EditForm f = new Book.UI.produceManager.createProduce.EditForm(false); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.SelectList == null || f.SelectList.Count == 0) { return; } Model.InvoiceXODetail xd = f.SelectList[0]; this._PCExportReportANSI.Customer = xd.Invoice.xocustomer; this._PCExportReportANSI.CustomerId = xd.Invoice.xocustomerId; this._PCExportReportANSI.Specification = xd.Invoice.Customer.CheckedStandard; this._PCExportReportANSI.Product = xd.Product; this._PCExportReportANSI.InvoiceCusXOId = xd.Invoice.CustomerInvoiceXOId; this._PCExportReportANSI.Amount = xd.InvoiceXODetailQuantity.HasValue ? xd.InvoiceXODetailQuantity.Value : 0; this._PCExportReportANSI.ProductUnitId = xd.Product.SellUnitId; //获取质检统计记录 //Model.PCExportReportANSIDetail _PCExportReportANSIDetail = new BL.PCExportReportANSIDetailManager().SelectForExpJISDetailsSUM(xd.Invoice.CustomerInvoiceXOId, xd.Product.ProductId); //if (_PCExportReportANSIDetail != null) //{ #region 测试数量、合格数量 //受测数量默认为订单数量的1/500,无条件进位,最大为12 //int Orderamount = int.Parse(this._PCExportReportANSI.Amount.HasValue ? this._PCExportReportANSI.Amount.ToString() : "0"); //double MustCheck = 0; //if (Orderamount < 500) // MustCheck = 1; //else // MustCheck = Orderamount % 500 == 0 ? Orderamount / 500 : Orderamount / 500 + 1; //this._PCExportReportANSI.AmountTest = MustCheck > 12 ? 12 : MustCheck;//受测数量12个,无条件进位 this._PCExportReportANSI.AmountTest = Common.AutoCalculation.Calculation("jis", Convert.ToInt32(this._PCExportReportANSI.Amount)); this._PCExportReportANSI.ShouCeShu1 = this._PCExportReportANSI.ShouCeShu2 = this._PCExportReportANSI.ShouCeShu3 = this._PCExportReportANSI.ShouCeShu4 = this._PCExportReportANSI.ShouCeShu5 = this._PCExportReportANSI.ShouCeShu6 = this._PCExportReportANSI.ShouCeShu7 = this._PCExportReportANSI.ShouCeShu8 = this._PCExportReportANSI.ShouCeShu9 = this._PCExportReportANSI.ShouCeShu10 = this._PCExportReportANSI.ShouCeShu11 = this._PCExportReportANSI.ShouCeShu12 = this._PCExportReportANSI.ShouCeShu13 = this._PCExportReportANSI.ShouCeShu14 = this._PCExportReportANSI.ShouCeShu15 = this._PCExportReportANSI.ShouCeShu16 = this._PCExportReportANSI.ShouCeShu17 = this._PCExportReportANSI.ShouCeShu18 = this._PCExportReportANSI.ShouCeShu19 = this._PCExportReportANSI.ShouCeShu20 = this._PCExportReportANSI.ShouCeShu21 = this._PCExportReportANSI.AmountTest; _PCExportReportANSI.PanDing1 = _PCExportReportANSI.PanDing2 = _PCExportReportANSI.PanDing3 = _PCExportReportANSI.PanDing4 = _PCExportReportANSI.PanDing5 = _PCExportReportANSI.PanDing6 = _PCExportReportANSI.PanDing7 = _PCExportReportANSI.PanDing8 = _PCExportReportANSI.PanDing9 = _PCExportReportANSI.PanDing10 = _PCExportReportANSI.PanDing11 = _PCExportReportANSI.PanDingShu12 = _PCExportReportANSI.PanDingShu13 = _PCExportReportANSI.PanDingShu14 = _PCExportReportANSI.PanDingShu15 = _PCExportReportANSI.PanDingShu16 = _PCExportReportANSI.PanDingShu17 = _PCExportReportANSI.PanDingShu18 = _PCExportReportANSI.PanDingShu19 = _PCExportReportANSI.PanDingShu20 = _PCExportReportANSI.PanDingShu21 = this._PCExportReportANSI.AmountTest; //this._PCExportReportANSI.PanDing1 = _PCExportReportANSIDetail.pJISJPWG; //this._PCExportReportANSI.QuYangShu1 = _PCExportReportANSIDetail.qJISJPWG; //this._PCExportReportANSI.PanDing2 = _PCExportReportANSIDetail.pJISJPLJD; //this._PCExportReportANSI.QuYangShu2 = _PCExportReportANSIDetail.qJISJPLJD; //this._PCExportReportANSI.PanDing3 = _PCExportReportANSIDetail.pJISJPQGD; //this._PCExportReportANSI.QuYangShu3 = _PCExportReportANSIDetail.qJISJPQGD; //this._PCExportReportANSI.PanDing4 = _PCExportReportANSIDetail.pJISJPSGD; //this._PCExportReportANSI.QuYangShu4 = _PCExportReportANSIDetail.qJISJPSGD; //this._PCExportReportANSI.PanDing5 = _PCExportReportANSIDetail.pJISJPTGL; //this._PCExportReportANSI.QuYangShu5 = _PCExportReportANSIDetail.qJISJPTGL; //this._PCExportReportANSI.PanDing6 = _PCExportReportANSIDetail.pJISJPNCCX; //this._PCExportReportANSI.QuYangShu6 = _PCExportReportANSIDetail.qJISJPNCCX; //this._PCExportReportANSI.PanDing7 = _PCExportReportANSIDetail.pJISJPBMNMHDK; //this._PCExportReportANSI.QuYangShu7 = _PCExportReportANSIDetail.qJISJPBMNMHDK; //this._PCExportReportANSI.PanDing8 = _PCExportReportANSIDetail.pJISJPNREX; //this._PCExportReportANSI.QuYangShu8 = _PCExportReportANSIDetail.qJISJPNREX; //this._PCExportReportANSI.PanDing9 = _PCExportReportANSIDetail.pJISJPNSX; ; //this._PCExportReportANSI.QuYangShu9 = _PCExportReportANSIDetail.qJISJPNSX; //this._PCExportReportANSI.PanDing10 = _PCExportReportANSIDetail.pJISJPNRAX; //this._PCExportReportANSI.QuYangShu10 = _PCExportReportANSIDetail.qJISJPNRAX; //this._PCExportReportANSI.PanDing11 = _PCExportReportANSIDetail.pJISWCPWG; //this._PCExportReportANSI.QuYangShu11 = _PCExportReportANSIDetail.qJISWCPWG; //this._PCExportReportANSI.PanDingShu12 = _PCExportReportANSIDetail.pJISWCPNCCX; //this._PCExportReportANSI.QuYangShu12 = _PCExportReportANSIDetail.qJISWCPNCCX; //this._PCExportReportANSI.PanDingShu13 = _PCExportReportANSIDetail.pJISWCPJMXDYSY; //this._PCExportReportANSI.QuYangShu13 = _PCExportReportANSIDetail.qJISWCPJMXDYSY; //this._PCExportReportANSI.PanDingShu14 = _PCExportReportANSIDetail.pJISWCPJMXDESY; //this._PCExportReportANSI.QuYangShu14 = _PCExportReportANSIDetail.qJISWCPJMXDESY; //this._PCExportReportANSI.PanDingShu15 = _PCExportReportANSIDetail.pJISWCPTDQD; //this._PCExportReportANSI.QuYangShu15 = _PCExportReportANSIDetail.qJISWCPTDQD; //this._PCExportReportANSI.PanDingShu16 = _PCExportReportANSIDetail.pJISWCPNXDX; //this._PCExportReportANSI.QuYangShu16 = _PCExportReportANSIDetail.qJISWCPNXDX; //this._PCExportReportANSI.PanDingShu17 = _PCExportReportANSIDetail.pJISWCPGZ; //this._PCExportReportANSI.QuYangShu17 = _PCExportReportANSIDetail.qJISWCPGZ; //this._PCExportReportANSI.PanDingShu18 = _PCExportReportANSIDetail.pJISWCPCL; //this._PCExportReportANSI.QuYangShu18 = _PCExportReportANSIDetail.qJISWCPCL; //this._PCExportReportANSI.PanDingShu19 = _PCExportReportANSIDetail.pJISWCPJHBS; //this._PCExportReportANSI.QuYangShu19 = _PCExportReportANSIDetail.qJISWCPJHBS; //this._PCExportReportANSI.PanDingShu20 = _PCExportReportANSIDetail.pJISWCPBZSJH; //this._PCExportReportANSI.QuYangShu20 = _PCExportReportANSIDetail.qJISWCPBZSJH; //this._PCExportReportANSI.PanDingShu21 = _PCExportReportANSIDetail.pJISWCPSYSC; ; //this._PCExportReportANSI.QuYangShu21 = _PCExportReportANSIDetail.qJISWCPSYSC; #endregion //} this.InitControls(); }
public void Insert(Model.InvoiceXODetail e) { this.Insert <Model.InvoiceXODetail>(e); }
/// <summary> /// Update a MPSheader. /// </summary> public void Update(Model.MPSheader mPSheader) { // // todo: add other logic here. // Validate(mPSheader); if (this.ExistsExcept(mPSheader)) { throw new Helper.InvalidValueException(Model.MPSheader.PRO_Id); } // mPSheader.UpdateTime = DateTime.Now; // accessor.Update(mPSheader); try { BL.V.BeginTransaction(); //this.Delete(mPSheader); //mPSheader.UpdateTime = DateTime.Now; //this.Insert(mPSheader); //以前这种修改是有BUG的,如果用“-”的方式删除一些项目后保存对应的已排单数量不会变,2016年4月7日16:33:55改新版。 mPSheader.InsertTime = DateTime.Now; mPSheader.UpdateTime = DateTime.Now; accessor.Update(mPSheader); //删除旧数据 IList <Model.MPSdetails> list = MPSdetailsAccessor.Select(mPSheader); foreach (var item in list) { Model.InvoiceXODetail xodetail = this.InvoiceXODetailAccessor.Get(item.InvoiceXODetailId); if (xodetail != null) { if (xodetail.InvoiceMPSQuantity == null) { xodetail.InvoiceMPSQuantity = 0; } xodetail.InvoiceMPSQuantity = Convert.ToDouble(xodetail.InvoiceMPSQuantity) - Convert.ToDouble(item.MPSdetailssum); xodetail.InvoiceMPSQuantity = xodetail.InvoiceMPSQuantity < 0 ? 0 : xodetail.InvoiceMPSQuantity; if (xodetail.InvoiceMPSQuantity >= xodetail.InvoiceXODetailQuantity) { xodetail.DetailMPSState = 2; } else { if (xodetail.InvoiceMPSQuantity > 0) { xodetail.DetailMPSState = 1; } else { xodetail.DetailMPSState = 0; } } //invoiceXODetail.InvoiceMPSQuantity = Convert.ToDouble(MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId)); invoiceManager.Update(xodetail); UpdateInvoiceXOFlag(xodetail.Invoice); } MPSdetailsAccessor.Delete(item.MPSdetailsId); } //插入新数据 foreach (Model.MPSdetails mPSdetails in mPSheader.Details) { if (mPSdetails.Product == null || string.IsNullOrEmpty(mPSdetails.Product.ProductId)) { continue; } mPSdetails.MPSheaderId = mPSheader.MPSheaderId; mPSdetails.MPSEndState = false; invoiceXODetail = invoiceManager.Get(mPSdetails.InvoiceXODetailId); //double ss = MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId); MPSdetailsAccessor.Insert(mPSdetails); if (invoiceXODetail != null) { if (invoiceXODetail.InvoiceMPSQuantity == null) { invoiceXODetail.InvoiceMPSQuantity = 0; } invoiceXODetail.InvoiceMPSQuantity += Convert.ToDouble(mPSdetails.MPSdetailssum); if (invoiceXODetail.InvoiceMPSQuantity >= invoiceXODetail.InvoiceXODetailQuantity) { invoiceXODetail.DetailMPSState = 2; } else { if (invoiceXODetail.InvoiceMPSQuantity > 0) { invoiceXODetail.DetailMPSState = 1; } else { invoiceXODetail.DetailMPSState = 0; } } //invoiceXODetail.InvoiceMPSQuantity = Convert.ToDouble(MPSdetailsAccessor.GetByInvoiceXODetailId(mPSdetails.InvoiceXODetailId)); invoiceManager.Update(invoiceXODetail); UpdateInvoiceXOFlag(invoiceXODetail.Invoice); } this.UpdateSql("update product set MpsStockQuantity=" + mPSdetails.MPSdetailssum + " where productid='" + mPSdetails.ProductId + "'"); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
//选择客户订单 private void barBtnInvoiceXO_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { createProduce.EditForm f = new Book.UI.produceManager.createProduce.EditForm(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.SelectList == null || f.SelectList.Count == 0) { return; } Model.InvoiceXODetail xod = f.SelectList[0]; this._pcExpANSI.Customer = xod.Invoice.xocustomer; this._pcExpANSI.CustomerId = xod.Invoice.xocustomerId; this._pcExpANSI.Specification = xod.Invoice.Customer.CheckedStandard; this._pcExpANSI.Product = xod.Product; this._pcExpANSI.ProductId = xod.Product.ProductId; this._pcExpANSI.InvoiceCusXOId = xod.Invoice.CustomerInvoiceXOId; this._pcExpANSI.Amount = xod.InvoiceXODetailQuantity.HasValue ? xod.InvoiceXODetailQuantity.Value : 0; this._pcExpANSI.ProductUnit = this._pcExpANSI.Product.ProduceUnit; this._pcExpANSI.ProductUnitId = this._pcExpANSI.Product.ProduceUnitId; //获取ANSI,Finish质检统计记录 //Model.PCExportReportANSI mPCExpANSI = this._pcExpANSIManager.SelectForExpANSI(xod.Invoice.CustomerInvoiceXOId, xod.Product.ProductId); Model.PCExportReportANSIDetail mPCExpANSIDet = new BL.PCExportReportANSIDetailManager().SelectForExpANSIDetailsSUM(xod.Invoice.CustomerInvoiceXOId, xod.Product.ProductId); if (mPCExpANSIDet != null) { //测试数量 //this._pcExpANSI.AmountTest = mPCExpANSI.mCountANSI; //this._pcExpANSI.PanDing0 = mPCExpANSI.SUMIsMuShiJianYan; //this._pcExpANSI.PanDing3 = mPCExpANSI.SUMIsKeJianGuang; //this._pcExpANSI.PanDing4 = mPCExpANSI.SUMIsZiWaiXian; //this._pcExpANSI.PanDing7 = mPCExpANSI.SUMIsGaoSuChongJi; //this._pcExpANSI.PanDing8 = mPCExpANSI.SUMIsYuanZhuiZhuiLuo; //this._pcExpANSI.PanDing10 = mPCExpANSI.SUMIsFogPassing; //this._pcExpANSI.PanDing11 = mPCExpANSI.SUMIsNaiRanXing; //this._pcExpANSI.PanDing9 = mPCExpANSI.SUMIsPenetrate; //this._pcExpANSI.ShouCeShu3 = mPCExpANSI.mCountOptics; //this._pcExpANSI.ShouCeShu4 = mPCExpANSI.mCountOptics; //this._pcExpANSI.ShouCeShu7 = mPCExpANSI.mCountANSI; //this._pcExpANSI.ShouCeShu8 = mPCExpANSI.mCountANSI; //this._pcExpANSI.ShouCeShu11 = mPCExpANSI.mCountANSI; //this._pcExpANSI.ShouCeShu10 = mPCExpANSI.mCountFog; //this._pcExpANSI.ShouCeShu9 = mPCExpANSI.mCountPenetrate; //this._pcExpANSI.QuYangShu3 = this._pcExpANSI.QuYangShu4 = mPCExpANSI.mCountOptics; //this._pcExpANSI.QuYangShu7 = this._pcExpANSI.QuYangShu8 = this._pcExpANSI.QuYangShu11 = mPCExpANSI.mCountANSI; //this._pcExpANSI.QuYangShu10 = mPCExpANSI.mCountFog; //this._pcExpANSI.QuYangShu9 = mPCExpANSI.mCountPenetrate; #region 测试数量与合格数量 //受测数量默认为订单数量的1/500,无条件进位.最大12 int mInvoiceXoDetailQuantity = int.Parse(this._pcExpANSI.Amount.HasValue ? this._pcExpANSI.Amount.ToString() : "0"); double mMustCheck = 0; if (mInvoiceXoDetailQuantity < 500) { mMustCheck = 1; } else { mMustCheck = mInvoiceXoDetailQuantity % 500 == 0 ? mInvoiceXoDetailQuantity / 500 : mInvoiceXoDetailQuantity / 500 + 1; } this._pcExpANSI.AmountTest = mMustCheck > 12 ? 12 : mMustCheck; //受测数量1/500订单数量,上限12个,无条件进位 this._pcExpANSI.ShouCeShu1 = this._pcExpANSI.ShouCeShu2 = this._pcExpANSI.ShouCeShu3 = this._pcExpANSI.ShouCeShu4 = this._pcExpANSI.ShouCeShu5 = this._pcExpANSI.ShouCeShu6 = this._pcExpANSI.ShouCeShu7 = this._pcExpANSI.ShouCeShu8 = this._pcExpANSI.ShouCeShu9 = this._pcExpANSI.ShouCeShu10 = this._pcExpANSI.ShouCeShu11 = this._pcExpANSI.AmountTest; this._pcExpANSI.PanDing0 = this._pcExpANSI.AmountTest; //this._pcExpANSI.QuYangShu1 = mPCExpANSIDet.qQXD; //this._pcExpANSI.PanDing1 = mPCExpANSIDet.pQXD; //this._pcExpANSI.QuYangShu2 = mPCExpANSIDet.qLJPHDS; //this._pcExpANSI.PanDing2 = mPCExpANSIDet.pLJPHDS; //this._pcExpANSI.QuYangShu3 = mPCExpANSIDet.qKJGTSL; //this._pcExpANSI.PanDing3 = mPCExpANSIDet.pKJGTSL; //this._pcExpANSI.QuYangShu4 = mPCExpANSIDet.qZWXTSL; //this._pcExpANSI.PanDing4 = mPCExpANSIDet.pZWXTSL; //this._pcExpANSI.QuYangShu5 = mPCExpANSIDet.qQMDS; //this._pcExpANSI.PanDing5 = mPCExpANSIDet.pQMDS; //this._pcExpANSI.QuYangShu6 = mPCExpANSIDet.qSGDS; //this._pcExpANSI.PanDing6 = mPCExpANSIDet.pSGDS; //this._pcExpANSI.QuYangShu7 = mPCExpANSIDet.qGSCJCS; //this._pcExpANSI.PanDing7 = mPCExpANSIDet.pGSCJCS; //this._pcExpANSI.QuYangShu8 = mPCExpANSIDet.qYZZLZJCS; //this._pcExpANSI.PanDing8 = mPCExpANSIDet.pYZZLZJCS; //this._pcExpANSI.QuYangShu9 = mPCExpANSIDet.qJPCTSC; //this._pcExpANSI.PanDing9 = mPCExpANSIDet.pJPCTSC; //this._pcExpANSI.QuYangShu10 = mPCExpANSIDet.qWDCS; //this._pcExpANSI.PanDing10 = mPCExpANSIDet.pWDCS; //this._pcExpANSI.QuYangShu11 = mPCExpANSIDet.qNRXCS; //this._pcExpANSI.PanDing11 = mPCExpANSIDet.pNRXCS; #endregion } this.InitControls(); }
//客户订单 private void BarBtnCutomerOrder_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { createProduce.EditForm f = new Book.UI.produceManager.createProduce.EditForm(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (f.SelectList == null || f.SelectList.Count == 0) { return; } Model.InvoiceXODetail xd = f.SelectList[0]; this._PCExportReportANSI.Customer = xd.Invoice.xocustomer; this._PCExportReportANSI.CustomerId = xd.Invoice.xocustomerId; this._PCExportReportANSI.Specification = xd.Invoice.Customer.CheckedStandard; this._PCExportReportANSI.Product = xd.Product; this._PCExportReportANSI.InvoiceCusXOId = xd.Invoice.CustomerInvoiceXOId; this._PCExportReportANSI.Amount = xd.InvoiceXODetailQuantity.HasValue ? xd.InvoiceXODetailQuantity.Value : 0; //获取质检统计记录 //Model.PCExportReportANSIDetail _PCExportReportANSIDetail = new BL.PCExportReportANSIDetailManager().SelectForExpCEENDetailsSUM(xd.Invoice.CustomerInvoiceXOId, xd.Product.ProductId); //if (_PCExportReportANSIDetail != null) //{ #region 测试数量、合格数量 //受测数量默认为订单数量的1/500,无条件进位,最大为12 int Orderamount = int.Parse(this._PCExportReportANSI.Amount.HasValue ? this._PCExportReportANSI.Amount.ToString() : "0"); double MustCheck = 0; if (Orderamount < 500) { MustCheck = 1; } else { MustCheck = Orderamount % 500 == 0 ? Orderamount / 500 : Orderamount / 500 + 1; } this._PCExportReportANSI.AmountTest = MustCheck > 12 ? 12 : MustCheck; //受测数量12个,无条件进位 this._PCExportReportANSI.ShouCeShu1 = this._PCExportReportANSI.AmountTest; //this._PCExportReportANSI.ShouCeShu2 = this._PCExportReportANSI.ShouCeShu3 = this._PCExportReportANSI.ShouCeShu4 = this._PCExportReportANSI.ShouCeShu5 = this._PCExportReportANSI.ShouCeShu6 = this._PCExportReportANSI.ShouCeShu7 = this._PCExportReportANSI.ShouCeShu8 = this._PCExportReportANSI.ShouCeShu9 == this._PCExportReportANSI.ShouCeShu12 this._PCExportReportANSI.PanDing1 = this._PCExportReportANSI.AmountTest; //this._PCExportReportANSI.QuYangShu1 = _PCExportReportANSIDetail.qCEENCONSTRUCTION; //this._PCExportReportANSI.PanDing2 = _PCExportReportANSIDetail.pCEENQMDS; //this._PCExportReportANSI.QuYangShu2 = _PCExportReportANSIDetail.qCEENQMDS; //this._PCExportReportANSI.PanDing3 = _PCExportReportANSIDetail.pCEENSGDS; //this._PCExportReportANSI.QuYangShu3 = _PCExportReportANSIDetail.qCEENSGDS; //this._PCExportReportANSI.PanDing4 = _PCExportReportANSIDetail.pCEENLJDS; //this._PCExportReportANSI.QuYangShu4 = _PCExportReportANSIDetail.qCEENLJDS; //this._PCExportReportANSI.PanDing5 = _PCExportReportANSIDetail.pCEENZB; //this._PCExportReportANSI.QuYangShu5 = _PCExportReportANSIDetail.qCEENZB; //this._PCExportReportANSI.PanDing6 = _PCExportReportANSIDetail.pCEENTSL; //this._PCExportReportANSI.QuYangShu6 = _PCExportReportANSIDetail.qCEENTSL; //this._PCExportReportANSI.PanDing7 = _PCExportReportANSIDetail.pCEENBMPZ; //this._PCExportReportANSI.QuYangShu7 = _PCExportReportANSIDetail.qCEENBMPZ; //this._PCExportReportANSI.PanDing8 = _PCExportReportANSIDetail.pCEENZSCJ; //this._PCExportReportANSI.QuYangShu8 = _PCExportReportANSIDetail.qCEENZSCJ; //this._PCExportReportANSI.PanDing9 = _PCExportReportANSIDetail.pCEENGSCJ; ; //this._PCExportReportANSI.QuYangShu9 = _PCExportReportANSIDetail.qCEENGSCJ; //this._PCExportReportANSI.PanDing10 = this._PCExportReportANSI.AmountTest; //this._PCExportReportANSI.QuYangShu10 = _PCExportReportANSIDetail.qCEENJH; //this._PCExportReportANSI.PanDing11 = this._PCExportReportANSI.AmountTest; //this._PCExportReportANSI.QuYangShu11 = _PCExportReportANSIDetail.qCEENZX; //this._PCExportReportANSI.PanDingShu12 = _PCExportReportANSIDetail.pCEENUVCF; //this._PCExportReportANSI.QuYangShu12 = _PCExportReportANSIDetail.qCEENUVCF; #endregion //} this.InitControls(); }
private void _Update(Model.InvoiceXS invoice) { _ValidateForUpdate(invoice); invoice.UpdateTime = DateTime.Now; invoice.CustomerId = invoice.Customer.CustomerId; invoice.DepotId = invoice.Depot.DepotId; invoice.Employee0Id = invoice.Employee0.EmployeeId; invoice.Employee1Id = invoice.Employee1 == null ? null : invoice.Employee1.EmployeeId; invoice.Employee2Id = invoice.Employee2 == null ? null : invoice.Employee2.EmployeeId; Model.InvoiceXS invoiceOriginal = this.Get(invoice.InvoiceId); switch ((Helper.InvoiceStatus)invoiceOriginal.InvoiceStatus) { case Helper.InvoiceStatus.Normal: switch ((Helper.InvoiceStatus)invoice.InvoiceStatus) { case Helper.InvoiceStatus.Draft: throw new InvalidOperationException(); case Helper.InvoiceStatus.Normal: invoiceOriginal.InvoiceStatus = (int)Helper.InvoiceStatus.Null; _TurnNull(invoiceOriginal); accessor.Delete(invoiceOriginal.InvoiceId); invoice.InsertTime = invoiceOriginal.InsertTime; invoice.UpdateTime = DateTime.Now; _Insert(invoice); break; case Helper.InvoiceStatus.Null: foreach (Model.InvoiceXSDetail detail in invoice.Details) { Model.InvoiceXODetail xodetail = invoiceXODetailAccessor.Get(detail.InvoiceXODetailId); if (xodetail != null) { xodetail.InvoiceXODetailBeenQuantity = Convert.ToDouble(xodetail.InvoiceXODetailBeenQuantity) - detail.InvoiceXSDetailQuantity; if (!xodetail.InvoiceXTDetailQuantity.HasValue) { xodetail.InvoiceXTDetailQuantity = 0; } xodetail.InvoiceXODetailQuantity0 = xodetail.InvoiceXODetailQuantity - xodetail.InvoiceXODetailBeenQuantity + xodetail.InvoiceXTDetailQuantity; if (xodetail.InvoiceXODetailQuantity0 < 0) { xodetail.InvoiceXODetailQuantity0 = 0; } if (xodetail.InvoiceXODetailQuantity0 == 0) { xodetail.DetailsFlag = 2; } else if (xodetail.InvoiceXODetailQuantity0 == xodetail.InvoiceXODetailQuantity) { xodetail.DetailsFlag = 0; } else { xodetail.DetailsFlag = 1; } invoiceXODetailAccessor.Update(xodetail); invoiceXOManager.UpdateInvoiceFlag(xodetail.Invoice); } if (detail.DepotPosition != null) { stockAccessor.Increment(detail.DepotPosition, detail.Product, detail.InvoiceXSDetailQuantity.Value); //更新产品库存 this.productManager.UpdateProduct_Stock(detail.Product); } //临时注销客户产品 //Model.CustomerProducts p = detail.PrimaryKey; //p.PrimaryKeyId = detail.PrimaryKey.PrimaryKeyId; //if (p.DepotQuantity == null) // p.DepotQuantity = 0; //if (p.OrderQuantity == null) // p.OrderQuantity = 0; //p.DepotQuantity -= detail.InvoiceXSDetailQuantity; //p.OrderQuantity += detail.InvoiceXSDetailQuantity; //customerProductsAccessor.Update(p); } if (invoice.InvoiceXO != null) { this.invoiceXOManager.UpdateInvoiceFlag(invoice.InvoiceXO); } break; } break; } }
private void _Insert(Model.InvoiceXS invoice) { invoice.DepotId = invoice.Depot.DepotId; invoice.Employee0Id = invoice.Employee0.EmployeeId; invoice.Employee1Id = invoice.Employee1 == null ? null : invoice.Employee1.EmployeeId; invoice.Employee2Id = invoice.Employee2 == null ? null : invoice.Employee2.EmployeeId; accessor.Insert(invoice); foreach (Model.InvoiceXSDetail detail in invoice.Details) { // if (detail.PrimaryKey == null || string.IsNullOrEmpty(detail.PrimaryKey.PrimaryKeyId)) continue; if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId)) { continue; } Model.Stock stock = stockAccessor.GetStockByProductIdAndDepotPositionId(detail.ProductId, detail.DepotPositionId); if (stock == null || Convert.ToDecimal(stock.StockQuantity1) < Convert.ToDecimal(detail.InvoiceXSDetailQuantity)) { throw new Helper.MessageValueException("" + detail.Product + "\r出貨數量不能大於貨位庫存"); } detail.InvoiceId = invoice.InvoiceId; invoiceXSDetailAccessor.Insert(detail); Model.InvoiceXODetail xodetail = invoiceXODetailAccessor.Get(detail.InvoiceXODetailId); if (xodetail != null) { if (detail.InvoiceXSDetailQuantity >= xodetail.InvoiceXODetailQuantity0) { xodetail.DetailsFlag = (int)Helper.DetailsFlag.AllArrived; } else { xodetail.DetailsFlag = (int)Helper.DetailsFlag.PartArrived; } if (!xodetail.InvoiceXODetailBeenQuantity.HasValue) { xodetail.InvoiceXODetailBeenQuantity = 0; } if (!xodetail.InvoiceXTDetailQuantity.HasValue) { xodetail.InvoiceXTDetailQuantity = 0; } xodetail.InvoiceXODetailBeenQuantity += detail.InvoiceXSDetailQuantity; xodetail.InvoiceXODetailQuantity0 = xodetail.InvoiceXODetailQuantity - xodetail.InvoiceXODetailBeenQuantity + xodetail.InvoiceXTDetailQuantity; if (xodetail.InvoiceXODetailQuantity0 < 0) { xodetail.InvoiceXODetailQuantity0 = 0; } invoiceXODetailAccessor.Update(xodetail); //改变客户订单和生产加工单的结案状态 invoiceXOManager.UpdateInvoiceFlag(xodetail.Invoice); } //更新产品表库存 // customerProductsAccessor.Update(p); //更新销售订单出货量和未出货量 //单位转化过程 //1 //2 //3 if (detail.DepotPosition != null) { // 更新库存 stockAccessor.Decrement(detail.DepotPosition, detail.Product, detail.InvoiceXSDetailQuantity.Value); //更新产品库存 //this.productManager.UpdateProduct_Stock(detail.Product); detail.Product.StocksQuantity = stockAccessor.GetTheCountByProduct(detail.Product); detail.Product.ProductNearXSDate = DateTime.Now; this.productManager.update(detail.Product); } } //客户最近交易日 invoice.Customer.LastTransactionDate = DateTime.Now; customerAccessor.Update(invoice.Customer); }
public void Update(Model.InvoiceXODetail e) { this.Update <Model.InvoiceXODetail>(e); }
/// <summary> /// 单价校对修改 /// </summary> public void UpdateProofUnitPrice(Model.InvoiceXODetail e) { //修改详细 accessor.UpdateProofUnitPrice(e); }
private void _Insert(Model.InvoiceXS invoice) { invoice.DepotId = invoice.Depot.DepotId; invoice.Employee0Id = invoice.Employee0.EmployeeId; invoice.Employee1Id = invoice.Employee1 == null ? null : invoice.Employee1.EmployeeId; invoice.Employee2Id = invoice.Employee2 == null ? null : invoice.Employee2.EmployeeId; accessor.Insert(invoice); foreach (Model.InvoiceXSDetail detail in invoice.Details) { // if (detail.PrimaryKey == null || string.IsNullOrEmpty(detail.PrimaryKey.PrimaryKeyId)) continue; if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId)) { continue; } detail.InvoiceId = invoice.InvoiceId; invoiceXSDetailAccessor.Insert(detail); Model.InvoiceXODetail xodetail = invoiceXODetailAccessor.Get(detail.InvoiceXODetailId); if (xodetail != null) { if (detail.InvoiceXSDetailQuantity >= xodetail.InvoiceXODetailQuantity0) { xodetail.DetailsFlag = (int)Helper.DetailsFlag.AllArrived; } else { xodetail.DetailsFlag = (int)Helper.DetailsFlag.PartArrived; } if (!xodetail.InvoiceXODetailBeenQuantity.HasValue) { xodetail.InvoiceXODetailBeenQuantity = 0; } if (!xodetail.InvoiceXTDetailQuantity.HasValue) { xodetail.InvoiceXTDetailQuantity = 0; } double noArr = xodetail.InvoiceXODetailQuantity0.Value; xodetail.InvoiceXODetailBeenQuantity += detail.InvoiceXSDetailQuantity; xodetail.InvoiceXODetailQuantity0 = xodetail.InvoiceXODetailQuantity - xodetail.InvoiceXODetailBeenQuantity + xodetail.InvoiceXTDetailQuantity; if (xodetail.InvoiceXODetailQuantity0 < 0) { xodetail.InvoiceXODetailQuantity0 = 0; } invoiceXODetailAccessor.Update(xodetail); invoiceXOManager.UpdateInvoiceFlag(xodetail.Invoice); if (!string.IsNullOrEmpty(xodetail.HandbookProductId) && !string.IsNullOrEmpty(xodetail.HandbookId)) { bGHandbookDetail1Manager.UpdateYDWC(xodetail, 0 - (noArr - xodetail.InvoiceXODetailQuantity0.Value)); } } if (!string.IsNullOrEmpty(detail.HandbookProductId) && !string.IsNullOrEmpty(detail.HandbookId)) { bGHandbookDetail1Manager.UpdateBee(detail.HandbookId, detail.HandbookProductId, detail.InvoiceXSDetailQuantity.Value);//修改手册已出 } if (detail.DepotPosition != null) { // 更新库存 stockAccessor.Decrement(detail.DepotPosition, detail.Product, detail.InvoiceXSDetailQuantity.Value); //更新产品库存 //this.productManager.UpdateProduct_Stock(detail.Product); detail.Product.StocksQuantity = stockAccessor.GetTheCountByProduct(detail.Product); detail.Product.ProductNearXSDate = DateTime.Now; this.productManager.update(detail.Product); } } //客户最近交易日 invoice.Customer.LastTransactionDate = DateTime.Now; customerAccessor.Update(invoice.Customer); }
private void _Update(Model.InvoiceXT invoice) { _ValidateForUpdate(invoice); invoice.UpdateTime = DateTime.Now; invoice.CustomerId = invoice.Customer.CustomerId; //invoice.DepotId = invoice.Depot.DepotId; invoice.Employee0Id = invoice.Employee0.EmployeeId; invoice.Employee1Id = invoice.Employee1 == null ? null : invoice.Employee1.EmployeeId; invoice.Employee2Id = invoice.Employee2 == null ? null : invoice.Employee2.EmployeeId; InvoiceCost(invoice); Model.InvoiceXT invocieOriginal = this.Get(invoice.InvoiceId); switch ((Helper.InvoiceStatus)invocieOriginal.InvoiceStatus) { case Helper.InvoiceStatus.Draft: switch ((Helper.InvoiceStatus)invoice.InvoiceStatus) { case Helper.InvoiceStatus.Draft: invoiceXTDetailAccessor.Delete(invocieOriginal); foreach (Model.InvoiceXTDetail detail in invoice.Details) { if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId)) { continue; } detail.InvoiceXTDetailId = Guid.NewGuid().ToString(); detail.InvoiceId = invoice.InvoiceId; invoiceXTDetailAccessor.Insert(detail); } break; case Helper.InvoiceStatus.Normal: accessor.Delete(invocieOriginal.InvoiceId); invoice.InsertTime = invocieOriginal.InsertTime; invoice.UpdateTime = DateTime.Now; _Insert(invoice); break; case Helper.InvoiceStatus.Null: throw new InvalidOperationException(); } break; case Helper.InvoiceStatus.Normal: switch ((Helper.InvoiceStatus)invoice.InvoiceStatus) { case Helper.InvoiceStatus.Draft: throw new InvalidOperationException(); case Helper.InvoiceStatus.Normal: invocieOriginal.InvoiceStatus = (int)Helper.InvoiceStatus.Null; _TurnNull(invocieOriginal); accessor.Delete(invocieOriginal.InvoiceId); invoice.UpdateTime = DateTime.Now; _Insert(invoice); break; case Helper.InvoiceStatus.Null: //invoice.Employee3Id = V.ActiveEmployee.EmployeeId; //invoice.InvoiceZFTime = DateTime.Now; //invoice.InvoiceZFCause = ""; //accessor.Update(invoice); //Model.Depot depot1 = invoice.Depot; foreach (Model.InvoiceXTDetail detail in invoice.Details) { if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId)) { continue; } if (detail.DepotPosition != null) { stockAccessor.Decrement(detail.DepotPosition, detail.Product, detail.InvoiceXTDetailQuantity); productManager.UpdateProduct_Stock(detail.Product); } Model.InvoiceXODetail xodetail = invoiceXODetailAccessor.Get(detail.InvoiceXODetailId); if (xodetail != null) { xodetail.InvoiceXTDetailQuantity = Convert.ToDouble(xodetail.InvoiceXTDetailQuantity) - Convert.ToDouble(detail.InvoiceXTDetailQuantity); xodetail.InvoiceXODetailQuantity0 = Convert.ToDouble(xodetail.InvoiceXODetailQuantity) - Convert.ToDouble(xodetail.InvoiceXODetailBeenQuantity) + Convert.ToDouble(xodetail.InvoiceXTDetailQuantity); if (xodetail.InvoiceXODetailQuantity0 < 0) { xodetail.InvoiceXODetailQuantity0 = 0; } if (xodetail.InvoiceXODetailQuantity0 == 0) { xodetail.DetailsFlag = 2; } else if (xodetail.InvoiceXODetailQuantity0 == xodetail.InvoiceXODetailQuantity) { xodetail.DetailsFlag = 0; } else { xodetail.DetailsFlag = 1; } invoiceXODetailAccessor.Update(xodetail); invoiceXOManager.UpdateInvoiceFlag(xodetail.Invoice); } } break; } break; case Helper.InvoiceStatus.Null: throw new InvalidOperationException(); } }