| @ -0,0 +1,56 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3CowButcherManage.BO; | |||
| using BWP.B3Frameworks; | |||
| using BWP.B3Sale.BL; | |||
| using BWP.B3Sale.BO; | |||
| using BWP.B3Sale.Utils; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| namespace B3_QiLianMuGe.TypeIOCs | |||
| { | |||
| [TypeIOC(typeof(SaleOutStoreBL), typeof(SaleOutStoreBL.IDoNullifyDoSomething))] | |||
| class SaleOutStoreDoNullifyDoSomethingIOC : SaleOutStoreBL.IDoNullifyDoSomething | |||
| { | |||
| public void Invoke(SaleOutStore outStore, IDmoSession session) | |||
| { | |||
| var billType = DmoTypeIDAttribute.GetID(typeof(SaleOutStore)); | |||
| DeleteByFunc<WeightingInfor>(session, () => { return DQCondition.And(DQCondition.EQ("BillID", outStore.ID), DQCondition.EQ("BillType", billType)); }); | |||
| DeleteByFunc<WeightingInfo_ScanDetail>(session, () => { return DQCondition.EQ("BillID", outStore.ID); }); | |||
| UpdateSaleOutStoreInfo(session,outStore.ID); | |||
| UpdateAssignGoodsInfo(session,outStore.ID); | |||
| } | |||
| private void UpdateSaleOutStoreInfo(IDmoSession session, long id) | |||
| { | |||
| var update = new DQUpdateDom(typeof(SaleOutStore)); | |||
| update.Columns.Add(new DQUpdateColumn("AssignState", DQExpression.Value(配货状态.未配货))); | |||
| update.Where.Conditions.Add(DQCondition.EQ("ID", id)); | |||
| session.ExecuteNonQuery(update); | |||
| var update2 = new DQUpdateDom(typeof(SaleOutStore)); | |||
| update2.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1)))); | |||
| update2.Where.Conditions.Add(DQCondition.EQ("ID", id)); | |||
| session.ExecuteNonQuery(update2); | |||
| } | |||
| public static void UpdateAssignGoodsInfo(IDmoSession session, long? billID) | |||
| { | |||
| var update = new DQUpdateDom(typeof(BarCodeProductionInfo)); | |||
| update.Columns.Add(new DQUpdateColumn("IsAssignGoods", false)); | |||
| update.Columns.Add(new DQUpdateColumn("AssignBillID", DQExpression.NULL)); | |||
| update.Where.Conditions.Add(DQCondition.EQ("AssignBillID",billID)); | |||
| session.ExecuteNonQuery(update); | |||
| } | |||
| void DeleteByFunc<T>(IDmoSession session, Func<IDQExpression> func) | |||
| { | |||
| var delete = new DQDeleteDom(typeof(T)); | |||
| delete.Where.Conditions.Add(func()); | |||
| session.ExecuteNonQuery(delete); | |||
| } | |||
| } | |||
| } | |||