From 50d57bb725955df24eb4276b5bfabc73450951b0 Mon Sep 17 00:00:00 2001 From: mahao Date: Mon, 11 Sep 2023 08:32:16 +0800 Subject: [PATCH 1/5] up --- .../Entities/BQ/Dtos/PUB_SA_DTO.cs | 5 + .../Entities/Prices/PriceListDtoBase.cs | 73 +++++------ .../Entities/BQ/BBAC_SA_SERVICE.cs | 24 +++- .../Entities/BQ/HBPO_SA_SERVICE.cs | 4 +- .../Entities/BQ/PUB_SA_SERVICE.cs | 30 +++-- .../Entities/Prices/PriceListAppService.cs | 34 ++++- .../Entities/Prices/PriceListAppServiceBJ.cs | 39 ++++-- ...ttleAccountApplicationAutoMapperProfile.cs | 8 +- .../Reports/PubSaSeCompareDiff.cs | 5 + .../Report/PubSaSeCompareExportService.cs | 122 +++++++++++++++++- .../Report/SaSeCompareExportBaseService.cs | 4 +- 11 files changed, 277 insertions(+), 71 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs index 028e8307..25c2909f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs @@ -66,6 +66,11 @@ public class PUB_SAImportRequestDto /// [Display(Name = "期间")] public int Version { get; set; } + /// + /// 地点 + /// + [Display(Name = "地点")] + public string Site { get; set; } } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs index ed086fb5..d7691e36 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs @@ -65,42 +65,36 @@ public class PriceListExportDto [Display(Name = "零件号")] [ExporterHeader(DisplayName = "客户零件号")] public string LU { get; set; } - /// /// 价格 /// [Display(Name = "价格")] [ExporterHeader(DisplayName = "价格")] public Decimal Price { set; get; } - /// /// 开始时间 /// [Display(Name = "开始时间")] [ExporterHeader(DisplayName = "开始时间")] public DateTime BeginTime { set; get; } - /// /// 结束时间 /// [Display(Name = "结束时间")] [ExporterHeader(DisplayName = "结束时间")] public DateTime EndTime { set; get; } - /// /// 客户编码 /// [Display(Name = "客户编码")] [ExporterHeader(DisplayName = "客户编码")] public string ClientCode { get; set; } - /// /// 合同签订时间 /// [Display(Name = "合同签订时间")] [ExporterHeader(DisplayName = "合同签订时间")] public DateTime Date { get; set; } - /// /// 合同号 /// @@ -112,8 +106,7 @@ public class PriceListExportDto /// /// 销售价格导入 /// -[ImportProject(Name = SettleAccountModuleName.PriceList)] -[Importer(HeaderRowIndex = 21)] +[Importer(HeaderRowIndex = 22)] public class PriceListImportDto { /// @@ -138,7 +131,7 @@ public class PriceListImportDto /// /// 价格 /// - [ImporterHeader(Name = "Total Price (Old)")] + [ImporterHeader(Name = "Total Price")] public decimal TotalPrice { get; set; } /// /// 开始时间 @@ -297,56 +290,58 @@ public class PriceListBJExportDto /// /// 客户备件价格导入 /// +[Importer(HeaderRowIndex = 22)] public class PriceListBJImportDto { /// - /// 客户零件号 + /// 合同签订时间 /// - [Display(Name = "客户零件号")] - [ImporterHeader(Name = "客户零件号")] - public string LU { get; set; } - + [ImporterHeader(IsIgnore = true)] + [ExcelImporterHeadDesc(Row = 1, Cell = 1)] + public string Date { get; set; } + /// + /// 合同号 + /// + [ImporterHeader(IsIgnore = true)] + [ExcelImporterHeadDesc(Row = 2, Cell = 1)] + public string ContractNo { get; set; } + /// + /// 零件号 + /// + [Display(Name = "零件号")] + [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "Part No.")] + public string PartNo { get; set; } /// /// 价格 /// - [Display(Name = "价格")] - [ImporterHeader(Name = "价格")] - public decimal Price { get; set; } - + [ImporterHeader(Name = "Total Price")] + public decimal TotalPrice { get; set; } /// /// 开始时间 /// - [Display(Name = "开始时间")] - [ImporterHeader(Name = "开始时间")] - public DateTime BeginDate { set; get; } - + [ImporterHeader(Name = "Valid From")] + public DateTime ValidFrom { get; set; } /// /// 结束时间 /// - [Display(Name = "结束时间")] - [ImporterHeader(Name = "结束时间")] - public DateTime EndDate { set; get; } - + [ImporterHeader(Name = "Valid To")] + public DateTime ValidTo { get; set; } /// /// 客户编码 /// - [Display(Name = "客户编码")] - [ImporterHeader(Name = "客户编码")] - public string ClientCode { get; set; } - + [ImporterHeader(Name = "Plant")] + public string Plant { get; set; } /// - /// 合同签订时间 + /// ES1 /// - [Display(Name = "合同签订时间")] - [ImporterHeader(Name = "合同签订时间")] - public DateTime Date { get; set; } - + [ImporterHeader(Name = "ES1")] + public string ES1 { get; set; } /// - /// 合同号 + /// ES2 /// - [Display(Name = "合同号")] - [ImporterHeader(Name = "合同号")] - public string ContractNo { get; set; } + [ImporterHeader(Name = "ES2")] + public string ES2 { get; set; } } public class PriceListBJRequestDto : RequestInputBase diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs index 76239a8b..97e06950 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs @@ -31,6 +31,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ; [Route("api/settleaccount/[controller]/[action]")] public class BBAC_SA_SERVICE : SettleAccountApplicationBase { + /// + /// DbContext + /// + private readonly SettleAccountDbContext _settleAccountDbContext; /// /// BBAC结算仓储 /// @@ -79,7 +83,8 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase /// /// 构造 /// - public BBAC_SA_SERVICE(INormalEfCoreRepository bbacSaRepository, + public BBAC_SA_SERVICE(SettleAccountDbContext settleAccountDbContext, + INormalEfCoreRepository bbacSaRepository, INormalEfCoreRepository bbacSaDetailRepository, INormalEfCoreRepository bbacCanSaRepository, INormalEfCoreRepository bbacCanSaDetailRepository, @@ -93,6 +98,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase ICommonManager commonManager ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) { + _settleAccountDbContext = settleAccountDbContext; _bbacSaRepository = bbacSaRepository; _bbacSaDetailRepository = bbacSaDetailRepository; _bbacCanSaRepository = bbacCanSaRepository; @@ -400,7 +406,8 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase //导入的零件号集合 var importPubSaLUs = bbacSaDetails.Select(t => t.LU).Distinct(); //销售价格 - var priceListEntitys = _priceListRepository.Where(t => t.IsCancel == false).Where(t => importPubSaLUs.Contains(t.LU)).ToList(); + + var priceListEntitys = GetPriceListEntitys(importPubSaLUs); var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false); bbacSaDetails.ForEach(bbacSaDetail => { @@ -507,5 +514,18 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase return (bbacSas, bbacSaDetails, bbacCanSas, bbacCanSaDetails, bbacNotSaDetails); } + + /// + /// 获取价格 + /// + private List GetPriceListEntitys(IEnumerable importSaLus) + { + var clientCode = Site; + return _settleAccountDbContext.Set() + .Where(t => t.IsCancel == false) + .Where(t => t.ClientCode == clientCode) + .Where(t => importSaLus.Contains(t.LU)) + .ToList(); + } #endregion } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs index 186c333f..3a5e00c1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs @@ -370,7 +370,9 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase //导入的零件号集合 var importPubSaLUs = hbpoSaDetails.Select(t => t.LU).Distinct(); //销售价格 - var priceListEntitys = _priceListRepository.Where(t => t.IsCancel == false).Where(t => importPubSaLUs.Contains(t.LU)).ToList(); + var priceListEntitys = _priceListRepository.Where(t => t.IsCancel == false) + .Where(t => t.ClientCode == "104T") + .Where(t => importPubSaLUs.Contains(t.LU)).ToList(); var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false); hbpoSaDetails.ForEach(hbpoSaDetail => { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs index 17361fa7..baaa6015 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs @@ -39,42 +39,34 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase /// PUB结算仓储 /// private readonly INormalEfCoreRepository _repository; - /// /// PUB结算明细仓储 /// private readonly INormalEfCoreRepository _pubSaDetailRepository; - /// /// PUB可结算仓储 /// private readonly INormalEfCoreRepository _pubCanSaRepository; - /// /// PUB可结算明细仓储 /// private readonly INormalEfCoreRepository _pubCanSaDetailRepository; - /// /// PUB不可结算明细仓储 /// private readonly INormalEfCoreRepository _pubNotSaDetailRepository; - /// /// 销售价格仓储 /// private readonly INormalEfCoreRepository _priceListRepository; - /// /// 备件价格仓储 /// private readonly INormalEfCoreRepository _priceBjListRepository; - /// /// 客户零件关系仓储 /// private readonly INormalEfCoreRepository _materialRelationshipRepository; - /// /// 替换件关系仓储 /// @@ -113,6 +105,14 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase /// 期间 /// private int _version; + /// + /// 业务类别 + /// + private EnumBusinessType businessType; + /// + /// 地点 + /// + private string site; #region 导入、导出 /// @@ -123,6 +123,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase { IActionResult result = new JsonResult(new { Code = 400 }); _version = pubSaImportRequestDto.Version; + businessType = pubSaImportRequestDto.BusinessType; + site = pubSaImportRequestDto.Site; switch (pubSaImportRequestDto.BusinessType) { case EnumBusinessType.ZhiGongJianBBAC: @@ -440,10 +442,21 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase importPubSaDetail.BusinessType = businessType; }); var lus = pubSaDetails.Select(t => t.LU).Distinct().ToList(); + + var clientCode = businessType switch + { + EnumBusinessType.ZhiGongJianBBAC => site, + EnumBusinessType.ZhiGongJianHBPO => "104T", + EnumBusinessType.BeiJian => "1040", + EnumBusinessType.YinDuJian => "1040", + _ => throw new UserFriendlyException($"业务编码错误", "400") + }; + if (businessType == EnumBusinessType.BeiJian) { //备件销售价格 var priceListEntitys = _priceBjListRepository.Where(t => t.IsCancel == false) + .Where(t => t.ClientCode == clientCode) .Where(t => lus.Contains(t.LU)).ToList(); pubSaDetails.ForEach(importPubSaDetail => { @@ -461,6 +474,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase { //销售价格 var priceListEntitys = _priceListRepository.Where(t => t.IsCancel == false) + .Where(t => t.ClientCode == clientCode) .Where(t => lus.Contains(t.LU)).ToList(); pubSaDetails.ForEach(importPubSaDetail => { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index 5f80eb94..238be6be 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -14,6 +14,7 @@ using Volo.Abp.Caching; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; @@ -29,7 +30,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices; public class PriceListAppService : SettleAccountApplicationBase { /// - /// 数据上下文 + /// DbContext /// private readonly SettleAccountDbContext _settleAccountDbContext; /// @@ -78,8 +79,29 @@ public class PriceListAppService : SettleAccountApplicationBase }; result = result.FindAll(p => filter.Contains(p.Plant)).ToList(); result.FindAll(t => !string.IsNullOrEmpty(t.ES1) || !string.IsNullOrEmpty(t.ES2)).ForEach(t => t.PartNo = t.PartNo + new string(' ', 6) + t.ES1 + t.ES2); - var entityList = ObjectMapper.Map, List>(result); - var newPrice = entityList.GroupBy(p => p.LU).Select(p => p.FirstOrDefault()).ToList(); + var newPrice = ObjectMapper.Map, List>(result); + newPrice = newPrice.GroupBy(p => new { p.LU, p.ClientCode, p.BeginTime, p.EndTime }).Select(p => p.FirstOrDefault()).ToList(); + + #region 校验 + if (newPrice.Any()) + { + var query = from item1 in newPrice + join item2 in newPrice + on new { item1.LU, item1.ClientCode } equals new { item2.LU, item2.ClientCode } + where (item1.BeginTime > item2.BeginTime && item1.EndTime < item2.EndTime) || (item2.BeginTime > item1.BeginTime && item2.EndTime < item1.EndTime) || (item1.BeginTime == item2.BeginTime && item1.EndTime != item2.EndTime) || (item1.BeginTime != item2.BeginTime && item1.EndTime == item2.EndTime) + select item1.LU; + var repeat = query.Distinct().ToList(); + foreach (var item in repeat) + { + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty)); + } + } + if (checkList.Count > 0) + { + var fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); + return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName }); + } + #endregion var importLus = newPrice.Select(t => t.LU).Distinct().ToList(); var oldPrices = _settleAccountDbContext.Set() @@ -87,14 +109,14 @@ public class PriceListAppService : SettleAccountApplicationBase .Where(t => importLus.Contains(t.LU)) .ToList(); //系统中合同日期比导入文件中的合同日期晚 - var oldpriceNewDate = from oldprice in oldPrices + var oldPriceNewDate = from oldprice in oldPrices from newprice in newPrice where oldprice.LU == newprice.LU && oldprice.Date > newprice.Date select oldprice; oldPrices.ForEach(t => t.IsCancel = true); - if (oldpriceNewDate.Any()) + if (oldPriceNewDate.Any()) { - oldPrices.FindAll(t => oldpriceNewDate.Contains(t)).ForEach(t => t.IsCancel = false); + oldPrices.FindAll(t => oldPriceNewDate.Contains(t)).ForEach(t => t.IsCancel = false); var importCancelLus = oldPrices.Select(t => t.LU).Distinct(); newPrice.FindAll(t => importCancelLus.Contains(t.LU)).ForEach(t => t.IsCancel = true); } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index 0d733857..408ce3bc 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -12,6 +12,7 @@ using Volo.Abp.Caching; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; @@ -57,13 +58,33 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase var result = await _exportImporter.UploadExcelImportByHeadDesc(files, _excelImportService).ConfigureAwait(false); var filter = new List { - "1040", - "1046", - "104T" + "1040" }; - result = result.Where(p => filter.Contains(p.ClientCode)).ToList(); - var entityList = ObjectMapper.Map, List>(result); - var newPrice = entityList.GroupBy(p => p.LU).Select(p => p.FirstOrDefault()).ToList(); + result = result.Where(p => filter.Contains(p.Plant)).ToList(); + result.FindAll(t => !string.IsNullOrEmpty(t.ES1) || !string.IsNullOrEmpty(t.ES2)).ForEach(t => t.PartNo = t.PartNo + new string(' ', 6) + t.ES1 + t.ES2); + var newPrice = ObjectMapper.Map, List>(result); + newPrice = newPrice.GroupBy(p => new { p.LU, p.BeginDate, p.EndDate }).Select(p => p.FirstOrDefault()).ToList(); + + #region 校验 + if (newPrice.Any()) + { + var query = from item1 in newPrice + join item2 in newPrice + on item1.LU equals item2.LU + where (item1.BeginDate > item2.BeginDate && item1.EndDate < item2.EndDate) || (item2.BeginDate > item1.BeginDate && item2.EndDate < item1.EndDate) || (item1.BeginDate == item2.BeginDate && item1.EndDate != item2.EndDate) || (item1.BeginDate != item2.BeginDate && item1.EndDate == item2.EndDate) + select item1.LU; + var repeat = query.Distinct().ToList(); + foreach (var item in repeat) + { + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty)); + } + } + if (checkList.Count > 0) + { + var fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); + return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName }); + } + #endregion var importLus = newPrice.Select(t => t.LU).Distinct().ToList(); var oldPrices = _settleAccountDbContext.Set() @@ -71,14 +92,14 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase .Where(t => importLus.Contains(t.LU)) .ToList(); //系统中合同日期比导入文件中的合同日期晚 - var oldpriceNewDate = from oldprice in oldPrices + var oldPriceNewDate = from oldprice in oldPrices from newprice in newPrice where oldprice.LU == newprice.LU && oldprice.Date > newprice.Date select oldprice; oldPrices.ForEach(t => t.IsCancel = true); - if (oldpriceNewDate.Any()) + if (oldPriceNewDate.Any()) { - oldPrices.FindAll(t => oldpriceNewDate.Contains(t)).ForEach(t => t.IsCancel = false); + oldPrices.FindAll(t => oldPriceNewDate.Contains(t)).ForEach(t => t.IsCancel = false); var importCancelLus = oldPrices.Select(t => t.LU).Distinct(); newPrice.FindAll(t => importCancelLus.Contains(t.LU)).ForEach(t => t.IsCancel = true); } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index ceb8bda0..3b24f6a3 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -577,7 +577,13 @@ namespace Win.Sfs.SettleAccount /// private void CreateMapPriceListBJ() { - CreateMap(); + CreateMap() + .ForMember(x => x.LU, y => y.MapFrom(y => y.PartNo)) + .ForMember(x => x.Price, y => y.MapFrom(y => y.TotalPrice)) + .ForMember(x => x.BeginDate, y => y.MapFrom(y => y.ValidFrom)) + .ForMember(x => x.EndDate, y => y.MapFrom(y => y.ValidTo)) + .ForMember(x => x.ClientCode, y => y.MapFrom(y => y.Plant)) + .ForMember(x => x.Date, y => y.MapFrom(y => DateTime.ParseExact(y.Date, "dd.MM.yyyy", System.Globalization.CultureInfo.CurrentCulture))); ; CreateMap().ReverseMap(); CreateMap().ReverseMap(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs index ff8f2efb..73ca86fc 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs @@ -11,6 +11,11 @@ namespace Win.Sfs.SettleAccount.Reports; /// public class PubSaSeCompareDiff { + /// + /// 期间 + /// + [Display(Name = "期间")] + public int Version { get; set; } /// /// Wms发货单号 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs index dcac44aa..381ef95c 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs @@ -1,12 +1,14 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.Drawing; using System.Linq; using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.SignalR; using Microsoft.OpenApi.Extensions; using SettleAccount.Domain.BQ; using SettleAccount.Job.SignalR; +using ShardingCore.Extensions; using Shouldly; using TaskJob.EventArgs; using TaskJob.Interfaces; @@ -178,7 +180,8 @@ namespace SettleAccount.Job.Services.Report /// /// 获取比对数据 /// - public List GetSaSeCompareData(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime) + [Obsolete] + private List GetSaSeCompareData(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime) { //印度件LU对比 if (businessType == EnumBusinessType.YinDuJian) @@ -264,7 +267,122 @@ namespace SettleAccount.Job.Services.Report /// /// 获取比对数据 /// - public List GetSaSeCompareDataYinDu(int version, DateTime seStartDateTime, DateTime seEndDateTime) + private List GetSaSeCompareDataOld(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime) + { + //印度件LU对比 + if (businessType == EnumBusinessType.YinDuJian) + { + return GetSaSeCompareDataYinDu(version, seStartDateTime, seEndDateTime); + } + //结算 + var saGroup = from sa in _settleAccountDbContext.Set() + where sa.BusinessType == businessType + group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.CustomerPartCodeNoSpace, + Id = groupItem.Max(t => t.Id), + Qty = groupItem.Sum(t => t.Qty), + Version = groupItem.Max(t => t.Version), + LU = groupItem.Max(t => t.LU), + SettleDate = groupItem.Max(t => t.SettleDate), + PartCode = groupItem.Max(t => t.PartCode), + }; + var saGroupByVersion = from sa in _settleAccountDbContext.Set() + where sa.BusinessType == businessType && sa.Version == version + group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.CustomerPartCodeNoSpace, + Qty = groupItem.Sum(t => t.Qty), + Version = groupItem.Max(t => t.Version), + LU = groupItem.Max(t => t.LU), + SettleDate = groupItem.Max(t => t.SettleDate), + PartCode = groupItem.Max(t => t.PartCode), + }; + //发运 + var seGroup = from se in _settleAccountDbContext.Set() + group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.CustomerPartCodeNoSpace, + Qty = groupItem.Sum(t => t.Qty), + LU = groupItem.Max(t => t.LU), + WmsBillNum = groupItem.Max(t => t.WmsBillNum), + ShippingDate = groupItem.Max(t => t.ShippingDate), + FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), + ToLocCode = groupItem.Max(t => t.ToLocCode), + ToErpLocCode = groupItem.Max(t => t.ToErpLocCode) + }; + + //有结算无发运 + var haveSaNotHaveSeList = (from sa in saGroup + join se in seGroup + on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace } + into temp + from se in temp.DefaultIfEmpty() + where se.PN == null + select new PubSaSeCompareDiff() + { + Version = sa.Version, + CustomerOfflineTime = sa.SettleDate, + PN = sa.PN, + SAQty = sa.Qty, + SaCustomerPartCode = sa.CustomerPartCodeNoSpace, + SaFactoryPartCode = sa.PartCode, + CustomerPartCode = sa.LU + }).ToList(); + //无结算有发运 + var notHaveSaHaveSeList = (from se in seGroup + join sa in saGroup + on new { se.PN, se.CustomerPartCodeNoSpace } equals new { sa.PN, sa.CustomerPartCodeNoSpace } + into temp + from sa in temp.DefaultIfEmpty() + where sa.PN == null + select new PubSaSeCompareDiff() + { + WmsBillNum = se.WmsBillNum, + ShippingDate = se.ShippingDate, + PN = se.PN, + SEQty = se.Qty, + ToLocCode = se.ToLocCode, + ToErpLocCode = se.ToErpLocCode, + SeCustomerPartCode = se.CustomerPartCodeNoSpace, + SeFactoryPartCode = se.FactoryPartCode, + CustomerPartCode = se.LU + }).ToList(); + + //有结算有发运 + var haveSaHaveSeList = (from sa in saGroupByVersion + from se in seGroup + where sa.PN == se.PN && sa.CustomerPartCodeNoSpace == se.CustomerPartCodeNoSpace + select new PubSaSeCompareDiff() + { + Version = sa.Version, + WmsBillNum = se.WmsBillNum, + ShippingDate = se.ShippingDate, + CustomerOfflineTime = sa.SettleDate, + PN = sa.PN, + SAQty = sa.Qty, + SEQty = se.Qty, + ToLocCode = se.ToLocCode, + ToErpLocCode = se.ToErpLocCode, + SeCustomerPartCode = se.CustomerPartCodeNoSpace, + SeFactoryPartCode = se.FactoryPartCode, + SaCustomerPartCode = sa.CustomerPartCodeNoSpace, + SaFactoryPartCode = sa.PartCode, + CustomerPartCode = sa.LU + }).ToList(); + return haveSaHaveSeList.Union(haveSaHaveSeList).Union(notHaveSaHaveSeList).ToList(); + } + + /// + /// 获取比对数据 + /// + private List GetSaSeCompareDataYinDu(int version, DateTime seStartDateTime, DateTime seEndDateTime) { var saGroup = from sa in _settleAccountDbContext.Set() where sa.BusinessType == EnumBusinessType.YinDuJian && sa.Version == version diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs index fb9fd5a2..6af50bd3 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs @@ -198,12 +198,10 @@ namespace SettleAccount.Job.Services.Report < 0 => EnumMappingType.None, _ => default, }; - o.ExtraProperties.Add("MappingType", mappingType); + o.MappingType = mappingType; return o; }).ToList(); _settleAccountDbContext.BulkUpdate(saDetailsUpdate); - _settleAccountDbContext.Set().FromSqlInterpolated($"SELECT * FROM dbo.Blogs"); - _settleAccountDbContext.Database.ExecuteSqlInterpolated($"SELECT * FROM dbo.Blogs"); } } } From 310c00ea27487c1cd04ed04609de805ad98ab040 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Mon, 11 Sep 2023 10:39:01 +0800 Subject: [PATCH 2/5] update --- .../wwwroot/views/settle/_check.js | 20 +++++++++++-------- .../wwwroot/views/settle/commerce.js | 8 ++++++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js index cec0888d..8e7b6dd6 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js @@ -11,7 +11,7 @@ import businessTypes from "../../models/_options.js"; export default { components: { AppForm, AppTable }, - template: html` + template: html` @@ -54,7 +54,7 @@ export default { - + @@ -121,7 +121,7 @@ export default { @@ -137,7 +137,7 @@ export default { - + @@ -193,7 +193,7 @@ export default { } `, props: ["modelValue", "row", "data", "isBusiness", "businessType"], - emit: ["update:modelValue"], + emit: ["update:modelValue", "complete"], setup(props, context) { const show = ref(props.modelValue); watch(show, (value) => context.emit("update:modelValue", value)); @@ -266,13 +266,13 @@ export default { }, }; - const columns22 = Object.assign({}, columns2); + const columns22 = JSON.parse(JSON.stringify(columns2)); columns22.properties.extend1 = { type: "number", title: "SA号", }; - const columns23 = Object.assign({}, columns2); + const columns23 = JSON.parse(JSON.stringify(columns2)); columns23.properties.extend1 = { type: "number", title: "凭证号", @@ -631,7 +631,7 @@ export default { } else if (result.data?.code === 400 && result.data.fileName) { window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); } - } else { + } else if (setupRef.value === 4) { setupDialogVisable.value = false; refreshRef.value = false; nextTick(() => { @@ -639,6 +639,9 @@ export default { }); } }; + const drawerClosed = () => { + context.emit("complete"); + }; // onMounted(async () => { loading.value = true; @@ -694,6 +697,7 @@ export default { refreshRef, setup3Model, businessTypes, + drawerClosed, }; }, }; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js index 298a2d65..e9681655 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js @@ -9,7 +9,7 @@ import AppCheck from "./_check.js"; export default { components: { AppList, AppCheck }, template: html` - `, + `, setup() { const appListRef = ref(null); const visable = ref(false); @@ -57,6 +57,10 @@ export default { } console.log(item.path, item, rows); }; - return { appListRef, config, onCommand, visable, row, data, businessType }; + const complete = async () => { + visable.value = false; + await appListRef.value.reload(); + }; + return { appListRef, config, onCommand, visable, row, data, businessType, complete }; }, }; From 838d1aea1225d93e57d61153c2367b4a71ca2105 Mon Sep 17 00:00:00 2001 From: mahao Date: Mon, 11 Sep 2023 11:29:20 +0800 Subject: [PATCH 3/5] up --- .../Entities/BQ/PUB_SE_DETAIL_SERVICE.cs | 6 +- .../Entities/Prices/PriceListAppService.cs | 28 + .../Entities/Prices/PriceListAppServiceBJ.cs | 28 + .../Consts/AppConst.cs | 4 + .../Enums/EnumMappingType.cs | 7 +- .../Reports/PubSaSeCompareDiff.cs | 829 ------------------ .../Reports/SaSeCompareDetailReport.cs | 116 +++ .../Reports/SaSeCompareDetailReportBeiJian.cs | 19 + .../SaSeCompareDetailReportMaiDanJianBBAC.cs | 19 + .../SaSeCompareDetailReportMaiDanJianHBPO.cs | 19 + .../SaSeCompareDetailReportYinDuJian.cs | 19 + .../SaSeCompareDetailReportZhiGongJianBBAC.cs | 19 + .../SaSeCompareDetailReportZhiGongJianHBPO.cs | 19 + .../Reports/SaSeCompareDiff.cs | 153 ++++ .../Reports/SaSeCompareSumReport.cs | 46 + .../Reports/SaSeEdiCompareDiff.cs | 26 - ...Report.cs => SeEidCompareReportJisBBAC.cs} | 2 +- ...Report.cs => SeEidCompareReportJisHBPO.cs} | 2 +- .../Report/PubSaSeCompareDapperRepository.cs | 4 +- .../JisBBACSaSeEdiCompareExportService.cs | 13 +- .../JisBBACSeEdiCompareExportService.cs | 2 +- .../JisHBPOSaSeEdiCompareExportService.cs | 13 +- .../JisHBPOSeEdiCompareExportService.cs | 2 +- .../MaiDanBBACSaSeCompareExportService.cs | 14 +- .../MaiDanHBPOSaSeCompareExportService.cs | 14 +- .../Report/PubSaSeCompareExportService.cs | 46 +- .../Report/SaSeCompareExportBaseService.cs | 28 +- .../SettleAccountJobAutoMapperProfile.cs | 14 +- 28 files changed, 567 insertions(+), 944 deletions(-) delete mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReport.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportBeiJian.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportMaiDanJianBBAC.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportMaiDanJianHBPO.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportYinDuJian.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportZhiGongJianBBAC.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportZhiGongJianHBPO.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDiff.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareSumReport.cs rename code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/{JisBBACSeEidCompareReport.cs => SeEidCompareReportJisBBAC.cs} (77%) rename code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/{JisHBPOSeEidCompareReport.cs => SeEidCompareReportJisHBPO.cs} (77%) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs index c73388c1..da8c89b1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs @@ -90,11 +90,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ public async Task TextExportAsync() { var fileName = $"发运数据_{Guid.NewGuid()}.xlsx"; - var haveEdiHaveSeList = new List(); + var haveEdiHaveSeList = new List(); for (int i = 0; i < 2_000_000; i++) { - haveEdiHaveSeList.Add(new JisBBACSeEidCompareReport() + haveEdiHaveSeList.Add(new SeEidCompareReportJisBBAC() { Category = "JIS", WmsBillNum = i.ToString(), @@ -119,7 +119,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ }); } - var jisBBACEidSeCompareEexcelExporterAttribute = typeof(JisBBACSeEidCompareReport).GetAttribute(); + var jisBBACEidSeCompareEexcelExporterAttribute = typeof(SeEidCompareReportJisBBAC).GetAttribute(); var jisBBACEidSeCompareEexcelMaxRowNumberOnASheet = 9_000_000; if (jisBBACEidSeCompareEexcelExporterAttribute != null) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index 238be6be..b6b67cda 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -95,6 +95,11 @@ public class PriceListAppService : SettleAccountApplicationBase { checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty)); } + + foreach (var item in CheckPriceListContinuity(newPrice)) + { + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},时间区间【{item.BeginTime}至{item.EndTime}】不连续", string.Empty)); + } } if (checkList.Count > 0) { @@ -139,6 +144,29 @@ public class PriceListAppService : SettleAccountApplicationBase return new JsonResult(new { Code = 200, Message = "导入成功" }); } + /// + /// 价格表时间是否连续 + /// + private List CheckPriceListContinuity(List priceList) + { + var pricelist = new List(); + if (priceList.Count <= 1) + { + return priceList; // 只有一个或零个价格条目 + } + + var sortedList = priceList.OrderBy(t => t.LU).ThenBy(t => t.BeginTime).ToList(); + for (var i = 1; i < sortedList.Count; i++) + { + if (sortedList[i].LU == sortedList[i - 1].LU && sortedList[i].BeginTime != sortedList[i - 1].EndTime.AddDays(1)) + { + priceList.Add(sortedList[i]); + } + } + + return priceList; // 所有价格时间都连续 + } + /// /// 导出 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index 408ce3bc..1b65a9d7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -78,6 +78,11 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase { checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty)); } + + foreach (var item in CheckPriceListContinuity(newPrice)) + { + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},时间区间【{item.BeginDate}至{item.EndDate}】不连续", string.Empty)); + } } if (checkList.Count > 0) { @@ -123,6 +128,29 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase } + /// + /// 价格表时间是否连续 + /// + private List CheckPriceListContinuity(List priceList) + { + var pricelist = new List(); + if (priceList.Count <= 1) + { + return priceList; // 只有一个或零个价格条目 + } + + var sortedList = priceList.OrderBy(t => t.LU).ThenBy(t => t.BeginDate).ToList(); + for (var i = 1; i < sortedList.Count; i++) + { + if (sortedList[i].LU == sortedList[i - 1].LU && sortedList[i].BeginDate != sortedList[i - 1].EndDate.AddDays(1)) + { + priceList.Add(sortedList[i]); + } + } + + return priceList; // 所有价格时间都连续 + } + /// /// 导出 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Consts/AppConst.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Consts/AppConst.cs index 0f35ea25..e28fafae 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Consts/AppConst.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Consts/AppConst.cs @@ -9,4 +9,8 @@ public static class AppConst /// 单页Sheet默认行数 /// public const int DefaultRowNumberOnASheet = 500_000; + /// + /// Db最大获取数量 + /// + public const int DefaultPageSizeOnDb = 10_000; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Enums/EnumMappingType.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Enums/EnumMappingType.cs index 4a3e7adc..46309f62 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Enums/EnumMappingType.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Enums/EnumMappingType.cs @@ -16,5 +16,10 @@ public enum EnumMappingType /// 完全匹配 /// [Display(Name = "完全匹配")] - PerfectMatch = 1 + PerfectMatch = 1, + /// + /// 部分匹配 + /// + [Display(Name = "部分匹配")] + PartialMatch = 2 } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs deleted file mode 100644 index 73ca86fc..00000000 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs +++ /dev/null @@ -1,829 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using Magicodes.ExporterAndImporter.Core; -using Magicodes.ExporterAndImporter.Excel; -using Win.Sfs.SettleAccount.Enums; - -namespace Win.Sfs.SettleAccount.Reports; - -/// -/// PUB结算与发运对比 -/// -public class PubSaSeCompareDiff -{ - /// - /// 期间 - /// - [Display(Name = "期间")] - public int Version { get; set; } - /// - /// Wms发货单号 - /// - [Display(Name = "Wms发货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - public DateTime? ShippingDate { get; set; } - /// - /// 日顺序号 - /// - [Display(Name = "日顺序号")] - public string SeqNumber { get; set; } - /// - /// PJIS日顺序号 - /// - [Display(Name = "PJIS日顺序号")] - public string PJISSeqNumber { get; set; } - /// - /// 结算数据中的过账日期 - /// - [Display(Name = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - public decimal? SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - public decimal? SEQty { get; set; } - /// - /// 生产号 - /// - [Display(Name = "生产号")] - public string PN { set; get; } - /// - /// 客户物料号 - /// - [Display(Name = "客户物料号")] - public string LU { set; get; } - /// - /// WMS目标库位 - /// - [Display(Name = "WMS目标库位")] - public string ToLocCode { get; set; } - /// - /// ERP目标库位 - /// - [Display(Name = "ERP目标库位")] - public string ToErpLocCode { get; set; } - /// - /// 类型 - /// - [Display(Name = "类型")] - public EnumPubSaSeCompareCategory Category { get; set; } - /// - /// 发运客户物料号 - /// - public string SeCustomerPartCode { get; set; } - /// - /// 发运厂内物料号 - /// - public string SeFactoryPartCode { get; set; } - /// - /// 结算客户物料号 - /// - public string SaCustomerPartCode { get; set; } - /// - /// 结算厂内物料号 - /// - public string SaFactoryPartCode { get; set; } - /// - /// 客户物料号 - /// - [Display(Name = "客户物料号")] - public string CustomerPartCode { get; set; } - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内物料号 - /// - [Display(Name = "替换厂内物料号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 是否已经移除 - /// - public bool IsRemove { get; set; } -} - -/// -/// PUB结算与发运对比明细 -/// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExport -{ -} - -/// -/// PUB结算与发运对比明细 -/// -public interface IPubSaSeCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运", 1)] - [ValueMapping("有结算无发运", 2)] - [ValueMapping("无结算有发运", 3)] - public EnumPubSaSeCompareCategory Category { get; set; } - /// - /// 零件描述 - /// - [Display(Name = "零件描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 替换厂内零件号 - /// - [Display(Name = "替换厂内零件号")] - [ExporterHeader(DisplayName = "替换厂内零件号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } -} - -/// -/// PUB结算与发运对比汇总 -/// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareSumExport -{ - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - [ExporterHeader(DisplayName = "LU")] - public string FactoryPartCode { get; set; } - - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - - /// - /// 差异数量 - /// - [ExporterHeader(DisplayName = "差异数量")] - public decimal DiffQty => SAQty - SEQty; -} - -/// -/// 直供件BBAC结算与发运对比明细 -/// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运", 1)] - [ValueMapping("有结算无发运", 2)] - [ValueMapping("无结算有发运", 3)] - public EnumPubSaSeCompareCategory Category { get; set; } - /// - /// Wms发货单号 - /// - [Display(Name = "Wms发货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "ASN发货单号")] - public string PN { get; set; } - /// - /// 客户零件号 - /// - [Display(Name = "客户零件号")] - [ExporterHeader(DisplayName = "客户零件号")] - public string CustomerPartCode { get; set; } - /// - /// 零件描述 - /// - [Display(Name = "零件描述")] - [ExporterHeader(DisplayName = "零件描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内零件号 - /// - [Display(Name = "厂内零件号")] - [ExporterHeader(DisplayName = "厂内零件号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内零件号 - /// - [Display(Name = "替换厂内零件号")] - [ExporterHeader(DisplayName = "替换厂内零件号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数据中的过账日期 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// 差异数量 - /// - [ExporterHeader(DisplayName = "差异数量")] - public decimal DiffQty => SAQty - SEQty; - /// - /// 匹配类型 - /// - [Display(Name = "匹配类型")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => DiffQty == 0; - /// - /// WMS目标库位 - /// - [Display(Name = "WMS目标库位")] - [ExporterHeader(DisplayName = "WMS目标库位")] - public string ToLocCode { get; set; } - /// - /// ERP目标库位 - /// - [Display(Name = "ERP目标库位")] - [ExporterHeader(DisplayName = "ERP目标库位")] - public string ToErpLocCode { get; set; } -} - - -/// -/// 直供件HBPO结算与发运对比明细 -/// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运", 1)] - [ValueMapping("有结算无发运", 2)] - [ValueMapping("无结算有发运", 3)] - public EnumPubSaSeCompareCategory Category { get; set; } - /// - /// Wms发货单号 - /// - [Display(Name = "Wms发货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "ASN发货单号")] - public string PN { get; set; } - /// - /// 客户零件号 - /// - [Display(Name = "客户零件号")] - [ExporterHeader(DisplayName = "客户零件号")] - public string CustomerPartCode { get; set; } - /// - /// 零件描述 - /// - [Display(Name = "零件描述")] - [ExporterHeader(DisplayName = "零件描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内零件号 - /// - [Display(Name = "厂内零件号")] - [ExporterHeader(DisplayName = "厂内零件号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内零件号 - /// - [Display(Name = "替换厂内零件号")] - [ExporterHeader(DisplayName = "替换厂内零件号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数据中的过账日期 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// 差异数量 - /// - [ExporterHeader(DisplayName = "差异数量")] - public decimal DiffQty => SAQty - SEQty; - /// - /// 匹配类型 - /// - [Display(Name = "匹配类型")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => DiffQty == 0; - /// - /// WMS目标库位 - /// - [Display(Name = "WMS目标库位")] - [ExporterHeader(DisplayName = "WMS目标库位")] - public string ToLocCode { get; set; } - /// - /// ERP目标库位 - /// - [Display(Name = "ERP目标库位")] - [ExporterHeader(DisplayName = "ERP目标库位")] - public string ToErpLocCode { get; set; } -} - -/// -/// 买单件BBAC结算与发运对比明细 -/// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExportMaiDanJianBBAC : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运", 1)] - [ValueMapping("有结算无发运", 2)] - [ValueMapping("无结算有发运", 3)] - public EnumPubSaSeCompareCategory Category { get; set; } - /// - /// Wms发货单号 - /// - [Display(Name = "Wms发货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "索引号")] - public string PN { get; set; } - /// - /// 客户零件号 - /// - [Display(Name = "客户零件号")] - [ExporterHeader(DisplayName = "客户零件号")] - public string CustomerPartCode { get; set; } - /// - /// 零件描述 - /// - [Display(Name = "零件描述")] - [ExporterHeader(DisplayName = "零件描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内零件号 - /// - [Display(Name = "厂内零件号")] - [ExporterHeader(DisplayName = "厂内零件号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内零件号 - /// - [Display(Name = "替换厂内零件号")] - [ExporterHeader(DisplayName = "替换厂内零件号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数据中的过账日期 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// 差异数量 - /// - [ExporterHeader(DisplayName = "差异数量")] - public decimal DiffQty => SAQty - SEQty; - /// - /// 匹配类型 - /// - [Display(Name = "匹配类型")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => DiffQty == 0; - /// - /// WMS目标库位 - /// - [Display(Name = "WMS目标库位")] - [ExporterHeader(DisplayName = "WMS目标库位")] - public string ToLocCode { get; set; } - /// - /// ERP目标库位 - /// - [Display(Name = "ERP目标库位")] - [ExporterHeader(DisplayName = "ERP目标库位")] - public string ToErpLocCode { get; set; } -} - -/// -/// 买单件HBPO结算与发运对比明细 -/// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运", 1)] - [ValueMapping("有结算无发运", 2)] - [ValueMapping("无结算有发运", 3)] - public EnumPubSaSeCompareCategory Category { get; set; } - /// - /// Wms发货单号 - /// - [Display(Name = "Wms发货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "索引号")] - public string PN { get; set; } - /// - /// 客户零件号 - /// - [Display(Name = "客户零件号")] - [ExporterHeader(DisplayName = "客户零件号")] - public string CustomerPartCode { get; set; } - /// - /// 零件描述 - /// - [Display(Name = "零件描述")] - [ExporterHeader(DisplayName = "零件描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内零件号 - /// - [Display(Name = "厂内零件号")] - [ExporterHeader(DisplayName = "厂内零件号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内零件号 - /// - [Display(Name = "替换厂内零件号")] - [ExporterHeader(DisplayName = "替换厂内零件号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数据中的过账日期 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// 差异数量 - /// - [ExporterHeader(DisplayName = "差异数量")] - public decimal DiffQty => SAQty - SEQty; - /// - /// 匹配类型 - /// - [Display(Name = "匹配类型")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => DiffQty == 0; - /// - /// WMS目标库位 - /// - [Display(Name = "WMS目标库位")] - [ExporterHeader(DisplayName = "WMS目标库位")] - public string ToLocCode { get; set; } - /// - /// ERP目标库位 - /// - [Display(Name = "ERP目标库位")] - [ExporterHeader(DisplayName = "ERP目标库位")] - public string ToErpLocCode { get; set; } -} - -/// -/// 备件结算与发运对比明细 -/// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运", 1)] - [ValueMapping("有结算无发运", 2)] - [ValueMapping("无结算有发运", 3)] - public EnumPubSaSeCompareCategory Category { get; set; } - /// - /// Wms发货单号 - /// - [Display(Name = "Wms发货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "索引号")] - public string PN { get; set; } - /// - /// 客户零件号 - /// - [Display(Name = "客户零件号")] - [ExporterHeader(DisplayName = "客户零件号")] - public string CustomerPartCode { get; set; } - /// - /// 零件描述 - /// - [Display(Name = "零件描述")] - [ExporterHeader(DisplayName = "零件描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内零件号 - /// - [Display(Name = "厂内零件号")] - [ExporterHeader(DisplayName = "厂内零件号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内零件号 - /// - [Display(Name = "替换厂内零件号")] - [ExporterHeader(DisplayName = "替换厂内零件号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数据中的过账日期 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// 差异数量 - /// - [ExporterHeader(DisplayName = "差异数量")] - public decimal DiffQty => SAQty - SEQty; - /// - /// 匹配类型 - /// - [Display(Name = "匹配类型")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => DiffQty == 0; - /// - /// WMS目标库位 - /// - [Display(Name = "WMS目标库位")] - [ExporterHeader(DisplayName = "WMS目标库位")] - public string ToLocCode { get; set; } - /// - /// ERP目标库位 - /// - [Display(Name = "ERP目标库位")] - [ExporterHeader(DisplayName = "ERP目标库位")] - public string ToErpLocCode { get; set; } -} - -/// -/// 印度件结算与发运对比明细 -/// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运", 1)] - [ValueMapping("有结算无发运", 2)] - [ValueMapping("无结算有发运", 3)] - public EnumPubSaSeCompareCategory Category { get; set; } - /// - /// Wms发货单号 - /// - [Display(Name = "Wms发货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "ASN发货单号")] - public string PN { get; set; } - /// - /// 客户物料号 - /// - [Display(Name = "客户物料号")] - [ExporterHeader(DisplayName = "客户物料号")] - public string CustomerPartCode { get; set; } - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - [ExporterHeader(DisplayName = "厂内物料号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内物料号 - /// - [Display(Name = "替换厂内物料号")] - [ExporterHeader(DisplayName = "替换厂内物料号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数据中的过账日期 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// 差异数量 - /// - [ExporterHeader(DisplayName = "差异数量")] - public decimal DiffQty => SAQty - SEQty; - /// - /// 匹配类型 - /// - [Display(Name = "匹配类型")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => DiffQty == 0; - /// - /// WMS目标库位 - /// - [Display(Name = "WMS目标库位")] - [ExporterHeader(DisplayName = "WMS目标库位")] - public string ToLocCode { get; set; } - /// - /// ERP目标库位 - /// - [Display(Name = "ERP目标库位")] - [ExporterHeader(DisplayName = "ERP目标库位")] - public string ToErpLocCode { get; set; } -} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReport.cs new file mode 100644 index 00000000..78f5b1ab --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReport.cs @@ -0,0 +1,116 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; +using Win.Sfs.SettleAccount.Enums; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 结算、发运明细对比报告 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeCompareDetailReport +{ + /// + /// 类别 + /// + [Display(Name = "类别")] + [ExporterHeader(DisplayName = "类别")] + [ValueMapping("有结算有发运", 1)] + [ValueMapping("有结算无发运", 2)] + [ValueMapping("无结算有发运", 3)] + public EnumPubSaSeCompareCategory Category { get; set; } + /// + /// Wms发货单号 + /// + [Display(Name = "Wms发货单号")] + [ExporterHeader(DisplayName = "交货单号")] + public string WmsBillNum { get; set; } + /// + /// 发货日期 + /// + [Display(Name = "发货日期")] + [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] + public DateTime? ShippingDate { get; set; } + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "生产码")] + public virtual string PN { get; set; } + /// + /// 客户零件号 + /// + [Display(Name = "客户零件号")] + [ExporterHeader(DisplayName = "客户零件号")] + public string CustomerPartCode { get; set; } + /// + /// 零件描述 + /// + [Display(Name = "零件描述")] + [ExporterHeader(DisplayName = "零件描述")] + public string PartCodeDesc { get; set; } + /// + /// 厂内零件号 + /// + [Display(Name = "厂内零件号")] + [ExporterHeader(DisplayName = "厂内零件号")] + public string FactoryPartCode { get; set; } + /// + /// 替换厂内零件号 + /// + [Display(Name = "替换厂内零件号")] + [ExporterHeader(DisplayName = "替换厂内零件号")] + public string ReplaceFactoryPartCode { get; set; } + /// + /// 结算数据中的过账日期 + /// + [Display(Name = "客户下线时间")] + [ExporterHeader(DisplayName = "客户下线时间", Format = "yyyy-MM-dd")] + public DateTime? CustomerOfflineTime { get; set; } + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal SAQty { get; set; } + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + [ExporterHeader(DisplayName = "WMS发货数量")] + public decimal SEQty { get; set; } + /// + /// 差异数量 + /// + [ExporterHeader(DisplayName = "差异数量")] + public decimal DiffQty => SAQty - SEQty; + /// + /// 匹配类型 + /// + [Display(Name = "匹配类型")] + [ExporterHeader(DisplayName = "是否完全匹配")] + [ValueMapping("是", true)] + [ValueMapping("否", false)] + public bool MateType => DiffQty == 0; + /// + /// WMS目标库位 + /// + [Display(Name = "WMS目标库位")] + [ExporterHeader(DisplayName = "WMS目标库位")] + public string ToLocCode { get; set; } + /// + /// ERP目标库位 + /// + [Display(Name = "ERP目标库位")] + [ExporterHeader(DisplayName = "ERP目标库位")] + public string ToErpLocCode { get; set; } + /// + /// 是否是当期 + /// + [Display(Name = "当期")] + [ValueMapping("当期数据", true)] + [ValueMapping("", false)] + public bool IsCurrent { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportBeiJian.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportBeiJian.cs new file mode 100644 index 00000000..f0d5d465 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportBeiJian.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 备件结算与发运对比明细 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeCompareDetailReportBeiJian : SaSeCompareDetailReport +{ + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "索引号")] + public override string PN { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportMaiDanJianBBAC.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportMaiDanJianBBAC.cs new file mode 100644 index 00000000..324ebf0b --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportMaiDanJianBBAC.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 买单件BBAC结算与发运对比明细 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeCompareDetailReportMaiDanJianBBAC : SaSeCompareDetailReport +{ + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "索引号")] + public override string PN { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportMaiDanJianHBPO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportMaiDanJianHBPO.cs new file mode 100644 index 00000000..48eef19f --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportMaiDanJianHBPO.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 买单件HBPO结算与发运对比明细 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeCompareDetailReportMaiDanJianHBPO : SaSeCompareDetailReport +{ + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "索引号")] + public override string PN { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportYinDuJian.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportYinDuJian.cs new file mode 100644 index 00000000..4e322a30 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportYinDuJian.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 印度件结算与发运对比明细 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeCompareDetailReportYinDuJian : SaSeCompareDetailReport +{ + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "ASN发货单号")] + public override string PN { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportZhiGongJianBBAC.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportZhiGongJianBBAC.cs new file mode 100644 index 00000000..6b24cb59 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportZhiGongJianBBAC.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 直供件BBAC结算与发运对比明细 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeCompareDetailReportZhiGongJianBBAC : SaSeCompareDetailReport +{ + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "ASN发货单号")] + public override string PN { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportZhiGongJianHBPO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportZhiGongJianHBPO.cs new file mode 100644 index 00000000..3601344b --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDetailReportZhiGongJianHBPO.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 直供件HBPO结算与发运对比明细 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeCompareDetailReportZhiGongJianHBPO : SaSeCompareDetailReport +{ + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "ASN发货单号")] + public override string PN { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDiff.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDiff.cs new file mode 100644 index 00000000..bb658c1b --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDiff.cs @@ -0,0 +1,153 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win.Sfs.SettleAccount.Enums; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 结算、发运对比 +/// +public class SaSeCompareDiff +{ + /// + /// 期间 + /// + [Display(Name = "期间")] + public int Version { get; set; } + /// + /// Wms发货单号 + /// + [Display(Name = "Wms发货单号")] + public string WmsBillNum { get; set; } + /// + /// 发货日期 + /// + [Display(Name = "发货日期")] + public DateTime? ShippingDate { get; set; } + /// + /// 日顺序号 + /// + [Display(Name = "日顺序号")] + public string SeqNumber { get; set; } + /// + /// PJIS日顺序号 + /// + [Display(Name = "PJIS日顺序号")] + public string PJISSeqNumber { get; set; } + /// + /// 结算数据中的过账日期 + /// + [Display(Name = "客户下线时间")] + public DateTime? CustomerOfflineTime { get; set; } + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + public decimal? SAQty { get; set; } + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + public decimal? SEQty { get; set; } + /// + /// 生产号 + /// + [Display(Name = "生产号")] + public string PN { set; get; } + /// + /// 客户物料号 + /// + [Display(Name = "客户物料号")] + public string LU { set; get; } + /// + /// WMS目标库位 + /// + [Display(Name = "WMS目标库位")] + public string ToLocCode { get; set; } + /// + /// ERP目标库位 + /// + [Display(Name = "ERP目标库位")] + public string ToErpLocCode { get; set; } + /// + /// 类型 + /// + [Display(Name = "类型")] + public EnumPubSaSeCompareCategory Category { get; set; } + /// + /// 发运客户物料号 + /// + public string SeCustomerPartCode { get; set; } + /// + /// 发运厂内物料号 + /// + public string SeFactoryPartCode { get; set; } + /// + /// 结算客户物料号 + /// + public string SaCustomerPartCode { get; set; } + /// + /// 结算厂内物料号 + /// + public string SaFactoryPartCode { get; set; } + /// + /// 客户物料号 + /// + [Display(Name = "客户物料号")] + public string CustomerPartCode { get; set; } + /// + /// 物料描述 + /// + [Display(Name = "物料描述")] + public string PartCodeDesc { get; set; } + /// + /// 厂内物料号 + /// + [Display(Name = "厂内物料号")] + public string FactoryPartCode { get; set; } + /// + /// 替换厂内物料号 + /// + [Display(Name = "替换厂内物料号")] + public string ReplaceFactoryPartCode { get; set; } + /// + /// 是否已经移除 + /// + public bool IsRemove { get; set; } + /// + /// 是否是当期 + /// + public bool IsCurrent { get; set; } +} + +/// +/// PUB结算与发运对比明细 +/// +public interface IPubSaSeCompareDetailExport +{ + /// + /// 类别 + /// + [Display(Name = "类别")] + public EnumPubSaSeCompareCategory Category { get; set; } + /// + /// 零件描述 + /// + [Display(Name = "零件描述")] + public string PartCodeDesc { get; set; } + /// + /// 替换厂内零件号 + /// + [Display(Name = "替换厂内零件号")] + public string ReplaceFactoryPartCode { get; set; } + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + public decimal SAQty { get; set; } + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + public decimal SEQty { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareSumReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareSumReport.cs new file mode 100644 index 00000000..fa2a4752 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareSumReport.cs @@ -0,0 +1,46 @@ +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 结算、发运汇总对比报告 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeCompareSumReport +{ + /// + /// 厂内物料号 + /// + [Display(Name = "厂内物料号")] + [ExporterHeader(DisplayName = "LU")] + public string FactoryPartCode { get; set; } + + /// + /// 物料描述 + /// + [Display(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string PartCodeDesc { get; set; } + + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal SAQty { get; set; } + + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + [ExporterHeader(DisplayName = "WMS发货数量")] + public decimal SEQty { get; set; } + + /// + /// 差异数量 + /// + [ExporterHeader(DisplayName = "差异数量")] + public decimal DiffQty => SAQty - SEQty; +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs index f735fb13..192db73e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs @@ -352,19 +352,6 @@ public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISa public string ToLocCode { get; set; } } -/// -/// JisBBAC结算、发运、Eid对比明细物流 -/// -public class SaSeEdiCompareDetailExportJisBBACWuLiu : SaSeEdiCompareDetailExportJisBBAC -{ - /// - /// 定价 - /// - [Display(Name = "定价")] - [ExporterHeader(IsIgnore = true)] - public override decimal? FixPrice { get; set; } -} - /// /// JisHBPO结算、发运、Eid对比明细 /// @@ -533,19 +520,6 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa public string ToLocCode { get; set; } } -/// -/// JisHBPO结算、发运、Eid对比明细物流 -/// -public class SaSeEdiCompareDetailExportJisHBPOWuLiu : SaSeEdiCompareDetailExportJisHBPO -{ - /// - /// 定价 - /// - [Display(Name = "定价")] - [ExporterHeader(IsIgnore = true)] - public override decimal? FixPrice { get; set; } -} - /// /// PUB结算与发运对比汇总 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACSeEidCompareReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs similarity index 77% rename from code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACSeEidCompareReport.cs rename to code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs index d478adae..36a79337 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACSeEidCompareReport.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs @@ -6,6 +6,6 @@ namespace Win.Sfs.SettleAccount.Reports; /// JisBBAC 发运、Edi与对比导出 /// [ExcelExporter(MaxRowNumberOnASheet = 500_000)] -public class JisBBACSeEidCompareReport : SeEidCompareReport +public class SeEidCompareReportJisBBAC : SeEidCompareReport { } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOSeEidCompareReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisHBPO.cs similarity index 77% rename from code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOSeEidCompareReport.cs rename to code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisHBPO.cs index 2831a987..da01018a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOSeEidCompareReport.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisHBPO.cs @@ -6,6 +6,6 @@ namespace Win.Sfs.SettleAccount.Reports; /// JisHBPO 发运、Edi与对比报告 /// [ExcelExporter(MaxRowNumberOnASheet = 500_000)] -public class JisHBPOSeEidCompareReport : SeEidCompareReport +public class SeEidCompareReportJisHBPO : SeEidCompareReport { } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs index 67910449..519eddd5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs @@ -22,7 +22,7 @@ public class PubSaSeCompareDapperRepository : DapperRepository /// 获取差异 /// - public virtual List GetDetailDiffReportList(string businessType, string version, string seStartDateTime, string seEndDateTime) + public virtual List GetDetailDiffReportList(string businessType, string version, string seStartDateTime, string seEndDateTime) { string strSeWhere = string.Empty; if (!string.IsNullOrWhiteSpace(seStartDateTime)) @@ -53,7 +53,7 @@ public class PubSaSeCompareDapperRepository : DapperRepository(strSqlText, null, null, true, 1200, null).ToList(); + return DbConnection.Query(strSqlText, null, null, true, 1200, null).ToList(); } public virtual List GetInvoiceSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string cp7begin, string cp7end, string kennCode, string chassisNumber, string materialGroup) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs index 343ab705..45b5fee1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs @@ -72,7 +72,6 @@ namespace SettleAccount.Job.Services.Report var seStartDateTime = DateTime.Parse(strSeStartDateTime); var seEndDateTime = DateTime.Parse(strSeEndDateTime); var filename = exportName.FirstOrDefault(); - var isWuLiu = filename.StartsWith("物流"); var saSeEdiCompareDiffs = GetEdiSeSaCompareData(version, seStartDateTime, seEndDateTime); HandleSaSeEdiCompareDiffList(saSeEdiCompareDiffs); @@ -107,16 +106,8 @@ namespace SettleAccount.Job.Services.Report saSeEdiCompareDiffs = saSeEdiCompareDiffs.OrderBy(t => t.Category).ToList(); var excelExporter = new ExcelExporter(); - if (isWuLiu) - { - var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); - } - else - { - var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); - } + var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs index cc7db84f..c36a68a9 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs @@ -60,7 +60,7 @@ namespace SettleAccount.Job.Services.Report var seEndDateTime = DateTime.Parse(strSeEndDateTime); var filename = exportName.FirstOrDefault(); - var excelExporter = GetSeEdiCompareData(seStartDateTime, seEndDateTime, businessTypeDisplayName); + var excelExporter = GetSeEdiCompareData(seStartDateTime, seEndDateTime, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); _fileContainer.SaveAsync(filename, result.Result, true); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs index 045c28af..b5dc8e4c 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs @@ -71,7 +71,6 @@ namespace SettleAccount.Job.Services.Report var seStartDateTime = DateTime.Parse(strSeStartDateTime); var seEndDateTime = DateTime.Parse(strSeEndDateTime); var filename = exportName.FirstOrDefault(); - var isWuLiu = filename.StartsWith("物流"); var saSeEdiCompareDiffs = GetSaSeEdiCompareData(version, seStartDateTime, seEndDateTime); HandleSaSeEdiCompareDiffList(saSeEdiCompareDiffs); @@ -106,16 +105,8 @@ namespace SettleAccount.Job.Services.Report saSeEdiCompareDiffs = saSeEdiCompareDiffs.OrderBy(t => t.Category).ToList(); var excelExporter = new ExcelExporter(); - if (isWuLiu) - { - var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); - } - else - { - var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); - } + var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs index 79e7af3b..830d0589 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs @@ -54,7 +54,7 @@ namespace SettleAccount.Job.Services.Report var seEndDateTime = DateTime.Parse(strSeEndDateTime); var filename = exportName.FirstOrDefault(); - var excelExporter = GetSeEdiCompareData(seStartDateTime, seEndDateTime, businessTypeDisplayName); + var excelExporter = GetSeEdiCompareData(seStartDateTime, seEndDateTime, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); _fileContainer.SaveAsync(filename, result.Result, true); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs index 5325b643..f3d83a47 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs @@ -83,10 +83,10 @@ namespace SettleAccount.Job.Services.Report { //二次匹配 匹配上的厂内零件号、PN var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); - pubSaSeCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); + pubSaSeCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes); //二次对比比对上的数据入库 - var pubSeCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); + var pubSeCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); _settleAccountDbContext.Set().AddRange(pubSeCDetailEntitys); } #endregion @@ -105,8 +105,8 @@ namespace SettleAccount.Job.Services.Report } pubSaSeCompareDiffs = pubSaSeCompareDiffs.OrderBy(t => t.Category).ToList(); var excelExporter = new ExcelExporter(); - var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); @@ -120,7 +120,7 @@ namespace SettleAccount.Job.Services.Report /// /// 获取结算与发运比对数据 /// - public List GetSaSeCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) + public List GetSaSeCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) { //结算 var saGroup = from sa in _settleAccountDbContext.Set() @@ -156,7 +156,7 @@ namespace SettleAccount.Job.Services.Report on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace } into temp from se in temp.DefaultIfEmpty() - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, @@ -177,7 +177,7 @@ namespace SettleAccount.Job.Services.Report on new { se.PN, se.CustomerPartCodeNoSpace } equals new { sa.PN, sa.CustomerPartCodeNoSpace } into temp from sa in temp.DefaultIfEmpty() - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs index 9fc712bf..42d1f5cf 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs @@ -83,10 +83,10 @@ namespace SettleAccount.Job.Services.Report { //二次匹配 匹配上的厂内零件号、PN var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); - pubSaSeCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); + pubSaSeCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes); //二次对比比对上的数据入库 - var pubSeCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); + var pubSeCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); _settleAccountDbContext.Set().AddRange(pubSeCDetailEntitys); } #endregion @@ -105,8 +105,8 @@ namespace SettleAccount.Job.Services.Report } pubSaSeCompareDiffs = pubSaSeCompareDiffs.OrderBy(t => t.Category).ToList(); var excelExporter = new ExcelExporter(); - var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); @@ -120,7 +120,7 @@ namespace SettleAccount.Job.Services.Report /// /// 获取结算与发运比对数据 /// - public List GetSaSeCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) + public List GetSaSeCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) { //结算 var saGroup = from sa in _settleAccountDbContext.Set() @@ -156,7 +156,7 @@ namespace SettleAccount.Job.Services.Report on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace } into temp from se in temp.DefaultIfEmpty() - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, @@ -177,7 +177,7 @@ namespace SettleAccount.Job.Services.Report on new { se.PN, se.LU } equals new { sa.PN, sa.LU } into temp from sa in temp.DefaultIfEmpty() - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs index 381ef95c..f2ff3796 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs @@ -113,16 +113,18 @@ namespace SettleAccount.Job.Services.Report { //二次匹配 匹配上的厂内零件号、PN var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); - pubSaSeCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); + pubSaSeCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes); //二次对比比对上的数据入库 - var pubSeCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); + var pubSeCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); _settleAccountDbContext.Set().AddRange(pubSeCDetailEntitys); } #endregion #region 结算数据处理 HandleSaDetails(pubSaSeCompareDiffs, businessType, version); + + HandleSaDetailsMain(pubSaSeCompareDiffs, businessType, version); #endregion if (string.IsNullOrEmpty(lu) == false) @@ -133,6 +135,7 @@ namespace SettleAccount.Job.Services.Report { pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn); } + pubSaSeCompareDiffs.FindAll(t => t.Version == version).ForEach(t => t.IsCurrent = true); pubSaSeCompareDiffs = pubSaSeCompareDiffs.OrderBy(t => t.Category).ToList(); var excelExporter = new ExcelExporter(); @@ -141,26 +144,26 @@ namespace SettleAccount.Job.Services.Report { case EnumBusinessType.ZhiGongJianBBAC: { - var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); } break; case EnumBusinessType.ZhiGongJianHBPO: { - var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); } break; case EnumBusinessType.BeiJian: { - var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); } break; case EnumBusinessType.YinDuJian: { - var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); } break; default: @@ -181,7 +184,7 @@ namespace SettleAccount.Job.Services.Report /// 获取比对数据 /// [Obsolete] - private List GetSaSeCompareData(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime) + private List GetSaSeCompareDataOld(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime) { //印度件LU对比 if (businessType == EnumBusinessType.YinDuJian) @@ -222,7 +225,7 @@ namespace SettleAccount.Job.Services.Report on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace } into temp from se in temp.DefaultIfEmpty() - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, @@ -243,7 +246,7 @@ namespace SettleAccount.Job.Services.Report on new { se.PN, se.CustomerPartCodeNoSpace } equals new { sa.PN, sa.CustomerPartCodeNoSpace } into temp from sa in temp.DefaultIfEmpty() - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, @@ -267,7 +270,7 @@ namespace SettleAccount.Job.Services.Report /// /// 获取比对数据 /// - private List GetSaSeCompareDataOld(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime) + private List GetSaSeCompareData(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime) { //印度件LU对比 if (businessType == EnumBusinessType.YinDuJian) @@ -282,7 +285,6 @@ namespace SettleAccount.Job.Services.Report { groupItem.Key.PN, groupItem.Key.CustomerPartCodeNoSpace, - Id = groupItem.Max(t => t.Id), Qty = groupItem.Sum(t => t.Qty), Version = groupItem.Max(t => t.Version), LU = groupItem.Max(t => t.LU), @@ -325,7 +327,7 @@ namespace SettleAccount.Job.Services.Report into temp from se in temp.DefaultIfEmpty() where se.PN == null - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { Version = sa.Version, CustomerOfflineTime = sa.SettleDate, @@ -342,7 +344,7 @@ namespace SettleAccount.Job.Services.Report into temp from sa in temp.DefaultIfEmpty() where sa.PN == null - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, @@ -359,7 +361,7 @@ namespace SettleAccount.Job.Services.Report var haveSaHaveSeList = (from sa in saGroupByVersion from se in seGroup where sa.PN == se.PN && sa.CustomerPartCodeNoSpace == se.CustomerPartCodeNoSpace - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { Version = sa.Version, WmsBillNum = se.WmsBillNum, @@ -376,13 +378,13 @@ namespace SettleAccount.Job.Services.Report SaFactoryPartCode = sa.PartCode, CustomerPartCode = sa.LU }).ToList(); - return haveSaHaveSeList.Union(haveSaHaveSeList).Union(notHaveSaHaveSeList).ToList(); + return haveSaHaveSeList.Union(haveSaNotHaveSeList).Union(notHaveSaHaveSeList).ToList(); } /// /// 获取比对数据 /// - private List GetSaSeCompareDataYinDu(int version, DateTime seStartDateTime, DateTime seEndDateTime) + private List GetSaSeCompareDataYinDu(int version, DateTime seStartDateTime, DateTime seEndDateTime) { var saGroup = from sa in _settleAccountDbContext.Set() where sa.BusinessType == EnumBusinessType.YinDuJian && sa.Version == version @@ -415,7 +417,7 @@ namespace SettleAccount.Job.Services.Report on sa.CustomerPartCodeNoSpace equals se.CustomerPartCodeNoSpace into temp from se in temp.DefaultIfEmpty() - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, @@ -435,7 +437,7 @@ namespace SettleAccount.Job.Services.Report on se.CustomerPartCodeNoSpace equals sa.CustomerPartCodeNoSpace into temp from sa in temp.DefaultIfEmpty() - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs index 6af50bd3..4ab4e2b9 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs @@ -35,7 +35,7 @@ namespace SettleAccount.Job.Services.Report _settleAccountDbContext = settleAccountDbContext; } - public virtual void HandlePubSaSeCompareDiffList(List pubSaSeCompareDiffs) + public virtual void HandlePubSaSeCompareDiffList(List pubSaSeCompareDiffs) { pubSaSeCompareDiffs.ForEach(p => { @@ -77,10 +77,10 @@ namespace SettleAccount.Job.Services.Report /// /// 二次比对 /// - public virtual List HandleSecondCompare(List pubSaSeCompareDiffs, EnumBusinessType businessType) + public virtual List HandleSecondCompare(List pubSaSeCompareDiffs, EnumBusinessType businessType) { //二次匹配上的记录 - var secondMatchHaveSaHaveSes = new List(); + var secondMatchHaveSaHaveSes = new List(); //有结算无发运 和 无结算有发运 var haveSaNotHaveSeUnionNotHaveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe || t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe); //有结算无发运 @@ -104,7 +104,7 @@ namespace SettleAccount.Job.Services.Report secondMatchHaveSaHaveSes = (from notHaveSaHaveSe in notHaveSaHaveSes join haveSaNotHaveSe in haveSaNotHaveSes on new { notHaveSaHaveSe.PN, notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.PN, haveSaNotHaveSe.ReplaceFactoryPartCode } - select new PubSaSeCompareDiff() + select new SaSeCompareDiff() { WmsBillNum = notHaveSaHaveSe.WmsBillNum, ShippingDate = notHaveSaHaveSe.ShippingDate, @@ -133,7 +133,7 @@ namespace SettleAccount.Job.Services.Report /// 结算数据处理 /// 写入库位、替换零件号 /// - public virtual void HandleSaDetails(List pubSaSeCompareDiffs, EnumBusinessType businessType, int version) + public virtual void HandleSaDetails(List pubSaSeCompareDiffs, EnumBusinessType businessType, int version) where TCanSa : SA_CAN_BASE where TNotSa : SA_NOT_BASE { @@ -177,7 +177,7 @@ namespace SettleAccount.Job.Services.Report /// 处理发运数据 /// 结算、发运对比上的数据修改结算数据状态 /// - public virtual void HandLeSaDetailsMain(List pubSaSeCompareDiffs, EnumBusinessType businessType, int version) where T : SA_BASE + public virtual void HandleSaDetailsMain(List pubSaSeCompareDiffs, EnumBusinessType businessType, int version) where T : SA_BASE { var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe); if (haveSaHaveSes.Any()) @@ -185,6 +185,7 @@ namespace SettleAccount.Job.Services.Report //结算详情 var saDetails = _settleAccountDbContext.Set() .Where(t => t.BusinessType == businessType) + .Where(t => t.MappingType == EnumMappingType.None) .Where(t => t.Version == version) .ToList(); if (saDetails.Any()) @@ -193,9 +194,8 @@ namespace SettleAccount.Job.Services.Report { var mappingType = (i.SAQty - i.SEQty) switch { - > 0 => EnumMappingType.None, 0 => EnumMappingType.PerfectMatch, - < 0 => EnumMappingType.None, + > 0 or < 0 => EnumMappingType.PartialMatch, _ => default, }; o.MappingType = mappingType; @@ -209,7 +209,7 @@ namespace SettleAccount.Job.Services.Report /// /// 创建导出文件结构 /// - public ExcelExporter BindExcelExporter(List saSeCompareDetailExports, string businessTypeDisplayName) where T : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport, new() + public ExcelExporter BindExcelExporter(List saSeCompareDetailExports, string businessTypeDisplayName) where T : SaSeCompareDetailReport, new() { //详情Sheet行数 var detailMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet; @@ -221,14 +221,14 @@ namespace SettleAccount.Job.Services.Report //汇总Sheet行数 var sumMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet; - var sumExportExporterAttribute = typeof(PubSaSeCompareSumExport).GetAttribute(inherit: true); + var sumExportExporterAttribute = typeof(SaSeCompareSumReport).GetAttribute(inherit: true); if (sumExportExporterAttribute != null) { sumMaxRowNumberOnASheet = sumExportExporterAttribute.MaxRowNumberOnASheet > 0 ? sumExportExporterAttribute.MaxRowNumberOnASheet : sumMaxRowNumberOnASheet; } //结算核对汇总 - var saSeCompareSumExports = saSeCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + var saSeCompareSumExports = saSeCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -239,7 +239,7 @@ namespace SettleAccount.Job.Services.Report //有结算有发运 var haveSaHaveSeExports = saSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe); //有结算有发运汇总 - var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -249,7 +249,7 @@ namespace SettleAccount.Job.Services.Report //有结算无发运 var haveSaNotHaveSeExports = saSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe); //有结算无发运 - var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -259,7 +259,7 @@ namespace SettleAccount.Job.Services.Report //无结算有发运 var notHaveSaHaveSeExports = saSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe); //无结算有发运 - var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs index d4a16aec..0611695b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs @@ -39,13 +39,13 @@ namespace SettleAccount.Job /// private void CreateMapSaSeCompare() { - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); } } } From acfd05815f462c52d041315ceda64e2ea05a1ac8 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Mon, 11 Sep 2023 11:34:25 +0800 Subject: [PATCH 4/5] update --- .../wwwroot/utils/validation.js | 10 +++++++++- .../wwwroot/views/settle/_check.js | 18 +++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/utils/validation.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/utils/validation.js index 4c8aa116..53494b3b 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/utils/validation.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/utils/validation.js @@ -159,4 +159,12 @@ const getRules = (parentSchema, property, data) => { //Object.assign(Schema.messages, messages); //Object.assign(Schema.validators, validators); -export { getRules }; +function required() { + return { required: true }; +} + +function trim(message) { + return { pattern: "^(?!\\s).*(? - + @@ -193,7 +193,7 @@ export default { } `, props: ["modelValue", "row", "data", "isBusiness", "businessType"], - emit: ["update:modelValue", "complete"], + emits: ["update:modelValue", "complete"], setup(props, context) { const show = ref(props.modelValue); watch(show, (value) => context.emit("update:modelValue", value)); @@ -452,35 +452,35 @@ export default { invBillNum: { type: "string", title: "发票号", - rules: [{ required: true }], + rules: [required(), trim()], default: props.data.invbillNum, }, settleDate: { type: "string", title: "下线日期", input: "datetime", - rules: [{ required: true }], + rules: [required()], }, lu: { type: "string", title: "零件号", - rules: [{ required: true }], + rules: [required(), trim()], }, pn: { type: "string", title: "标识号", - rules: [{ required: true }], + rules: [required(), trim()], }, qty: { type: "string", title: "数量", input: "number", - rules: [{ required: true }], + rules: [required()], }, groupNum: { type: "string", title: "结算分组", - rules: [{ required: true }], + rules: [required(), trim()], }, }, }; From 7dd053ba98f131cd5cbee1faa87871fe9b143141 Mon Sep 17 00:00:00 2001 From: mahao Date: Mon, 11 Sep 2023 11:43:43 +0800 Subject: [PATCH 5/5] up --- .../Reports/SaSeEdiCompareDetailReport.cs | 176 ++++++++ .../SaSeEdiCompareDetailReportJisBBAC.cs | 8 + .../SaSeEdiCompareDetailReportJisHBPO.cs | 8 + .../Reports/SaSeEdiCompareDiff.cs | 410 ------------------ .../Reports/SaSeEdiCompareSumReport.cs | 53 +++ .../Reports/SeEidCompareReportJisBBAC.cs | 2 +- .../JisBBACSaSeEdiCompareExportService.cs | 4 +- .../JisHBPOSaSeEdiCompareExportService.cs | 4 +- .../Report/SaSeEdiCompareExportBaseService.cs | 12 +- .../SettleAccountJobAutoMapperProfile.cs | 4 +- 10 files changed, 258 insertions(+), 423 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisBBAC.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisHBPO.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareSumReport.cs diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs new file mode 100644 index 00000000..a903c64d --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs @@ -0,0 +1,176 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; +using Win.Sfs.SettleAccount.Enums; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 结算、发运、Eid对比明细报告 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeEdiCompareDetailReport +{ + /// + /// 类别 + /// + [Display(Name = "类别")] + [ExporterHeader(DisplayName = "类别")] + [ValueMapping("有结算有发运(有EDI数据)", 1)] + [ValueMapping("有结算有发运(无EDI数据)", 2)] + [ValueMapping("有结算无发运(有EDI数据)", 3)] + [ValueMapping("有结算无发运(无EDI数据)", 4)] + [ValueMapping("无结算有发运(有EDI数据)", 5)] + [ValueMapping("无结算有发运(无EDI数据)", 6)] + public EnumSaSeEdiCompareCategory Category { get; set; } + [Display(Name = "WMS多发")] + [ExporterHeader(DisplayName = "WMS多发")] + [ValueMapping("", 0)] + [ValueMapping("WMS多发", 1)] + public EnumWMSSend WMSSend + { + get + { + return (Category, SaSeQty < 0) switch + { + (EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, true) => EnumWMSSend.WMSRepeat, + (EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi, true) => EnumWMSSend.WMSRepeat, + _ => EnumWMSSend.None + }; + } + } + [Display(Name = "价格信息")] + [ExporterHeader(DisplayName = "价格信息", IsIgnore = true)] + [ValueMapping("有价格信息", true)] + [ValueMapping("无价格信息", false)] + public bool IsHavePrice => FixPrice != null && FixPrice != 0; + /// + /// 交货单号 + /// + [Display(Name = "交货单号")] + [ExporterHeader(DisplayName = "交货单号")] + public string WmsBillNum { get; set; } + /// + /// 发货日期 + /// + [Display(Name = "发货日期")] + [ExporterHeader(DisplayName = "发货日期")] + public DateTime? ShippingDate { get; set; } + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "订单生产码")] + public string PN { get; set; } + /// + /// 日顺序号 + /// + [Display(Name = "日顺序号")] + [ExporterHeader(DisplayName = "日顺序号")] + public string SeqNumber { get; set; } + /// + /// PJIS日顺序号 + /// + [Display(Name = "PJIS日顺序号")] + [ExporterHeader(DisplayName = "PJIS日顺序号")] + public string PJISSeqNumber { get; set; } + /// + /// 客户物料号 + /// + [Display(Name = "客户物料号")] + [ExporterHeader(DisplayName = "客户物料号")] + public string CustomerPartCode { get; set; } + /// + /// 物料描述 + /// + [Display(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string PartCodeDesc { get; set; } + /// + /// 厂内物料号 + /// + [Display(Name = "厂内物料号")] + [ExporterHeader(DisplayName = "厂内物料号")] + public string FactoryPartCode { get; set; } + /// + /// 替换厂内物料号 + /// + [Display(Name = "替换厂内物料号")] + [ExporterHeader(DisplayName = "替换厂内物料号")] + public string ReplaceFactoryPartCode { get; set; } + /// + /// 客户下线时间 + /// + [Display(Name = "客户下线时间")] + [ExporterHeader(DisplayName = "客户下线时间")] + public DateTime? CustomerOfflineTime { get; set; } + /// + /// 小总成号 + /// + [Display(Name = "小总成号")] + [ExporterHeader(DisplayName = "小总成号")] + public string AssemblyCode { get; set; } + /// + /// 注塑码 + /// + [Display(Name = "注塑码")] + [ExporterHeader(DisplayName = "注塑码")] + public string InjectionCode { get; set; } + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal SAQty { get; set; } + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + [ExporterHeader(DisplayName = "WMS发货数量")] + public decimal SEQty { get; set; } + /// + /// Edi数量 + /// + [Display(Name = "Edi数量")] + [ExporterHeader(DisplayName = "Edi数量")] + public decimal EdiQty { get; set; } + /// + /// 结算与WMS发货量差 + /// + [ExporterHeader(DisplayName = "结算与WMS发货量差")] + public decimal SaSeQty => SAQty - SEQty; + /// + /// 结算与EDI量差 + /// + [ExporterHeader(DisplayName = "结算与EDI量差")] + public decimal SaEdiQty => SAQty - EdiQty; + /// + /// WMS发货与EDI数量差 + /// + [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] + public decimal SeEdiQty => SEQty - EdiQty; + [Display(Name = "是否完全匹配")] + [ExporterHeader(DisplayName = "是否完全匹配")] + [ValueMapping("是", true)] + [ValueMapping("否", false)] + public bool MateType => SaSeQty == 0 && SaEdiQty == 0 && SeEdiQty == 0; + /// + /// 定价 + /// + [Display(Name = "定价")] + [ExporterHeader(DisplayName = "定价", IsIgnore = true)] + public decimal? FixPrice { get; set; } + /// + /// ERP销售库位 + /// + [Display(Name = "ERP销售库位")] + [ExporterHeader(DisplayName = "ERP销售库位")] + public string ToErpLocCode { get; set; } + /// + /// WMS发货库位 + /// + [Display(Name = "WMS发货库位")] + [ExporterHeader(DisplayName = "WMS发货库位")] + public string ToLocCode { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisBBAC.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisBBAC.cs new file mode 100644 index 00000000..e592b95c --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisBBAC.cs @@ -0,0 +1,8 @@ +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// JisBBAC结算、发运、Eid明细对比报告 +/// +public class SaSeEdiCompareDetailReportJisBBAC : SaSeEdiCompareDetailReport +{ +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisHBPO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisHBPO.cs new file mode 100644 index 00000000..6f5e5ca4 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisHBPO.cs @@ -0,0 +1,8 @@ +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// JisHBPO结算、发运、Eid明细对比报告 +/// +public class SaSeEdiCompareDetailReportJisHBPO : SaSeEdiCompareDetailReport +{ +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs index 192db73e..4343ed77 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs @@ -1,7 +1,5 @@ using System; using System.ComponentModel.DataAnnotations; -using Magicodes.ExporterAndImporter.Core; -using Magicodes.ExporterAndImporter.Excel; using Win.Sfs.SettleAccount.Enums; namespace Win.Sfs.SettleAccount.Reports; @@ -121,18 +119,6 @@ public class SaSeEdiCompareDiff /// [Display(Name = "替换厂内物料号")] public string ReplaceFactoryPartCode { get; set; } - /// - /// 是否替换了厂内零件号 - /// - public bool IsReplace { get; set; } -} - -/// -/// 结算、发运、Eid对比明细 -/// -[ExcelExporter(MaxRowNumberOnASheet = 500_000)] -public class SaSeEdiCompareDetailExport -{ } /// @@ -144,426 +130,30 @@ public interface ISaSeEdiCompareDetailExport /// 类别 /// [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运(有EDI数据)", 1)] - [ValueMapping("有结算有发运(无EDI数据)", 2)] - [ValueMapping("有结算无发运(有EDI数据)", 3)] - [ValueMapping("有结算无发运(无EDI数据)", 4)] - [ValueMapping("无结算有发运(有EDI数据)", 5)] - [ValueMapping("无结算有发运(无EDI数据)", 6)] public EnumSaSeEdiCompareCategory Category { get; set; } /// /// 零件描述 /// [Display(Name = "零件描述")] - [ExporterHeader(DisplayName = "物料描述")] public string PartCodeDesc { get; set; } /// /// 替换厂内零件号 /// [Display(Name = "替换厂内零件号")] - [ExporterHeader(DisplayName = "替换厂内零件号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// Edi数量 - /// - [Display(Name = "Edi数量")] - [ExporterHeader(DisplayName = "Edi数量")] - public decimal EdiQty { get; set; } -} - -/// -/// JisBBAC结算、发运、Eid对比明细 -/// -public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运(有EDI数据)", 1)] - [ValueMapping("有结算有发运(无EDI数据)", 2)] - [ValueMapping("有结算无发运(有EDI数据)", 3)] - [ValueMapping("有结算无发运(无EDI数据)", 4)] - [ValueMapping("无结算有发运(有EDI数据)", 5)] - [ValueMapping("无结算有发运(无EDI数据)", 6)] - public EnumSaSeEdiCompareCategory Category { get; set; } - [Display(Name = "WMS多发")] - [ExporterHeader(DisplayName = "WMS多发")] - [ValueMapping("", 0)] - [ValueMapping("WMS多发", 1)] - public EnumWMSSend WMSSend - { - get - { - return (Category, SaSeQty < 0) switch - { - (EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, true) => EnumWMSSend.WMSRepeat, - (EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi, true) => EnumWMSSend.WMSRepeat, - _ => EnumWMSSend.None - }; - } - } - [Display(Name = "价格信息")] - [ExporterHeader(DisplayName = "价格信息")] - [ValueMapping("有价格信息", true)] - [ValueMapping("无价格信息", false)] - public bool IsHavePrice => FixPrice != null && FixPrice != 0; - /// - /// 交货单号 - /// - [Display(Name = "交货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "订单生产码")] - public string PN { get; set; } - /// - /// 日顺序号 - /// - [Display(Name = "日顺序号")] - [ExporterHeader(DisplayName = "日顺序号")] - public string SeqNumber { get; set; } - /// - /// PJIS日顺序号 - /// - [Display(Name = "PJIS日顺序号")] - [ExporterHeader(DisplayName = "PJIS日顺序号")] - public string PJISSeqNumber { get; set; } - /// - /// 客户物料号 - /// - [Display(Name = "客户物料号")] - [ExporterHeader(DisplayName = "客户物料号")] - public string CustomerPartCode { get; set; } - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - [ExporterHeader(DisplayName = "厂内物料号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内物料号 - /// - [Display(Name = "替换厂内物料号")] - [ExporterHeader(DisplayName = "替换厂内物料号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 客户下线时间 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - /// - /// 小总成号 - /// - [Display(Name = "小总成号")] - [ExporterHeader(DisplayName = "小总成号")] - public string AssemblyCode { get; set; } - /// - /// 注塑码 - /// - [Display(Name = "注塑码")] - [ExporterHeader(DisplayName = "注塑码")] - public string InjectionCode { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// Edi数量 - /// - [Display(Name = "Edi数量")] - [ExporterHeader(DisplayName = "Edi数量")] - public decimal EdiQty { get; set; } - /// - /// 结算与WMS发货量差 - /// - [ExporterHeader(DisplayName = "结算与WMS发货量差")] - public decimal SaSeQty => SAQty - SEQty; - /// - /// 结算与EDI量差 - /// - [ExporterHeader(DisplayName = "结算与EDI量差")] - public decimal SaEdiQty => SAQty - EdiQty; - /// - /// WMS发货与EDI数量差 - /// - [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] - public decimal SeEdiQty => SEQty - EdiQty; - [Display(Name = "是否完全匹配")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => SaSeQty == 0 && SaEdiQty == 0 && SeEdiQty == 0; - /// - /// 定价 - /// - [Display(Name = "定价")] - [ExporterHeader(DisplayName = "定价")] - public virtual decimal? FixPrice { get; set; } - /// - /// ERP销售库位 - /// - [Display(Name = "ERP销售库位")] - [ExporterHeader(DisplayName = "ERP销售库位")] - public string ToErpLocCode { get; set; } - /// - /// WMS发货库位 - /// - [Display(Name = "WMS发货库位")] - [ExporterHeader(DisplayName = "WMS发货库位")] - public string ToLocCode { get; set; } -} - -/// -/// JisHBPO结算、发运、Eid对比明细 -/// -public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运(有EDI数据)", 1)] - [ValueMapping("有结算有发运(无EDI数据)", 2)] - [ValueMapping("有结算无发运(有EDI数据)", 3)] - [ValueMapping("有结算无发运(无EDI数据)", 4)] - [ValueMapping("无结算有发运(有EDI数据)", 5)] - [ValueMapping("无结算有发运(无EDI数据)", 6)] - public EnumSaSeEdiCompareCategory Category { get; set; } - [Display(Name = "WMS多发")] - [ExporterHeader(DisplayName = "WMS多发")] - [ValueMapping("", 0)] - [ValueMapping("WMS多发", 1)] - public EnumWMSSend WMSSend - { - get - { - return (Category, SaSeQty < 0) switch - { - (EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, true) => EnumWMSSend.WMSRepeat, - (EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi, true) => EnumWMSSend.WMSRepeat, - _ => EnumWMSSend.None - }; - } - } - [Display(Name = "价格信息")] - [ExporterHeader(DisplayName = "价格信息")] - [ValueMapping("有价格信息", true)] - [ValueMapping("无价格信息", false)] - public bool IsHavePrice => FixPrice != null && FixPrice != 0; - /// - /// 交货单号 - /// - [Display(Name = "交货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "订单生产码")] - public string PN { get; set; } - /// - /// 日顺序号 - /// - [Display(Name = "日顺序号")] - [ExporterHeader(DisplayName = "日顺序号")] - public string SeqNumber { get; set; } - /// - /// PJIS日顺序号 - /// - [Display(Name = "PJIS日顺序号")] - [ExporterHeader(DisplayName = "PJIS日顺序号")] - public string PJISSeqNumber { get; set; } - /// - /// 客户物料号 - /// - [Display(Name = "客户物料号")] - [ExporterHeader(DisplayName = "客户物料号")] - public string CustomerPartCode { get; set; } - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - [ExporterHeader(DisplayName = "厂内物料号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内物料号 - /// - [Display(Name = "替换厂内物料号")] - [ExporterHeader(DisplayName = "替换厂内物料号")] public string ReplaceFactoryPartCode { get; set; } /// - /// 客户下线时间 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - /// - /// 小总成号 - /// - [Display(Name = "小总成号")] - [ExporterHeader(DisplayName = "小总成号")] - public string AssemblyCode { get; set; } - /// - /// 注塑码 - /// - [Display(Name = "注塑码")] - [ExporterHeader(DisplayName = "注塑码")] - public string InjectionCode { get; set; } - /// /// 结算数量 /// [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] public decimal SAQty { get; set; } /// /// 发货数量 /// [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] public decimal SEQty { get; set; } /// /// Edi数量 /// [Display(Name = "Edi数量")] - [ExporterHeader(DisplayName = "Edi数量")] public decimal EdiQty { get; set; } - /// - /// 结算与EDI量差 - /// - [ExporterHeader(DisplayName = "结算与WMS发货量差")] - public decimal SaSeQty => SAQty - SEQty; - /// - /// 结算与EDI量差 - /// - [ExporterHeader(DisplayName = "结算与EDI量差")] - public decimal SaEdiQty => SAQty - EdiQty; - /// - /// WMS发货与EDI数量差 - /// - [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] - public decimal SeEdiQty => SEQty - EdiQty; - [Display(Name = "是否完全匹配")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => SaSeQty == 0 && SaEdiQty == 0 && SeEdiQty == 0; - /// - /// 定价 - /// - [Display(Name = "定价")] - [ExporterHeader(DisplayName = "定价")] - public virtual decimal? FixPrice { get; set; } - /// - /// ERP销售库位 - /// - [Display(Name = "ERP销售库位")] - [ExporterHeader(DisplayName = "ERP销售库位")] - public string ToErpLocCode { get; set; } - /// - /// WMS发货库位 - /// - [Display(Name = "WMS发货库位")] - [ExporterHeader(DisplayName = "WMS发货库位")] - public string ToLocCode { get; set; } -} - -/// -/// PUB结算与发运对比汇总 -/// -[ExcelExporter(MaxRowNumberOnASheet = 500_000)] -public class SaSeEdiCompareSumExport -{ - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - [ExporterHeader(DisplayName = "LU")] - public string FactoryPartCode { get; set; } - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// Edi数量 - /// - [Display(Name = "Edi数量")] - [ExporterHeader(DisplayName = "Edi数量")] - public decimal EdiQty { get; set; } - /// - /// 结算与EDI量差 - /// - [ExporterHeader(DisplayName = "结算与EDI量差")] - public decimal SaEdiQty => SAQty - EdiQty; - /// - /// WMS发货与EDI数量差 - /// - [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] - public decimal SeEdiQty => SEQty - EdiQty; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareSumReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareSumReport.cs new file mode 100644 index 00000000..93100f01 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareSumReport.cs @@ -0,0 +1,53 @@ +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 结算、发运、Edi汇总对比报告 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeEdiCompareSumReport +{ + /// + /// 厂内物料号 + /// + [Display(Name = "厂内物料号")] + [ExporterHeader(DisplayName = "LU")] + public string FactoryPartCode { get; set; } + /// + /// 物料描述 + /// + [Display(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string PartCodeDesc { get; set; } + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal SAQty { get; set; } + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + [ExporterHeader(DisplayName = "WMS发货数量")] + public decimal SEQty { get; set; } + /// + /// Edi数量 + /// + [Display(Name = "Edi数量")] + [ExporterHeader(DisplayName = "Edi数量")] + public decimal EdiQty { get; set; } + /// + /// 结算与EDI量差 + /// + [ExporterHeader(DisplayName = "结算与EDI量差")] + public decimal SaEdiQty => SAQty - EdiQty; + /// + /// WMS发货与EDI数量差 + /// + [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] + public decimal SeEdiQty => SEQty - EdiQty; +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs index 36a79337..03f90227 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs @@ -3,7 +3,7 @@ using Magicodes.ExporterAndImporter.Excel; namespace Win.Sfs.SettleAccount.Reports; /// -/// JisBBAC 发运、Edi与对比导出 +/// JisBBAC 发运、Edi与对比报告 /// [ExcelExporter(MaxRowNumberOnASheet = 500_000)] public class SeEidCompareReportJisBBAC : SeEidCompareReport diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs index 45b5fee1..73da9782 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs @@ -106,8 +106,8 @@ namespace SettleAccount.Job.Services.Report saSeEdiCompareDiffs = saSeEdiCompareDiffs.OrderBy(t => t.Category).ToList(); var excelExporter = new ExcelExporter(); - var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs index b5dc8e4c..0869466a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs @@ -105,8 +105,8 @@ namespace SettleAccount.Job.Services.Report saSeEdiCompareDiffs = saSeEdiCompareDiffs.OrderBy(t => t.Category).ToList(); var excelExporter = new ExcelExporter(); - var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs index f3f240a6..59170860 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs @@ -179,7 +179,7 @@ namespace SettleAccount.Job.Services.Report /// /// 创建导出文件结构 /// - public ExcelExporter BindExcelExporter(List saSeEdiCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport, new() + public ExcelExporter BindExcelExporter(List saSeEdiCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailReport, new() { //详情Sheet行数 var detailMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet; @@ -191,14 +191,14 @@ namespace SettleAccount.Job.Services.Report //汇总Sheet行数 var sumMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet; - var sumExportExporterAttribute = typeof(SaSeEdiCompareSumExport).GetAttribute(inherit: true); + var sumExportExporterAttribute = typeof(SaSeEdiCompareSumReport).GetAttribute(inherit: true); if (sumExportExporterAttribute != null) { sumMaxRowNumberOnASheet = sumExportExporterAttribute.MaxRowNumberOnASheet > 0 ? sumExportExporterAttribute.MaxRowNumberOnASheet : sumMaxRowNumberOnASheet; } //汇总 - var saSeEdiCompareSumExports = saSeEdiCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport() + var saSeEdiCompareSumExports = saSeEdiCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -210,7 +210,7 @@ namespace SettleAccount.Job.Services.Report //有结算有发运 var haveSaHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi }.Contains(t.Category)); //有结算有发运汇总 - var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport() + var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -221,7 +221,7 @@ namespace SettleAccount.Job.Services.Report //有结算无发运 var haveSaNotHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi }.Contains(t.Category)); //有结算无发运 - var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport() + var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -232,7 +232,7 @@ namespace SettleAccount.Job.Services.Report //无结算有发运 var notHaveSaHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi }.Contains(t.Category)); //无结算有发运 - var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport() + var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs index 0611695b..55dffce8 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs @@ -28,8 +28,8 @@ namespace SettleAccount.Job /// public void CreateMapSaSeEdiCompare() { - CreateMap(); - CreateMap(); + CreateMap(); + CreateMap(); CreateMap(); CreateMap(); }