|
|
@ -1,5 +1,4 @@ |
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
|
|
|
|
using System; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using BWP.B3ClientService.BO; |
|
|
using BWP.B3ClientService.BO; |
|
|
using BWP.B3ClientService.Utils; |
|
|
using BWP.B3ClientService.Utils; |
|
|
@ -11,11 +10,10 @@ using Forks.EnterpriseServices.JsonRpc; |
|
|
using Forks.EnterpriseServices.SqlDoms; |
|
|
using Forks.EnterpriseServices.SqlDoms; |
|
|
using Newtonsoft.Json; |
|
|
using Newtonsoft.Json; |
|
|
using TSingSoft.WebPluginFramework; |
|
|
using TSingSoft.WebPluginFramework; |
|
|
|
|
|
using System.Web; |
|
|
|
|
|
|
|
|
namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_ |
|
|
namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_ |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Rpc] |
|
|
[Rpc] |
|
|
public static class TrunksIousOutInStoreRecordRpc |
|
|
public static class TrunksIousOutInStoreRecordRpc |
|
|
{ |
|
|
{ |
|
|
@ -25,8 +23,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_ |
|
|
var query = new DQueryDom(new JoinAlias(typeof(TrunksIousOutInStoreRecord))); |
|
|
var query = new DQueryDom(new JoinAlias(typeof(TrunksIousOutInStoreRecord))); |
|
|
query.Where.Conditions.Add(DQCondition.Or(DQCondition.IsNull(DQExpression.Field("IsSubmited")), DQCondition.EQ("IsSubmited", false))); |
|
|
query.Where.Conditions.Add(DQCondition.Or(DQCondition.IsNull(DQExpression.Field("IsSubmited")), DQCondition.EQ("IsSubmited", false))); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); |
|
|
var list = query.EExecuteDmoList<TrunksIousOutInStoreRecord>("ID", "BarCode", "Goods_Name", "Number", "Weight", "LossWeight"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var list = query.EExecuteDmoList<TrunksIousOutInStoreRecord>("ID", "BarCode", "Goods_Name", "Number", "Weight"); |
|
|
return JsonConvert.SerializeObject(list); |
|
|
return JsonConvert.SerializeObject(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -38,68 +35,45 @@ namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_ |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); |
|
|
query.Range = SelectRange.Top(50); |
|
|
query.Range = SelectRange.Top(50); |
|
|
|
|
|
|
|
|
var list = query.EExecuteDmoList<TrunksIousOutInStoreRecord>("ID", "BarCode", "Goods_Name", "Number","BeforeWeight", "Weight", "LossWeight"); |
|
|
|
|
|
|
|
|
var list = query.EExecuteDmoList<TrunksIousOutInStoreRecord>("ID", "BarCode", "Goods_Name", "Number", "BeforeWeight", "Weight"); |
|
|
|
|
|
|
|
|
return JsonConvert.SerializeObject(list); |
|
|
return JsonConvert.SerializeObject(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Rpc] |
|
|
[Rpc] |
|
|
public static long SetWeight(long id,decimal weight,string biaoshi,string store) |
|
|
|
|
|
{ |
|
|
|
|
|
var query = new DQUpdateDom(typeof(TrunksIousOutInStoreRecord)); |
|
|
|
|
|
query.Columns.Add(new DQUpdateColumn("Weight", weight)); |
|
|
|
|
|
query.Columns.Add(new DQUpdateColumn("IsSubmited", true)); |
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(biaoshi)) |
|
|
|
|
|
{ |
|
|
|
|
|
query.Columns.Add(new DQUpdateColumn("BiaoShi", biaoshi)); |
|
|
|
|
|
} |
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(store)) |
|
|
|
|
|
{ |
|
|
|
|
|
query.Columns.Add(new DQUpdateColumn("Store", store)); |
|
|
|
|
|
} |
|
|
|
|
|
// query.Columns.Add(new DQUpdateColumn("LossWeight", ));
|
|
|
|
|
|
//todo 这里要算损耗
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("ID", id)); |
|
|
|
|
|
query.EExecute(); |
|
|
|
|
|
return id; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Rpc] |
|
|
|
|
|
public static long Insert(string json) |
|
|
|
|
|
|
|
|
public static long SetWeight(string json) |
|
|
{ |
|
|
{ |
|
|
var clientRecord = JsonConvert.DeserializeObject<TrunksIousOutInStoreRecordDto>(json); |
|
|
|
|
|
|
|
|
var entity = JsonConvert.DeserializeObject<TrunksIousOutInStoreRecord>(json); |
|
|
using (var session = Dmo.NewSession()) |
|
|
using (var session = Dmo.NewSession()) |
|
|
{ |
|
|
{ |
|
|
var record = new TrunksIousOutInStoreRecord(); |
|
|
|
|
|
DmoUtil.CopyDmoFields(clientRecord, record, "ID", "B3_ID", "CreateTime"); |
|
|
|
|
|
session.Insert(record); |
|
|
|
|
|
|
|
|
var update = new DQUpdateDom(typeof(TrunksIousOutInStoreRecord)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Creator", entity.Creator)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Weight", entity.Weight)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("WorkShop_ID", entity.WorkShop_ID)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("WorkUnit_ID", entity.WorkUnit_ID)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Store_ID", entity.Store_ID)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("ProductBatch_ID", entity.ProductBatch_ID)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("ProductBatch", entity.ProductBatch)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("IsSubmited", true)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Sync", false)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("CreateTime", DateTime.Now)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1)))); |
|
|
|
|
|
update.Where.Conditions.Add(DQCondition.EQ("ID", entity.ID)); |
|
|
|
|
|
session.ExecuteNonQuery(update); |
|
|
session.Commit(); |
|
|
session.Commit(); |
|
|
return record.ID; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Rpc] |
|
|
[Rpc] |
|
|
public static string GetFinalCode(string barCode) |
|
|
public static string GetFinalCode(string barCode) |
|
|
{ |
|
|
{ |
|
|
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)) |
|
|
|
|
|
{ |
|
|
|
|
|
code = barCode; |
|
|
|
|
|
} |
|
|
|
|
|
return code; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var uri = new Uri(barCode); |
|
|
|
|
|
return HttpUtility.ParseQueryString(uri.Query)["code"]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Rpc] |
|
|
[Rpc] |
|
|
public static long SimpleInsertOrUpdate(long goodsId,string goodsName,string barCode) |
|
|
|
|
|
|
|
|
public static long SimpleInsertOrUpdate(long goodsId, string goodsName, string barCode) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
using (var session = Dmo.NewSession()) |
|
|
using (var session = Dmo.NewSession()) |
|
|
@ -112,23 +86,25 @@ namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_ |
|
|
record.Goods_Name = goodsName; |
|
|
record.Goods_Name = goodsName; |
|
|
record.BarCode = barCode; |
|
|
record.BarCode = barCode; |
|
|
record.IsSubmited = false; |
|
|
record.IsSubmited = false; |
|
|
|
|
|
record.ModifyTime = DateTime.Now; |
|
|
session.Insert(record); |
|
|
session.Insert(record); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
record.Goods_ID = goodsId; |
|
|
record.Goods_ID = goodsId; |
|
|
record.Goods_Name = goodsName; |
|
|
record.Goods_Name = goodsName; |
|
|
|
|
|
record.Sync = false; |
|
|
|
|
|
record.RowVersion += 1; |
|
|
session.Update(record); |
|
|
session.Update(record); |
|
|
} |
|
|
} |
|
|
session.Commit(); |
|
|
session.Commit(); |
|
|
return record.ID; |
|
|
return record.ID; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static TrunksIousOutInStoreRecord GetExist(IDmoSession session, string barCode) |
|
|
|
|
|
|
|
|
private static TrunksIousOutInStoreRecord GetExist(IDmoSession session, string barCode) |
|
|
{ |
|
|
{ |
|
|
var query=new DmoQuery(typeof(TrunksIousOutInStoreRecord)); |
|
|
|
|
|
|
|
|
var query = new DmoQuery(typeof(TrunksIousOutInStoreRecord)); |
|
|
query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode)); |
|
|
query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode)); |
|
|
var res = session.ExecuteList(query).Cast<TrunksIousOutInStoreRecord>().ToList(); |
|
|
var res = session.ExecuteList(query).Cast<TrunksIousOutInStoreRecord>().ToList(); |
|
|
if (res.Count > 0) |
|
|
if (res.Count > 0) |
|
|
@ -138,31 +114,5 @@ namespace BWP.B3ClientService.Rpcs.BillRpc.TrunksIousOutInStoreRecord_ |
|
|
//throw new Exception("存在多条记录,请找管理员");
|
|
|
//throw new Exception("存在多条记录,请找管理员");
|
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Rpc] |
|
|
|
|
|
public static int Update(string json) |
|
|
|
|
|
{ |
|
|
|
|
|
var clientRecord = JsonConvert.DeserializeObject<TrunksIousOutInStoreRecordDto>(json); |
|
|
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
|
|
{ |
|
|
|
|
|
var record = session.Load(new DmoIdentity(typeof(TrunksIousOutInStoreRecord), clientRecord.Service_ID ?? 0)); |
|
|
|
|
|
DmoUtil.CopyDmoFields(clientRecord, record, "ID", "B3_ID", "CreateTime"); |
|
|
|
|
|
session.Update(record); |
|
|
|
|
|
} |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Rpc] |
|
|
|
|
|
public static int Delete(long id) |
|
|
|
|
|
{ |
|
|
|
|
|
var delDom = new DQDeleteDom(typeof(TrunksIousOutInStoreRecord)); |
|
|
|
|
|
delDom.Where.Conditions.Add(DQCondition.EQ("ID", id)); |
|
|
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
|
|
{ |
|
|
|
|
|
session.Update(delDom); |
|
|
|
|
|
} |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |