From 8a1493336d6fb7334a4b6a0dc71dbbf4b39b1bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Thu, 23 Nov 2023 14:45:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BQ/Syncs/PendingDeductionService.cs | 8 -- .../Entities/BQ/VmiAppService.cs | 23 +++- .../ReportServices/ReportMakeService.cs | 23 +++- .../SettleAccountApplicationModule.cs | 8 +- .../BalanceSum/BalanceSumDapperRepository.cs | 126 +++++++----------- 5 files changed, 96 insertions(+), 92 deletions(-) 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 03c54076..85e3ea71 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 @@ -44,17 +44,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs var projectList = _dbcontext.Set().Where(p => p.Project == "库位").ToList(); var jisbbac = projectList.FirstOrDefault(p => p.Value == "JisBBAC").Description; var jisbbac_sy = projectList.FirstOrDefault(p => p.Value == "JisBBAC顺义").Description; - - var jism = projectList.FirstOrDefault(p => p.Value == "MaiDanJianBBAC").Description; - var maidanhbpo = projectList.FirstOrDefault(p => p.Value == "MaiDanJianHBPO").Description; - - var jism_sy = projectList.FirstOrDefault(p => p.Value == "MaiDanJianBBAC顺义").Description; - - - var yindujian = projectList.FirstOrDefault(p => p.Value == "YinDuJian").Description; var beijian = projectList.FirstOrDefault(p => p.Value == "BeiJian").Description; if (type == "JisBBAC" || type == "ZhiGongJianBBAC" || type == "MaiDanJianBBAC" || type == "BeiJian" || type == "YinDuJian") 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 f2b0535a..e89144bb 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 @@ -13,6 +13,7 @@ using System.Threading.Tasks; using AutoMapper; using ClosedXML.Excel; using DocumentFormat.OpenXml; +using DocumentFormat.OpenXml.Wordprocessing; using EFCore.BulkExtensions; using LinqToDB.EntityFrameworkCore; using Magicodes.ExporterAndImporter.Core; @@ -33,6 +34,7 @@ using SettleAccount.Domain.BQ; using SettleAccount.Job.SignalR; using Shouldly; using SqlSugar; +using TaskJob.EventArgs; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; @@ -44,7 +46,9 @@ using Volo.Abp.Validation; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; +using Win.Sfs.SettleAccount.Entities.BQ.Syncs; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; +using Win.Sfs.SettleAccount.Entities.TaskJobs; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.Shared; @@ -67,6 +71,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ private readonly IHubContext _hubContext; private readonly ICurrentUser _currentUser; private readonly ILogger _logger; + private readonly TaskJobService _service; protected readonly IExcelImportAppService _excelImportService; public VmiAppService(IConfiguration cfg, IServiceProvider serviceProvider, @@ -74,10 +79,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ INormalEfCoreRepository balanceRepository, INormalEfCoreRepository logRepository, IBlobContainer fileContainer, + IHubContext hubContext, ICurrentUser currentUser, ILogger logger, - IExcelImportAppService excelImportService) + IExcelImportAppService excelImportService, + TaskJobService service + + ) { this._cfg = cfg; this._guidGenerator = guidGenerator; @@ -88,6 +97,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ this._hubContext = hubContext; this._currentUser = currentUser; this._logger = logger; + _service = service; LinqToDBForEFTools.Initialize(); _excelImportService = excelImportService; } @@ -159,6 +169,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } } + + + + + + + + + + + /// /// 1.库存余额查询 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index 0b4386ec..b8edf413 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -10,6 +10,7 @@ using Volo.Abp.Application.Services; using Volo.Abp.Uow; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.SettleAccount.Entities.BQ.Syncs; using Win.Sfs.SettleAccount.Entities.Invoices; using Win.Sfs.SettleAccount.Entities.ItemInvoicePrices; using Win.Sfs.SettleAccount.Entities.MaterialRelationships; @@ -50,18 +51,32 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices } [HttpPost] [DisableRequestSizeLimit] - public async Task GetBalance(string p_year) + /// + /// 1.库存余额查询 + /// + /// + /// + + public async Task GetBalanceSum([FromBody] string p_year) { List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Year", Value = p_year ?? DateTime.Now.Year.ToString() }); - var _taskid = await _service.ExportEnqueueAsync("库存余额汇总", ExportExtentsion.Excel, p_year, string.Empty, CurrentUser, typeof(SharePartUnSettledExport), customConditionList, (rs) => + customConditionList.Add(new CustomCondition() { Name = "Year", Value = p_year ?? DateTime.Now.Year.ToString() }); + + var _taskid = await _service.ExportEnqueueAsync("生成库存余额", ExportExtentsion.Excel, string.Empty, string.Empty, CurrentUser, typeof(BalanceSumService), customConditionList, (rs) => { + + + }).ConfigureAwait(false); + return _taskid; + + + } - + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs index 515c588f..ccf9a575 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs @@ -90,8 +90,14 @@ namespace Win.Sfs.SettleAccount return implementationFactory.GetService(); } + if (key.Equals(typeof(BalanceSumService).FullName)) + { + return implementationFactory.GetService(); + } + + + - else { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs index 7df5de5a..0ace4379 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs @@ -9,125 +9,95 @@ using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Uow; using Win.Sfs.SettleAccount.Entities.BQ.Temp; + namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report { - public class Meta - { - public class SettleInvoiceDiff + + public class BalanceSum { - - [ExporterHeader(DisplayName = "零件号", IsBold = true)] - public string MaterialCode { set; get; } + [ExporterHeader(DisplayName = "年份", IsBold = true)] + public string Year { set; get; } + + [ExporterHeader(DisplayName = "零件号", IsBold = true)] + public string RealPartCode { set; get; } + [ExporterHeader(DisplayName = "零件名称", IsBold = true)] public string MaterialDesc { set; get; } - - [ExporterHeader(DisplayName = "全年发票合计", IsBold = true)] - public string SumInvoice { set; get; } - [ExporterHeader(DisplayName = "全年结算合计", IsBold = true)] - public string SumSettle { set; get; } - [ExporterHeader(DisplayName = "全年合计差异", IsBold = true)] - public string SumDiff { set; get; } - + [ExporterHeader(DisplayName = "通用编码(生产码)", IsBold = true)] + public string VinCode { set; get; } + + [ExporterHeader(DisplayName = "库存余额数量", IsBold = true)] + public string BalanceQty { set; get; } + [ExporterHeader(DisplayName = "有结无发合计", IsBold = true)] + public string SettleQty { set; get; } + [ExporterHeader(DisplayName = "1月发票", IsBold = true)] public string January { set; get; } [ExporterHeader(DisplayName = "1月结算", IsBold = true)] public string SettleJanuary { set; get; } [ExporterHeader(DisplayName = "2月发票", IsBold = true)] - public string InvoiceFebruary { set; get; } + public string February { set; get; } [ExporterHeader(DisplayName = "2月结算", IsBold = true)] public string SettleFebruary { set; get; } - - - - [ExporterHeader(DisplayName = "3月发票", IsBold = true)] - public string InvoiceMarch { set; get; } + public string March { set; get; } [ExporterHeader(DisplayName = "3月结算", IsBold = true)] public string SettleMarch { set; get; } [ExporterHeader(DisplayName = "4月发票", IsBold = true)] - public string InvoiceApril { set; get; } + public string April { set; get; } [ExporterHeader(DisplayName = "4月结算", IsBold = true)] public string SettleApril { set; get; } [ExporterHeader(DisplayName = "5月发票", IsBold = true)] - public string InvoiceMay { set; get; } + public string May { set; get; } [ExporterHeader(DisplayName = "5月结算", IsBold = true)] public string SettleMay { set; get; } [ExporterHeader(DisplayName = "6月发票", IsBold = true)] - public string InvoiceJune { set; get; } + public string June { set; get; } [ExporterHeader(DisplayName = "6月结算", IsBold = true)] public string SettleJune { set; get; } - [ExporterHeader(DisplayName = "7月发票", IsBold = true)] - public string InvoiceJuly { set; get; } - + public string July { set; get; } [ExporterHeader(DisplayName = "7月结算", IsBold = true)] public string SettleJuly { set; get; } - - - [ExporterHeader(DisplayName = "8月发票", IsBold = true)] - public string InvoiceAugust { set; get; } - + public string August { set; get; } [ExporterHeader(DisplayName = "8月结算", IsBold = true)] public string SettleAugust { set; get; } - - - - [ExporterHeader(DisplayName = "9月发票", IsBold = true)] - public string InvoiceSeptember { set; get; } - + public string September { set; get; } [ExporterHeader(DisplayName = "9月结算", IsBold = true)] public string SettleSeptember { set; get; } - - - - [ExporterHeader(DisplayName = "10月发票", IsBold = true)] - public string InvoiceOctober { set; get; } - - - + public string October { set; get; } [ExporterHeader(DisplayName = "10月结算", IsBold = true)] public string SettleOctober { set; get; } - - - - [ExporterHeader(DisplayName = "11月发票", IsBold = true)] - public string InvoiceNovember { set; get; } - - [ExporterHeader(DisplayName = "11月结算", IsBold = true)] - - public string DiffNovember { set; get; } - + public string November { set; get; } + [ExporterHeader(DisplayName = "11月结算", IsBold = true)] + public string SettleNovember { set; get; } [ExporterHeader(DisplayName = "12月发票", IsBold = true)] - public string InvoiceDecember { set; get; } + public string December { set; get; } [ExporterHeader(DisplayName = "12月结算", IsBold = true)] public string SettleDecember { set; get; } - - - - } - } + @@ -145,7 +115,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report /// /// /// - public virtual object GetBalanceSum(string p_year) + public virtual List GetBalanceSum(string p_year) { var sql = "declare @lastyear as varchar(50)\n" + "declare @lastTime as varchar(50)\n" + @@ -328,7 +298,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report "isnull(a.[{0}09],0)+\n" + "isnull(a.[{0}10],0)+\n" + "isnull(a.[{0}11],0)+\n" + - "isnull(a.[{0}12],0) 库存余额数量,\n" + + "isnull(a.[{0}12],0) BalanceQty ,\n" + "isnull(b.[{0}01],0) +\n" + "isnull(b.[{0}02],0) +\n" + "isnull(b.[{0}03],0) +\n" + @@ -340,19 +310,19 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report "isnull(b.[{0}09],0) +\n" + "isnull(b.[{0}10],0) +\n" + "isnull(b.[{0}11],0) +\n" + - "isnull(b.[{0}12],0) 有结无发合计,\n" + - "isnull(a.[{0}01],0) [{0}01],isnull(b.[{0}01],0) [有结无发],\n" + - "isnull(a.[{0}02],0) [{0}02],isnull(b.[{0}02],0) [有结无发],\n" + - "isnull(a.[{0}03],0) [{0}03],isnull(b.[{0}03],0) [有结无发],\n" + - "isnull(a.[{0}04],0) [{0}04],isnull(b.[{0}04],0) [有结无发],\n" + - "isnull(a.[{0}05],0) [{0}05],isnull(b.[{0}05],0) [有结无发],\n" + - "isnull(a.[{0}06],0) [{0}06],isnull(b.[{0}06],0) [有结无发],\n" + - "isnull(a.[{0}07],0) [{0}07],isnull(b.[{0}07],0) [有结无发],\n" + - "isnull(a.[{0}08],0) [{0}08],isnull(b.[{0}08],0) [有结无发],\n" + - "isnull(a.[{0}09],0) [{0}09],isnull(b.[{0}09],0) [有结无发],\n" + - "isnull(a.[{0}10],0) [{0}10],isnull(b.[{0}10],0) [有结无发],\n" + - "isnull(a.[{0}11],0) [{0}11],isnull(b.[{0}11],0) [有结无发],\n" + - "isnull(a.[{0}12],0) [{0}12],isnull(b.[{0}12],0) [有结无发] \n" + + "isnull(b.[{0}12],0) SettleQty,\n" + + "isnull(a.[{0}01],0) January,isnull(b.[{0}01],0) SettleJanuary,\n" + + "isnull(a.[{0}02],0) February,isnull(b.[{0}02],0) SettleFebruary,\n" + + "isnull(a.[{0}03],0) March,isnull(b.[{0}03],0) SettleMarch,\n" + + "isnull(a.[{0}04],0) April,isnull(b.[{0}04],0) SettleApril,\n" + + "isnull(a.[{0}05],0) May,isnull(b.[{0}05],0) SettleMay,\n" + + "isnull(a.[{0}06],0) June,isnull(b.[{0}06],0) SettleJune,\n" + + "isnull(a.[{0}07],0) July,isnull(b.[{0}07],0) SettleJuly,\n" + + "isnull(a.[{0}08],0) August,isnull(b.[{0}08],0) SettleAugust,\n" + + "isnull(a.[{0}09],0) September,isnull(b.[{0}09],0) SettleSeptember,\n" + + "isnull(a.[{0}10],0) October,isnull(b.[{0}10],0) SettleOctober,\n" + + "isnull(a.[{0}11],0) November,isnull(b.[{0}11],0) SettleNovember,\n" + + "isnull(a.[{0}12],0) December,isnull(b.[{0}12],0) SettleDecember \n" + "from #temp_js a full join #temp_bh b on a.ErpToLoc=b.ErpToLoc and a.RealPartCode=b.RealPartCode\n" + "drop table #temp_js\n" + "drop table #temp_bh\n"; @@ -361,10 +331,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report var query = string.Format(sql, p_year); - var list = DbConnection.Query(query,null,null,false,1200,null); + var entities = DbConnection.Query(query,null,null,false,1200,null); - return ""; + return entities.ToList(); }