diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs index 81f42abd..71c6ceb6 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs @@ -29,6 +29,7 @@ public class Startup options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "image/svg+xml" }); }); services.AddScheduler(); + services.AddSingleton(); services.AddSignalR(o => o.EnableDetailedErrors = true); JobHostdService.AddService(services); services.AddSingleton(); @@ -56,6 +57,7 @@ public class Startup app.UseEndpoints(endpoints => endpoints.MapHub("/api/hub")); app.ApplicationServices.UseScheduler(scheduler => { + scheduler.Schedule().EverySeconds(10); }); var contentTypeProvider = new FileExtensionContentTypeProvider(); contentTypeProvider.Mappings.Add(".mjs", "text/javascript"); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs index 9145bc23..213832ce 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs @@ -87,7 +87,7 @@ public class HBPO_SA_DETAIL_IMPORT_DTO [Display(Name = "PartNumber")] [Required(ErrorMessage = "{0}不能为空")] [ImporterHeader(Name = "PartNumber")] - public string LU { get; set; } + public string PartCode { get; set; } /// /// 数量 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 17738f4d..e387b2f8 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 @@ -76,12 +76,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public DateTime SettleDate { set; get; } /// - /// 零件号 + /// 客户零件号 /// [Display(Name = "Material")] [Required(ErrorMessage = "{0}不能为空")] [ImporterHeader(Name = "Material")] - public string LU { get; set; } + public string PartCode { get; set; } /// /// 生产号 @@ -120,12 +120,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public DateTime SettleDate { set; get; } /// - /// 零件号 + /// 客户零件号 /// [Display(Name = "零件号")] [Required(ErrorMessage = "{0}不能为空")] [ImporterHeader(Name = "零件号")] - public string LU { get; set; } + public string PartCode { get; set; } /// /// 生产号 @@ -164,12 +164,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public DateTime SettleDate { set; get; } /// - /// 零件号 + /// 客户零件号 /// [Display(Name = "零件号")] [Required(ErrorMessage = "{0}不能为空")] [ImporterHeader(Name = "零件号")] - public string LU { get; set; } + public string PartCode { get; set; } /// /// 生产号 @@ -208,12 +208,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public DateTime SettleDate { set; get; } /// - /// 零件号 + /// 客户零件号 /// [Display(Name = "零件号")] [Required(ErrorMessage = "{0}不能为空")] [ImporterHeader(Name = "零件号")] - public string LU { get; set; } + public string PartCode { get; set; } /// /// 生产号 @@ -252,12 +252,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public DateTime SettleDate { set; get; } /// - /// 零件号 + /// 客户零件号 /// [Display(Name = "Material")] [Required(ErrorMessage = "{0}不能为空")] [ImporterHeader(Name = "Material")] - public string LU { get; set; } + public string PartCode { get; set; } /// /// 生产号 @@ -283,79 +283,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public string GroupNum { get; set; } } - /// - /// 导入 - /// - public class PUB_SA_DETAIL_IMPORT_DTO - { - ///// - ///// 期间 - ///// - //public int Version { set; get; } - - ///// - ///// 单价 - ///// - //public decimal Price { set; get; } - - ///// - ///// 结算单 - ///// - //public string BillNum { set; get; } - - /// - /// 结算日期 - /// - [Display(Name = "结算日期")] - [ImporterHeader(Name = "Pstng Date")] - public DateTime SettleDate { set; get; } - - /// - /// 零件号 - /// - [Display(Name = "零件号")] - [Required(ErrorMessage = "{0}不能为空")] - [ImporterHeader(Name = "Material")] - public string LU { get; set; } - - /// - /// 生产号 - /// - [Display(Name = "生产号")] - [ImporterHeader(Name = "External Delivery ID")] - [Required(ErrorMessage = "{0}不能为空")] - public string PN { get; set; } - - ///// - ///// 组合键值(LU+PN) - ///// - //public string KeyCode - //{ - // get => LU + PN; - //} - - ///// - /// 数量 - /// - [Display(Name = "数量")] - [ImporterHeader(Name = "Quantity")] - public decimal Qty { get; set; } - - /// - /// 结算分组号 - /// - [Display(Name = "结算分组号")] - [ImporterHeader(Name = "Delivery")] - [Required(ErrorMessage = "{0}不能为空")] - public string GroupNum { get; set; } - - /////// - /////// 工厂地点 - /////// - ////[Display(Name = "工厂地点")] - ////public string Site { get; set; } - } - /// /// 结算明细导出请求 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs index f7b551a7..12f87562 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs @@ -41,11 +41,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public class TB_RePartsRelationship_IMPORT_DTO { /// - /// 客户物料号 + /// 厂内物料号 /// - [Display(Name = "客户物料号")] + [Display(Name = "厂内物料号")] [Required(ErrorMessage = "{0}是必填项")] - [ImporterHeader(Name = "客户物料号")] + [ImporterHeader(Name = "厂内物料号")] public string LU { set; get; } /// @@ -56,11 +56,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public EnumBusinessType BusinessType { get; set; } /// - /// 替换客户物料号 + /// 替换厂内物料号 /// - [Display(Name = "替换客户物料号")] + [Display(Name = "替换厂内物料号")] [Required(ErrorMessage = "{0}是必填项")] - [ImporterHeader(Name = "替换客户物料号")] + [ImporterHeader(Name = "替换厂内物料号")] public string RepLU { set; get; } } @@ -70,10 +70,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public class TB_RePartsRelationship_EXPORT_DTO { /// - /// 零件号 + /// 厂内物料号 /// - [Display(Name = "零件号")] - [ExporterHeader(DisplayName = "客户物料号")] + [Display(Name = "厂内物料号")] + [ExporterHeader(DisplayName = "厂内物料号")] public string LU { set; get; } /// @@ -84,10 +84,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public EnumBusinessType BusinessType { get; set; } /// - /// 替换零件号 + /// 替换厂内物料号 /// - [Display(Name = "替换零件号")] - [ExporterHeader(DisplayName = "替换客户物料号")] + [Display(Name = "替换厂内物料号")] + [ExporterHeader(DisplayName = "替换厂内物料号")] public string RepLU { set; get; } } 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 d5fe29d0..430cc75e 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 @@ -323,20 +323,19 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase hbpoSaDetails.ForEach(hbpoSaDetail => { - List luList = hbpoSaDetail.LU.Split(" ").ToList(); - hbpoSaDetail.LU = luList[0].Replace(" ", ""); - if (luList.Count > 1) + List partCodes = hbpoSaDetail.PartCode.Split(" ").ToList(); + hbpoSaDetail.PartCode = partCodes[0].Replace(" ", ""); + if (partCodes.Count > 1) { - luList.RemoveAt(0); - var luAssemble = luList.Select(t => t.Replace(" ", "")); - hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); + partCodes.RemoveAt(0); + var luAssemble = partCodes.Select(t => t.Replace(" ", "")); + hbpoSaDetail.PartCode += luAssemble.Aggregate(" ", (current, index) => current + index); } hbpoSaDetail.BillNum = hbpoSaBillNum; - hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU; //根据物料号、结算日期获取价格 - var priceListEntity = priceListEntitys.Find(t => t.LU == hbpoSaDetail.LU && hbpoSaDetail.SettleDate > t.BeginTime && hbpoSaDetail.SettleDate < t.EndTime); + var priceListEntity = priceListEntitys.Find(t => t.LU == hbpoSaDetail.PartCode && hbpoSaDetail.SettleDate > t.BeginTime && hbpoSaDetail.SettleDate < t.EndTime); hbpoSaDetail.Price = priceListEntity?.Price ?? default; hbpoSaDetail.BusinessType = _businessType; }); @@ -358,6 +357,13 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, _businessType.ToString()); materialRelationships.Add(materialRelationship); }); + + var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships); + hbpoSaDetails.ForEach(hbpoSaDetail => + { + hbpoSaDetail.LU = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == hbpoSaDetail.PartCode)?.ErpMaterialCode ?? hbpoSaDetail.PartCode.Replace(" ", "-"); + hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU; + }); #endregion #region 入库数据赋值 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 2889f65d..372e884f 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 @@ -278,158 +278,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase #endregion #region 私有方法 - /// - /// 导入 - /// - [Obsolete(message: "过时废弃")] - private async Task ImportAsync([FromForm] IFormFileCollection files, EnumBusinessType businessType) - { - //数据校验 - var checkList = new List(); - //结算单号 - var pubSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA"); - //结算主表 - var pubSa = new PUB_SA() - { - BillNum = pubSaBillNum, - State = "1", - BusinessType = businessType - }; - //结算明细 - var pubSaDetails = new List(); - //可结算单号 - var pubCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C"); - //可结算主表 - var pubCanSa = new PUB_CAN_SA() - { - BillNum = pubCanSaBillNum, - SettleBillNum = pubSaBillNum, - State = SettleBillState.未结状态, - BusinessType = businessType - }; - //可结算明细 - var pubCanSaDetails = new List(); - //不可结算明细 - var pubNotSaDetails = new List(); - //客户零件关系 - var materialRelationships = new List(); - - #region 导入数据转换、数据校验 - ExportImporter _exportImporter = new ExportImporter(); - var result = await _exportImporter.UploadExcelImport(files, _excelImportService); - var importPubSaDetails = ObjectMapper.Map, List>(result); - - //结算分组号 - var pubSaGroupNums = importPubSaDetails.Select(t => t.GroupNum).Distinct(); - - //已存在的结算分组号 - var havPubSaGroupNums = (await _pubSaDetailRepository.GetListAsync(t => pubSaGroupNums.Contains(t.GroupNum))).Select(t => t.GroupNum).Distinct(); - if (havPubSaGroupNums.Any() == true) - { - foreach (var item in havPubSaGroupNums) - { - checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"结算分组号{item}已存在", string.Empty)); - } - //throw new UserFriendlyException($"导入失败,结算分组号({string.Join(",", havPubSaGroupNums)})已存在", "400"); - } - - if (checkList.Count > 0) - { - return await ExportErrorReportAsync(checkList); - } - #endregion - - #region 处理结算数据 - //销售价格 - var priceListEntitys = await _priceListRepository.GetAllAsync(); - - importPubSaDetails.ForEach(importPubSaDetail => - { - List luList = importPubSaDetail.LU.Split(" ").ToList(); - importPubSaDetail.LU = luList[0].Replace(" ", ""); - if (luList.Count > 1) - { - luList.RemoveAt(0); - var luAssemble = luList.Select(t => t.Replace(" ", "")); - importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); - } - - importPubSaDetail.BillNum = pubSaBillNum; - importPubSaDetail.Site = "XX工厂"; - importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU; - - //根据物料号、结算日期获取价格 - var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime); - importPubSaDetail.Price = priceListEntity?.Price ?? 0; - }); - - //导入的零件号集合 - var importPubSaLUs = importPubSaDetails.Select(t => t.LU).Distinct(); - var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)); - var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct(); - - /* - * (不存在的客户零件号)差集 - * 转换为厂内零件号 - * 转换规则6个空格替换成“-” - */ - var noExistSettleMaterialCodes = importPubSaLUs.Except(materialRelationshipEntitySettleMaterialCodes); - - noExistSettleMaterialCodes.ForEach(t => - { - var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, businessType.ToString()); - materialRelationships.Add(materialRelationship); - }); - #endregion - - #region 入库数据赋值 - //结算明细 - pubSaDetails = importPubSaDetails; - - //不可结算 结算分组号码(根据价格区分结算、不可结算) - var pubNotSaGroupNums = importPubSaDetails.FindAll(t => t.Price == default(decimal)).Select(t => t.GroupNum).Distinct(); - var pubSaDetailsCanSes = importPubSaDetails.FindAll(t => pubNotSaGroupNums.Contains(t.GroupNum) == false); - var pubSaDetailsNotCanSes = importPubSaDetails.FindAll(t => pubNotSaGroupNums.Contains(t.GroupNum) == true); - - //可结算明细 - pubCanSaDetails = ObjectMapper.Map, List>(pubSaDetailsCanSes); - //不可结算明细 - pubNotSaDetails = ObjectMapper.Map, List>(pubSaDetailsNotCanSes); - #endregion - - #region 添加入库 - await _repository.InsertAsync(pubSa); - await _pubSaDetailRepository.InsertManyAsync(importPubSaDetails); - if (pubCanSaDetails.Count > 0) - { - pubCanSa.InvGroupNum = pubCanSaDetails.Count.ToString(); - pubCanSaDetails.ForEach(pubCanSaDetail => - { - pubCanSaDetail.BillNum = pubCanSaDetail.InvGroupNum = pubCanSaBillNum; - pubCanSaDetail.BusinessType = businessType; - }); - - await _pubCanSaRepository.InsertAsync(pubCanSa); - await _pubCanSaDetailRepository.InsertManyAsync(pubCanSaDetails); - } - if (pubNotSaDetails.Count > 0) - { - pubNotSaDetails.ForEach(pubNotSaDetail => - { - pubNotSaDetail.BusinessType = businessType; - }); - - await _pubNotSaDetailRepository.InsertManyAsync(pubNotSaDetails); - } - if (materialRelationships.Count > 0) - { - await _materialRelationshipRepository.InsertManyAsync(materialRelationships); - } - #endregion - - return ApplicationConsts.SuccessStr; - } - /// /// 直供件BBAC导入 /// @@ -601,28 +449,27 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase pubSaDetails.ForEach(importPubSaDetail => { - List luList = importPubSaDetail.LU.Split(" ").ToList(); - importPubSaDetail.LU = luList[0].Replace(" ", ""); - if (luList.Count > 1) + List partCodes = importPubSaDetail.PartCode.Split(" ").ToList(); + importPubSaDetail.PartCode = partCodes[0].Replace(" ", ""); + if (partCodes.Count > 1) { - luList.RemoveAt(0); - var luAssemble = luList.Select(t => t.Replace(" ", "")); - importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); + partCodes.RemoveAt(0); + var luAssemble = partCodes.Select(t => t.Replace(" ", "")); + importPubSaDetail.PartCode += luAssemble.Aggregate(" ", (current, index) => current + index); } importPubSaDetail.Version = _version; importPubSaDetail.BusinessType = businessType; importPubSaDetail.Site = "XX工厂"; - importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU; //根据物料号、结算日期获取价格 - var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime); + var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.PartCode && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime); importPubSaDetail.Price = priceListEntity?.Price ?? 0; }); //导入的零件号集合 - var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct(); - var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)); + var importPubSaPartCodes = pubSaDetails.Select(t => t.PartCode).Distinct(); + var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaPartCodes.Contains(t.SettleMaterialCode)); var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct(); /* @@ -630,13 +477,20 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase * 转换为厂内零件号 * 转换规则6个空格替换成“-” */ - var noExistSettleMaterialCodes = importPubSaLUs.Except(materialRelationshipEntitySettleMaterialCodes); + var noExistSettleMaterialCodes = importPubSaPartCodes.Except(materialRelationshipEntitySettleMaterialCodes); noExistSettleMaterialCodes.ForEach(t => { var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, businessType.ToString()); materialRelationships.Add(materialRelationship); }); + + var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships); + pubSaDetails.ForEach(pubSaDetail => + { + pubSaDetail.LU = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.PartCode)?.ErpMaterialCode ?? pubSaDetail.PartCode.Replace(" ", "-"); + pubSaDetail.KeyCode = pubSaDetail.PN + pubSaDetail.LU; + }); #endregion #region 添加入库 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 new file mode 100644 index 00000000..f0ae4698 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs @@ -0,0 +1,102 @@ +using System; +using System.Diagnostics; +using System.Threading.Tasks; +using Coravel.Invocable; +using Microsoft.AspNetCore.Mvc; +using SettleAccount.Domain.BQ; +using Volo.Abp.Application.Services; +using Win.Sfs.Shared.RepositoryBase; +using System.Linq; +using DocumentFormat.OpenXml.Office2010.ExcelAc; +using System.Collections.Generic; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Application; +using System.Runtime.Intrinsics.X86; + +namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; + +/// +/// JisHBPO 发运数据与EDI数据对比 +/// +[ApiExplorerSettings(IgnoreApi = true)] +public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable +{ + private readonly IServiceProvider _serviceProvider; + + /// + /// HBPO发运数据仓储 + /// + private readonly INormalEfCoreRepository _hbpoSeDetailRepository; + + /// + /// HBPOEDI数据仓储 + /// + private readonly INormalEfCoreRepository _hbpoSeEdiRepository; + + public JisHBPOSeEdiCompareAppService( + IServiceProvider serviceProvider, + INormalEfCoreRepository hbpoSeDetailRepository, INormalEfCoreRepository hbpoSeEdiRepository) + { + _serviceProvider = serviceProvider; + _hbpoSeDetailRepository = hbpoSeDetailRepository; + _hbpoSeEdiRepository = hbpoSeEdiRepository; + } + + /// + /// 执行 + /// + public async Task Invoke() + { + await Task.CompletedTask; + Debug.WriteLine($"执行了 {this.GetType()}"); + + using var serviceScope = _serviceProvider.CreateScope(); + var db = serviceScope.ServiceProvider.GetRequiredService(); + + //List hbpoSeDetails = await _hbpoSeDetailRepository.GetListAsync(t => t.IsHaveEdiData == false); + + //var hbpoSeDetails = db.Set().Where(t => t.IsHaveEdiData == false).OrderBy(t => t.BillTime); + + //var hbpoSeEdis = db.Set().Where(t => t.IsHaveSeData == false && hbpoSeDetails.Any(w => w.PN.Equals(t.PN) && w.LU.Equals(t.LU) && w.Qty.Equals(t.Qty))); + + var query = from se in db.Set() + join edi in db.Set() on new + { + se.LU, + se.PN, + se.Qty + } equals new + { + edi.LU, + edi.PN, + edi.Qty + } + where se.IsHaveEdiData == false && edi.IsHaveSeData == false + //select new + //{ + // SeID = se.Id, + // se.PN, + // se.LU, + // se.Qty, + // EdiID = edi.Id + //}; + select new + { + se, + edi + }; + + query.ForEach(item => + { + Debug.WriteLine($"{Newtonsoft.Json.JsonConvert.SerializeObject(item)}"); + }); + //var ses = query.SelectMany(t => t.se); + //var edis = query.SelectMany(t => t.edi); + + //hbpoSeEdis.ForEach(hbpoSeEdi => + //{ + // Debug.WriteLine($"{hbpoSeEdi.Id}"); + //}); + + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index f27191dc..80296cbf 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -1102,7 +1102,6 @@ namespace Win.Sfs.SettleAccount .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); CreateMap(); - CreateMap(); CreateMap(); CreateMap(); CreateMap();