/// <summary> /// after Delete /// </summary> protected override void OnDeleted() { using (ISession sessoin = Session.Open()) { ShipPlanDetailBE.ShipPlanDetailLine line = null; if (this.OriginalData.SrcShipLine > 0) { line = ShipPlanDetailBE.ShipPlanDetailLine.Finder.FindByID(this.OriginalData.SrcShipLine); //写所有出运明细单行.已预装柜=false; if (line != null) { line.IsShipping = false; //反写出运明细单行装柜数量 line.InstalledArkQty = line.InstalledArkQty - this.OriginalData.InstalledArkNumber; line.IsShipping = false; //删除出运差异信息 ShipPlanDifference shipDiffe = ShipPlanDifference.Finder.Find("ShipLine=" + line.ID); if (shipDiffe != null) { shipDiffe.Remove(); } } } sessoin.Commit(); } base.OnDeleted(); // TO DO: write your business code here... }
/// <summary> /// after Insert /// </summary> protected override void OnInserted() { using (ISession session = Session.Open()) { ShipPlanDetailBE.ShipPlanDetailLine line = null; if (this.SrcShipLine > 0) { line = ShipPlanDetailBE.ShipPlanDetailLine.Finder.FindByID(this.SrcShipLine); line.IsShipping = true; if (line != null) { //反写出运明细单行装柜数量 line.InstalledArkQty = line.InstalledArkQty + this.InstalledArkNumber; //创建出运差异信息 ShipPlanDifference shipDiffe = ShipPlanDifference.Finder.Find("ShipLine=" + line.ID); if (shipDiffe == null) { shipDiffe = ShipPlanDifference.Create(); shipDiffe.ShipLine = line.ID; shipDiffe.ShipPlanDocNo = line.ShipPlanDetailHead.DocNo; shipDiffe.ShipPlanLineNo = line.RowNo; shipDiffe.SOLine = line.SrcLineID; shipDiffe.SODocNo = line.SrcDocNo; shipDiffe.SODocLineNo = Convert.ToInt32(line.SrcLineNo); shipDiffe.ItemCode = line.Item.Code; shipDiffe.ItemName = line.Item.Name; shipDiffe.PlanQty = line.Qty; shipDiffe.ShipUOM = line.NumberUom; shipDiffe.Status = StateEnum.NonExecution; } } } session.Commit(); } base.OnInserted(); // TO DO: write your business code here... }