|
|
@ -6,6 +6,7 @@ using BWP.B3Frameworks; |
|
|
using Forks.EnterpriseServices; |
|
|
using Forks.EnterpriseServices; |
|
|
using Forks.EnterpriseServices.BusinessInterfaces; |
|
|
using Forks.EnterpriseServices.BusinessInterfaces; |
|
|
using Forks.EnterpriseServices.DomainObjects2; |
|
|
using Forks.EnterpriseServices.DomainObjects2; |
|
|
|
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery; |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
@ -28,8 +29,23 @@ namespace BWP.B3ButcherManageExport.BL |
|
|
public class StatPayToNcBL : NcBL<StatPay>, IStatPayToNcBL |
|
|
public class StatPayToNcBL : NcBL<StatPay>, IStatPayToNcBL |
|
|
{ |
|
|
{ |
|
|
public readonly List<string> MinPreDetailProperties = new List<string>(); |
|
|
public readonly List<string> MinPreDetailProperties = new List<string>(); |
|
|
|
|
|
public long AbnormalItem_ID = 0; |
|
|
protected override NcUfinterface CreateUfinterface(IList<StatPay> dmos) |
|
|
protected override NcUfinterface CreateUfinterface(IList<StatPay> 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); |
|
|
var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this); |
|
|
scriptHelper.AddLocalVar("dmos", dmos); |
|
|
scriptHelper.AddLocalVar("dmos", dmos); |
|
|
if (Version == "6.3") |
|
|
if (Version == "6.3") |
|
|
@ -93,5 +109,28 @@ namespace BWP.B3ButcherManageExport.BL |
|
|
} |
|
|
} |
|
|
return returnMess; |
|
|
return returnMess; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<StatPay_Exception> FillExceptionDetail(IEnumerable<long> 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<StatPay_Exception>(); |
|
|
|
|
|
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; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |