diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BalanceSumService .cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BalanceSumService .cs index 4f5579f0..a08d3a0f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BalanceSumService .cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BalanceSumService .cs @@ -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 - ) + private readonly IBlobContainer _fileContainer; + + + public BalanceSumService( IBlobContainer fileContainer, BalanceSumDapperRepository dapper,IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager) : base(excelImportService, snowflakeIdGenerator, commonManager) { _dapper = dapper; - - //_dbcontext = dbcontext; - + _fileContainer = fileContainer; } + [UnitOfWork(false)] public string ExportFile(Guid id, List exportName, List 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(); } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs index 94a2155c..e06cc228 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs @@ -207,6 +207,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs var invbills=p_ls.Select(p => p.BillNum).ToList();//发票号 var invs=_dbcontext.Set().Where(p => invbills.Contains(p.InvbillNum)).ToList();//所有发票 + + foreach (var inv in invs) { var pdls= p_ls.Where(p => p.BillNum == inv.InvbillNum).ToList();