Browse Source

需求单No.137208

master
robin 8 years ago
parent
commit
22f5e654a3
4 changed files with 104 additions and 4 deletions
  1. +2
    -0
      BWP.B3_YunKen.Web/PluginClass.cs
  2. +7
    -2
      BWP.B3_YunKen/BWP.B3_YunKen.csproj
  3. +89
    -0
      BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs
  4. +6
    -2
      WebFolder/Config/Plugins/B3_YunKen.Plugin

+ 2
- 0
BWP.B3_YunKen.Web/PluginClass.cs View File

@ -8,6 +8,8 @@ namespace BWP.B3_YunKen.Web
public void OnInit() {
GlobalFlags.On(B3SaleConsts.Flags.EnableStandardGoods);
GlobalFlags.On(B3SaleConsts.Flags.RecordLastSaleOutStoreDate);
}
public void OnUnitInit()


+ 7
- 2
BWP.B3_YunKen/BWP.B3_YunKen.csproj View File

@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BWP.B3_YunKen</RootNamespace>
<AssemblyName>B3_YunKen</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<KeyContainerName>BwpApp</KeyContainerName>
</PropertyGroup>
@ -22,7 +22,7 @@
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -34,6 +34,9 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="B3Frameworks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL" />
<Reference Include="B3Sale, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL" />
<Reference Include="B3SaleInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL" />
<Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL" />
<Reference Include="Forks.Utils, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6911f69af04f1ecb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@ -47,9 +50,11 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\TsingSoft2\TSREF\TSingSoft.WebControls2.dll</HintPath>
</Reference>
<Reference Include="Wpf.System, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TimerTask\NullifyCustomerTask.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="BL\BaseInfo\" />


+ 89
- 0
BWP.B3_YunKen/TimerTask/NullifyCustomerTask.cs View File

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Threading;
using BWP.B3Frameworks;
using BWP.B3Frameworks.BL;
using BWP.B3Frameworks.BO;
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;
using TSingSoft.WebPluginFramework.TimerTasks;
namespace BWP.B3_YunKen.TimerTask {
public class StoppedCustomerTask : ITimerTask {
public string Name { get { return "耘垦停用客户定时任务"; } }
public long? Days { get; set; }//天数
volatile static object _lockObj = new object();
public void Execute() {
if (!Monitor.TryEnter(_lockObj)) {
throw new SameTaskNotFinishException(this);
}
try {
DoExecute();
} finally {
Monitor.Exit(_lockObj);
}
}
//A:查找启用状态的客户
//B:根据客户查找客户的【销售出库单】
//C:确定客户最晚【销售出库单】的日期
//D:若当前日期-最晚【销售出库单】的日期=60 则停用客户
//E:查找客户档案上的销售人员,根据销售人员查找关联的用户
//F:将停用客户的名单推送给销售人员关联的用户
private void DoExecute() {
var mDmoTypeID = DmoTypeIDAttribute.GetID(typeof(Customer));
var dom = new DQueryDom(new JoinAlias(typeof(Customer)));
dom.Columns.Add(DQSelectColumn.Field("ID"));
dom.Columns.Add(DQSelectColumn.Field("LastGoodsOutStoreDate"));
dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false));
dom.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("LastGoodsOutStoreDate")));
var list = dom.EExecuteList<long, DateTime>();
var userMesageBL = BIFactory.Create<IUserMessageBL>();
var cusBL = BIFactory.Create<ICustomerBL>();
foreach (var tuple in list) {
var span = DateTime.Today - tuple.Item2;
if (span.Days >= (Days ?? 60)) {
var cus = cusBL.Load(tuple.Item1);
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}因60天内未发货,被系统自动停用。", cus.Name, tuple.Item1);
userMesageBL.Insert(BLContext.User.ID, new long[] { userID.Value }, message);
}
}
}
}
private static long? GetBindingEmployeeID(long employeeID) {
var query = new DQueryDom(new JoinAlias(typeof(User_Employee)));
query.Where.Conditions.Add(DQCondition.EQ("Employee_ID", employeeID));
query.Columns.Add(DQSelectColumn.Field("User_ID"));
var result = (long?)query.EExecuteScalar();
return result;
}
}
}

+ 6
- 2
WebFolder/Config/Plugins/B3_YunKen.Plugin View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<Plugin xmlns="http://www.TSingSoft.com/Schemas/WPF.xsd" name="B3_YunKen" displayName="B3耘垦模块" version="1.0" appVersion="$appVersion" schemaVersion="1.0" pluginClass="BWP.B3_YunKen.Web.PluginClass, B3_YunKen.Web">
<Requires>
<Plugin name="B3Sale" version="$appVersion" />
</Requires>
<Assemblies>
<File name="B3_YunKen.dll" type="bo bl"/>
@ -8,11 +9,14 @@
</Assemblies>
<ContentFiles>
</ContentFiles>
<DbResources></DbResources>
<DbResources>
</DbResources>
<Profiles>
<UserProfile type="BWP.B3_YunKen.BO.UserProfile,BWP.B3_YunKen"/>
</Profiles>
<Security>
<FunctionGroup name="销售预报调整" roleSchemas="employee">
<Function index="0" name="访问" />


Loading…
Cancel
Save