|
|
@ -1,43 +1,66 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Security.Cryptography; |
|
|
|
using EFCore.BulkExtensions; |
|
|
|
using Magicodes.ExporterAndImporter.Excel; |
|
|
|
using NPOI.OpenXmlFormats.Spreadsheet; |
|
|
|
using SettleAccount.Bases; |
|
|
|
using SettleAccount.Domain.BQ; |
|
|
|
using Shouldly; |
|
|
|
using TaskJob.EventArgs; |
|
|
|
using TaskJob.Interfaces; |
|
|
|
using Volo.Abp.Application.Services; |
|
|
|
using Volo.Abp.BlobStoring; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
using Volo.Abp.Emailing; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Win.Abp.Snowflakes; |
|
|
|
using Win.Sfs.BaseData.ImportExcelCommon; |
|
|
|
using Win.Sfs.SettleAccount.Bases; |
|
|
|
using Win.Sfs.SettleAccount.CommonManagers; |
|
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|
|
|
using Win.Sfs.SettleAccount.Entities.CodeSettings; |
|
|
|
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; |
|
|
|
|
|
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
|
{ |
|
|
|
public class BalanceSumService : ApplicationService, ITransientDependency, IExportJob |
|
|
|
public class BalanceSumService : BASE_SERVICE, ITransientDependency, IExportJob |
|
|
|
{ |
|
|
|
|
|
|
|
//protected readonly SettleAccountDbContext _dbcontext;
|
|
|
|
protected readonly BalanceSumDapperRepository _dapper; |
|
|
|
|
|
|
|
public BalanceSumService( |
|
|
|
BalanceSumDapperRepository dapper |
|
|
|
) |
|
|
|
{ |
|
|
|
_dapper = dapper; |
|
|
|
private readonly IBlobContainer<MyFileContainer> _fileContainer; |
|
|
|
|
|
|
|
//_dbcontext = dbcontext;
|
|
|
|
|
|
|
|
public BalanceSumService( IBlobContainer<MyFileContainer> fileContainer, BalanceSumDapperRepository dapper,IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager) : base(excelImportService, snowflakeIdGenerator, commonManager) |
|
|
|
{ |
|
|
|
_dapper = dapper; |
|
|
|
_fileContainer = fileContainer; |
|
|
|
} |
|
|
|
|
|
|
|
[UnitOfWork(false)] |
|
|
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) |
|
|
|
{ |
|
|
|
var _filename = exportName.FirstOrDefault(); |
|
|
|
var year = property.Where(p => p.Name == "Year").FirstOrDefault().Value; |
|
|
|
var list=_dapper.GetBalanceSum(year); |
|
|
|
|
|
|
|
ExcelExporter _exporter = new ExcelExporter();//导出Excel
|
|
|
|
var result = _exporter.Append(list.ToList(), "余额表") |
|
|
|
|
|
|
|
|
|
|
|
//.SeparateBySheet()
|
|
|
|
//.Append(_reversels.ToList(), "有发货无结算对比")
|
|
|
|
.ExportAppendDataAsByteArray(); |
|
|
|
result.ShouldNotBeNull(); |
|
|
|
_fileContainer.SaveAsync(_filename, result.Result, true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return id.ToString(); |
|
|
|
|
|
|
|
} |
|
|
|