Browse Source

加 自动创建批次的定时任务。

master
yibo 7 years ago
parent
commit
81ae0e2628
2 changed files with 43 additions and 0 deletions
  1. +1
    -0
      B3ClientService/B3ClientService.csproj
  2. +42
    -0
      B3ClientService/Tasks/AutoCreateProductBatchTask.cs

+ 1
- 0
B3ClientService/B3ClientService.csproj View File

@ -192,6 +192,7 @@
<Compile Include="Rpcs\BillRpc\GradeAndWeightRpc.cs" />
<Compile Include="Rpcs\BillRpc\WeightBillRpc.cs" />
<Compile Include="Rpcs\UserInfoRpc.cs" />
<Compile Include="Tasks\AutoCreateProductBatchTask.cs" />
<Compile Include="Tasks\SyncCarcassInStoreToTrackBack.cs" />
<Compile Include="Tasks\SyncInfoFromServer.cs" />
<Compile Include="Tasks\SyncBillFromServer.cs" />


+ 42
- 0
B3ClientService/Tasks/AutoCreateProductBatchTask.cs View File

@ -0,0 +1,42 @@
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework.TimerTasks;
using TSingSoft.WebPluginFramework;
using Forks.EnterpriseServices.BusinessInterfaces;
using BWP.B3ClientService.BL;
namespace BWP.B3ClientService.Tasks
{
public class AutoCreateProductBatchTask : ITimerTask
{
public void Execute()
{
var exist = Exist();
if (exist)
return;
var bl = BIFactory.Create<IProductBatchBL>();
var entity = new ProductBatch();
bl.InitNewDmo(entity);
entity.Name = DateTime.Today.ToString("yyyyMMdd"); ;
entity.Date = DateTime.Today;
bl.Insert(entity);
}
bool Exist()
{
var query = new DQueryDom(new JoinAlias(typeof(ProductBatch)));
query.Where.Conditions.Add(DQCondition.EQ("Date", DateTime.Today));
return query.EExists();
}
public string Name
{
get { return "自动创建生产批次"; }
}
}
}

Loading…
Cancel
Save