Browse Source

需求单No.137222:1.【结算单】导用友【采购入库单】。

master
gaowenwei 8 years ago
parent
commit
36e4934d36
1 changed files with 61 additions and 5 deletions
  1. +61
    -5
      BWP.B3ButcherManageExport/BL/U8/StatPayToU8BL_/StatPayToU8BL.cs

+ 61
- 5
BWP.B3ButcherManageExport/BL/U8/StatPayToU8BL_/StatPayToU8BL.cs View File

@ -5,6 +5,8 @@ using BWP.B3ExportBase.BO;
using BWP.B3Frameworks; 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.DQuery;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -27,16 +29,20 @@ namespace BWP.B3ButcherManageExport.BL
{ {
protected override Ufinterface CreateUfinterface(IList<StatPay> dmos) protected override Ufinterface CreateUfinterface(IList<StatPay> dmos)
{ {
if (string.IsNullOrEmpty(Config.Script))
throw new ApplicationException("脚本为空");
var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this); var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this);
var inv = SaleInvoices.CreateSaleInvoice();
var inv = StatPayU8s.CreateStoreIn();
new StoreInBodyEntry();
scriptHelper.AddLocalVar("dmos", dmos); scriptHelper.AddLocalVar("dmos", dmos);
scriptHelper.AddLocalVar("invoices", inv);
scriptHelper.AddLocalVar("vouchers", inv);
scriptHelper.Execute(); scriptHelper.Execute();
var i = 0; var i = 0;
foreach (var invoice in inv.Bills)
foreach (var voucher in inv.Bills)
{ {
BillIDs.Add(i, invoice.B2BillIDs);
//回执文件里 会有这个信息,通过这个voucherid来判断单据是否导出成功
voucher.Head.Id = i.ToString();
BillIDs.Add(i, voucher.B2BillIDs);
i++; i++;
} }
return inv; return inv;
@ -54,5 +60,55 @@ namespace BWP.B3ButcherManageExport.BL
_date = date ?? BLContext.Today; _date = date ?? BLContext.Today;
Export(dmoIDs, extSystemID); Export(dmoIDs, extSystemID);
} }
protected override Action<List<StatPay>> FillDetail
{
get
{
return dmos =>
{
var dmoType = typeof(StatPay_Butcher);
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("StatPay_ID"), expressionList.ToArray()));
var details = new List<StatPay_Butcher>();
details.Clear();
using (IDQDataReader reader = Session.ExecuteReader(dom))
{
while (reader.Read())
{
var detail = new StatPay_Butcher
{
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.StatPay_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);
}
}
};
}
}
} }
} }

Loading…
Cancel
Save