Browse Source

调整逻辑

master
wugang 7 years ago
parent
commit
1ece59a59b
2 changed files with 28 additions and 20 deletions
  1. +1
    -0
      BWP.B3_YunKen/BWP.B3_YunKen.csproj
  2. +27
    -20
      BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs

+ 1
- 0
BWP.B3_YunKen/BWP.B3_YunKen.csproj View File

@ -77,6 +77,7 @@
<Compile Include="BL\Bill\Goods_PackageBL.cs" />
<Compile Include="BO\Bill\Goods_Package.cs" />
<Compile Include="BO\Bill\Goods_PackagePrice.cs" />
<Compile Include="DataPatchs\UpdateCustomerStartedTime.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rpcs\DriverRpc.cs" />
<Compile Include="TimerTask\NullifyCustomerTask.cs" />


+ 27
- 20
BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs View File

@ -58,33 +58,40 @@ namespace BWP.B3_YunKen.TimerTask {
var cusBL = BIFactory.Create<ICustomerBL>();
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)


Loading…
Cancel
Save