Browse Source

销售发货客户端接口。

master
yibo 7 years ago
parent
commit
737cb41753
4 changed files with 94 additions and 1 deletions
  1. +1
    -0
      B3ClientService/B3ClientService.csproj
  2. +2
    -0
      B3ClientService/BO/Bill/SegmentProductionInfo.cs
  3. +90
    -0
      B3ClientService/OfflinRpc/SegmentSaleOutStoreRpc.cs
  4. +1
    -1
      B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs

+ 1
- 0
B3ClientService/B3ClientService.csproj View File

@ -213,6 +213,7 @@
<Compile Include="OfflinRpc\SegmentInStoreRpc.cs" /> <Compile Include="OfflinRpc\SegmentInStoreRpc.cs" />
<Compile Include="OfflinRpc\SegmentProductionRpc.cs" /> <Compile Include="OfflinRpc\SegmentProductionRpc.cs" />
<Compile Include="OfflinRpc\MiniProgramRpc.cs" /> <Compile Include="OfflinRpc\MiniProgramRpc.cs" />
<Compile Include="OfflinRpc\SegmentSaleOutStoreRpc.cs" />
<Compile Include="Rpcs\BillRpc\BaseInfoRpc.cs" /> <Compile Include="Rpcs\BillRpc\BaseInfoRpc.cs" />
<Compile Include="Rpcs\BillRpc\BeforeDeathRpc.cs" /> <Compile Include="Rpcs\BillRpc\BeforeDeathRpc.cs" />
<Compile Include="Rpcs\BillRpc\ByProductWeightRecordRpc.cs" /> <Compile Include="Rpcs\BillRpc\ByProductWeightRecordRpc.cs" />


+ 2
- 0
B3ClientService/BO/Bill/SegmentProductionInfo.cs View File

@ -60,6 +60,8 @@ namespace BWP.B3ClientService.BO
#endregion #endregion
#region 领用信息 #region 领用信息
[LogicName("领用时间")]
public DateTime? PickTime { get; set; }
#endregion #endregion
public bool IsDelete { get; set; } public bool IsDelete { get; set; }


+ 90
- 0
B3ClientService/OfflinRpc/SegmentSaleOutStoreRpc.cs View File

@ -0,0 +1,90 @@
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using Forks.EnterpriseServices.SqlDoms;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.Rpcs
{
[Rpc]
public static class SegmentSaleOutStoreRpc
{
[Rpc(RpcFlags.SkipAuth)]
public static string GetSegmentInfo(string barCode)
{
var main = new JoinAlias(typeof(SegmentProductionInfo));
var goods = new JoinAlias(typeof(Goods));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "Goods_ID", goods, "ID"));
query.Columns.Add(DQSelectColumn.Field("Code", goods));
query.Columns.Add(DQSelectColumn.Field("Weight"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDelete", false), DQCondition.EQ("BarCode", barCode)));
query.Range = SelectRange.Top(1);
var rst = query.EExecuteScalar<string, decimal?>();
var entity = new ExtensionObj();
if (rst != null)
{
entity.StringExt1 = rst.Item1;
entity.DecimalExt1 = rst.Item2;
}
return JsonConvert.SerializeObject(entity);
}
[Rpc(RpcFlags.SkipAuth)]
public static int UploadSegmentInfo(string json)
{
var list = JsonConvert.DeserializeObject<List<SegmentSaleOutStoreObj>>(json);
using (var session = Dmo.NewSession())
{
foreach (var item in list)
{
var id = GetSegmentID(item.BarCode, session);
if (id == null)
Insert(item, session);
else
Update(id.Value, item, session);
}
session.Commit();
}
return 1;
}
static long? GetSegmentID(string code, IDmoSession session)
{
if (string.IsNullOrEmpty(code))
return null;
var query = new DQueryDom(new JoinAlias(typeof(SegmentProductionInfo)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDelete", false), DQCondition.EQ("BarCode", code)));
return query.EExecuteScalar<long>(session);
}
static void Update(long id, SegmentSaleOutStoreObj obj, IDmoSession session)
{
var update = new DQUpdateDom(typeof(SegmentProductionInfo));
update.Columns.Add(new DQUpdateColumn("PickTime", obj.Time));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
session.ExecuteNonQuery(update);
}
static void Insert(SegmentSaleOutStoreObj obj, IDmoSession session)
{
var entity = new SegmentProductionInfo();
entity.BarCode = obj.BarCode;
entity.PickTime = obj.Time;
session.Insert(entity);
}
}
class SegmentSaleOutStoreObj
{
public string BarCode { get; set; }
public DateTime? Time { get; set; }
}
}

+ 1
- 1
B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs View File

@ -391,7 +391,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
return 1; return 1;
} }
public static void UpdateSecondOrder(long id, IDmoSessionWithTransaction session)
public static void UpdateSecondOrder(long id, IDmoSession session)
{ {
var update = new DQUpdateDom(typeof(SecondOrder)); var update = new DQUpdateDom(typeof(SecondOrder));
update.Columns.Add(new DQUpdateColumn("Sync", false)); update.Columns.Add(new DQUpdateColumn("Sync", false));


Loading…
Cancel
Save