From 6d8bfad5c0e4a0d93cf6909fffd2abbfd46b6b72 Mon Sep 17 00:00:00 2001 From: wugang <1029149336@qq.com> Date: Thu, 2 Nov 2017 18:59:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E5=AD=98=E8=B4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3ClientService/B3ClientService.csproj | 8 ++++ .../BO/ClientGoodsSet_/ClientGoodsSet.cs | 26 ++++++++++++ .../ClientGoodsSet_/ClientGoodsSet_Detail.cs | 38 +++++++++++++++++ .../Rpcs/BillRpc/ClientGoodsSetRpc.cs | 41 +++++++++++++++++++ .../Rpcs/RpcBO/Bill/ClientGoodsSetDto.cs | 17 ++++++++ B3ClientService/Tasks/SyncInfoFromServer.cs | 18 ++++++++ 6 files changed, 148 insertions(+) create mode 100644 B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet.cs create mode 100644 B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet_Detail.cs create mode 100644 B3ClientService/Rpcs/BillRpc/ClientGoodsSetRpc.cs create mode 100644 B3ClientService/Rpcs/RpcBO/Bill/ClientGoodsSetDto.cs diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj index 2a63910..b911877 100644 --- a/B3ClientService/B3ClientService.csproj +++ b/B3ClientService/B3ClientService.csproj @@ -47,6 +47,10 @@ False ..\..\..\..\BwpB3Project\tsref\Debug\Forks.Utils.dll + + False + ..\..\..\tsref\Debug\Newtonsoft.Json.dll + @@ -98,6 +102,8 @@ + + @@ -110,6 +116,8 @@ + + diff --git a/B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet.cs b/B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet.cs new file mode 100644 index 0000000..99df4dc --- /dev/null +++ b/B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3Frameworks.BO; +using Forks.EnterpriseServices.DomainObjects2; + +namespace BWP.B3ClientService.BO +{ + [Serializable] + public class ClientGoodsSet:Base + { + public string Name { get; set; } + + + private readonly ClientGoodsSet_DetailCollection _details = new ClientGoodsSet_DetailCollection(); + + [OneToMany(typeof(ClientGoodsSet_Detail), "ID", false)] + [Join("ID", "ClientGoodsSet_ID")] + public ClientGoodsSet_DetailCollection Details + { + get { return _details; } + } + + } +} diff --git a/B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet_Detail.cs b/B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet_Detail.cs new file mode 100644 index 0000000..5515f22 --- /dev/null +++ b/B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet_Detail.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3Frameworks.BO; +using Forks.EnterpriseServices; +using Forks.EnterpriseServices.DomainObjects2; + +namespace BWP.B3ClientService.BO +{ + [Serializable] + public class ClientGoodsSet_Detail : Base + { + public long ClientGoodsSet_ID { get; set; } + + [LogicName("存货")] + public long Goods_ID { get; set; } + + [LogicName("存货")] + public string Goods_Name { get; set; } + + [LogicName("存货编码")] + public string Goods_Code { get; set; } + + [LogicName("存货规格")] + public string Goods_Spec { get; set; } + + public string Goods_Spell { get; set; } + + + } + + [Serializable] + public class ClientGoodsSet_DetailCollection : DmoCollection + { + + } +} diff --git a/B3ClientService/Rpcs/BillRpc/ClientGoodsSetRpc.cs b/B3ClientService/Rpcs/BillRpc/ClientGoodsSetRpc.cs new file mode 100644 index 0000000..0962c8b --- /dev/null +++ b/B3ClientService/Rpcs/BillRpc/ClientGoodsSetRpc.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3ClientService.BO; +using BWP.B3ClientService.Rpcs.RpcBO.Bill; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.JsonRpc; +using Newtonsoft.Json; +using TSingSoft.WebPluginFramework; + +namespace BWP.B3ClientService.Rpcs.BillRpc +{ + [Rpc] + public static class ClientGoodsSetRpc + { + + [Rpc] + public static string GetList() + { + var list=new List(); + var query=new DmoQuery(typeof(ClientGoodsSet)); + var clist = query.EExecuteList().Cast().ToList(); + foreach (ClientGoodsSet set in clist) + { + var dto=new ClientGoodsSetDto(); + dto.Name = set.Name; + foreach (ClientGoodsSet_Detail setDetail in set.Details) + { + dto.Goods_ID = setDetail.Goods_ID; + dto.Goods_Name = setDetail.Goods_Name; + dto.Goods_Code = setDetail.Goods_Code; + dto.Goods_Spec = setDetail.Goods_Spec; + list.Add(dto); + } + } + var json = JsonConvert.SerializeObject(list); + return json; + } + } +} diff --git a/B3ClientService/Rpcs/RpcBO/Bill/ClientGoodsSetDto.cs b/B3ClientService/Rpcs/RpcBO/Bill/ClientGoodsSetDto.cs new file mode 100644 index 0000000..9e6012a --- /dev/null +++ b/B3ClientService/Rpcs/RpcBO/Bill/ClientGoodsSetDto.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BWP.B3ClientService.Rpcs.RpcBO.Bill +{ + [Serializable] + public class ClientGoodsSetDto + { + public string Name { get; set; } + public long Goods_ID { get; set; } + public string Goods_Name { get; set; } + public string Goods_Code { get; set; } + public string Goods_Spec { get; set; } + } +} diff --git a/B3ClientService/Tasks/SyncInfoFromServer.cs b/B3ClientService/Tasks/SyncInfoFromServer.cs index af94385..b1302c0 100644 --- a/B3ClientService/Tasks/SyncInfoFromServer.cs +++ b/B3ClientService/Tasks/SyncInfoFromServer.cs @@ -13,6 +13,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Script.Serialization; +using Newtonsoft.Json; using TSingSoft.WebPluginFramework; using TSingSoft.WebPluginFramework.TimerTasks; @@ -53,11 +54,28 @@ namespace BWP.B3ClientService.Tasks SyncSanction(); SyncLiveVarieties(); SyncBodyDiscontItem(); + SyncClientGoodsSet(); } //catch { } } + private void SyncClientGoodsSet() + { + var jsonStr = RpcFacade.Call("/MainSystem/B3ButcherManageForClient/Rpcs/ClientGoodsSetRpc/GetList"); + var list =JsonConvert.DeserializeObject>(jsonStr); + using (var context = new TransactionContext()) + { + var sql1 = @"truncate table [B3ClientService_ClientGoodsSet];truncate table [B3ClientService_ClientGoodsSet_Detail];"; + context.Session.ExecuteSqlNonQuery(sql1); + foreach (ClientGoodsSet entity in list) + { + context.Session.Insert(entity); + } + context.Commit(); + } + } + static void SyncWpfUser() { var list = RpcFacade.Call>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetWpfUser");