| @ -0,0 +1,86 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Web.UI; | |||
| using BWP.B3Frameworks.BO; | |||
| using BWP.B3Frameworks.Utils; | |||
| using BWP.B3Sale.BL; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| namespace BWP.Web.Pages.WeixinMessage_ | |||
| { | |||
| public class CusAcceptWeixinMessageTemplate : WeixinMessageUtil.IWeixinMessageView | |||
| { | |||
| WeixinMessage mMessage; | |||
| public CusAcceptWeixinMessageTemplate(WeixinMessage message) | |||
| { | |||
| mMessage = message; | |||
| } | |||
| public System.Web.UI.Control CreateContent() | |||
| { | |||
| var bl = BIFactory.Create<ICustomerAcceptBL>(); | |||
| var cusAccept = bl.Load(mMessage.TargetID.Value); | |||
| var html = @" | |||
| <article class=""weui-article""> | |||
| <h1>{title}</h1> | |||
| <section> | |||
| <table border=""1"" cellspacing=""0""> | |||
| <tr><td>会计单位</td><td>{AccountingUnit_ID}</td><td>发货时间</td><td>{LoadTime}</td></tr> | |||
| <tr><td>销售出库报价数量合计</td><td>{AcceptNumber}</td><td>销售出库金额</td><td>{Money}</td></tr> | |||
| <tr><td>送货员</td><td>{Deliveryman_Name}</td><td>车牌号</td><td>{Car_Name}</td></tr> | |||
| <tr><td>运费金额</td><td>{FreightPrice}</td><td>客户</td><td>{Customer_Name}</td></tr> | |||
| </table> | |||
| <table border=""1"" cellspacing=""0"" style=""margin-top:10px;""> | |||
| <tr><th>存货</th><th>规格</th><th>验收数量</th><th>验收金额</th><th>主单位</th><th>辅单位</th><th>品牌项</th><th>备注</th></tr> | |||
| {trs} | |||
| </table> | |||
| </section> | |||
| </article> | |||
| "; | |||
| html = html.Replace("{title}", mMessage.Title); | |||
| html = html.Replace("{AccountingUnit_ID}", cusAccept.AccountingUnit_ID == null ? "" : cusAccept.AccountingUnit_ID.Value.ToString()).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); | |||
| if (cusAccept.Details.Count() > 0) { | |||
| var str = new StringBuilder(); | |||
| foreach (var detail in cusAccept.Details) { | |||
| str.Append("<str>"); | |||
| str.Append("<td>"); | |||
| str.Append(detail.Goods_Name); | |||
| str.Append("</td>"); | |||
| str.Append("<td>"); | |||
| str.Append(detail.Goods_Spec); | |||
| str.Append("</td>"); | |||
| str.Append("<td>"); | |||
| str.Append(detail.AcceptNum); | |||
| str.Append("</td>"); | |||
| str.Append("<td>"); | |||
| str.Append(detail.Money); | |||
| str.Append("</td>"); | |||
| str.Append("<td>"); | |||
| str.Append(detail.Unit); | |||
| str.Append("</td>"); | |||
| str.Append("<td>"); | |||
| str.Append(detail.Goods_SecondUnit); | |||
| str.Append("</td>"); | |||
| str.Append("<td>"); | |||
| str.Append(detail.BrandItem_Name); | |||
| str.Append("</td>"); | |||
| str.Append("<td>"); | |||
| str.Append(detail.Remark); | |||
| str.Append("</td>"); | |||
| str.Append("</str>"); | |||
| } | |||
| html = html.Replace("{trs}", str.ToString()); | |||
| } | |||
| return new LiteralControl(html); | |||
| } | |||
| public string GetTitle() | |||
| { | |||
| return mMessage.Title; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,70 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3Frameworks.BO; | |||
| using BWP.B3Frameworks.BO.NamedValueTemplate; | |||
| 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 Forks.EnterpriseServices.SqlDoms; | |||
| using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| using BWP.B3Frameworks.BL; | |||
| namespace BWP.B3_YunKen.BLActions | |||
| { | |||
| public class CusrAcceptDoCheckSendWeixinMessage : IBLMethodAction | |||
| { | |||
| public string Description | |||
| { | |||
| get { return "【客户验收】审核时发送微信消息给{客户}和{销售人员}"; } | |||
| } | |||
| public void Execute(IDmoContext context, object customer, object parameter) | |||
| { | |||
| var dmo = customer as CustomerAccept; | |||
| if (dmo == null) | |||
| return; | |||
| string empUserName; | |||
| string cusUserName; | |||
| if (dmo.Employee_ID != null) { | |||
| empUserName = InnerBLUtil.GetDmoProperty<Employee, string>(context.Session, "User_Name", new Tuple<string, object>("Employee_ID", dmo.Employee_ID)); | |||
| InsertExternalMessage(dmo, empUserName, context); | |||
| } | |||
| if (dmo.Customer_ID != null) { | |||
| cusUserName = InnerBLUtil.GetDmoProperty<Customer, string>(context.Session, "User_Name", new Tuple<string, object>("Customer_ID", dmo.Customer_ID)); | |||
| InsertExternalMessage(dmo, cusUserName, context); | |||
| } | |||
| } | |||
| private void InsertExternalMessage(CustomerAccept accept, string userName, IDmoContext context) | |||
| { | |||
| var message = new WeixinMessage(); | |||
| message.Title = "客户验收单No."+accept.ID; | |||
| message.TargetID = accept.ID; | |||
| message.Type = "耘垦客户验收"; | |||
| var url = WeixinMessageUtil.NewWeixinMessageUrl(context.Session, message); | |||
| var externalMessageBL = BIFactory.Create<IExternalMessageBL>(context); | |||
| var externalMessage = new ExternalMessage(); | |||
| externalMessage.Type = ExternalMessageType.微信; | |||
| externalMessage.Receiver = userName; | |||
| externalMessage.Url = url; | |||
| externalMessage.Subject = message.Title; | |||
| externalMessageBL.Insert(externalMessage); | |||
| } | |||
| public IList<string> Features | |||
| { | |||
| get { return new List<string>(); } | |||
| } | |||
| public string Name | |||
| { | |||
| get { return "B3_YunKen.【客户验收】审核时发送微信消息给{客户}和{销售人员}"; } | |||
| } | |||
| } | |||
| } | |||