diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs index feee168f..c6c838b2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs @@ -1,5 +1,7 @@ using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.Linq; using Magicodes.ExporterAndImporter.Core; using Microsoft.AspNetCore.Http; using Volo.Abp.Application.Dtos; @@ -101,7 +103,7 @@ public class BBAC_SA_DETAIL_DTO : AuditedAggregateRoot /// /// BBAC结算导入请求 /// -public class BBACSaImportRequestDto +public class BBACSaImportRequestDto //: IValidatableObject { /// /// 文件 @@ -116,7 +118,43 @@ public class BBACSaImportRequestDto /// 地点 /// [Display(Name = "地点")] + [Required(ErrorMessage = "{0}必须填写")] + //[ValidateSite(Sites = new string[] { "1040", "1046" }, ErrorMessage = "{0}值无效")] public string Site { get; set; } + + //public IEnumerable Validate(ValidationContext validationContext) + //{ + // if (Site != "1040" && Site != "1046") + // { + // yield return new ValidationResult( + // $"地点值无效", + // new[] { nameof(Site) }); + // } + //} +} + +public class ValidateSiteAttribute : ValidationAttribute +{ + public ValidateSiteAttribute() + { + } + + public string[] Sites { get; set; } + + protected override ValidationResult IsValid(object value, ValidationContext validationContext) + { + if (!Sites.Contains(value)) + { + return new ValidationResult(FormatErrorMessage(validationContext.DisplayName)); + } + return ValidationResult.Success; + } + + //public override bool IsValid(object value) + //{ + // return AllowEmptyStrings || value is not string stringValue || !string.IsNullOrWhiteSpace(stringValue); + // return base.IsValid(value); + //} } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs index a7a1cd80..d903dcef 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using Coravel.Invocable; @@ -47,7 +47,7 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable from edi in ediDetailGroup where se.PN == edi.PN && se.CustomerPartCodeNoSpace == edi.CustomerPartCodeNoSpace select new { se.PN, se.CustomerPartCodeNoSpace } - ).Take(1000).ToList(); + ).Take(5_000).ToList(); if (keyCodes.Any()) { var pns = keyCodes.Select(t => t.PN).Distinct().ToList(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs index 8af42ea8..5e0a8191 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs @@ -48,7 +48,7 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable from edi in ediDetailGroup where se.PN == edi.PN && se.CustomerPartCodeNoSpace == edi.CustomerPartCodeNoSpace select new { se.PN, se.CustomerPartCodeNoSpace } - ).Take(1000).ToList(); + ).Take(5_000).ToList(); if (keyCodes.Any()) { var pns = keyCodes.Select(t => t.PN).Distinct().ToList(); 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 b6b67cda..c297c05b 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 @@ -155,16 +155,23 @@ public class PriceListAppService : SettleAccountApplicationBase return priceList; // 只有一个或零个价格条目 } - var sortedList = priceList.OrderBy(t => t.LU).ThenBy(t => t.BeginTime).ToList(); - for (var i = 1; i < sortedList.Count; i++) + var clientCodeGroup = priceList.GroupBy(t => t.ClientCode); + foreach (var item in clientCodeGroup) { - if (sortedList[i].LU == sortedList[i - 1].LU && sortedList[i].BeginTime != sortedList[i - 1].EndTime.AddDays(1)) + if (item.ToList().Count <= 1) { - priceList.Add(sortedList[i]); + continue; + } + var sortedList = item.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; // 所有价格时间都连续 + 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 1b65a9d7..e593dd1d 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 @@ -139,16 +139,24 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase return priceList; // 只有一个或零个价格条目 } - var sortedList = priceList.OrderBy(t => t.LU).ThenBy(t => t.BeginDate).ToList(); - for (var i = 1; i < sortedList.Count; i++) + var clientCodeGroup = priceList.GroupBy(t => t.ClientCode); + foreach (var item in clientCodeGroup) { - if (sortedList[i].LU == sortedList[i - 1].LU && sortedList[i].BeginDate != sortedList[i - 1].EndDate.AddDays(1)) + if (item.ToList().Count <= 1) { - priceList.Add(sortedList[i]); + continue; + } + var sortedList = item.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; // 所有价格时间都连续 + return pricelist; // 所有价格时间都连续 } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs index a903c64d..45fbcccc 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel.DataAnnotations; using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Excel; @@ -55,7 +55,7 @@ public class SaSeEdiCompareDetailReport /// 发货日期 /// [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期")] + [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] public DateTime? ShippingDate { get; set; } /// /// 生产码 @@ -103,7 +103,7 @@ public class SaSeEdiCompareDetailReport /// 客户下线时间 /// [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] + [ExporterHeader(DisplayName = "客户下线时间", Format = "yyyy-MM-dd")] public DateTime? CustomerOfflineTime { get; set; } /// /// 小总成号 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReport.cs index c61cecb7..c1cac5c7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReport.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReport.cs @@ -121,7 +121,7 @@ public class SeEidCompareReport /// 客户下线时间 /// [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] + [ExporterHeader(DisplayName = "客户下线时间", Format = "yyyy-MM-dd")] public DateTime? AssemblyDate { get; set; } /// /// 小总成号