From 6db650b16edc77c823ace1aabfc195376baa3440 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Sun, 24 Jun 2018 10:49:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3ClientService/BO/BaseInfo/Supplier.cs | 2 -- .../BO/MiniProgram/SendPigRecord.cs | 10 +++++-- B3ClientService/OfflinRpc/MiniProgramRpc.cs | 12 +++++++++ B3ClientService/Rpcs/SelfHelpRpc.cs | 26 +++++-------------- B3ClientService/Tasks/SyncInfoFromServer.cs | 3 +-- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/B3ClientService/BO/BaseInfo/Supplier.cs b/B3ClientService/BO/BaseInfo/Supplier.cs index a58cd15..fd0f294 100644 --- a/B3ClientService/BO/BaseInfo/Supplier.cs +++ b/B3ClientService/BO/BaseInfo/Supplier.cs @@ -13,7 +13,5 @@ namespace BWP.B3ClientService.BO public string BankAccount { get; set; } public string IDCardNumber { get; set; } - - public long? Zone_ID { get; set; } } } diff --git a/B3ClientService/BO/MiniProgram/SendPigRecord.cs b/B3ClientService/BO/MiniProgram/SendPigRecord.cs index 7a8a59b..5b008f8 100644 --- a/B3ClientService/BO/MiniProgram/SendPigRecord.cs +++ b/B3ClientService/BO/MiniProgram/SendPigRecord.cs @@ -17,6 +17,12 @@ namespace BWP.B3ClientService.BO public int bType { get; set; } + public long? zoneID { get; set; } + + [ReferenceTo(typeof(Zone), "Name")] + [Join("zoneID", "ID")] + public string zoneName { get; set; } + public long carID { get; set; } [ReferenceTo(typeof(Car), "Name")] @@ -65,8 +71,8 @@ namespace BWP.B3ClientService.BO public int fidx { get; set; } - [ReferenceTo(typeof(Farmer),"Name")] - [Join("farmerID","ID")] + [ReferenceTo(typeof(Farmer), "Name")] + [Join("farmerID", "ID")] public string fName { get; set; } public long farmerID { get; set; } diff --git a/B3ClientService/OfflinRpc/MiniProgramRpc.cs b/B3ClientService/OfflinRpc/MiniProgramRpc.cs index e091212..3a09ff1 100644 --- a/B3ClientService/OfflinRpc/MiniProgramRpc.cs +++ b/B3ClientService/OfflinRpc/MiniProgramRpc.cs @@ -218,6 +218,18 @@ namespace BWP.B3ClientService.Rpcs } return null; } + + [Rpc(RpcFlags.SkipAuth)] + public static string GetZoneList(string name) + { + var query = new DQueryDom(new JoinAlias(typeof(Zone))); + query.Columns.Add(DQSelectColumn.Field("ID")); + query.Columns.Add(DQSelectColumn.Field("Name")); + query.Where.Conditions.Add(DQCondition.Like("Name", name)); + query.Range = SelectRange.Top(3); + var list = query.EExecuteList().Select(x => new Zone { ID = x.Item1, Name = x.Item2 }); + return JsonConvert.SerializeObject(list); + } } class HistoryObj diff --git a/B3ClientService/Rpcs/SelfHelpRpc.cs b/B3ClientService/Rpcs/SelfHelpRpc.cs index a901741..675adde 100644 --- a/B3ClientService/Rpcs/SelfHelpRpc.cs +++ b/B3ClientService/Rpcs/SelfHelpRpc.cs @@ -107,18 +107,19 @@ namespace BWP.B3ClientService.Rpcs weight.Department_ID = 2; weight.Employee_Name = entity.employee; weight.Employee_ID = entity.employeeID; + weight.Zone_ID = entity.zoneID; + weight.Zone_Name = entity.zoneName; weight.WeighTime = DateTime.Now; weight.Supplier_ID = entity.supplierID; weight.Supplier_Name = entity.supplier; - var supInfo = GetSupplierZone(session, weight.Supplier_ID.Value); - if (supInfo != null) - { - weight.Zone_ID = supInfo.Item1; - weight.Zone_Name = supInfo.Item2; - } weight.BankAccount = entity.supplierIDCard; weight.PurchaseType_ID = entity.bType + 1; weight.PurchaseType_Name = entity.bType == 0 ? "社会" : "业务"; + if (weight.Employee_ID == null && weight.PurchaseType_Name == "社会") + { + weight.Employee_ID = 1; + weight.Employee_Name = "王新辉"; + } weight.Car_Name = entity.carNum; weight.Car_ID = entity.carID; weight.JingJianFee = entity.jjf; @@ -163,19 +164,6 @@ namespace BWP.B3ClientService.Rpcs } } - static Tuple GetSupplierZone(IDmoSession session, long supplierID) - { - var supplier = new JoinAlias(typeof(Supplier)); - var zone = new JoinAlias(typeof(Zone)); - var query = new DQueryDom(supplier); - query.From.AddJoin(JoinType.Left, new DQDmoSource(zone), DQCondition.EQ(supplier - , "Zone_ID", zone, "ID")); - query.Columns.Add(DQSelectColumn.Field("")); - query.Columns.Add(DQSelectColumn.Field("")); - query.Where.Conditions.Add(DQCondition.And(DQCondition.IsNotNull(DQExpression.Field(supplier, "Zone_ID")), DQCondition.EQ("ID", supplierID))); - return query.EExecuteScalar(session); - } - private static void FillSendPigWeightID(IDmoSession session, long id, long weightID) { var update = new DQUpdateDom(typeof(SendPigRecord)); diff --git a/B3ClientService/Tasks/SyncInfoFromServer.cs b/B3ClientService/Tasks/SyncInfoFromServer.cs index 7569ce2..f128e6c 100644 --- a/B3ClientService/Tasks/SyncInfoFromServer.cs +++ b/B3ClientService/Tasks/SyncInfoFromServer.cs @@ -228,7 +228,6 @@ namespace BWP.B3ClientService.Tasks entity.Spell = o.Get("Spell"); entity.IDCardNumber = o.Get("Card_ID"); entity.BankAccount = o.Get("BankAccount"); - entity.Zone_ID = o.Get("Zone_ID"); context.Session.Insert(entity); } context.Commit(); @@ -304,7 +303,7 @@ namespace BWP.B3ClientService.Tasks public void Execute() { var serverUri = ServerHost.GetServerUrl(); - if (string.IsNullOrEmpty(serverUri)) + if (!string.IsNullOrEmpty(serverUri)) { try {