From 81ae0e2628bab815fcbde4d0197d9fe36c8b3320 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Fri, 27 Apr 2018 13:18:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=20=E8=87=AA=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=89=B9=E6=AC=A1=E7=9A=84=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3ClientService/B3ClientService.csproj | 1 + .../Tasks/AutoCreateProductBatchTask.cs | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 B3ClientService/Tasks/AutoCreateProductBatchTask.cs 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 "自动创建生产批次"; } + } + } +}