From 40ee6458d56d83be00cd42e636cfd6ce422fcf52 Mon Sep 17 00:00:00 2001
From: yibo <361071264@qq.com>
Date: Thu, 23 Aug 2018 08:34:03 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=90=8E=E5=8F=B0=E4=BB=BB=E5=8A=A1?=
=?UTF-8?q?=E6=8F=90=E5=8F=96=E5=8F=91=E8=B4=A7=E6=89=AB=E7=A0=81=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E5=88=B0=E5=B1=A0=E5=AE=B0=E7=B3=BB=E7=BB=9F=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../B3CowButcherManageToSale.csproj | 5 +
.../TypeIOCs/SaleOutStoreBLTypeIoc.cs | 111 ++++++++++++++++++
2 files changed, 116 insertions(+)
create mode 100644 B3CowButcherManageToSale/TypeIOCs/SaleOutStoreBLTypeIoc.cs
diff --git a/B3CowButcherManageToSale/B3CowButcherManageToSale.csproj b/B3CowButcherManageToSale/B3CowButcherManageToSale.csproj
index a894c0b..3036cef 100644
--- a/B3CowButcherManageToSale/B3CowButcherManageToSale.csproj
+++ b/B3CowButcherManageToSale/B3CowButcherManageToSale.csproj
@@ -54,6 +54,10 @@
False
..\..\..\..\..\..\..\BwpB3Project\tsref\Debug\Forks.Utils.dll
+
+ False
+ ..\..\..\tsref\Debug\Newtonsoft.Json.dll
+
@@ -76,6 +80,7 @@
+
diff --git a/B3CowButcherManageToSale/TypeIOCs/SaleOutStoreBLTypeIoc.cs b/B3CowButcherManageToSale/TypeIOCs/SaleOutStoreBLTypeIoc.cs
new file mode 100644
index 0000000..aa5c40a
--- /dev/null
+++ b/B3CowButcherManageToSale/TypeIOCs/SaleOutStoreBLTypeIoc.cs
@@ -0,0 +1,111 @@
+using BWP.B3CowButcherManage.Rpcs;
+using BWP.B3Frameworks;
+using BWP.B3Sale.BL;
+using BWP.B3Sale.BO;
+using Forks.EnterpriseServices.BusinessInterfaces;
+using Forks.EnterpriseServices.DomainObjects2;
+using Forks.EnterpriseServices.DomainObjects2.DQuery;
+using Forks.EnterpriseServices.SqlDoms;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using TSingSoft.WebPluginFramework;
+using TSingSoft.WebPluginFramework.QueueTasks;
+
+namespace BWP.B3CowButcherManageToSale.TypeIOCs
+{
+ [TypeIOC(typeof(SaleOutStoreBL), typeof(SaleOutStoreBL.BillBLIOCs.AfterCheck))]
+ public class SaleOutStoreCheckBLTypeIoc : SaleOutStoreBL.BillBLIOCs.AfterCheck
+ {
+ public void Invoke(IDmoContext context, SaleOutStore dmo)
+ {
+ var task = new SaleInfoToButcherTask(dmo.ID);
+ task.AddTaskUser_ID = BLContext.User.ID;
+ task.DomainUser_ID = DomainContext.Current.DomainUser.ID;
+ QueueTaskService.Add(task);
+ }
+ }
+
+ [Serializable]
+ class SaleInfoToButcherTask : QueueTaskBase
+ {
+ public long BillID { get; set; }
+ public long DomainUser_ID { get; set; }
+
+ public SaleInfoToButcherTask(long id)
+ {
+ BillID = id;
+ }
+
+ public override bool PersistTask
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ protected override bool SingleTaskInQueue
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public override void Execute(QueueTaskContext context)
+ {
+ using (var scope = new SpecialDomainUserBLScope(DomainUser_ID))
+ {
+ using (var session = Dmo.NewSession())
+ {
+ var infos = GetBarCodeInfos(session, BillID);
+ if(infos.Count==0)
+ return;
+ var json = JsonConvert.SerializeObject(infos);
+ BarCodeProductRpc.UploadSaleOutInfo(json);
+ }
+ }
+ }
+
+ List