protected override void AddNew() { this.newChooseContorlDepot.EditValue = null; this.bindingSourceDepotPositionId.DataSource = null; this._produceOtherInDepot = new Model.ProduceOtherInDepot(); this._produceOtherInDepot.ProduceOtherInDepotDate = DateTime.Now; this._produceOtherInDepot.PayDate = DateTime.Now; this._produceOtherInDepot.ProduceOtherInDepotId = this.produceOtherInDepotManager.GetId();// Guid.NewGuid().ToString(); this._produceOtherInDepot.Employee0 = BL.V.ActiveOperator.Employee; this._produceOtherInDepot.Details = new List <Model.ProduceOtherInDepotDetail>(); if (this.action == "insert") { Model.ProduceOtherInDepotDetail detail = new Model.ProduceOtherInDepotDetail(); detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString(); detail.ProduceQuantity = 0; detail.ProducePrice = 0; detail.ProductGuige = ""; detail.ProduceMoney = 0; detail.ProcessPrice = 0; detail.ProductUnit = ""; detail.Product = new Book.Model.Product(); this._produceOtherInDepot.Details.Add(detail); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); } }
public Editform(Model.ProduceOtherInDepot produceOtherInDepot, string action) : this() { this._produceOtherInDepot = produceOtherInDepot; this._produceOtherInDepot.Details = this.produceOtherInDepotDetailManager.Select(produceOtherInDepot); this.action = action; }
protected override void MoveLast() { //if (produceOtherInDepot == null) { this._produceOtherInDepot = this.produceOtherInDepotManager.Get(this.produceOtherInDepotManager.GetLast() == null ? "" : this.produceOtherInDepotManager.GetLast().ProduceOtherInDepotId); } }
private void Validate(Model.ProduceOtherInDepot produceOtherInDepot) { if (string.IsNullOrEmpty(produceOtherInDepot.ProduceOtherInDepotId)) { throw new Helper.RequireValueException(Model.ProduceOtherInDepot.PRO_ProduceOtherInDepotId); } if (string.IsNullOrEmpty(produceOtherInDepot.SupplierId)) { throw new Helper.InvalidValueException(Model.ProduceOtherInDepot.PRO_SupplierId); } foreach (var item in produceOtherInDepot.Details) { if (item.ProduceQuantity == null || item.ProduceQuantity == 0) { throw new Helper.InvalidValueException(Model.ProduceOtherInDepotDetail.PRO_ProduceQuantity); } if ((item.ProduceTransferQuantity == null || item.ProduceTransferQuantity <= 0) && (item.ProduceInDepotQuantity == null || item.ProduceInDepotQuantity <= 0)) { throw new Helper.InvalidValueException(Model.ProduceOtherInDepotDetail.PRO_ProduceTransferQuantity); } } //if (string.IsNullOrEmpty(produceOtherInDepot.WorkHouseId)) //{ // throw new Helper.RequireValueException(Model.ProduceOtherInDepot.PROPERTY_WORKHOUSEID); //} }
public Editform(Model.ProduceOtherInDepot produceOtherInDepot) : this() { this._produceOtherInDepot = produceOtherInDepot; this._produceOtherInDepot.Details = this.produceOtherInDepotDetailManager.Select(produceOtherInDepot); this.action = "update"; }
protected override void Delete() { foreach (var item in this._produceOtherInDepot.Details) { if (this.pcOtherCheckDetailManager.IsHasByFromInvoiceDetailID(item.ProduceOtherInDepotDetailId)) { MessageBox.Show("已在進料檢驗單使用,請勿刪除!", this.Text, MessageBoxButtons.OK); return; } } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } try { this.produceOtherInDepotManager.Delete(this._produceOtherInDepot); this.produceOtherInDepotManager.DeleteAtSummon(this._produceOtherInDepot); this._produceOtherInDepot = this.produceOtherInDepotManager.GetNext(this._produceOtherInDepot); if (this._produceOtherInDepot == null) { this._produceOtherInDepot = this.produceOtherInDepotManager.GetLast(); } } catch { throw; } }
public Editform(string produceOtherInDepotId, string action) : this() { this._produceOtherInDepot = this.produceOtherInDepotManager.Get(produceOtherInDepotId); this._produceOtherInDepot.Details = this.produceOtherInDepotDetailManager.Select(this._produceOtherInDepot); this.action = action; this.flag = 1; }
public void DeleteAtSummon(Model.ProduceOtherInDepot produceOtherInDepot) { Model.AtSummon atSummon = atSummonManager.GetByProduceOtherInDepotId(produceOtherInDepot.ProduceOtherInDepotId); if (atSummon != null) { atSummonManager.Delete(atSummon); } }
protected override void MovePrev() { Model.ProduceOtherInDepot produceOtherInDepot = this.produceOtherInDepotManager.GetPrev(this._produceOtherInDepot); if (produceOtherInDepot == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._produceOtherInDepot = this.produceOtherInDepotManager.Get(produceOtherInDepot.ProduceOtherInDepotId); }
public Model.ProduceOtherInDepot GetDetails(string produceOtherInDepotId) { Model.ProduceOtherInDepot produceOtherInDepot = accessor.Get(produceOtherInDepotId); if (produceOtherInDepot != null) { produceOtherInDepot.Details = ProduceOtherInDepotDetailAccessor.Select(produceOtherInDepot); } return(produceOtherInDepot); }
private void Validate(Model.ProduceOtherInDepot produceOtherInDepot) { if (string.IsNullOrEmpty(produceOtherInDepot.ProduceOtherInDepotId)) { throw new Helper.RequireValueException(Model.ProduceOtherInDepot.PRO_ProduceOtherInDepotId); } //if (string.IsNullOrEmpty(produceOtherInDepot.WorkHouseId)) //{ // throw new Helper.RequireValueException(Model.ProduceOtherInDepot.PROPERTY_WORKHOUSEID); //} }
protected override void MoveLast() { //if (this._produceOtherInDepot == null) //{ if (this.flag == 1) { this.flag = 0; return; } this._produceOtherInDepot = this.produceOtherInDepotManager.Get(this.produceOtherInDepotManager.GetLast() == null ? "" : this.produceOtherInDepotManager.GetLast().ProduceOtherInDepotId); //} }
private void xrSubreport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { Q56_1 subReport = this.xrSubreport1.ReportSource as Q56_1; Model.ProduceOtherInDepot currentModel = this.GetCurrentRow() as Model.ProduceOtherInDepot; if (currentModel != null) { currentModel.Details = this.detailManager.SelectByCondition(currentModel.ProduceOtherInDepotId, this._condition.Product1 == null ? null : this._condition.Product1.ProductName, this._condition.Product2 == null ? null : this._condition.Product2.ProductName); subReport.ProduceOtherInDepot = currentModel; } }
private void barBtn_Search_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ListForm lf = new ListForm(); if (lf.ShowDialog() == DialogResult.OK) { this._produceOtherInDepot = lf.SelectItem as Model.ProduceOtherInDepot; this.action = "view"; this.Refresh(); } GC.Collect(); lf.Dispose(); }
//头更改 private void bsGCHeader_CurrentChanged(object sender, EventArgs e) { if (this.bsGCHeader.Current != null) { if ((this.bsGCHeader.Current as Model.ProduceOtherInDepot).Details == null) { Model.ProduceOtherInDepot proInDepot = this.bsGCHeader.Current as Model.ProduceOtherInDepot; IList <Model.ProduceOtherInDepotDetail> poidd = ProduceOtherInDepotDetailManager.SelectByProduceotherInDepotId(proInDepot.ProduceOtherInDepotId); (this.bsGCHeader.Current as Model.ProduceOtherInDepot).Details = poidd; } this.bsDetail.DataSource = (this.bsGCHeader.Current as Model.ProduceOtherInDepot).Details; } }
private void TiGuiExists(Model.ProduceOtherInDepot model) { if (this.ExistsPrimary(model.ProduceOtherInDepotId)) { //设置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.ProduceOtherInDepotId = this.GetId(model.InsertTime.Value); TiGuiExists(model); //throw new Helper.InvalidValueException(Model.Product.PRO_Id); } }
//获取数据进行绑定 private void loadData() { //绑定头 DateTime ds = this.dateStart.EditValue == null?DateTime.Now.AddDays(-1) : this.dateStart.DateTime; DateTime de = this.dateEnd.EditValue == null?DateTime.Now.AddDays(1).AddSeconds(-1) : this.dateEnd.DateTime; this.ListProduceOtherInDepot = this.ProduceOtherInDepotManager.SelectByDateRange(ds, de); this.bsGCHeader.DataSource = this.ListProduceOtherInDepot; //绑定详细 if (this.bsGCHeader.Current != null) { Model.ProduceOtherInDepot proInDepot = this.bsGCHeader.Current as Model.ProduceOtherInDepot; IList <Model.ProduceOtherInDepotDetail> poidd = ProduceOtherInDepotDetailManager.SelectByProduceotherInDepotId(proInDepot.ProduceOtherInDepotId); (this.bsGCHeader.Current as Model.ProduceOtherInDepot).Details = poidd; this.bsDetail.DataSource = (this.bsGCHeader.Current as Model.ProduceOtherInDepot).Details; } }
protected override void Delete() { if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } try { this.produceOtherInDepotManager.Delete(this._produceOtherInDepot); this._produceOtherInDepot = this.produceOtherInDepotManager.GetNext(this._produceOtherInDepot); if (this._produceOtherInDepot == null) { this._produceOtherInDepot = this.produceOtherInDepotManager.GetLast(); } } catch { throw; } }
/// <summary> /// Delete ProduceOtherInDepot by primary key. /// </summary> public void Delete(string produceOtherInDepotId) { try { BL.V.BeginTransaction(); Model.ProduceOtherInDepot model = this.Get(produceOtherInDepotId); 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); CancelAffect(accessor.Get(produceOtherInDepotId), 1); accessor.Delete(produceOtherInDepotId); BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
private void CancelAffect(Model.ProduceOtherInDepot produceOtherInDepot, int tag) { foreach (Model.ProduceOtherInDepotDetail item in ProduceOtherInDepotDetailAccessor.Select(produceOtherInDepot)) { if (!string.IsNullOrEmpty(item.DepotPositionId)) { stockAccessor.Increment(new BL.DepotPositionManager().Get(item.DepotPositionId), item.Product, -item.ProduceInDepotQuantity); this.productManager.UpdateProduct_Stock(item.Product); } Model.ProduceOtherCompactDetail CompactDetail = produceOtherCompactDetailAccessor.Get(item.ProduceOtherCompactDetailId); if (CompactDetail != null) { CompactDetail.InDepotCount = CompactDetail.InDepotCount == null ? 0 : CompactDetail.InDepotCount - item.ProduceQuantity; CompactDetail.ArrivalInQuantity = CompactDetail.ArrivalInQuantity == null ? 0 : CompactDetail.ArrivalInQuantity - item.ProduceQuantity; if (CompactDetail.InDepotCount >= CompactDetail.OtherCompactCount) { CompactDetail.DetailsFlag = 2; } else { if (CompactDetail.InDepotCount > 0) { CompactDetail.DetailsFlag = 1; } else { CompactDetail.DetailsFlag = 0; } } produceOtherCompactDetailAccessor.Update(CompactDetail); if (tag == 1) { UpdateProduceOtherCompactFlag(CompactDetail.ProduceOtherCompact); } } } }
public Model.ProduceOtherInDepot GetPrev(Model.ProduceOtherInDepot e) { return(sqlmapper.QueryForObject <Model.ProduceOtherInDepot>("ProduceOtherInDepot.get_prev", e)); }
public Model.ProduceOtherInDepot GetNext(Model.ProduceOtherInDepot e) { return(sqlmapper.QueryForObject <Model.ProduceOtherInDepot>("ProduceOtherInDepot.get_next", e)); }
public bool HasRowsAfter(Model.ProduceOtherInDepot e) { return(sqlmapper.QueryForObject <bool>("ProduceOtherInDepot.has_rows_after", e)); }
public bool HasRowsBefore(Model.ProduceOtherInDepot e) { return(sqlmapper.QueryForObject <bool>("ProduceOtherInDepot.has_rows_before", e)); }
public void Update(Model.ProduceOtherInDepot e) { this.Update <Model.ProduceOtherInDepot>(e); }
public void Insert(Model.ProduceOtherInDepot e) { this.Insert <Model.ProduceOtherInDepot>(e); }
public RO(string produceOtherInDepotId) { InitializeComponent(); this.produceOtherInDepot = this.ProduceOtherInDepotManager.Get(produceOtherInDepotId); if (this.produceOtherInDepot == null) { return; } this.produceOtherInDepot.Details = this.ProduceOtherInDepotDetailManager.Select(this.produceOtherInDepot); this.DataSource = this.produceOtherInDepot.Details; //CompanyInfo this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName; this.xrLabelDataName.Text = Properties.Resources.ProduceOtherInDepot; //外發入庫 this.xrLabelProduceOtherInDepotId.Text = this.produceOtherInDepot.ProduceOtherInDepotId; this.xrLabelProduceOtherInDepotDate.Text = this.produceOtherInDepot.ProduceOtherInDepotDate.Value.ToString("yyyy-MM-dd"); if (this.produceOtherInDepot.Employee0 != null) { this.xrLabelEmployee0.Text = this.produceOtherInDepot.Employee0.EmployeeName; } if (this.produceOtherInDepot.Employee1 != null) { this.xrLabelEmployee1.Text = this.produceOtherInDepot.Employee1.EmployeeName; } if (this.produceOtherInDepot.WorkHouse != null) { this.xrLabelDepartment.Text = this.produceOtherInDepot.WorkHouse.Workhousename; } this.xrLabelProduceOtherInDepotDesc.Text = this.produceOtherInDepot.ProduceOtherInDepotDesc; if (this.produceOtherInDepot.Depot != null) { this.xrLabelDepot.Text = this.produceOtherInDepot.Depot.ToString(); } this.xrLabelSupplier.Text = this.produceOtherInDepot.Supplier == null ? "" : this.produceOtherInDepot.Supplier.ToString(); this.xrLabelOtherCompact.Text = this.produceOtherInDepot.ProduceOtherCompactId; this.xrLabelInsertTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.xrBarCode1.Text = this.produceOtherInDepot.ProduceOtherInDepotId; //明细 //this.xrTableCell1ProductId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id); this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName); //if (produceOtherInDepot.WorkHouse.Workhousename != null) //{ // this.xrTableCellDepartment.DataBindings.Add("Text", this.DataSource, "ProduceOtherInDepot.WorkHouse.Workhousename"); //} // this.xrTableDate.DataBindings.Add("Text", this.DataSource, "ProduceOtherInDepot." + Model.ProduceOtherInDepot.PRO_ProduceOtherInDepotDate, "{0:yyyy-MM-dd}"); this.xrTableProduceQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherInDepotDetail.PRO_ProduceQuantity); this.xrTableTransferQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherInDepotDetail.PRO_ProduceTransferQuantity); this.InDepotQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherInDepotDetail.PRO_ProduceInDepotQuantity); this.xrTableUnit.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherInDepotDetail.PRO_ProductUnit); // this.xrTableProductGuige.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherInDepotDetail.PRO_ProductGuige); // this.xrTableProduceOtherInDepotId.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherInDepotDetail.PRO_ProduceOtherInDepotId); this.xrTableCellDepotPosition.DataBindings.Add("Text", this.DataSource, "DepotPosition." + Model.DepotPosition.PROPERTY_ID); this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, "ProductDescription"); //this.TC_ProductDesc.DataBindings.Add("Rtf", this.DataSource, "ProductDescription"); this.TCProduceOtherCompactId.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherInDepotDetail.PRO_ProduceOtherCompactId); }
public Model.ProduceOtherInDepot GetNext(Model.ProduceOtherInDepot e) { return(accessor.GetNext(e)); }
public bool HasRowsAfter(Model.ProduceOtherInDepot e) { return(accessor.HasRowsAfter(e)); }
public bool HasRowsBefore(Model.ProduceOtherInDepot e) { return(accessor.HasRowsBefore(e)); }