| @ -0,0 +1,61 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3Sale.BL; | |||
| using BWP.B3Sale.BO; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Forks.EnterpriseServices.SqlDoms; | |||
| using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; | |||
| namespace BWP.B3_YunKen.BLActions | |||
| { | |||
| public class CusAcceptUpdateAcceptInfoBLAction : IBLMethodAction | |||
| { | |||
| public string Description | |||
| { | |||
| get { return "【客户验收单】删除或者作废时更新验收数量"; } | |||
| } | |||
| public void Execute(Forks.EnterpriseServices.BusinessInterfaces.IDmoContext context, object dmo, object parameter) | |||
| { | |||
| var customer = dmo as CustomerAccept; | |||
| if (customer == null) | |||
| return; | |||
| var details = customer.Details.Where(x => x.BillType == DmoTypeIDAttribute.GetID(typeof(SaleOutStore)) && x.SourceBillDetailID != null && x.BillID != null); | |||
| var dom = new DmoQuery(typeof(SaleOutStore_DetailToCustomerAcceptNumber)); | |||
| dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("SaleOutStore_Detail_ID"), details.Select(x=> DQExpression.Value(x.SourceBillDetailID)).ToArray())); | |||
| var acceptNumberList = context.Session.ExecuteList(dom).Cast<SaleOutStore_DetailToCustomerAcceptNumber>(); | |||
| foreach (var detail in details) { | |||
| var accDetail = acceptNumberList.FirstOrDefault(x => x.SaleOutStore_Detail_ID == detail.SourceBillDetailID.Value); | |||
| bool isNew = false; | |||
| if (accDetail == null) { | |||
| accDetail = new SaleOutStore_DetailToCustomerAcceptNumber(); | |||
| accDetail.SaleOutStore_Detail_ID = detail.SourceBillDetailID.Value; | |||
| accDetail.SaleOutStore_ID = detail.BillID.Value; | |||
| isNew = true; | |||
| } | |||
| accDetail.AlreadyAcceptNumber = (accDetail.AlreadyAcceptNumber ?? 0) - (detail.AcceptNum ?? 0); | |||
| accDetail.AlreadyAcceptUnitNum = (accDetail.AlreadyAcceptUnitNum ?? 0) - (detail.AcceptNum ?? 0); | |||
| accDetail.AlreadyAcceptSecondNumber = (accDetail.AlreadyAcceptSecondNumber ?? 0) - (detail.AcceptSecondNumber ?? 0); | |||
| if (isNew) | |||
| context.Session.Insert(accDetail); | |||
| else { | |||
| context.Session.Update(accDetail); | |||
| } | |||
| } | |||
| } | |||
| public IList<string> Features | |||
| { | |||
| get { return new List<string>(); } | |||
| } | |||
| public string Name | |||
| { | |||
| get { return "B3_YunKen.【客户验收单】删除或者作废时更新验收数量"; } | |||
| } | |||
| } | |||
| } | |||
| @ -1,46 +0,0 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3Frameworks.Utils; | |||
| using BWP.B3Sale.BL; | |||
| using BWP.B3Sale.BO; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; | |||
| namespace BWP.B3_YunKen.BLActions | |||
| { | |||
| public class CustomerWithDealerBLAction : IBLMethodAction | |||
| { | |||
| public string Description | |||
| { | |||
| get { return @"1、【客户档案】保存增加业务逻辑:若该客户同时为经销商档案,则{是否经销商}选择为否,不能保存,提示:该客户是经销商客户是否经销商不能选择为否(客户名称查询【经销商】档案基本属性的‘经销商’) | |||
| 2、【客户档案】增加保存逻辑:若该客户在【经销商】档案的明细表已存在,则{是否经销商}选择为是,不能保存,提示:该客户所属于**经销商,请先维护经销商档案"; } | |||
| } | |||
| public void Execute(Forks.EnterpriseServices.BusinessInterfaces.IDmoContext context, object dmo, object parameter) | |||
| { | |||
| var customer = dmo as Customer; | |||
| if (customer != null) { | |||
| var id = InnerBLUtil.GetDmoProperty<Dealer, long?>(context.Session, "ID", new Tuple<string, object>("Customer_ID", customer.ID)); | |||
| if (id != null && !customer.IsDealers) | |||
| throw new ApplicationException("该客户是经销商客户是否经销商不能选择为否(客户名称查询【经销商】档案基本属性的‘经销商’)"); | |||
| var dealerID = InnerBLUtil.GetDmoProperty<Dealer_Detail, long?>(context.Session, "Dealer_ID", new Tuple<string, object>("Customer_ID", customer.ID)); | |||
| if (dealerID != null && customer.IsDealers) | |||
| throw new ApplicationException("该客户属于【经销商】档案No." + dealerID + ",请先维护经销商档案"); | |||
| } | |||
| } | |||
| public IList<string> Features | |||
| { | |||
| get { return new List<string>(); } | |||
| } | |||
| public string Name | |||
| { | |||
| get { return "B3_YunKen.【客户】档案与【经销商】档案逻辑控制"; } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,27 @@ | |||
| using BWP.B3Sale.BL; | |||
| using System; | |||
| using BWP.B3Sale.BO; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| using BWP.B3Frameworks; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using BWP.B3Frameworks.Utils; | |||
| namespace BWP.B3_YunKen.TypeIocs | |||
| { | |||
| [TypeIOC(typeof(CustomerBL), typeof(CustomerBL.ICheckDealerInfo))] | |||
| public class CheckDealerInfoTypeIOC : CustomerBL.ICheckDealerInfo | |||
| { | |||
| public void Invoke(Customer customer,IDmoSession session) | |||
| { | |||
| if (customer != null) { | |||
| var id = InnerBLUtil.GetDmoProperty<Dealer, long?>(session, "ID", new Tuple<string, object>("Customer_ID", customer.ID)); | |||
| if (id != null && !customer.IsDealers) | |||
| throw new ApplicationException("该客户是经销商客户是否经销商不能选择为否(客户名称查询【经销商】档案基本属性的‘经销商’)"); | |||
| var dealerID = InnerBLUtil.GetDmoProperty<Dealer_Detail, long?>(session, "Dealer_ID", new Tuple<string, object>("Customer_ID", customer.ID)); | |||
| if (dealerID != null && customer.IsDealers) | |||
| throw new ApplicationException("该客户属于【经销商】档案No." + dealerID + ",请先维护经销商档案"); | |||
| } | |||
| } | |||
| } | |||
| } | |||