|
|
@ -12,6 +12,12 @@ using TSingSoft.WebPluginFramework; |
|
|
|
|
|
|
|
|
namespace BWP.B3ClientService.Rpcs |
|
|
namespace BWP.B3ClientService.Rpcs |
|
|
{ |
|
|
{ |
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 状态 入库时间 退库时间
|
|
|
|
|
|
/// 未入库 空 空
|
|
|
|
|
|
/// 已入库 有 空
|
|
|
|
|
|
/// 已退库 有 有
|
|
|
|
|
|
/// </summary>
|
|
|
[Rpc] |
|
|
[Rpc] |
|
|
public static class SegmentInStoreRpc |
|
|
public static class SegmentInStoreRpc |
|
|
{ |
|
|
{ |
|
|
@ -54,28 +60,17 @@ namespace BWP.B3ClientService.Rpcs |
|
|
var list = JsonConvert.DeserializeObject<List<SegmentInStoreObj>>(json); |
|
|
var list = JsonConvert.DeserializeObject<List<SegmentInStoreObj>>(json); |
|
|
using (var session = Dmo.NewSession()) |
|
|
using (var session = Dmo.NewSession()) |
|
|
{ |
|
|
{ |
|
|
/* BarCode InStoreTime Store_ID State */ |
|
|
|
|
|
|
|
|
/* BarCode InStoreTime Store_ID BackStoreTime */ |
|
|
foreach (var item in list) |
|
|
foreach (var item in list) |
|
|
{ |
|
|
{ |
|
|
var id = Exist(session, item.BarCode); |
|
|
var id = Exist(session, item.BarCode); |
|
|
if (id == null) |
|
|
if (id == null) |
|
|
{ |
|
|
{ |
|
|
if (item.Delete) |
|
|
|
|
|
continue; |
|
|
|
|
|
var entity = new SegmentProductionInfo(); |
|
|
var entity = new SegmentProductionInfo(); |
|
|
entity.BarCode = item.BarCode; |
|
|
entity.BarCode = item.BarCode; |
|
|
if (item.State == 2) |
|
|
|
|
|
{ |
|
|
|
|
|
entity.InStoreTime = item.InStoreTime; |
|
|
|
|
|
entity.BackTime = item.BackStoreTime; |
|
|
|
|
|
entity.Store_ID = item.Store_ID; |
|
|
|
|
|
entity.IsDelete = true; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
entity.InStoreTime = item.InStoreTime; |
|
|
|
|
|
entity.Store_ID = item.Store_ID; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
entity.InStoreTime = item.InStoreTime; |
|
|
|
|
|
entity.BackTime = item.BackStoreTime; |
|
|
|
|
|
entity.Store_ID = item.Store_ID; |
|
|
session.Insert(entity); |
|
|
session.Insert(entity); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
@ -97,25 +92,11 @@ namespace BWP.B3ClientService.Rpcs |
|
|
private static void Update(IDmoSession session, long id, SegmentInStoreObj entity) |
|
|
private static void Update(IDmoSession session, long id, SegmentInStoreObj entity) |
|
|
{ |
|
|
{ |
|
|
var update = new DQUpdateDom(typeof(SegmentProductionInfo)); |
|
|
var update = new DQUpdateDom(typeof(SegmentProductionInfo)); |
|
|
if (entity.Delete || entity.State == 2) |
|
|
|
|
|
{ |
|
|
|
|
|
if (entity.Delete) |
|
|
|
|
|
{ |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("InStoreTime", DQExpression.NULL)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Store_ID", DQExpression.NULL)); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("BackTime", entity.BackStoreTime)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("IsDelete", true)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("InStoreTime", entity.InStoreTime)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Store_ID", entity.Store_ID)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("InStoreTime", entity.InStoreTime)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Store_ID", entity.Store_ID)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("BackTime", DQExpression.Value(entity.BackStoreTime))); |
|
|
update.Columns.Add(new DQUpdateColumn("IsSync", false)); |
|
|
update.Columns.Add(new DQUpdateColumn("IsSync", false)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1)))); |
|
|
update.Where.Conditions.Add(DQCondition.EQ("ID", id)); |
|
|
update.Where.Conditions.Add(DQCondition.EQ("ID", id)); |
|
|
session.ExecuteNonQuery(update); |
|
|
session.ExecuteNonQuery(update); |
|
|
} |
|
|
} |
|
|
@ -127,7 +108,7 @@ namespace BWP.B3ClientService.Rpcs |
|
|
var goods = new JoinAlias(typeof(Goods)); |
|
|
var goods = new JoinAlias(typeof(Goods)); |
|
|
var query = new DQueryDom(main); |
|
|
var query = new DQueryDom(main); |
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "Goods_ID", goods, "ID")); |
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "Goods_ID", goods, "ID")); |
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.IsNull(DQExpression.Field("InStoreTime")), DQCondition.EQ("IsDelete", false))); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("InStoreTime"))); |
|
|
query.Columns.Add(DQSelectColumn.Field("BarCode")); |
|
|
query.Columns.Add(DQSelectColumn.Field("BarCode")); |
|
|
query.Columns.Add(DQSelectColumn.Field("Code", goods)); |
|
|
query.Columns.Add(DQSelectColumn.Field("Code", goods)); |
|
|
query.Columns.Add(DQSelectColumn.Field("Name", goods)); |
|
|
query.Columns.Add(DQSelectColumn.Field("Name", goods)); |
|
|
@ -165,7 +146,7 @@ namespace BWP.B3ClientService.Rpcs |
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "Goods_ID", goods, "ID")); |
|
|
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("Code", goods)); |
|
|
query.Columns.Add(DQSelectColumn.Field("Weight")); |
|
|
query.Columns.Add(DQSelectColumn.Field("Weight")); |
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("BarCode", barCode), DQCondition.EQ("IsDelete", false))); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("BarCode", barCode), DQCondition.IsNotNull(DQExpression.Field("InStoreTime")), DQCondition.IsNull(DQExpression.Field("BackTime")))); |
|
|
var result = query.EExecuteScalar<string, decimal?>(); |
|
|
var result = query.EExecuteScalar<string, decimal?>(); |
|
|
if (result == null) |
|
|
if (result == null) |
|
|
return string.Empty; |
|
|
return string.Empty; |
|
|
@ -181,11 +162,6 @@ namespace BWP.B3ClientService.Rpcs |
|
|
|
|
|
|
|
|
public long? Store_ID { get; set; } |
|
|
public long? Store_ID { get; set; } |
|
|
|
|
|
|
|
|
//0入库 2退库
|
|
|
|
|
|
public int State { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public bool Delete { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public DateTime? BackStoreTime { get; set; } |
|
|
public DateTime? BackStoreTime { get; set; } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|