|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using BWP.B3ClientService.BO; |
|
|
|
using BWP.B3Frameworks.Utils; |
|
|
|
using Forks.EnterpriseServices.DomainObjects2; |
|
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery; |
|
|
|
using System; |
|
|
|
@ -58,18 +59,30 @@ namespace BWP.B3ClientService.BL |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(barCode)) |
|
|
|
return; |
|
|
|
var id = GetID(barCode, session); |
|
|
|
if (id == null) |
|
|
|
var infos = GetExistInfo(barCode, session); |
|
|
|
if (infos == null) |
|
|
|
return; |
|
|
|
|
|
|
|
var update = new DQUpdateDom(typeof(CarcassFullInfo)); |
|
|
|
update.Columns.Add(new DQUpdateColumn("ButcherDate", DQExpression.NULL)); |
|
|
|
update.Columns.Add(new DQUpdateColumn("GradeTime", DQExpression.NULL)); |
|
|
|
//update.Columns.Add(new DQUpdateColumn("GradeWorker_ID", obj.));
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Livestock_ID", DQExpression.NULL)); |
|
|
|
update.Columns.Add(new DQUpdateColumn("GradeWeight", DQExpression.NULL)); |
|
|
|
update.Where.Conditions.Add(DQCondition.EQ("ID", id)); |
|
|
|
session.ExecuteNonQuery(update); |
|
|
|
if (infos.Item2.HasValue) |
|
|
|
Update(infos.Item1, new GradeAndWeight_Detail(), session); |
|
|
|
else |
|
|
|
Delete(infos.Item1, session); |
|
|
|
} |
|
|
|
|
|
|
|
static void Delete(long id, IDmoSession session) |
|
|
|
{ |
|
|
|
var delete = new DQDeleteDom(typeof(CarcassFullInfo)); |
|
|
|
delete.Where.Conditions.Add(DQCondition.EQ("ID", id)); |
|
|
|
session.ExecuteNonQuery(delete); |
|
|
|
} |
|
|
|
|
|
|
|
static Tuple<long, DateTime?> GetExistInfo(string barCode, IDmoSession session) |
|
|
|
{ |
|
|
|
var query = new DQueryDom(new JoinAlias(typeof(CarcassFullInfo))); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("ID")); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("InStoreTime")); |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode)); |
|
|
|
return query.EExecuteScalar<long, DateTime?>(session); |
|
|
|
} |
|
|
|
} |
|
|
|
} |