|
|
@ -89,6 +89,7 @@ namespace BWP.B3SheepButcherManage.BL |
|
|
if (Session.ExecuteScalar(dom) != null) |
|
|
if (Session.ExecuteScalar(dom) != null) |
|
|
throw new Exception("你要删除的屠宰单明细后已经有重量录入"); |
|
|
throw new Exception("你要删除的屠宰单明细后已经有重量录入"); |
|
|
|
|
|
|
|
|
|
|
|
var needUpdateIds = GetNeedUpdateWeightDetailIDs(butcherID, startID, endID); |
|
|
//删除屠宰单明细
|
|
|
//删除屠宰单明细
|
|
|
var delDom = new DQDeleteDom(typeof(Butcher_Detail)); |
|
|
var delDom = new DQDeleteDom(typeof(Butcher_Detail)); |
|
|
delDom.Where.Conditions.Add(DQCondition.EQ("Butcher_ID", butcherID)); |
|
|
delDom.Where.Conditions.Add(DQCondition.EQ("Butcher_ID", butcherID)); |
|
|
@ -96,9 +97,27 @@ namespace BWP.B3SheepButcherManage.BL |
|
|
delDom.Where.Conditions.Add(DQCondition.LessThanOrEqual("Sequence", endID)); |
|
|
delDom.Where.Conditions.Add(DQCondition.LessThanOrEqual("Sequence", endID)); |
|
|
Session.ExecuteNonQuery(delDom); |
|
|
Session.ExecuteNonQuery(delDom); |
|
|
|
|
|
|
|
|
|
|
|
var weightBL = BIFactory.Create<IWeightBillBL>(this); |
|
|
|
|
|
foreach (var id in needUpdateIds) |
|
|
|
|
|
{ |
|
|
|
|
|
weightBL.UpdateDetailOtherNumber(id); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
ReUpdateSequenceAndPhaseCode(butcherID); |
|
|
ReUpdateSequenceAndPhaseCode(butcherID); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<long> GetNeedUpdateWeightDetailIDs(long butcherID, long? startID, long? endID) |
|
|
|
|
|
{ |
|
|
|
|
|
var dom = new DQueryDom(new JoinAlias(typeof(Butcher_Detail))); |
|
|
|
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Butcher_ID", butcherID)); |
|
|
|
|
|
dom.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("Weigh_Detail_ID"))); |
|
|
|
|
|
dom.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("Sequence", startID)); |
|
|
|
|
|
dom.Where.Conditions.Add(DQCondition.LessThanOrEqual("Sequence", endID)); |
|
|
|
|
|
dom.Columns.Add(DQSelectColumn.Field("Weigh_Detail_ID")); |
|
|
|
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field("Weigh_Detail_ID")); |
|
|
|
|
|
return dom.EExecuteList<long>(Session); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void ReUpdateSequenceAndPhaseCode(long butcherID) |
|
|
void ReUpdateSequenceAndPhaseCode(long butcherID) |
|
|
{ |
|
|
{ |
|
|
var query = new DmoQuery(typeof(Butcher_Detail)); |
|
|
var query = new DmoQuery(typeof(Butcher_Detail)); |
|
|
@ -158,6 +177,7 @@ namespace BWP.B3SheepButcherManage.BL |
|
|
var detail = new Butcher_Detail(); |
|
|
var detail = new Butcher_Detail(); |
|
|
detail.StatPay_ID = preDetail.StatPay_ID; |
|
|
detail.StatPay_ID = preDetail.StatPay_ID; |
|
|
detail.WeightBill_ID = preDetail.WeightBill_ID; |
|
|
detail.WeightBill_ID = preDetail.WeightBill_ID; |
|
|
|
|
|
detail.Weigh_Detail_ID = preDetail.Weigh_Detail_ID; |
|
|
detail.Livestock_ID = preDetail.Livestock_ID; |
|
|
detail.Livestock_ID = preDetail.Livestock_ID; |
|
|
detail.Livestock_Name = preDetail.Livestock_Name; |
|
|
detail.Livestock_Name = preDetail.Livestock_Name; |
|
|
detail.Sequence = currentSequence; |
|
|
detail.Sequence = currentSequence; |
|
|
@ -182,6 +202,11 @@ namespace BWP.B3SheepButcherManage.BL |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Update(dmo); |
|
|
Update(dmo); |
|
|
|
|
|
if (preDetail.Weigh_Detail_ID.HasValue) |
|
|
|
|
|
{ |
|
|
|
|
|
var weightBL = BIFactory.Create<IWeightBillBL>(this); |
|
|
|
|
|
weightBL.UpdateDetailOtherNumber(preDetail.Weigh_Detail_ID.Value); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public long InsertOrUpdate(long? accID, long? deptID, DateTime? date, IList<WeightBill_Record> selectedList) |
|
|
public long InsertOrUpdate(long? accID, long? deptID, DateTime? date, IList<WeightBill_Record> selectedList) |
|
|
@ -412,7 +437,7 @@ namespace BWP.B3SheepButcherManage.BL |
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Shortcut", code.ToString())); |
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Shortcut", code.ToString())); |
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); |
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); |
|
|
return dom.EExecuteScalar<long, string>(Session); |
|
|
return dom.EExecuteScalar<long, string>(Session); |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class tempWeightTable |
|
|
class tempWeightTable |
|
|
|