From 0dd65c1cf0f2ad19387cd7f86c3a8aaeefbd82db Mon Sep 17 00:00:00 2001
From: wugang <1029149336@qq.com>
Date: Thu, 14 Dec 2017 22:24:29 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=89=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
B3ClientService/B3ClientService.csproj | 6 +-
.../B3ClientServiceOnLineConfig.cs | 33 ++++
.../SegmentationInStoreRecord.cs | 7 +-
.../SegmentationWeightRecord.cs | 5 +-
B3ClientService/BO/ServerHost.cs | 2 +-
B3ClientService/Rpcs/BaseInfoRpc.cs | 8 +
.../BillRpc/SegmentationInStoreRecordRpc.cs | 38 ----
.../SegmentationInStoreRecordDto.cs | 26 +++
.../SegmentationInStoreRecordRpc.cs | 164 ++++++++++++++++++
.../SegmentationWeightRecordDto.cs | 2 -
.../SegmentationWeightRecordRpc.cs | 49 ++++++
.../TrunksIousOutInStoreRecordRpc.cs | 50 +++++-
B3ClientService/Utils/UrlUtil.cs | 95 ++++++++++
13 files changed, 428 insertions(+), 57 deletions(-)
create mode 100644 B3ClientService/B3ClientServiceOnLineConfig.cs
delete mode 100644 B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc.cs
create mode 100644 B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordDto.cs
create mode 100644 B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordRpc.cs
create mode 100644 B3ClientService/Utils/UrlUtil.cs
diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj
index 9310395..a2fcf62 100644
--- a/B3ClientService/B3ClientService.csproj
+++ b/B3ClientService/B3ClientService.csproj
@@ -70,6 +70,7 @@
+
@@ -138,7 +139,8 @@
-
+
+
@@ -163,7 +165,6 @@
-
@@ -175,6 +176,7 @@
+
diff --git a/B3ClientService/B3ClientServiceOnLineConfig.cs b/B3ClientService/B3ClientServiceOnLineConfig.cs
new file mode 100644
index 0000000..9cdb9b1
--- /dev/null
+++ b/B3ClientService/B3ClientServiceOnLineConfig.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Forks.EnterpriseServices;
+using Forks.Utils.Configuration;
+using TSingSoft.WebPluginFramework;
+
+namespace BWP.B3ClientService
+{
+ [ConfigurationEnabled]
+ public class B3ClientServiceOnLineConfig
+ {
+ public B3ClientServiceOnLineConfig()
+ {
+ ConfigurationUtil.Fill(this);
+ }
+
+ //全局
+ private StringConfigRef _outNetUrl = new StringConfigRef("");
+
+ [LogicName("外网地址")]
+ [ConfigurationItemGroup("中间服务器")]
+ [ConfigurationItemDescription("追溯外网地址")]
+ public StringConfigRef OutNetUrl
+ {
+ get { return _outNetUrl; }
+ set { _outNetUrl = value; }
+ }
+
+
+ }
+}
diff --git a/B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs b/B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs
index 61dd747..aede16e 100644
--- a/B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs
+++ b/B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs
@@ -17,20 +17,19 @@ namespace BWP.B3ClientService.BO
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 BiaoShi { get; set; }
+ public string ProductBatch { get; set; }
+ public string CardBarCode { get; set; }//放产品的车的条码
public string CreateUserName { get; set; }
}
diff --git a/B3ClientService/BO/SegmentationWeightRecord_/SegmentationWeightRecord.cs b/B3ClientService/BO/SegmentationWeightRecord_/SegmentationWeightRecord.cs
index 20bbce7..450347e 100644
--- a/B3ClientService/BO/SegmentationWeightRecord_/SegmentationWeightRecord.cs
+++ b/B3ClientService/BO/SegmentationWeightRecord_/SegmentationWeightRecord.cs
@@ -17,8 +17,10 @@ namespace BWP.B3ClientService.BO
[DFClass]
public class SegmentationWeightRecord:Base
{
- private DateTime mCreateTime=DateTime.Now;
+ public long? B3_ID { get; set; }
+ public DateTime? SyncToB3DateTime { get; set; }
+ private DateTime mCreateTime=DateTime.Now;
[DbColumn(DbType = SqlDbType.DateTime)]
public DateTime CreateTime { get { return mCreateTime; }set { mCreateTime = value; } }
@@ -40,5 +42,6 @@ namespace BWP.B3ClientService.BO
[DbColumn(DefaultValue = false)]
public bool IsInStored { get; set; }//是否已经入库
+
}
}
diff --git a/B3ClientService/BO/ServerHost.cs b/B3ClientService/BO/ServerHost.cs
index 5bd18bf..82c2ef1 100644
--- a/B3ClientService/BO/ServerHost.cs
+++ b/B3ClientService/BO/ServerHost.cs
@@ -26,7 +26,7 @@ namespace BWP.B3ClientService.BO
{
var query = new DQueryDom(new JoinAlias(typeof(ServerHost)));
query.Columns.Add(DQSelectColumn.Field("ServerUrl"));
- return query.EExecuteScalar();
+ return query.EExecuteScalar(session);
}
}
}
diff --git a/B3ClientService/Rpcs/BaseInfoRpc.cs b/B3ClientService/Rpcs/BaseInfoRpc.cs
index d897837..abf0698 100644
--- a/B3ClientService/Rpcs/BaseInfoRpc.cs
+++ b/B3ClientService/Rpcs/BaseInfoRpc.cs
@@ -37,6 +37,14 @@ namespace BWP.B3ClientService.Rpcs
return JsonConvert.SerializeObject(list);
}
+ [Rpc]
+ public static string GetStoreList()
+ {
+ var query = new DmoQuery(typeof(Store));
+ var list = query.EExecuteList().Cast().ToList();
+ return JsonConvert.SerializeObject(list);
+ }
+
[Rpc]
public static string GetProductBatchList()
{
diff --git a/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc.cs b/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc.cs
deleted file mode 100644
index 52b8b7a..0000000
--- a/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-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/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordDto.cs b/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordDto.cs
new file mode 100644
index 0000000..7fdb037
--- /dev/null
+++ b/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordDto.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using BWP.B3ClientService.BO;
+using Forks.EnterpriseServices.DataForm;
+
+namespace BWP.B3ClientService.Rpcs.BillRpc
+{
+ [Serializable, DFClass]
+ public class SegmentationInStoreRecordDto : ClientSyncBaseDto
+ {
+ 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 BiaoShi { get; set; }
+ public string ProductBatch { get; set; }
+ public string CardBarCode { get; set; }//放产品的车的条码
+ public string CreateUserName { get; set; }
+
+ }
+}
diff --git a/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordRpc.cs b/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordRpc.cs
new file mode 100644
index 0000000..1065524
--- /dev/null
+++ b/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordRpc.cs
@@ -0,0 +1,164 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using BWP.B3ClientService.BO;
+using BWP.B3Frameworks.Utils;
+using Forks.EnterpriseServices.DomainObjects2;
+using Forks.EnterpriseServices.DomainObjects2.DQuery;
+using Forks.EnterpriseServices.JsonRpc;
+using Newtonsoft.Json;
+using TSingSoft.WebPluginFramework;
+
+namespace BWP.B3ClientService.Rpcs.BillRpc
+{
+
+ [Rpc]
+ public static class SegmentationInStoreRecordRpc
+ {
+
+ [Rpc]//根据汇总码得到所有的
+ public static string GetWeightRecordList(string barcode)
+ {
+ var query = new DmoQuery(typeof(SegmentationWeightRecord));
+ query.Where.Conditions.Add(DQCondition.EQ("CardBarCode", barcode));
+ var list = query.EExecuteList().Cast().ToList();
+ return JsonConvert.SerializeObject(list);
+ }
+
+ [Rpc]
+ public static string GetWeightRecord(string barcode)
+ {
+ SegmentationWeightRecord record;
+ var query = new DmoQuery(typeof(SegmentationWeightRecord));
+ query.Where.Conditions.Add(DQCondition.EQ("BarCode", barcode));
+ query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
+ var list = query.EExecuteList().Cast().ToList();
+ if (list.Count > 0)
+ {
+ record = list[0];
+ return JsonConvert.SerializeObject(record);
+ }
+ throw new Exception("无效条码");
+ }
+
+ private static SegmentationWeightRecord GetWeightRecordDmo(string barcode)
+ {
+ var query = new DmoQuery(typeof(SegmentationWeightRecord));
+ query.Where.Conditions.Add(DQCondition.EQ("BarCode", barcode));
+ query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
+ var list = query.EExecuteList().Cast().ToList();
+ if (list.Count > 0)
+ {
+ return list[0];
+ }
+ throw new Exception("无效条码");
+ }
+
+ private static readonly object _insertObj = new object();
+ [Rpc]
+ public static long Insert(string json)
+ {
+ lock (_insertObj)
+ {
+ var dmo = JsonConvert.DeserializeObject(json);
+ using (var session = Dmo.NewSession())
+ {
+ var record = GetExist(session, dmo.BarCode);
+ if (record == null)
+ {
+ dmo.CreateTime = DateTime.Now;
+ if (string.IsNullOrWhiteSpace(dmo.Goods_Name))
+ {
+ var weight = GetWeightRecordDmo(dmo.BarCode);
+ dmo.Goods_ID = weight.Goods_ID;
+ dmo.Goods_Name = weight.Goods_Name;
+ dmo.Goods_Spec = weight.Goods_Spec;
+ dmo.Weight = weight.Weight;
+ dmo.BiaoShi = weight.BiaoShi;
+ dmo.ProductBatch = weight.ProductBatch;
+ dmo.CardBarCode = weight.CardBarCode;
+ dmo.CreateUserName = weight.CreateUserName;
+ }
+ UpdateWeightRecordInStored(session, dmo.BarCode);
+ session.Insert(dmo);
+ }
+ else
+ {
+ record.Goods_ID = dmo.Goods_ID;
+ record.Goods_Name = dmo.Goods_Name;
+ record.Goods_Spec = dmo.Goods_Spec;
+ record.Weight = dmo.Weight;
+ record.Store_ID = dmo.Store_ID;
+ record.Store_Name = dmo.Store_Name;
+ record.BiaoShi = dmo.BiaoShi;
+ record.ProductBatch = dmo.ProductBatch;
+ record.CardBarCode = dmo.CardBarCode;
+ record.CreateUserName = dmo.CreateUserName;
+ session.Update(record);
+ }
+ session.Commit();
+ }
+ return dmo.ID;
+ }
+ }
+
+ private static SegmentationInStoreRecord GetExist(IDmoSession session, string barCode)
+ {
+ var query = new DmoQuery(typeof(SegmentationInStoreRecord));
+ query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode));
+ var res = session.ExecuteList(query).Cast().ToList();
+ if (res.Count > 0)
+ {
+ return res[0];
+ }
+ //throw new Exception("存在多条记录,请找管理员");
+ return null;
+ }
+
+
+ private static readonly object _updateObj = new object();
+ [Rpc]
+ public static int Update(string json)
+ {
+ lock (_updateObj)
+ {
+ var clientRecord = JsonConvert.DeserializeObject(json);
+ using (var session = Dmo.NewSession())
+ {
+ var record = session.Load(new DmoIdentity(typeof(SegmentationInStoreRecord), clientRecord.Service_ID ?? 0));
+ DmoUtil.CopyDmoFields(clientRecord, record, "ID", "B3_ID");
+ session.Update(record);
+ session.Commit();
+ //需要更新大表???
+ }
+ return 1;
+ }
+ }
+
+ [Rpc]
+ public static int Delete(long id)
+ {
+ var delDom = new DQDeleteDom(typeof(SegmentationInStoreRecord));
+ delDom.Where.Conditions.Add(DQCondition.EQ("ID", id));
+ using (var session = Dmo.NewSession())
+ {
+ session.ExecuteNonQuery(delDom);
+ session.Commit();
+ //需要删除大表
+ }
+ return 1;
+ }
+
+
+ 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/SegmentationWeightRecord_/SegmentationWeightRecordDto.cs b/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecord_/SegmentationWeightRecordDto.cs
index 6e3b344..9c0dd25 100644
--- a/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecord_/SegmentationWeightRecordDto.cs
+++ b/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecord_/SegmentationWeightRecordDto.cs
@@ -10,8 +10,6 @@ namespace BWP.B3ClientService.Rpcs.BillRpc.SegmentationWeightRecord_
[Serializable, DFClass]
public class SegmentationWeightRecordDto : ClientSyncBaseDto
{
- public DateTime CreateTime { get; set; }
-
public string BarCode { get; set; }//条码
public long Goods_ID { get; set; }
diff --git a/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecord_/SegmentationWeightRecordRpc.cs b/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecord_/SegmentationWeightRecordRpc.cs
index 7640145..b88af30 100644
--- a/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecord_/SegmentationWeightRecordRpc.cs
+++ b/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecord_/SegmentationWeightRecordRpc.cs
@@ -9,6 +9,7 @@ using BWP.B3Frameworks.Utils;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
+using Forks.JsonRpc.Client;
using Newtonsoft.Json;
using TSingSoft.WebPluginFramework;
@@ -18,6 +19,52 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
public static class SegmentationWeightRecordRpc
{
+
+ [Rpc]
+ public static bool CreateTodayB3OutputBill()
+ {
+ var serverUri = ServerHost.GetServerUrl();
+ if (string.IsNullOrEmpty(serverUri))
+ throw new Exception("请配置服务器地址");
+ //try
+ {
+ try
+ {
+ RpcFacade.Init(serverUri, "B3ClientServer");
+ }
+ catch (Exception ex)
+ {
+ if (ex.Message != "Can only start once")
+ throw;
+ }
+
+ var today = DateTime.Today;
+ var query = new DmoQuery(typeof(SegmentationWeightRecord));
+ query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("CreateTime", today));
+ query.Where.Conditions.Add(DQCondition.LessThan("CreateTime", today.AddDays(1)));
+ query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("B3_ID")));
+
+ using (var session = Dmo.NewSession())
+ {
+ var list = session.ExecuteList(query).Cast().ToList();
+ var json = JsonConvert.SerializeObject(list);
+ var b3Id = RpcFacade.Call("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/CreateB3OutPut", json);
+ if (b3Id > 0)
+ {
+ var update = new DQUpdateDom(typeof(SegmentationWeightRecord));
+ update.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("CreateTime", today));
+ update.Where.Conditions.Add(DQCondition.LessThan("CreateTime", today.AddDays(1)));
+ update.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("B3_ID")));
+ update.Columns.Add(new DQUpdateColumn("B3_ID", b3Id));
+ update.Columns.Add(new DQUpdateColumn("SyncToB3DateTime", DateTime.Now));
+ session.ExecuteNonQuery(update);
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
[Rpc]
public static string GetCountByNameAndBatch(long goodsId, string batch)
{
@@ -78,6 +125,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
var record = session.Load(new DmoIdentity(typeof(SegmentationWeightRecord), clientRecord.Service_ID ?? 0));
DmoUtil.CopyDmoFields(clientRecord, record, "ID", "B3_ID");
session.Update(record);
+ session.Commit();
//需要更新大表???
}
return 1;
@@ -92,6 +140,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
using (var session = Dmo.NewSession())
{
session.ExecuteNonQuery(delDom);
+ session.Commit();
//需要删除大表
}
return 1;
diff --git a/B3ClientService/Rpcs/BillRpc/TrunksIousOutInStoreRecord_/TrunksIousOutInStoreRecordRpc.cs b/B3ClientService/Rpcs/BillRpc/TrunksIousOutInStoreRecord_/TrunksIousOutInStoreRecordRpc.cs
index 6d39248..e62af6f 100644
--- a/B3ClientService/Rpcs/BillRpc/TrunksIousOutInStoreRecord_/TrunksIousOutInStoreRecordRpc.cs
+++ b/B3ClientService/Rpcs/BillRpc/TrunksIousOutInStoreRecord_/TrunksIousOutInStoreRecordRpc.cs
@@ -1,6 +1,10 @@
+using System;
+using System.Linq;
using BWP.B3ClientService.BO;
+using BWP.B3ClientService.Utils;
using BWP.B3Frameworks.Utils;
+using Forks.EnterpriseServices.Calc;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
@@ -59,7 +63,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_
using (var session = Dmo.NewSession())
{
var record = new TrunksIousOutInStoreRecord();
- DmoUtil.CopyDmoFields(clientRecord, record, "ID", "B3_ID");
+ DmoUtil.CopyDmoFields(clientRecord, record, "ID", "B3_ID", "CreateTime");
session.Insert(record);
session.Commit();
return record.ID;
@@ -68,22 +72,50 @@ namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_
}
[Rpc]
- public static long SimpleInsert(long goodsId,string goodsName,string barCode)
+ public static long SimpleInsertOrUpdate(long goodsId,string goodsName,string barCode)
{
+// var netUrl=new B3ClientServiceOnLineConfig().OutNetUrl;
+ if (barCode.Contains("http"))
+ {
+ barCode = UrlUtil.GetValue("code", barCode);
+ }
using (var session = Dmo.NewSession())
{
- var record = new TrunksIousOutInStoreRecord();
- record.Goods_ID = goodsId;
- record.Goods_Name = goodsName;
- record.BarCode = barCode;
- record.IsSubmited = false;
- session.Insert(record);
+ var record = GetExist(session, barCode);
+ if (record == null)
+ {
+ record = new TrunksIousOutInStoreRecord();
+ record.Goods_ID = goodsId;
+ record.Goods_Name = goodsName;
+ record.BarCode = barCode;
+ record.IsSubmited = false;
+ session.Insert(record);
+ }
+ else
+ {
+ record.Goods_ID = goodsId;
+ record.Goods_Name = goodsName;
+ session.Update(record);
+ }
session.Commit();
return record.ID;
}
}
+ private static TrunksIousOutInStoreRecord GetExist(IDmoSession session, string barCode)
+ {
+ var query=new DmoQuery(typeof(TrunksIousOutInStoreRecord));
+ query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode));
+ var res = session.ExecuteList(query).Cast().ToList();
+ if (res.Count > 0)
+ {
+ return res[0];
+ }
+ //throw new Exception("存在多条记录,请找管理员");
+ return null;
+ }
+
[Rpc]
public static int Update(string json)
{
@@ -91,7 +123,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_
using (var session = Dmo.NewSession())
{
var record = session.Load(new DmoIdentity(typeof(TrunksIousOutInStoreRecord), clientRecord.Service_ID ?? 0));
- DmoUtil.CopyDmoFields(clientRecord, record, "ID", "B3_ID");
+ DmoUtil.CopyDmoFields(clientRecord, record, "ID", "B3_ID", "CreateTime");
session.Update(record);
}
return 1;
diff --git a/B3ClientService/Utils/UrlUtil.cs b/B3ClientService/Utils/UrlUtil.cs
new file mode 100644
index 0000000..789a181
--- /dev/null
+++ b/B3ClientService/Utils/UrlUtil.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Linq;
+using System.Text;
+using System.Web;
+
+namespace BWP.B3ClientService.Utils
+{
+ public class UrlUtil
+ {
+ public static string GetValue(string name, string queryString)
+ {
+ var namevalues = GetQueryString(queryString);
+ return namevalues[name];
+ }
+
+ private static NameValueCollection GetQueryString(string queryString)
+ {
+ return GetQueryString(queryString, null, false);
+ }
+
+ private static NameValueCollection GetQueryString(string queryString, Encoding encoding, bool isEncoded)
+ {
+ queryString = queryString.Replace("?", "");
+ NameValueCollection result = new NameValueCollection(StringComparer.OrdinalIgnoreCase);
+ if (!String.IsNullOrEmpty(queryString))
+ {
+ int count = queryString.Length;
+ for (int i = 0; i < count; i++)
+ {
+ int startIndex = i;
+ int index = -1;
+ while (i < count)
+ {
+ char item = queryString[i];
+ if (item == '=')
+ {
+ if (index < 0)
+ {
+ index = i;
+ }
+ }
+ else if (item == '&')
+ {
+ break;
+ }
+ i++;
+ }
+ string key = null;
+ string value = null;
+ if (index >= 0)
+ {
+ key = queryString.Substring(startIndex, index - startIndex);
+ value = queryString.Substring(index + 1, (i - index) - 1);
+ }
+ else
+ {
+ key = queryString.Substring(startIndex, i - startIndex);
+ }
+ if (isEncoded)
+ {
+ result[(string)MyUrlDeCode(key, encoding)] = MyUrlDeCode(value, encoding);
+ }
+ else
+ {
+ result[key] = value;
+ }
+ if ((i == (count - 1)) && (queryString[i] == '&'))
+ {
+ result[key] = String.Empty;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static string MyUrlDeCode(string str, Encoding encoding)
+ {
+ if (encoding == null)
+ {
+ Encoding utf8 = Encoding.UTF8;
+ //首先用utf-8进行解码
+ string code = HttpUtility.UrlDecode(str.ToUpper(), utf8);
+ //将已经解码的字符再次进行编码.
+ string encode = HttpUtility.UrlEncode(code, utf8).ToUpper();
+ if (str == encode)
+ encoding = Encoding.UTF8;
+ else
+ encoding = Encoding.GetEncoding("gb2312");
+ }
+ return HttpUtility.UrlDecode(str, encoding);
+ }
+ }
+}