From 1ece59a59b5e9067000d98627f7152d31ddc64cb Mon Sep 17 00:00:00 2001 From: wugang <425674808@qq.com> Date: Tue, 24 Jul 2018 14:52:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BWP.B3_YunKen/BWP.B3_YunKen.csproj | 1 + .../TimerTask/NullifyCustomerTask.cs | 47 +++++++++++-------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/BWP.B3_YunKen/BWP.B3_YunKen.csproj b/BWP.B3_YunKen/BWP.B3_YunKen.csproj index 5797acd..c208b67 100644 --- a/BWP.B3_YunKen/BWP.B3_YunKen.csproj +++ b/BWP.B3_YunKen/BWP.B3_YunKen.csproj @@ -77,6 +77,7 @@ + diff --git a/BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs b/BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs index ba67d53..86f477e 100644 --- a/BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs +++ b/BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs @@ -58,33 +58,40 @@ namespace BWP.B3_YunKen.TimerTask { var cusBL = BIFactory.Create(); foreach (var tuple in list) { var loadTime = GetMaxLoadTime(tuple.Item1); + int? diffDays2 = null; + if (tuple.Item2 != null) { + diffDays2 = (DateTime.Now - tuple.Item2.Value).Days; + } if (loadTime != null) { var diffDays = (DateTime.Now - loadTime.Value).Days; - int? diffDays2 = null; - if (tuple.Item2 != null) { - diffDays2 = (DateTime.Now - tuple.Item2.Value).Days; - } if (diffDays >= Days && diffDays2 >= Days) { - var cus = cusBL.Load(tuple.Item1); - cus.StopedByCustomerTask = true; - cus.StopReason = Days + "天内未发货"; - cusBL.Update(cus); - cusBL.Stop(cus); - if (cus.Employee_ID.HasValue) { - var userID = GetBindingEmployeeID(cus.Employee_ID.Value); - if (userID == null) - continue; - var message = new CommonUserMessage(); - message.TargetDmoTypeID = mDmoTypeID; - message.TargetDmoID = tuple.Item1; - message.Text = string.Format("客户{0}NO.{1}因{2}天内未发货,被系统自动停用。", cus.Name, tuple.Item1, Days); - userMesageBL.Insert(BLContext.User.ID, new long[] { userID.Value }, message); - } + StopCustomer(userMesageBL, cusBL, tuple.Item1, mDmoTypeID); + } + } else { + if (diffDays2 >= Days) { + StopCustomer(userMesageBL, cusBL, tuple.Item1, mDmoTypeID); } } } + } - + private void StopCustomer(IUserMessageBL userMesageBL, ICustomerBL cusBL,long cusId,short dmoTypeID) + { + var cus = cusBL.Load(cusId); + cus.StopedByCustomerTask = true; + cus.StopReason = Days + "天内未发货"; + cusBL.Update(cus); + cusBL.Stop(cus); + if (cus.Employee_ID.HasValue) { + var userID = GetBindingEmployeeID(cus.Employee_ID.Value); + if (userID != null) { + var message = new CommonUserMessage(); + message.TargetDmoTypeID = dmoTypeID; + message.TargetDmoID = cusId; + message.Text = string.Format("客户{0}NO.{1}因{2}天内未发货,被系统自动停用。", cus.Name, cusId, Days); + userMesageBL.Insert(BLContext.User.ID, new long[] { userID.Value }, message); + } + } } private static DateTime? GetMaxLoadTime(long cusID)