From 679ee0247ebe9df3f7b31a94e99cfda5a448f34d Mon Sep 17 00:00:00 2001 From: wugang <1029149336@qq.com> Date: Sun, 5 Nov 2017 16:33:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E5=89=B2=E5=93=81?= =?UTF-8?q?=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3ClientService/B3ClientService.csproj | 2 + .../SegmentationInStoreRecord.cs | 35 ++++++++++++++ .../SegmentationWeightRecord.cs | 7 +++ .../BillRpc/SegmentationInStoreRecordRpc.cs | 38 +++++++++++++++ .../BillRpc/SegmentationWeightRecordRpc.cs | 47 +++++++++++++++++++ 5 files changed, 129 insertions(+) create mode 100644 B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs create mode 100644 B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc.cs diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj index 5bea345..a13003a 100644 --- a/B3ClientService/B3ClientService.csproj +++ b/B3ClientService/B3ClientService.csproj @@ -104,6 +104,7 @@ + @@ -118,6 +119,7 @@ + diff --git a/B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs b/B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs new file mode 100644 index 0000000..5f12d50 --- /dev/null +++ b/B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using BWP.B3Frameworks.BO; +using Forks.EnterpriseServices.DomainObjects2; + +namespace BWP.B3ClientService.BO +{ + /// + /// 分割品入库 + /// + [Serializable] + public class SegmentationInStoreRecord:Base + { + private DateTime mCreateTime = DateTime.Now; + + [DbColumn(DbType = SqlDbType.DateTime)] + public DateTime CreateTime { get { return mCreateTime; } set { mCreateTime = value; } } + + public string BarCode { get; set; }//条码 + + public long Goods_ID { get; set; } + + public string Goods_Name { get; set; } + + public string Goods_Spec { get; set; } + public decimal Weight { get; set; } + public long? Store_ID { get; set; } + public string Store_Name { get; set; } + public string CreateUserName { get; set; } + + } +} diff --git a/B3ClientService/BO/SegmentationWeightRecord_/SegmentationWeightRecord.cs b/B3ClientService/BO/SegmentationWeightRecord_/SegmentationWeightRecord.cs index c2aaaa1..0fcb9fb 100644 --- a/B3ClientService/BO/SegmentationWeightRecord_/SegmentationWeightRecord.cs +++ b/B3ClientService/BO/SegmentationWeightRecord_/SegmentationWeightRecord.cs @@ -9,6 +9,9 @@ using Forks.EnterpriseServices.DomainObjects2; namespace BWP.B3ClientService.BO { + /// + /// 分割品称重 + /// [Serializable] public class SegmentationWeightRecord:Base { @@ -32,5 +35,9 @@ namespace BWP.B3ClientService.BO public string CardBarCode { get; set; }//放产品的车的条码 public string BiaoShi { get; set; }//用来记录那个工作台或者哪台触摸屏做的 + public string CreateUserName { get; set; } + + [DbColumn(DefaultValue = false)] + public bool IsInStored { get; set; }//是否已经入库 } } diff --git a/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc.cs b/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc.cs new file mode 100644 index 0000000..52b8b7a --- /dev/null +++ b/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3ClientService.BO; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.JsonRpc; +using Newtonsoft.Json; + +namespace BWP.B3ClientService.Rpcs.BillRpc +{ + + [Rpc] + public static class SegmentationInStoreRecordRpc + { + [Rpc] + public static long Insert(string json) + { + var dmo = JsonConvert.DeserializeObject(json); + using (var session=Dmo.NewSession()) + { + UpdateWeightRecordInStored(session, dmo.BarCode); + session.Insert(dmo); + session.Commit(); + } + return dmo.ID; + } + + private static void UpdateWeightRecordInStored(IDmoSession session, string barCode) + { + var updateDom=new DQUpdateDom(typeof(SegmentationWeightRecord)); + updateDom.Where.Conditions.Add(DQCondition.EQ("BarCode",barCode)); + updateDom.Columns.Add(new DQUpdateColumn("IsInStored",true)); + session.ExecuteNonQuery(updateDom); + } + } +} diff --git a/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc.cs b/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc.cs index 10550a5..81558cb 100644 --- a/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc.cs +++ b/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc.cs @@ -4,8 +4,10 @@ using System.Linq; using System.Text; using BWP.B3ClientService.BO; using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; using Forks.EnterpriseServices.JsonRpc; using Newtonsoft.Json; +using TSingSoft.WebPluginFramework; namespace BWP.B3ClientService.Rpcs.BillRpc { @@ -24,5 +26,50 @@ namespace BWP.B3ClientService.Rpcs.BillRpc } return record.ID; } + + /// + /// 获取为入库的 + /// + /// + [Rpc] + public static string GetNotInStoreList() + { + var query=new DmoQuery(typeof(SegmentationWeightRecord)); + query.Where.Conditions.Add(DQCondition.EQ("IsInStored",false)); + var list = query.EExecuteList().Cast().ToList(); + return JsonConvert.SerializeObject(list); + } + + /// + /// 获取为入库的 + /// + /// + [Rpc] + public static string GetNotInStoreListByMaxId(long id) + { + var query = new DmoQuery(typeof(SegmentationWeightRecord)); + query.Where.Conditions.Add(DQCondition.EQ("IsInStored", false)); + query.Where.Conditions.Add(DQCondition.GreaterThan("ID", id)); + var list = query.EExecuteList().Cast().ToList(); + return JsonConvert.SerializeObject(list); + } + + + /// + /// 批量 设置已入库 + /// + /// + /// + [Rpc] + public static bool SetInStored(string json) + { + var list = JsonConvert.DeserializeObject>(json); + var whereList = list.Select(x => DQExpression.Value(x)).ToArray(); + var updateDom=new DQUpdateDom(typeof(SegmentationWeightRecord)); + updateDom.Columns.Add(new DQUpdateColumn("IsInStored",true)); + updateDom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"),whereList)); + updateDom.EExecute(); + return true; + } } }