Browse Source

需求单No.136588:大红门B3【付款单】导NC凭证财务接口。

master
gaowenwei 8 years ago
parent
commit
d29cea74bd
2 changed files with 109 additions and 7 deletions
  1. +0
    -6
      BWP.B3ButcherManageExport.Web/Pages/B3ButcherManageExport/NC_/PayToNc_/PayToNcList.cs
  2. +109
    -1
      BWP.B3ButcherManageExport/BL/NC/PayToNcBL_/PayToNcBL.cs

+ 0
- 6
BWP.B3ButcherManageExport.Web/Pages/B3ButcherManageExport/NC_/PayToNc_/PayToNcList.cs View File

@ -1,20 +1,14 @@
using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using BWP.B3ButcherManage.BO;
using BWP.B3ButcherManageExport.BL;
using BWP.B3ExportBase;
using BWP.B3ExportBase.BO;
using BWP.B3ExportBase.Utils;
using BWP.B3Frameworks;
using BWP.Web.Pages.B3ExportBase;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework;
namespace BWP.Web.Pages.B3ButcherManageExport.NC_.PayToNc_
{


+ 109
- 1
BWP.B3ButcherManageExport/BL/NC/PayToNcBL_/PayToNcBL.cs View File

@ -8,6 +8,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 TSingSoft.WebPluginFramework;
using TSingSoft.WebPluginFramework.BIPlugins.BLEvents;
@ -24,6 +26,7 @@ namespace BWP.B3ButcherManageExport.BL
[ExportID(B3FrameworksConsts.DmoTypeIDBases.B3ButcherManageExport, B3ButcherManageExportConsts.ExportIDOffsets.PayToNc)]
public class PayToNcBL : NcBL<Pay>, IPayToNcBL
{
public readonly List<string> MinPreDetailProperties = new List<string>();
protected override NcUfinterface CreateUfinterface(IList<Pay> dmos)
{
var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this);
@ -58,7 +61,7 @@ namespace BWP.B3ButcherManageExport.BL
Export(dmoIDs, extSystemID);
}
public void CheckAccountingUnit(IEnumerable<AdvancePay> dmos)
public void CheckAccountingUnit(IEnumerable<Pay> dmos)
{
var groups = dmos.GroupBy(x => x.AccountingUnit_Name);
var count = groups.Count();
@ -84,5 +87,110 @@ namespace BWP.B3ButcherManageExport.BL
return string.Empty;
return GetDateTime(dmo.Details[0].StatPay_Date, format);
}
public string GetSumMoney(IEnumerable<Pay_Detail> details)
{
return details.Sum(x => (x.Money ?? 0).Value).ToString();
}
public string GetSumPreMoney(IEnumerable<Pay_AdvanceDetail> details)
{
return details.Sum(x => (x.AdvancePay_Money ?? 0).Value).ToString();
}
protected override void BeforeExport(List<long> dmoIDs)
{
base.BeforeExport(dmoIDs);
var dmoType = typeof(Pay_AdvanceDetail);
var dom = new DQueryDom(new JoinAlias(dmoType));
dom.Columns.Add(DQSelectColumn.Field("ID"));
foreach (string property in MinPreDetailProperties)
{
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_AdvanceDetail>();
using (IDQDataReader reader = Session.ExecuteReader(dom))
{
while (reader.Read())
{
var detail = new Pay_AdvanceDetail
{
ID = (long)reader[0]
};
int i = 1;
foreach (var property in MinPreDetailProperties)
{
var propertyInfo = dmoType.GetProperty(property);
if (propertyInfo != null)
propertyInfo.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.AdvanceDetails.Add(billDetail);
}
}
}
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>();
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);
}
}
};
}
}
}
}

Loading…
Cancel
Save