diff --git a/BWP.B3_YunKen.Web/Pages/WeixinMessage_/CusAcceptWeixinMessageTemplate.cs b/BWP.B3_YunKen.Web/Pages/WeixinMessage_/CusAcceptWeixinMessageTemplate.cs index b32f9d4..0a5f410 100644 --- a/BWP.B3_YunKen.Web/Pages/WeixinMessage_/CusAcceptWeixinMessageTemplate.cs +++ b/BWP.B3_YunKen.Web/Pages/WeixinMessage_/CusAcceptWeixinMessageTemplate.cs @@ -6,7 +6,9 @@ using System.Web.UI; using BWP.B3Frameworks.BO; using BWP.B3Frameworks.Utils; using BWP.B3Sale.BL; +using BWP.B3Sale.BO; using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DomainObjects2; namespace BWP.Web.Pages.WeixinMessage_ { @@ -23,26 +25,60 @@ namespace BWP.Web.Pages.WeixinMessage_ { var bl = BIFactory.Create(); var cusAccept = bl.Load(mMessage.TargetID.Value); + var dmoTypeId = DmoTypeIDAttribute.GetID(typeof(SaleOutStore)); + string outCode = string.Empty; + string dealer = string.Empty; + string handcarNumber = string.Empty; + string freightUnitPrice = string.Empty; + string driver_Name = string.Empty; + string driverPhone = string.Empty; + string allUnitNum = string.Empty; + string money = string.Empty; + string freightPrice = string.Empty; + if (cusAccept.BillType == dmoTypeId && cusAccept.BillID != null) { + var outbl = BIFactory.Create(); + var saleOutStore = outbl.Load(cusAccept.BillID.Value); + outCode = saleOutStore.Code; + dealer = saleOutStore.CustomerDealer_Name; + handcarNumber = saleOutStore.HandcarNumber; + freightUnitPrice = saleOutStore.FreightUnitPrice==null?string.Empty:saleOutStore.FreightUnitPrice.ToString(); + driver_Name = saleOutStore.Driver_Name; + driverPhone = saleOutStore.DriverPhone; + allUnitNum = saleOutStore.AllUnitNum == null ? string.Empty : saleOutStore.AllUnitNum.ToString(); + money = saleOutStore.Money == null ? string.Empty : saleOutStore.Money.ToString(); + freightPrice = saleOutStore.FreightPrice == null ? string.Empty : saleOutStore.FreightPrice.ToString(); + } + var checkTime = cusAccept.CheckTime == null ? "" : cusAccept.CheckTime.Value.ToString(); + var acceptNumber = cusAccept.AcceptNumber==null?string.Empty:cusAccept.AcceptNumber.ToString(); + var acceptFreightUnitPrice = cusAccept.FreightUnitPrice==null?string.Empty:cusAccept.FreightUnitPrice.ToString(); + var acceptMoney = cusAccept.Money==null?string.Empty:cusAccept.Money.ToString(); + var acceptFreightPrice = cusAccept.FreightPrice==null?string.Empty:cusAccept.FreightPrice.ToString(); var html = @"

{title}

- - - - + + + + + +
会计单位{AccountingUnit_Name}发货时间{LoadTime}
销售出库报价数量合计{AcceptNumber}销售出库金额{Money}
送货员{Deliveryman_Name}车牌号{Car_Name}
运费金额{FreightPrice}客户{Customer_Name}
经销商发货信息单号{OutCode}
发货工厂{AccountingUnit_Name}发货时间{CheckTime}
客户名称{CustomerDealer_Name}
运输车号{HandcarNumber}运费单价{FreightUnitPrice}
司机姓名{Driver_Name}司机电话{DriverPhone}
总数量{AllUnitNum}总金额{Money}总运费{FreightPrice}
- + + + {trs} + +
存货规格验收数量验收金额主单位辅单位品牌项备注
分销商发货明细单号{AcceptCode}
客户名称{AcceptCode}
名称品牌件数单价重量金额
总数量{AcceptNumber}运费单价{AcceptFreightUnitPrice}
总金额{AcceptMoney}运费金额{AcceptFreightPrice}
"; html = html.Replace("{title}", mMessage.Title); - html = html.Replace("{AccountingUnit_Name}", cusAccept.AccountingUnit_Name).Replace("{LoadTime}", cusAccept.LoadTime == null ? "" : cusAccept.LoadTime.Value.ToString()).Replace("{AcceptNumber}", cusAccept.AcceptNumber == null ? "" : cusAccept.AcceptNumber.Value.ToString()).Replace("{Money}", cusAccept.Money == null ? string.Empty : cusAccept.Money.Value.ToString()).Replace("{Deliveryman_Name}", cusAccept.Deliveryman_Name).Replace("{Car_Name}", cusAccept.Car_Name).Replace("{FreightPrice}", cusAccept.FreightPrice == null ? string.Empty : cusAccept.FreightPrice.Value.ToString()).Replace("{Customer_Name}", cusAccept.Customer_Name); + html = html.Replace("{OutCode}", outCode).Replace("{AccountingUnit_Name}", cusAccept.AccountingUnit_Name).Replace("{CheckTime}", checkTime).Replace("{{CustomerDealer_Name}}", dealer).Replace("{HandcarNumber}", handcarNumber).Replace("{FreightUnitPrice}", freightUnitPrice).Replace("{Driver_Name}", driver_Name).Replace("{DriverPhone}", driverPhone).Replace("{AllUnitNum}", allUnitNum).Replace("{Money}", money).Replace("{FreightPrice}", freightPrice).Replace("{AcceptCode}",cusAccept.Code).Replace("{AcceptNumber}", acceptNumber).Replace("{AcceptFreightUnitPrice}", acceptFreightUnitPrice).Replace("{AcceptMoney}", acceptMoney).Replace("{AcceptFreightPrice}", acceptFreightPrice); if (cusAccept.Details.Count() > 0) { var str = new StringBuilder(); foreach (var detail in cusAccept.Details) { @@ -51,25 +87,19 @@ namespace BWP.Web.Pages.WeixinMessage_ str.Append(detail.Goods_Name); str.Append(""); str.Append(""); - str.Append(detail.Goods_Spec); - str.Append(""); - str.Append(""); - str.Append(detail.AcceptNum); - str.Append(""); - str.Append(""); - str.Append(detail.AcceptMoney); + str.Append(detail.BrandItem_Name); str.Append(""); str.Append(""); - str.Append(detail.Unit); + str.Append(detail.AcceptSecondNumber); str.Append(""); str.Append(""); - str.Append(detail.Goods_SecondUnit); + str.Append(detail.Price); str.Append(""); str.Append(""); - str.Append(detail.BrandItem_Name); + str.Append(detail.AcceptNum); str.Append(""); str.Append(""); - str.Append(detail.Remark); + str.Append(detail.AcceptMoney); str.Append(""); str.Append(""); } diff --git a/BWP.B3_YunKen/BLActions/CusrAcceptDoCheckSendWeixinMessage.cs b/BWP.B3_YunKen/BLActions/CusrAcceptDoCheckSendWeixinMessage.cs index efacad2..20e8d30 100644 --- a/BWP.B3_YunKen/BLActions/CusrAcceptDoCheckSendWeixinMessage.cs +++ b/BWP.B3_YunKen/BLActions/CusrAcceptDoCheckSendWeixinMessage.cs @@ -21,7 +21,7 @@ namespace BWP.B3_YunKen.BLActions { public string Description { - get { return "【客户验收】审核时发送微信消息给{客户}和{销售人员}"; } + get { return "【客户验收】审核时发送微信消息给{客户}、{销售人员}、{经销商}"; } } public void Execute(IDmoContext context, object customer, object parameter) @@ -29,15 +29,28 @@ namespace BWP.B3_YunKen.BLActions var dmo = customer as CustomerAccept; if (dmo == null) return; + if (parameter == null) + throw new ApplicationException("请配置接收消息的角色"); string empUserName; string cusUserName; - if (dmo.Employee_ID != null) { - empUserName = InnerBLUtil.GetDmoProperty(context.Session, "User_Name", new Tuple("ID", dmo.Employee_ID)); - InsertExternalMessage(dmo, empUserName, context); + var roles = parameter.ToString().Split(','); + if (roles.Contains("销售人员")) { + if (dmo.Employee_ID != null) { + empUserName = InnerBLUtil.GetDmoProperty(context.Session, "User_Name", new Tuple("ID", dmo.Employee_ID)); + InsertExternalMessage(dmo, empUserName, context); + } } - if (dmo.Customer_ID != null) { - cusUserName = InnerBLUtil.GetDmoProperty(context.Session, "User_Name", new Tuple("ID", dmo.Customer_ID)); - InsertExternalMessage(dmo, cusUserName, context); + if (roles.Contains("客户")) { + if (dmo.Customer_ID != null) { + cusUserName = InnerBLUtil.GetDmoProperty(context.Session, "User_Name", new Tuple("ID", dmo.Customer_ID)); + InsertExternalMessage(dmo, cusUserName, context); + } + } + if (roles.Contains("经销商")) { + if (dmo.CustomerDealer_ID != null) { + cusUserName = InnerBLUtil.GetDmoProperty(context.Session, "User_Name", new Tuple("ID", dmo.CustomerDealer_ID)); + InsertExternalMessage(dmo, cusUserName, context); + } } } @@ -67,7 +80,7 @@ namespace BWP.B3_YunKen.BLActions public string Name { - get { return "B3_YunKen.【客户验收】审核时发送微信消息给{客户}和{销售人员}"; } + get { return "B3_YunKen.【客户验收】审核时发送微信消息给{客户}、{销售人员}、{经销商}"; } } } } diff --git a/BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs b/BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs index 8875d78..127ab36 100644 --- a/BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs +++ b/BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs @@ -58,7 +58,7 @@ namespace BWP.B3_YunKen.TimerTask { foreach (var tuple in list) { var span = DateTime.Today - tuple.Item2; if (span.Days >= Days) - { + { var cus = cusBL.Load(tuple.Item1); cus.StopedByCustomerTask = true; cus.StopReason = Days + "天内未发货";