From 6098036886d2ca46e01594408e5c46b583f60ee5 Mon Sep 17 00:00:00 2001
From: yibo <361071264@qq.com>
Date: Thu, 19 Oct 2017 21:11:04 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=20=E8=BF=87=E7=A3=85=E5=8D=95?=
=?UTF-8?q?=E5=AE=A1=E6=A0=B8=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
B3ClientService/B3ClientService.csproj | 1 +
.../BO/Bill/WeightBill/WeightBillCheck.cs | 59 +++++++++++++++++++
B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs | 6 ++
.../Tasks/UpdateLoad/DoCheckBills.cs | 35 +++++++++++
.../Tasks/UpdateLoad/UploadTest.cs | 2 +
5 files changed, 103 insertions(+)
create mode 100644 B3ClientService/BO/Bill/WeightBill/WeightBillCheck.cs
create mode 100644 B3ClientService/Tasks/UpdateLoad/DoCheckBills.cs
diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj
index ad119e9..d0c90ed 100644
--- a/B3ClientService/B3ClientService.csproj
+++ b/B3ClientService/B3ClientService.csproj
@@ -88,6 +88,7 @@
+
diff --git a/B3ClientService/BO/Bill/WeightBill/WeightBillCheck.cs b/B3ClientService/BO/Bill/WeightBill/WeightBillCheck.cs
new file mode 100644
index 0000000..94d1ee3
--- /dev/null
+++ b/B3ClientService/BO/Bill/WeightBill/WeightBillCheck.cs
@@ -0,0 +1,59 @@
+using Forks.EnterpriseServices.DomainObjects2;
+using Forks.EnterpriseServices.DomainObjects2.DQuery;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using TSingSoft.WebPluginFramework;
+
+namespace BWP.B3ClientService.BO
+{
+ [Serializable]
+ [BOClass]
+ public class WeightBillCheck
+ {
+ public long B3ID { get; set; }
+
+ ///
+ /// 单据创建人用户名
+ ///
+ public string Creator { get; set; }
+
+ ///
+ /// 同步状态
+ ///
+ public bool Sync { get; set; }
+
+ public DateTime ModifyTime { get; set; }
+
+ public static void Insert(long id, string creator)
+ {
+ if (Exist(id))
+ return;
+ var entity = new WeightBillCheck();
+ entity.B3ID = id;
+ entity.Creator = creator;
+ entity.ModifyTime = DateTime.Now;
+ using (var session = Dmo.NewSession())
+ {
+ session.Insert(entity);
+ session.Commit();
+ }
+ }
+
+ static bool Exist(long id)
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(WeightBillCheck)));
+ query.Where.Conditions.Add(DQCondition.EQ("B3ID", id));
+ return query.EExists();
+ }
+
+ public static void SetSynced(long id)
+ {
+ var update = new DQUpdateDom(typeof(WeightBillCheck));
+ update.Columns.Add(new DQUpdateColumn("Sync", true));
+ update.Where.Conditions.Add(DQCondition.EQ("B3ID", id));
+ update.EExecute();
+ }
+ }
+}
diff --git a/B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs b/B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs
index f3441ed..aab118e 100644
--- a/B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs
+++ b/B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs
@@ -301,5 +301,11 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
entity.Details = s.Select(x => new PWeightBill_SanctionDetail { AbnormalItem_Name = x.Item1, Number = x.Item2, Money = x.Item3 }).ToList();
return serializer.Serialize(entity);
}
+
+ [Rpc]
+ public static void DoCheck(long b3ID, string creator)
+ {
+ WeightBillCheck.Insert(b3ID, creator);
+ }
}
}
diff --git a/B3ClientService/Tasks/UpdateLoad/DoCheckBills.cs b/B3ClientService/Tasks/UpdateLoad/DoCheckBills.cs
new file mode 100644
index 0000000..78857ba
--- /dev/null
+++ b/B3ClientService/Tasks/UpdateLoad/DoCheckBills.cs
@@ -0,0 +1,35 @@
+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.BWPClients;
+using TSingSoft.WebPluginFramework;
+
+namespace BWP.B3ClientService.Tasks.UpdateLoad
+{
+ public static class DoCheckBills
+ {
+ public static void Execute(string uri)
+ {
+ var weightBills = GetWeightBillCheck();
+ foreach (var item in weightBills)
+ {
+ var bwpClient = new BWPClient(uri, item.Item2);
+ bwpClient.Call("/MainSystem/B3ButcherManage/Rpcs/WeighBillRpc/DoCheck", item.Item1);
+ WeightBillCheck.SetSynced(item.Item1);
+ }
+ }
+
+ static List> GetWeightBillCheck()
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(WeightBillCheck)));
+ query.Columns.Add(DQSelectColumn.Field("B3ID"));
+ query.Columns.Add(DQSelectColumn.Field("Creator"));
+ query.Where.Conditions.Add(DQCondition.EQ("Sync", false));
+ return query.EExecuteList();
+ }
+ }
+}
diff --git a/B3ClientService/Tasks/UpdateLoad/UploadTest.cs b/B3ClientService/Tasks/UpdateLoad/UploadTest.cs
index 82e9010..0a455fd 100644
--- a/B3ClientService/Tasks/UpdateLoad/UploadTest.cs
+++ b/B3ClientService/Tasks/UpdateLoad/UploadTest.cs
@@ -25,6 +25,8 @@ namespace BWP.B3ClientService.Tasks
UpLoadWeightBill.Execute(serverUri);
UploadOrderDetail.Execute(serverUri);
UploadSecondOrder.Execute(serverUri);
+
+ DoCheckBills.Execute(serverUri);
}
public string Name