From 7b38123969d0fc59916efd0b25cd426299d0d6f0 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Mon, 23 Jul 2018 20:42:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8D=95No.140580=201?= =?UTF-8?q?=E3=80=81=E3=80=90=E7=BB=93=E7=AE=97=E5=8D=95=E3=80=91=E5=AF=BC?= =?UTF-8?q?NC=E5=87=AD=E8=AF=81=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=B4=B7?= =?UTF-8?q?=E6=96=B9=E7=A7=91=E7=9B=AE=EF=BC=8C=E5=8F=96=E5=80=BC=E3=80=90?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=8D=95=E3=80=91=E4=B8=AD=EF=BD=9B=E8=BF=87?= =?UTF-8?q?=E7=A3=85=E5=BC=82=E5=B8=B8=EF=BD=9D=E4=B8=AD=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=9C=89=E2=80=9C=E5=BC=82=E5=B8=B8=E9=A1=B9=E7=9B=AE=E2=80=9D?= =?UTF-8?q?=20ID=E4=B8=BAX=EF=BC=88=E8=BF=99=E9=87=8C=E6=98=AF=E5=8D=B8?= =?UTF-8?q?=E8=BD=A6=E8=B4=B9=EF=BC=8C=E5=9C=A8=E8=84=9A=E6=9C=AC=E9=87=8C?= =?UTF-8?q?=E5=8F=AF=E7=BC=96=E8=BE=91=E5=BC=82=E5=B8=B8=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?ID=EF=BC=89=EF=BC=8C=E7=94=9F=E6=88=90NC=E5=87=AD=E8=AF=81?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=80=9F=E6=96=B9=E7=A7=91=E7=9B=AE=20=E8=B4=B7?= =?UTF-8?q?=E6=96=B9=E5=88=86=E5=BD=95=E4=B8=BA=EF=BC=9A=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E5=BA=94=E4=BB=98=E6=AC=BE\=E9=9B=86=E5=9B=A2=E5=A4=96?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=BA=94=E4=BB=98=E6=AC=BE\=E5=85=B6?= =?UTF-8?q?=E4=BB=96\=E5=85=B6=E4=BB=96=EF=BC=8C=20=20=E9=87=91=E9=A2=9D?= =?UTF-8?q?=3D=20-=20=EF=BC=88=E5=BC=82=E5=B8=B8=E9=A1=B9=E7=9B=AEID?= =?UTF-8?q?=E9=87=91=E9=A2=9D=EF=BC=89=EF=BC=8C=E8=BE=85=E5=8A=A9=E6=A0=B8?= =?UTF-8?q?=E7=AE=97=EF=BC=9A=E5=AE=A2=E5=95=86=E8=BE=85=E5=8A=A9=E6=A0=B8?= =?UTF-8?q?=E7=AE=97=EF=BC=8C=E5=9B=BA=E5=AE=9A=E4=B8=BA=E3=80=90=E9=99=88?= =?UTF-8?q?=E6=96=B0=E5=AE=89=E3=80=91=202=E3=80=81=E5=8E=9F=E5=80=9F?= =?UTF-8?q?=E6=96=B9=E9=87=91=E9=A2=9D=3D=E5=BA=94=E4=BB=98=E9=87=91?= =?UTF-8?q?=E9=A2=9D=EF=BC=8C=E7=8E=B0=E5=9C=A8=E5=80=9F=E6=96=B9=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E9=9C=80=E8=A6=81=E5=8A=A0=E4=B8=8A=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=B4=B7=E6=96=B9=E5=88=86=E5=BD=95=E7=9A=84=E9=87=91?= =?UTF-8?q?=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BL/NC/StatPayToNcBL_/StatPayToNcBL.cs | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/BWP.B3ButcherManageExport/BL/NC/StatPayToNcBL_/StatPayToNcBL.cs b/BWP.B3ButcherManageExport/BL/NC/StatPayToNcBL_/StatPayToNcBL.cs index 906f4c8..6cd3922 100644 --- a/BWP.B3ButcherManageExport/BL/NC/StatPayToNcBL_/StatPayToNcBL.cs +++ b/BWP.B3ButcherManageExport/BL/NC/StatPayToNcBL_/StatPayToNcBL.cs @@ -6,6 +6,7 @@ using BWP.B3Frameworks; using Forks.EnterpriseServices; using Forks.EnterpriseServices.BusinessInterfaces; using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; using System; using System.Collections.Generic; using System.Linq; @@ -28,8 +29,23 @@ namespace BWP.B3ButcherManageExport.BL public class StatPayToNcBL : NcBL, IStatPayToNcBL { public readonly List MinPreDetailProperties = new List(); + public long AbnormalItem_ID = 0; protected override NcUfinterface CreateUfinterface(IList dmos) { + if (AbnormalItem_ID != 0) + { + var details = FillExceptionDetail(dmos.Select(x => x.ID)); + foreach (var dmo in dmos) + { + var first = details.FirstOrDefault(x => x.StatPay_ID == dmo.ID); + if (first != null) + { + dmo.Money = dmo.Money - first.Money; + dmo.ExceptionDetails.Add(first); + } + } + } + var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this); scriptHelper.AddLocalVar("dmos", dmos); if (Version == "6.3") @@ -93,5 +109,28 @@ namespace BWP.B3ButcherManageExport.BL } return returnMess; } + + IEnumerable FillExceptionDetail(IEnumerable ids) + { + var query = new DQueryDom(new JoinAlias(typeof(StatPay_Exception))); + query.Columns.Add(DQSelectColumn.Field("StatPay_ID")); + query.Columns.Add(DQSelectColumn.Sum("Money")); + query.GroupBy.Expressions.Add(DQExpression.Field("StatPay_ID")); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("AbnormalItem_ID", AbnormalItem_ID), DQCondition.InList(DQExpression.Field("StatPay_ID"), ids.Select(x => DQExpression.Value(x)).ToArray()))); + query.Where.Conditions.Add(DQCondition.InEQ(DQExpression.IfNull(DQExpression.Field("Money"), DQExpression.Value(0)), DQExpression.Value(0))); + var list = new List(); + using (var session = Dmo.NewSession()) + { + using (var reader = session.ExecuteReader(query)) + { + list.Add(new StatPay_Exception() + { + StatPay_ID = (long)reader[0], + Money = Convert.ToDecimal(reader[1] ?? 0) + }); + } + } + return list; + } } }