diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj index 156a58a..7043a21 100644 --- a/B3ClientService/B3ClientService.csproj +++ b/B3ClientService/B3ClientService.csproj @@ -192,6 +192,7 @@ + diff --git a/B3ClientService/Tasks/AutoCreateProductBatchTask.cs b/B3ClientService/Tasks/AutoCreateProductBatchTask.cs new file mode 100644 index 0000000..ff4f76c --- /dev/null +++ b/B3ClientService/Tasks/AutoCreateProductBatchTask.cs @@ -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(); + 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 "自动创建生产批次"; } + } + } +}