|
|
|
@ -5,6 +5,8 @@ using BWP.B3ExportBase.BO; |
|
|
|
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; |
|
|
|
@ -21,14 +23,14 @@ namespace BWP.B3ButcherManageExport.BL |
|
|
|
} |
|
|
|
|
|
|
|
[LogicName("屠宰场付款单导U8付款单")] |
|
|
|
[BindToFeature("B3ButcherManageExport.0006")] |
|
|
|
//[BindToFeature("B3ButcherManageExport.0006")]
|
|
|
|
[ExportID(B3FrameworksConsts.DmoTypeIDBases.B3ButcherManageExport, B3ButcherManageExportConsts.ExportIDOffsets.PayToU8)] |
|
|
|
public class PayToU8BL : ExportU8BL<Pay>, IPayToU8BL |
|
|
|
{ |
|
|
|
protected override Ufinterface CreateUfinterface(IList<Pay> dmos) |
|
|
|
{ |
|
|
|
var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this); |
|
|
|
var inv = SaleInvoices.CreateSaleInvoice(); |
|
|
|
var inv = PayU8s.CreateStoreIn(); |
|
|
|
|
|
|
|
scriptHelper.AddLocalVar("dmos", dmos); |
|
|
|
scriptHelper.AddLocalVar("invoices", inv); |
|
|
|
@ -54,5 +56,55 @@ namespace BWP.B3ButcherManageExport.BL |
|
|
|
_date = date ?? BLContext.Today; |
|
|
|
Export(dmoIDs, extSystemID); |
|
|
|
} |
|
|
|
|
|
|
|
protected override Action<List<Pay>> FillDetail |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return dmos => |
|
|
|
{ |
|
|
|
var dmoType = typeof(Pay_Detail); |
|
|
|
var dom = new DQueryDom(new JoinAlias(dmoType)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("ID")); |
|
|
|
foreach (string property in MinDetailProperties) |
|
|
|
{ |
|
|
|
dom.Columns.Add(DQSelectColumn.Field(property)); |
|
|
|
} |
|
|
|
var expressionList = new List<IDQExpression>(); |
|
|
|
foreach (var dmo in dmos) |
|
|
|
expressionList.Add(DQExpression.Value(dmo.ID)); |
|
|
|
dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("Pay_ID"), expressionList.ToArray())); |
|
|
|
var details = new List<Pay_Detail>(); |
|
|
|
details.Clear(); |
|
|
|
using (IDQDataReader reader = Session.ExecuteReader(dom)) |
|
|
|
{ |
|
|
|
while (reader.Read()) |
|
|
|
{ |
|
|
|
var detail = new Pay_Detail |
|
|
|
{ |
|
|
|
ID = (long)reader[0] |
|
|
|
}; |
|
|
|
int i = 1; |
|
|
|
foreach (var property in MinDetailProperties) |
|
|
|
{ |
|
|
|
dmoType.GetProperty(property).SetValue(detail, reader[i++], null); |
|
|
|
} |
|
|
|
details.Add(detail); |
|
|
|
} |
|
|
|
} |
|
|
|
var groups = details.GroupBy(x => x.Pay_ID); |
|
|
|
foreach (var gDetail in groups) |
|
|
|
{ |
|
|
|
var firstDmo = dmos.FirstOrDefault(x => x.ID == gDetail.Key); |
|
|
|
if (firstDmo == null) |
|
|
|
continue; |
|
|
|
foreach (var billDetail in gDetail) |
|
|
|
{ |
|
|
|
firstDmo.Details.Add(billDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |