|
|
@ -72,14 +72,14 @@ namespace ButcherFactory.BO.LocalBL |
|
|
entity.WorkUnit_ID = workUnitID; |
|
|
entity.WorkUnit_ID = workUnitID; |
|
|
entity.ProductBatch_ID = productBatchID; |
|
|
entity.ProductBatch_ID = productBatchID; |
|
|
entity.RowIndex = GenerateRowIndex(productBatchID, session); |
|
|
entity.RowIndex = GenerateRowIndex(productBatchID, session); |
|
|
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate,AppContext.ConnectInfo.ClientCode, entity.RowIndex); |
|
|
|
|
|
|
|
|
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate, AppContext.ConnectInfo.ClientCode, entity.RowIndex); |
|
|
session.Insert(entity); |
|
|
session.Insert(entity); |
|
|
session.Commit(); |
|
|
session.Commit(); |
|
|
return entity; |
|
|
return entity; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static SegmentProduction InsertAndSetGroupID(long goodsID, decimal weight, long? workUnitID, long productBatchID, DateTime batchDate,bool test) |
|
|
|
|
|
|
|
|
public static SegmentProduction InsertAndSetGroupID(long goodsID, decimal weight, long? workUnitID, long productBatchID, DateTime batchDate, bool test) |
|
|
{ |
|
|
{ |
|
|
using (var session = DmoSession.New()) |
|
|
using (var session = DmoSession.New()) |
|
|
{ |
|
|
{ |
|
|
@ -175,7 +175,7 @@ namespace ButcherFactory.BO.LocalBL |
|
|
{ |
|
|
{ |
|
|
var update = new DQUpdateDom(typeof(SegmentProduction)); |
|
|
var update = new DQUpdateDom(typeof(SegmentProduction)); |
|
|
update.Columns.Add(new DQUpdateColumn("InStored", true)); |
|
|
update.Columns.Add(new DQUpdateColumn("InStored", true)); |
|
|
update.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"),ids.Select(x=>DQExpression.Value(x)).ToArray())); |
|
|
|
|
|
|
|
|
update.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), ids.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
update.EExecute(); |
|
|
update.EExecute(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -209,7 +209,7 @@ namespace ButcherFactory.BO.LocalBL |
|
|
var query = new DQueryDom(new JoinAlias(typeof(SegmentProduction))); |
|
|
var query = new DQueryDom(new JoinAlias(typeof(SegmentProduction))); |
|
|
query.Columns.Add(DQSelectColumn.Sum("Weight")); |
|
|
query.Columns.Add(DQSelectColumn.Sum("Weight")); |
|
|
query.Columns.Add(DQSelectColumn.Count()); |
|
|
query.Columns.Add(DQSelectColumn.Count()); |
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("ProductBatch_ID", detail.ProductBatch_ID), DQCondition.EQ("Goods_ID", detail.Goods_ID))); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Delete", false), DQCondition.EQ("ProductBatch_ID", detail.ProductBatch_ID), DQCondition.EQ("Goods_ID", detail.Goods_ID))); |
|
|
using (var session = DmoSession.New()) |
|
|
using (var session = DmoSession.New()) |
|
|
{ |
|
|
{ |
|
|
using (var reader = session.ExecuteReader(query)) |
|
|
using (var reader = session.ExecuteReader(query)) |
|
|
@ -261,6 +261,7 @@ namespace ButcherFactory.BO.LocalBL |
|
|
query.Columns.Add(DQSelectColumn.Field("Goods_ID")); |
|
|
query.Columns.Add(DQSelectColumn.Field("Goods_ID")); |
|
|
query.Columns.Add(DQSelectColumn.Field("Weight")); |
|
|
query.Columns.Add(DQSelectColumn.Field("Weight")); |
|
|
query.Columns.Add(DQSelectColumn.Field("CreateTime")); |
|
|
query.Columns.Add(DQSelectColumn.Field("CreateTime")); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("Delete")); |
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", true), DQCondition.EQ("Sync", false))); |
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", true), DQCondition.EQ("Sync", false))); |
|
|
query.Range = SelectRange.Top(10); |
|
|
query.Range = SelectRange.Top(10); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID")); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID")); |
|
|
@ -280,6 +281,7 @@ namespace ButcherFactory.BO.LocalBL |
|
|
obj.Goods_ID = (long)reader[6]; |
|
|
obj.Goods_ID = (long)reader[6]; |
|
|
obj.Weight = (decimal)reader[7]; |
|
|
obj.Weight = (decimal)reader[7]; |
|
|
obj.ProductTime = (DateTime)reader[8]; |
|
|
obj.ProductTime = (DateTime)reader[8]; |
|
|
|
|
|
obj.Delete = (bool)reader[9]; |
|
|
upload.Add(obj); |
|
|
upload.Add(obj); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -293,6 +295,35 @@ namespace ButcherFactory.BO.LocalBL |
|
|
update.Columns.Add(new DQUpdateColumn("Sync", true)); |
|
|
update.Columns.Add(new DQUpdateColumn("Sync", true)); |
|
|
session.ExecuteNonQuery(update); |
|
|
session.ExecuteNonQuery(update); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void SetAsDelete(long id, string barCode) |
|
|
|
|
|
{ |
|
|
|
|
|
var canDelete = CheckCanDelete(barCode); |
|
|
|
|
|
if (canDelete == null) |
|
|
|
|
|
throw new Exception("网络中断,请稍后再试!"); |
|
|
|
|
|
else if (canDelete == false) |
|
|
|
|
|
throw new Exception("已入库,不允许删除!"); |
|
|
|
|
|
|
|
|
|
|
|
var update = new DQUpdateDom(typeof(SegmentProduction)); |
|
|
|
|
|
update.Where.Conditions.Add(DQCondition.EQ("ID", id)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Sync", false)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Delete", true)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1)))); |
|
|
|
|
|
update.EExecute(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool? CheckCanDelete(string barCode) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
var rst = RpcFacade.Call<string>(RpcPath + "CheckInStored", JsonConvert.SerializeObject(new List<string> { barCode })); |
|
|
|
|
|
return JsonConvert.DeserializeObject<List<string>>(rst).Count == 0; |
|
|
|
|
|
} |
|
|
|
|
|
catch |
|
|
|
|
|
{ |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class SegmentProductionMin |
|
|
class SegmentProductionMin |
|
|
@ -309,7 +340,7 @@ namespace ButcherFactory.BO.LocalBL |
|
|
public long? Goods_ID { get; set; } |
|
|
public long? Goods_ID { get; set; } |
|
|
public decimal? Weight { get; set; } |
|
|
public decimal? Weight { get; set; } |
|
|
public DateTime? InStoreTime { get; set; } |
|
|
public DateTime? InStoreTime { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public bool Delete { get; set; } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class TaskTemp |
|
|
class TaskTemp |
|
|
|