luanhui 8 years ago
parent
commit
f4220e3a84
5 changed files with 99 additions and 18 deletions
  1. +3
    -0
      B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs
  2. +66
    -10
      B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordRpc.cs
  3. +3
    -0
      B3ClientService/Rpcs/BillRpc/SegmentationWeightRecord_/SegmentationWeightRecordRpc.cs
  4. +19
    -4
      B3ClientService/Rpcs/BillRpc/TrunksIousOutInStoreRecord_/TrunksIousOutInStoreRecordRpc.cs
  5. +8
    -4
      B3ClientService/Utils/UrlUtil.cs

+ 3
- 0
B3ClientService/BO/SegmentationInStoreRecord_/SegmentationInStoreRecord.cs View File

@ -16,6 +16,9 @@ namespace BWP.B3ClientService.BO
[DFClass]
public class SegmentationInStoreRecord:Base
{
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; } }


+ 66
- 10
B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc_/SegmentationInStoreRecordRpc.cs View File

@ -7,6 +7,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;
@ -17,6 +18,58 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
public static class SegmentationInStoreRecordRpc
{
[Rpc]
public static long CreateTodayB3ProductInStoreBill()
{
var serverUri = ServerHost.GetServerUrl();
if (string.IsNullOrEmpty(serverUri))
{
throw new Exception("请配置服务器地址");
}
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(SegmentationInStoreRecord));
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<SegmentationInStoreRecord>().ToList();
if (list.Count == 0)
{
return -1;
}
var json = JsonConvert.SerializeObject(list);
var b3Id = RpcFacade.Call<long>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/CreateB3ProductInStore", json);
if (b3Id > 0)
{
var update = new DQUpdateDom(typeof(SegmentationInStoreRecord));
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);
session.Commit();
return b3Id;
}
}
return 0;
}
[Rpc]//根据汇总码得到所有的
public static string GetWeightRecordList(string barcode)
{
@ -39,7 +92,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
record = list[0];
return JsonConvert.SerializeObject(record);
}
throw new Exception("无效条码");
return "";
}
private static SegmentationWeightRecord GetWeightRecordDmo(string barcode)
@ -52,7 +105,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
{
return list[0];
}
throw new Exception("无效条码");
return null;
}
private static readonly object _insertObj = new object();
@ -71,14 +124,17 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
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;
if (weight != null)
{
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);


+ 3
- 0
B3ClientService/Rpcs/BillRpc/SegmentationWeightRecord_/SegmentationWeightRecordRpc.cs View File

@ -9,6 +9,7 @@ using BWP.B3Frameworks.Utils;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using Forks.EnterpriseServices.SqlDoms;
using Forks.JsonRpc.Client;
using Newtonsoft.Json;
using TSingSoft.WebPluginFramework;
@ -23,6 +24,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
[Rpc]
public static long CreateTodayB3OutputBill()
{
//todo 一个批次一个单据
var serverUri = ServerHost.GetServerUrl();
if (string.IsNullOrEmpty(serverUri))
{
@ -178,6 +180,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
public static string GetNotInStoreList()
{
var query=new DmoQuery(typeof(SegmentationWeightRecord));
query.Range=SelectRange.Top(50);
query.Where.Conditions.Add(DQCondition.EQ("IsInStored",false));
var list = query.EExecuteList().Cast<SegmentationWeightRecord>().ToList();
return JsonConvert.SerializeObject(list);


+ 19
- 4
B3ClientService/Rpcs/BillRpc/TrunksIousOutInStoreRecord_/TrunksIousOutInStoreRecordRpc.cs View File

@ -72,13 +72,28 @@ namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_
}
[Rpc]
public static long SimpleInsertOrUpdate(long goodsId,string goodsName,string barCode)
public static string GetFinalCode(string barCode)
{
// var netUrl=new B3ClientServiceOnLineConfig().OutNetUrl;
if (barCode.Contains("http"))
var netUrl=new B3ClientServiceOnLineConfig().OutNetUrl;
barCode = barCode.Replace(netUrl+"?", "");
var code = UrlUtil.GetValueByKey("code", barCode);
if (string.IsNullOrWhiteSpace(code))
{
code = UrlUtil.GetValueByKey("CODE", barCode);
}
if (string.IsNullOrWhiteSpace(code))
{
barCode = UrlUtil.GetValue("code", barCode);
code = barCode;
}
return code;
}
[Rpc]
public static long SimpleInsertOrUpdate(long goodsId,string goodsName,string barCode)
{
using (var session = Dmo.NewSession())
{
var record = GetExist(session, barCode);


+ 8
- 4
B3ClientService/Utils/UrlUtil.cs View File

@ -9,12 +9,16 @@ namespace BWP.B3ClientService.Utils
{
public class UrlUtil
{
public static string GetValue(string name, string queryString)
public static string GetValueByKey(string key, string queryString)
{
var namevalues = GetQueryString(queryString);
return namevalues[name];
var namevalue = GetQueryString(queryString);
if (namevalue.AllKeys.ToList().Contains(key))
{
return namevalue[key];
}
return "";
}
private static NameValueCollection GetQueryString(string queryString)
{
return GetQueryString(queryString, null, false);


Loading…
Cancel
Save