private void Validate(Model.ProduceOtherCompact produceOtherCompact) { if (string.IsNullOrEmpty(produceOtherCompact.ProduceOtherCompactId)) { throw new Helper.RequireValueException(Model.ProduceOtherCompact.PRO_ProduceOtherCompactId); } }
public void Delete(Model.ProduceOtherCompact produceOtherCompact) { // // todo:add other logic here // this.Delete(produceOtherCompact.ProduceOtherCompactId); }
public EditForm(string produceOtherCompactId) : this() { this._produceOtherCompact = this.produceOtherCompactManager.GetDetails(produceOtherCompactId); this.action = "view"; LastFlag = 1; }
/// <summary> /// 自定义列显示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.ProduceOtherCompactDetail> details = this.bindingSource1.DataSource as IList <Model.ProduceOtherCompactDetail>; if (details == null || details.Count < 1) { return; } Model.ProduceOtherCompact detail = details[e.ListSourceRowIndex].ProduceOtherCompact; Model.Product products = details[e.ListSourceRowIndex].Product; switch (e.Column.Name) { case "gridColumn2": if (detail == null) { return; } e.DisplayText = detail.ProduceOtherCompactDate.Value.ToString("yyyy-MM-dd"); break; case "gridColumn5": if (products == null) { return; } e.DisplayText = string.IsNullOrEmpty(products.Id) ? "" : products.Id;; break; } }
public void UpdateProduceOtherCompactFlag(Model.ProduceOtherCompact produceOtherCompact) { int flag = 0; IList <Model.ProduceOtherCompactDetail> list = produceOtherCompactDetailAccessor.Select(produceOtherCompact); foreach (Model.ProduceOtherCompactDetail detail in list) { flag += detail.DetailsFlag == null ? 0 : detail.DetailsFlag.Value; } if (flag == 0) { produceOtherCompact.InvoiceDetailFlag = 0; } else if (flag < list.Count * 2) { produceOtherCompact.InvoiceDetailFlag = 1; } else if (flag == list.Count * 2) { produceOtherCompact.InvoiceDetailFlag = 2; } if (produceOtherCompact.InvoiceDetailFlag == 2) { produceOtherCompact.IsClose = true; } else { produceOtherCompact.IsClose = false; } new BL.ProduceOtherCompactManager().UpdateOtherCompact(produceOtherCompact); }
//选择委外合同 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(); }
protected override void MovePrev() { Model.ProduceOtherCompact produceOtherCompact = this.produceOtherCompactManager.GetPrev(this._produceOtherCompact); if (produceOtherCompact == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._produceOtherCompact = this.produceOtherCompactManager.Get(produceOtherCompact.ProduceOtherCompactId); }
public void UpdateOtherCompact(Model.ProduceOtherCompact produceOtherCompact) { // // todo: add other logic here. // Validate(produceOtherCompact); produceOtherCompact.UpdateTime = DateTime.Now; accessor.Update(produceOtherCompact); }
public Model.ProduceOtherCompact GetDetails(string produceOtherCompactId) { Model.ProduceOtherCompact produceOtherCompact = accessor.Get(produceOtherCompactId); if (produceOtherCompact != null) { produceOtherCompact.Details = ProduceOtherCompactDetailAccessor.Select(produceOtherCompact); produceOtherCompact.DetailMaterial = ProduceOtherCompactMaterialAccessor.Select(produceOtherCompact); } return(produceOtherCompact); }
public IList <Book.Model.ProduceOtherInDepotDetail> Select(Model.ProduceOtherCompact startPronoteHeader, Model.ProduceOtherCompact endPronoteHeader, DateTime startDate, DateTime endDate) { Hashtable ht = new Hashtable(); ht.Add("startpronoteid", startPronoteHeader == null ? null : startPronoteHeader.ProduceOtherCompactId); ht.Add("endpronoteid", endPronoteHeader == null ? null : endPronoteHeader.ProduceOtherCompactId); ht.Add("startdate", startDate); ht.Add("enddate", endDate); return(sqlmapper.QueryForList <Model.ProduceOtherInDepotDetail>("ProduceOtherInDepotDetail.select_byProduceInDateAndPronote", ht)); }
private void btn_ProduceOtherCompact_Click(object sender, EventArgs e) { #region 取客户订单(弃用2013年5月17日11:40:06 CN) //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.txt_Product.EditValue = model.Product == null ? null : model.Product.ToString(); // this._pcBoxFootCheck.InvoiceXOId = model.InvoiceId; // this.txt_InvoiceXO.EditValue = model.InvoiceId; // this.spinEditGetNum.EditValue = model.InvoiceXODetailQuantity; // } //} #endregion #region 取委外合同 2013年5月17日11:40:23 CN ProduceOtherCompact.ChooseOutContract f = new Book.UI.produceManager.ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) == DialogResult.OK) { Model.ProduceOtherCompact currentModel = f.SelectItem as Model.ProduceOtherCompact; if (currentModel != null) { this._pcBoxFootCheck.PronoteHeaderId = currentModel.PronoteHeaderId; //加工单据编号 this._pcBoxFootCheck.InvoiceXOId = currentModel.InvoiceXOId; //客户订单编号 this._pcBoxFootCheck.InvoiceXO = currentModel.InvoiceXO; if (currentModel.InvoiceXO != null) { this._pcBoxFootCheck.Customer = currentModel.InvoiceXO.Customer; this._pcBoxFootCheck.CheckStandard = currentModel.InvoiceXO.xocustomer.CheckedStandard; this.txt_InvoiceXO.EditValue = currentModel.InvoiceXO.CustomerInvoiceXOId; } Model.ProduceOtherCompactDetail pocd = new Book.BL.ProduceOtherCompactDetailManager().Select(currentModel)[0]; if (pocd != null) { //if (this._pcBoxFootCheck.Product != null) //{ this._pcBoxFootCheck.Product = pocd.Product; this._pcBoxFootCheck.ProductId = this._pcBoxFootCheck.Product.ProductId; //} if (pocd.ProduceOtherCompact != null) { this._pcBoxFootCheck.PronoteHeaderId = pocd.ProduceOtherCompact.PronoteHeaderId; } this._pcBoxFootCheck.GetNum = pocd.OtherCompactCount; } this.Refresh(); } } #endregion }
private void xrSubreport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { ROContinuousDetails detail = this.xrSubreport1.ReportSource as ROContinuousDetails; Model.ProduceOtherCompact poc = this.GetCurrentRow() as Model.ProduceOtherCompact; if (poc != null) { poc.Details = this.produceOtherCompactdetailManager.Select(poc); detail.ProduceOtherCompact = poc; } }
//private void barButtonItemProcedures_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) //{ // #region // PronoteHeader.SelectPronoteProceduresDetail f = new PronoteHeader.SelectPronoteProceduresDetail(); // if (f.ShowDialog(this) == DialogResult.OK) // { // if (f._pronoteProcedureDetails != null&&f._pronoteProcedureDetails.Count>0) // { // this._produceOtherCompact.Details.Clear(); // this._produceOtherCompact.DetailMaterial.Clear(); // this.comboBoxOperationType.SelectedIndex = (int)global::Helper.ProduceOther.OtherOperationType.ProceduresOther; // this._produceOtherCompact.PronoteHeaderId = f._pronoteProcedureDetails[0].PronoteHeaderID; // this._produceOtherCompact.MRSHeaderId = (new BL.PronoteHeaderManager()).Get(this._produceOtherCompact.PronoteHeaderId).MRSHeaderId; // this.newChooseSupplierId.EditValue = f._pronoteProcedureDetails[0].Supplier; // if (!string.IsNullOrEmpty(this._produceOtherCompact.MRSHeaderId)) // { // Model.MRSHeader mRSHeader = this.mRSHeaderManager.Get(this._produceOtherCompact.MRSHeaderId); // if (mRSHeader != null) // { // Model.MPSheader mPSheader = this.mPSheaderManager.Get(mRSHeader.MPSheaderId); // if (mPSheader != null) // { // this.textEditCustomerXOId.Text = this.invoiceXOManager.Get(mPSheader.InvoiceXOId) == null ? "" : this.invoiceXOManager.Get(mPSheader.InvoiceXOId).CustomerInvoiceXOId; // } // else // this.textEditCustomerXOId.Text = string.Empty; // } // else // this.textEditCustomerXOId.Text = string.Empty; // } // else // this.textEditCustomerXOId.Text = string.Empty; // foreach(Model.PronoteProceduresDetail item in f._pronoteProcedureDetails ) // { // Model.ProduceOtherCompactDetail detail = new Model.ProduceOtherCompactDetail(); // detail.OtherCompactDetailId=Guid.NewGuid().ToString(); // detail.Product=item.PronoteHeader.Product; // if(detail.Product!=null ) // detail.ProductId=detail.Product.ProductId; // detail.CustomInvoiceXOId = invoiceXOManager.Get(item.PronoteHeader.InvoiceXOId).CustomerInvoiceXOId; // detail.Procedures=item.Procedures; // detail.ProceduresId=item.ProceduresId; // detail.ProductUnit=item.PronoteHeader.ProductUnit; // detail.OtherCompactCount=item.PronoteHeader.DetailsSum; // this._produceOtherCompact.Details.Add(detail); // Model.ProduceOtherCompactMaterial material = new Model.ProduceOtherCompactMaterial(); // material.ProduceOtherCompactMaterialId = Guid.NewGuid().ToString(); // material.ProduceQuantity = item.PronoteHeader.DetailsSum; // //取前道工序 商品名称 // Model.Product productUp=new Model.Product(); // Model.BomParentPartInfo bom=new BL.BomParentPartInfoManager().Get(detail.Product); // if(bom !=null) // { // Model.TechonlogyHeader th=new BL.TechonlogyHeaderManager().Get(bom.TechonlogyHeaderId); // if(th!=null) // { // IList<Model.Technologydetails> tHdetail=new BL.TechnologydetailsManager().Select(th); // IList<string> proceduresList = new List<string>(); // string a=""; // foreach (Model.Technologydetails td in tHdetail) // { // if (td.ProceduresId == detail.ProceduresId) // { // a = td.TechnologydetailsNo; // } // } // foreach(Model.Technologydetails td in tHdetail ) // { // if(Int32.Parse(td.TechnologydetailsNo)<Int32.Parse(a)) // proceduresList.Add(td.ProceduresId); // } // BL.ProductProcessManager productProcessManager=new BL.ProductProcessManager(); // int flag=0; // foreach( Model.Product pro in this.productManager.SelectProceProduct(detail.Product)) // { // flag = 0; // IList<Model.ProductProcess> processList= productProcessManager.Select(pro.ProductId); // foreach(Model.ProductProcess process in processList) // { // if((!proceduresList.Contains(process.ProceduresId))||proceduresList.Count!=processList.Count) // flag=1; // } // if (flag == 0) // { // if (processList.Count == 0) // { // if (productUp.ProductId == null) // productUp = pro; // } // else // productUp = pro; // } // } // } // } // if (productUp.ProductId != null) // { // material.Product = productUp; // material.ProductId = productUp.ProductId; // material.ProductUnit = item.PronoteHeader.ProductUnit; // this._produceOtherCompact.DetailMaterial.Add(material); // } // } // } // this.gridControl1.RefreshDataSource(); // this.gridControl2.RefreshDataSource(); // f.Dispose(); // GC.Collect(); // } // #endregion //} private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ListForm f = new ListForm(); if (f.ShowDialog(this) == DialogResult.OK) { this._produceOtherCompact = f.SelectItem as Model.ProduceOtherCompact; this.action = "view"; this.Refresh(); } }
protected override void MoveLast() { if (LastFlag == 1) { LastFlag = 0; return; } // if (produceOtherCompact == null) // { this._produceOtherCompact = this.produceOtherCompactManager.Get(this.produceOtherCompactManager.GetLast() == null ? "" : this.produceOtherCompactManager.GetLast().ProduceOtherCompactId); // } }
private void xrSubreport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { Q53_1 compact = this.xrSubreport1.ReportSource as Q53_1; Model.ProduceOtherCompact temp = this.GetCurrentRow() as Model.ProduceOtherCompact; if (temp != null) { temp.Details = this.detailManager.Select(temp.ProduceOtherCompactId, this.conditionCom.ProductId1, this.conditionCom.ProductId2); compact.ProduceOtherCompact = temp; } }
public EditForm(Model.ProduceOtherCompact produceOtherCompact, string action) : this() { this._produceOtherCompact = produceOtherCompact; this._produceOtherCompact.Details = this.produceOtherCompactDetailManager.Select(produceOtherCompact); this._produceOtherCompact.DetailMaterial = this.produceOtherCompactMaterialManager.Select(produceOtherCompact); this.action = action; if (this.action == "view") { LastFlag = 1; } }
/// <summary> /// Update a ProduceOtherCompact. /// </summary> public void Update(Model.ProduceOtherCompact produceOtherCompact) { // // todo: add other logic here. // Validate(produceOtherCompact); if (produceOtherCompact != null) { this.Delete(produceOtherCompact); produceOtherCompact.UpdateTime = DateTime.Now; this.Insert(produceOtherCompact); } }
/// <summary> /// /// Delete ProduceOtherCompact by primary key. /// </summary> public void Delete(string produceOtherCompactId) { // // todo:add other logic here // Model.ProduceOtherCompact model = this.Get(produceOtherCompactId); string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd")); SequenceManager.Decrement(sequencekey_d); accessor.Delete(produceOtherCompactId); }
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.ProduceOtherCompactDetail> details = this.bindingSourceDetail.DataSource as IList <Model.ProduceOtherCompactDetail>; Model.ProduceOtherCompactDetail detailss = details[e.ListSourceRowIndex]; Model.ProduceOtherCompact detail = details[e.ListSourceRowIndex].ProduceOtherCompact; switch (e.Column.Name) { //case "gridColumn2": // if (detail == null) return; // e.DisplayText = detail.ProduceOtherCompactDate.Value.ToString("yyyy-MM-dd"); // break; case "gridColumn3": if (detail == null) { return; } e.DisplayText = detail.Supplier == null ? "" : detail.Supplier.SupplierShortName; break; case "gridColumnguige": if (detailss == null) { return; } e.DisplayText = detailss == null ? "" : detailss.ProductSpecification; break; case "gridColumnProductId": if (detailss == null) { return; } e.DisplayText = detailss.Product == null ? "" : detailss.Product.Id; break; case "gridColumnstock": if (detailss == null || detailss.Product.StocksQuantity == null) { return; } e.DisplayText = detailss.Product.StocksQuantity.ToString(); break; } }
//选择委外单据 private void btnGetOtherPacmt_Click(object sender, EventArgs e) { ProduceOtherCompact.ChooseOutContract f = new Book.UI.produceManager.ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) == DialogResult.OK) { Model.ProduceOtherCompact currentModel = f.SelectItem as Model.ProduceOtherCompact; if (currentModel != null) { this._PCIC.WorkHouse = (this.nccWorkHouse.EditValue as Model.WorkHouse); if (this._PCIC.WorkHouse != null) { this._PCIC.WorkHouseId = this._PCIC.WorkHouse.WorkHouseId; } this._PCIC.PCImpactCheckDate = this.DE_PCImpactCheckDate.DateTime; this._PCIC.PronoteHeaderId = currentModel.PronoteHeaderId; //加工单据编号 this._PCIC.InvoiceCusXOId = currentModel.CustomerInvoiceXOId; //客户订单编号 this._PCIC.mCheckStandard = currentModel.Customer.CheckedStandard; //质检标准 //if (!string.IsNullOrEmpty(currentModel.MRSHeaderId)) //客户订单编号 //{ // Model.MRSHeader mrsHeader = new BL.MRSHeaderManager().Get(currentModel.MRSHeaderId); // if (mrsHeader != null) // { // Model.MPSheader mPSheader = new BL.MPSheaderManager().Get(mrsHeader.MPSheaderId); // if (mPSheader != null) // { // Model.InvoiceXO invoiceXo = new BL.InvoiceXOManager().Get(mPSheader.InvoiceXOId); // this._PCIC.InvoiceCusXOId = invoiceXo == null ? string.Empty : invoiceXo.CustomerInvoiceXOId; // } // } //} if (this.OtherCompactDetailManager.Select(currentModel)[0] != null) { this._PCIC.Product = this.OtherCompactDetailManager.Select(currentModel)[0].Product; this._PCIC.ProductId = this.OtherCompactDetailManager.Select(currentModel)[0].ProductId; this._PCIC.PronoteHeaderId = currentModel.ProduceOtherCompactId; this._PCIC.PCFromType = 1; //单据类型 this._PCIC.ProductUnit = this._PCIC.Product.ProduceUnit; this._PCIC.ProductUnitId = this._PCIC.Product.ProduceUnitId; } this.Refresh(); } } f.Dispose(); GC.Collect(); }
private void simpleButton_Sure_Click(object sender, EventArgs e) { Model.ProduceOtherCompact temp = this.bindingSourceProduceOtherCompay.Current as Model.ProduceOtherCompact; if (temp == null) { return; } if (this.sign == "product") { Editform._compact = temp; } else if (this.sign == "material") { ProduceOtherMaterial.EditForm._compact = temp; } this.DialogResult = DialogResult.OK; }
private void TiGuiExists(Model.ProduceOtherCompact model) { if (this.ExistsPrimary(model.ProduceOtherCompactId)) { //设置KEY值 string invoiceKind = this.GetInvoiceKind().ToLower(); //string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year); //string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd")); //string sequencekey = string.Format(invoiceKind); //SequenceManager.Increment(sequencekey_y); //SequenceManager.Increment(sequencekey_m); SequenceManager.Increment(sequencekey_d); //SequenceManager.Increment(sequencekey); model.ProduceOtherCompactId = this.GetIdSimple(model.InsertTime.Value); TiGuiExists(model); //throw new Helper.InvalidValueException(Model.Product.PRO_Id); } }
protected override void Delete() { if (this.produceOtherCompactManager == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } // try //{ this.produceOtherCompactManager.Delete(this._produceOtherCompact); this._produceOtherCompact = this.produceOtherCompactManager.GetNext(this._produceOtherCompact); if (this._produceOtherCompact == null) { this._produceOtherCompact = this.produceOtherCompactManager.GetLast(); } // TreeLoad(); }
public Model.ProduceOtherCompact GetPrev(Model.ProduceOtherCompact e) { return(sqlmapper.QueryForObject <Model.ProduceOtherCompact>("ProduceOtherCompact.get_prev", e)); }
public Model.ProduceOtherCompact GetNext(Model.ProduceOtherCompact e) { return(sqlmapper.QueryForObject <Model.ProduceOtherCompact>("ProduceOtherCompact.get_next", e)); }
public bool HasRowsAfter(Model.ProduceOtherCompact e) { return(sqlmapper.QueryForObject <bool>("ProduceOtherCompact.has_rows_after", e)); }
public bool HasRowsBefore(Model.ProduceOtherCompact e) { return(sqlmapper.QueryForObject <bool>("ProduceOtherCompact.has_rows_before", e)); }
public void Update(Model.ProduceOtherCompact e) { this.Update <Model.ProduceOtherCompact>(e); }
public void Insert(Model.ProduceOtherCompact e) { this.Insert <Model.ProduceOtherCompact>(e); }
/// <summary> /// Insert a ProduceOtherCompact. /// </summary> public void Insert(Model.ProduceOtherCompact produceOtherCompact) { // // todo:add other logic here // produceOtherCompact.InsertTime = DateTime.Now; produceOtherCompact.UpdateTime = DateTime.Now; Validate(produceOtherCompact); TiGuiExists(produceOtherCompact); try { if (this.ExistsPrimary(produceOtherCompact.ProduceOtherCompactId)) { produceOtherCompact.ProduceOtherCompactId = this.GetId(); } BL.V.BeginTransaction(); string invoiceKind = this.GetInvoiceKind().ToLower(); //string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, produceOtherCompact.InsertTime.Value.Year); //string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, produceOtherCompact.InsertTime.Value.Year, produceOtherCompact.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, produceOtherCompact.InsertTime.Value.ToString("yyyy-MM-dd")); //string sequencekey = string.Format(invoiceKind); //SequenceManager.Increment(sequencekey_y); //SequenceManager.Increment(sequencekey_m); SequenceManager.Increment(sequencekey_d); //SequenceManager.Increment(sequencekey); produceOtherCompact.InvoiceStatus = 1; accessor.Insert(produceOtherCompact); foreach (Model.ProduceOtherCompactDetail produceOtherCompactDetail in produceOtherCompact.Details) { if (produceOtherCompactDetail.Product == null || string.IsNullOrEmpty(produceOtherCompactDetail.ProductId)) { throw new Exception("貨品不為空"); } if (produceOtherCompactDetail.OtherCompactCount < 0) { continue; } produceOtherCompactDetail.ProduceOtherCompactId = produceOtherCompact.ProduceOtherCompactId; Model.MPSdetails mpsDal = new BL.MPSdetailsManager().Get(produceOtherCompactDetail.MPSDetailId); //double Sum = new PronotedetailsManager().GetByMPSdetail(produceOtherCompactDetail.MPSDetailId); if (mpsDal != null) { mpsDal.MPSHasSingleSum += produceOtherCompactDetail.OtherCompactCount; if (mpsDal.MPSHasSingleSum == mpsDal.MPSdetailssum) { mpsDal.MPSEndState = true; } new BL.MPSdetailsManager().Update(mpsDal); } ProduceOtherCompactDetailAccessor.Insert(produceOtherCompactDetail); } foreach (Model.ProduceOtherCompactMaterial detailMaterial in produceOtherCompact.DetailMaterial) { if (string.IsNullOrEmpty(detailMaterial.ProductId)) { continue; } detailMaterial.ProduceOtherCompactId = produceOtherCompact.ProduceOtherCompactId; //Model.MPSdetails mpsDal = new BL.MPSdetailsManager().Get(produceOtherCompactDetail.MPSDetailId); ////double Sum = new PronotedetailsManager().GetByMPSdetail(produceOtherCompactDetail.MPSDetailId); //if (mpsDal != null) //{ // mpsDal.MPSHasSingleSum += produceOtherCompactDetail.OtherCompactCount; // if (mpsDal.MPSHasSingleSum == mpsDal.MPSdetailssum) // { // mpsDal.MPSEndState = true; // } // new BL.MPSdetailsManager().Update(mpsDal); //} ProduceOtherCompactMaterialAccessor.Insert(detailMaterial); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }