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 "自动创建生产批次"; }
|
|
}
|
|
}
|
|
}
|