From 3b446754743594063e6a7f51a0cc188766f32123 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Mon, 5 Nov 2018 20:39:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E4=BA=A4=E5=8D=95No?= =?UTF-8?q?.46475=20=E7=BB=93=E7=AE=97=E5=8D=95=E5=A5=96=E7=BD=9A=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=B8=A6=E4=B8=8D=E5=87=BA=E5=8D=95=E4=BB=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BL/Bill/StatPayBL/StatPayBL.cs | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/B3SheepButcherManage/BL/Bill/StatPayBL/StatPayBL.cs b/B3SheepButcherManage/BL/Bill/StatPayBL/StatPayBL.cs index 551563e..e9cb850 100644 --- a/B3SheepButcherManage/BL/Bill/StatPayBL/StatPayBL.cs +++ b/B3SheepButcherManage/BL/Bill/StatPayBL/StatPayBL.cs @@ -126,6 +126,8 @@ namespace BWP.B3SheepButcherManage.BL detail.Money = detail.PriceWeight * detail.Price * ((detail.Discount ?? 100) / 100); } + + FillOtherRewardInfo(dmo); foreach (StatPay_OtherReward detail in dmo.OtherRewardDetails) { detail.Money = detail.Price * detail.Number; @@ -160,6 +162,40 @@ namespace BWP.B3SheepButcherManage.BL base.beforeSave(dmo); } + void FillOtherRewardInfo(StatPay dmo) + { + var tags = dmo.OtherRewardDetails.Where(x => x.RewardItem_ID.HasValue && x.Price == null); + if (tags.Count() == 0) + return; + var sanction = new JoinAlias(typeof(CW.SanctionSetting)); + var abnormalItem = new JoinAlias(typeof(CW.RewardItem)); + + var dom = new DQueryDom(sanction); + dom.From.AddJoin(JoinType.Left, new DQDmoSource(abnormalItem), + DQCondition.EQ(sanction, "RewardItem_ID", abnormalItem, "ID")); + dom.Columns.Add(DQSelectColumn.Field("ID", abnormalItem)); + dom.Columns.Add(DQSelectColumn.Field("Condition", sanction)); + dom.Columns.Add(DQSelectColumn.Field("BeforeScript", sanction)); + dom.Where.Conditions.Add(DQCondition.EQ(sanction, "FitBill", 奖罚设置适用单据类型.结算单)); + dom.Where.Conditions.Add(DQCondition.EQ("BillState", 单据状态.已审核)); + dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(abnormalItem, "ID"), tags.Select(x => DQExpression.Value(x)).ToArray())); + var sanctionList = dom.EExecuteList(Session); + + var runner = new Runner(); + foreach (var item in sanctionList) + { + var detail = dmo.OtherRewardDetails.First(x => x.RewardItem_ID == item.Item1); + runner.Global["单价"] = 0m; + runner.Execute(item.Item2); + var price = TypeMarshal.AsNumber(runner.Global["单价"]); + detail.Price = price; + if (price == 0) + { + detail.Price = null; + } + } + } + public void WeightCreateStayDom(StatPay dmo) { if (dmo.ValuationArea_ID == null) @@ -545,7 +581,7 @@ namespace BWP.B3SheepButcherManage.BL var bType = TypeMarshal.AsString(runner.Global["奖罚依据"]); switch (bType) { - case "屠宰单": + case "羊屠宰单": AddRewardWithButcher(dmo, runner, tuple); break; }