From 22c944c742017be8e2ac2dbb0ecac55e3f971a9e Mon Sep 17 00:00:00 2001 From: zhaoxinyu <89237069@qq.com> Date: Wed, 10 Jul 2024 17:03:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appsettings.json | 2 +- .../Entities/BQ/VmiAppService.cs | 86 +++++++++++++++---- .../Entities/BQ/SHIP_REC_SUM.cs | 4 + 3 files changed, 72 insertions(+), 20 deletions(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json index d1c2b2e2..2ead8600 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json @@ -5,7 +5,7 @@ "ConnectionStrings": { "Default": "Server=dev.ccwin-in.com,13326;Database=BJABP;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", //"SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;", - "SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA_TEMP;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;Connection Timeout=120", + "SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;Connection Timeout=120", "ExChangeCenterService": "Server=dev.ccwin-in.com,13326;Database=ExChangeCenter;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;", "WMSBJBMPT": "Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;", "questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;" diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs index f1bdf216..94985ccc 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs @@ -94,6 +94,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ private readonly INormalEfCoreRepository _vmiBalanceSumRepository; private readonly INormalEfCoreRepository _balanceSumRepository; + private readonly INormalEfCoreRepository _recRepository; + private readonly IBlobContainer _fileContainer; private readonly IHubContext _hubContext; private readonly ICurrentUser _currentUser; @@ -111,6 +113,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ INormalEfCoreRepository codeRepository, INormalEfCoreRepository vmiBalanceSumDetailRepository, INormalEfCoreRepository balanceSumRepository, + INormalEfCoreRepository recRepository, IBlobContainer fileContainer, Volo.Abp.ObjectMapping.IObjectMapper maper, IHubContext hubContext, @@ -123,6 +126,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ ) { + _recRepository = recRepository; _balanceSumRepository = balanceSumRepository; _vmiBalanceSumRepository = vmiBalanceSumRepository; _vmiBalanceSumDetailRepository = vmiBalanceSumDetailRepository; @@ -1717,6 +1721,23 @@ namespace Win.Sfs.SettleAccount.Entities.BQ connection.Close(); return ls; } + + + + + [HttpPost] + public async Task> GetSHIP_REC_SUMListAsync(RequestDto input) + { + return await _recRepository.ToListAsync().ConfigureAwait(false); + //var entities = await _recRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); + //var totalCount = await _recRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); + ////var dtos = ObjectMapper.Map, List>(entities); + //return new PagedResultDto(totalCount, entities); + } + + + + /// /// jisbbac收发汇总 /// @@ -1731,9 +1752,24 @@ namespace Win.Sfs.SettleAccount.Entities.BQ public async Task GetReceiveShipSum(RequestDto input) { - ConcurrentBag bagList = new ConcurrentBag(); - // ConcurrentBag bagList = new ConcurrentBag(); + var sebegin= input.Filters.Any(p => p.Column == "sebegin")? input.Filters.FirstOrDefault(p => p.Column == "sebegin").Value : ""; + var seend = input.Filters.Any(p => p.Column == "seend")? input.Filters.FirstOrDefault(p => p.Column == "seend").Value : ""; + var sabegin = input.Filters.Any(p => p.Column == "sabegin")? input.Filters.FirstOrDefault(p => p.Column == "sabegin").Value : ""; + var saend = input.Filters.Any(p => p.Column == "saend")? input.Filters.FirstOrDefault(p => p.Column == "saend").Value : ""; + var parcode = input.Filters.Any(p => p.Column == "partcode")? input.Filters.FirstOrDefault(p => p.Column == "partcode").Value : ""; + + List list = new List(); + list.Add(EnumBusinessType.JisBBAC); + list.Add(EnumBusinessType.JisHBPO); + list.Add(EnumBusinessType.MaiDanJianHBPO); + list.Add(EnumBusinessType.MaiDanJianBBAC); + list.Add(EnumBusinessType.BeiJian); + list.Add(EnumBusinessType.ZhiGongJianHBPO); + list.Add(EnumBusinessType.ZhiGongJianBBAC); + list.Add(EnumBusinessType.YinDuJian); + + ConcurrentBag bagList = new ConcurrentBag(); Parallel.ForEach(list, async chunk => { @@ -1743,23 +1779,35 @@ namespace Win.Sfs.SettleAccount.Entities.BQ bagList.Add(itm); } }); - var entities=bagList.ToList(); - - // IExporter _csv = new CsvExporter(); - // IExporter _excel = new ExcelExporter(); - // byte[] result = null; - // result = await _excel.ExportAsByteArray(entities).ConfigureAwait(false); - // result.ShouldNotBeNull(); - // string _fileName = $"收发存汇总{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"; - // //保存导出文件到服务器存成二进制 - // await _excelImportService.SaveBlobAsync( - // new SaveExcelImportInputDto - // { - // Name = _fileName, - // Content = result - // } - // ).ConfigureAwait(false); - // return _fileName; + + var entities = bagList.ToList(); + await _recRepository.BatchDeleteAsync().ConfigureAwait(false); + foreach (var entity in entities) + { + entity.SetId(Guid.NewGuid()); + entity.CreationTime = DateTime.Now; + } + + await _recRepository.DbContext.BulkInsertAsync(entities).ConfigureAwait(false); + + + + + IExporter _csv = new CsvExporter(); + IExporter _excel = new ExcelExporter(); + byte[] result = null; + result = await _excel.ExportAsByteArray(entities).ConfigureAwait(false); + result.ShouldNotBeNull(); + string _fileName = $"收发存汇总{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"; + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ).ConfigureAwait(false); + return _fileName; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/SHIP_REC_SUM.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/SHIP_REC_SUM.cs index 3a66a26f..01bde88b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/SHIP_REC_SUM.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/SHIP_REC_SUM.cs @@ -39,6 +39,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ [Display(Name = "已开票数量")] public string INVQty { set; get; } + public void SetId(Guid setId) + { + Id = setId; + } public REC_SHIP_SUM() {