Browse Source

bug

master
yibo 7 years ago
parent
commit
c3464c6f7b
1 changed files with 9 additions and 4 deletions
  1. +9
    -4
      B3SheepButcherManage/BL/Bill/WeightBillBL/WeightBillBL.cs

+ 9
- 4
B3SheepButcherManage/BL/Bill/WeightBillBL/WeightBillBL.cs View File

@ -150,7 +150,7 @@ namespace BWP.B3SheepButcherManage.BL
query.Columns.Add(DQSelectColumn.Max(detail, "Number")); query.Columns.Add(DQSelectColumn.Max(detail, "Number"));
query.GroupBy.Expressions.Add(DQExpression.Field(detail, "ID")); query.GroupBy.Expressions.Add(DQExpression.Field(detail, "ID"));
var list = new List<Tuple<long, int, int>>();
var list = new List<Tuple<long, int>>();
using (var reader = Session.ExecuteReader(query)) using (var reader = Session.ExecuteReader(query))
{ {
while (reader.Read()) while (reader.Read())
@ -161,19 +161,24 @@ namespace BWP.B3SheepButcherManage.BL
var last = item3 - item2; var last = item3 - item2;
if (last < 0) if (last < 0)
throw new Exception(string.Format("过磅单明细ID{0} 头数{1} 已计划{2} 超出{3}", item1, item3, item2, -last)); throw new Exception(string.Format("过磅单明细ID{0} 头数{1} 已计划{2} 超出{3}", item1, item3, item2, -last));
list.Add(new Tuple<long, int, int>(item1, item2, last));
list.Add(new Tuple<long, int>(item1, item2));
} }
} }
foreach (var item in weightDetailIDs)
{
if (!list.Any(x => x.Item1 == item))
list.Add(new Tuple<long, int>(item, 0));
}
foreach (var item in list) foreach (var item in list)
UpdateReocrdPlanNumber(item); UpdateReocrdPlanNumber(item);
AfterUpdateRecord(weightDetailIDs); AfterUpdateRecord(weightDetailIDs);
} }
private void UpdateReocrdPlanNumber(Tuple<long, int, int> item)
private void UpdateReocrdPlanNumber(Tuple<long, int> item)
{ {
var update = new DQUpdateDom(typeof(WeightBill_Record)); var update = new DQUpdateDom(typeof(WeightBill_Record));
update.Columns.Add(new DQUpdateColumn("PlanNumber", item.Item2)); update.Columns.Add(new DQUpdateColumn("PlanNumber", item.Item2));
update.Columns.Add(new DQUpdateColumn("RemainNumber", item.Item3));
update.Columns.Add(new DQUpdateColumn("RemainNumber", DQExpression.Subtract(DQExpression.Field("Number"), DQExpression.Value(item.Item2))));
update.Where.Conditions.Add(DQCondition.EQ("ID", item.Item1)); update.Where.Conditions.Add(DQCondition.EQ("ID", item.Item1));
Session.ExecuteNonQuery(update); Session.ExecuteNonQuery(update);
} }


Loading…
Cancel
Save