From dcbe7e9199411f9a444830ebf873f278da60edbc Mon Sep 17 00:00:00 2001 From: mahao Date: Mon, 14 Aug 2023 11:34:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E7=AE=97=E4=BB=8E=E8=A1=A8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettleAccount.HttpApi.Host/Startup.cs | 4 +- .../Entities/BQ/Dtos/BBAC_SA_DTO.cs | 106 +++++++++++- .../Entities/BQ/Dtos/HBPO_SA_DTO.cs | 104 ++++++++++++ .../Entities/BQ/Dtos/PUB_SA_DTO.cs | 158 +++++++++++++++++- .../Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs | 91 +++++++++- .../Entities/BQ/BBAC_SA_SERVICE.cs | 15 +- .../Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs | 91 +++++++++- .../Entities/BQ/HBPO_SA_SERVICE.cs | 34 ++-- .../Entities/BQ/PUB_SA_DETAIL_SERVICE.cs | 15 ++ .../Entities/BQ/PUB_SA_SERVICE.cs | 86 +++++----- .../Entities/BQ/Syncs/BBACSeSyncAppService.cs | 36 ++-- .../Entities/BQ/Syncs/HBPOSeSyncAppService.cs | 117 ++++++++----- .../BQ/Syncs/JisBBACSeEdiCompareAppService.cs | 50 +++++- .../BQ/Syncs/JisHBPOSeEdiCompareAppService.cs | 24 ++- .../Entities/BQ/Syncs/JitSeSyncAppService.cs | 19 +++ ...ttleAccountApplicationAutoMapperProfile.cs | 156 +++++++++++------ .../Entities/BQ/BBAC_SE_DETAIL.cs | 13 +- .../Entities/BQ/BBAC_SE_EDI.cs | 6 + .../Entities/BQ/HBPO_SE_EDI.cs | 6 + 19 files changed, 930 insertions(+), 201 deletions(-) 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 71c6ceb6..93e27e85 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.AddSingleton(); services.AddSignalR(o => o.EnableDetailedErrors = true); JobHostdService.AddService(services); @@ -57,7 +58,8 @@ public class Startup app.UseEndpoints(endpoints => endpoints.MapHub("/api/hub")); app.ApplicationServices.UseScheduler(scheduler => { - scheduler.Schedule().EverySeconds(10); + scheduler.Schedule().EverySeconds(10); + //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/BBAC_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs index 85ece7d0..9e0cfe70 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 @@ -53,6 +53,49 @@ public class BBAC_SA_DTO : EntityDto public EnumBusinessType BusinessType { get; set; } } +/// +/// BBAC结算明细 +/// +public class BBAC_SA_DETAIL_DTO : EntityDto +{ + /// + /// 结算单 + /// + public string BillNum { set; get; } + /// + /// 期间 + /// + public int Version { set; get; } + /// + /// 结算分组号 + /// + public string GroupNum { get; set; } + /// + /// 生产号 + /// + public string PN { get; set; } + /// + /// 客户物料号 + /// + public string LU { get; set; } + /// + /// 数量 + /// + public string Qty { get; set; } + /// + /// 结算日期 + /// + public DateTime SettleDate { set; get; } + /// + /// 单价 + /// + public decimal Price { set; get; } + /// + /// 厂内物料号 + /// + public string PartCode { get; set; } +} + /// /// BBAC结算明细导入 /// @@ -79,7 +122,7 @@ public class BBAC_SA_DETAIL_IMPORT_DTO [Display(Name = "Material")] [Required(ErrorMessage = "{0}不能为空")] [ImporterHeader(Name = "Material")] - public string PartCode { get; set; } + public string LU { get; set; } /// /// 数量 @@ -96,3 +139,64 @@ public class BBAC_SA_DETAIL_IMPORT_DTO [ImporterHeader(Name = "External Call Number")] public string PN { get; set; } } + +/// +/// 结算明细导出请求 +/// +public class BBAC_SA_DETAIL_EXPORT_REQUEST_DTO +{ + /// + /// 结算单号 + /// + [Display(Name = "结算单号")] + [Required(ErrorMessage = "{0}不能为空")] + public string BillNum { set; get; } +} + +/// +/// 结算明细导出 +/// +public class BBAC_SA_DETAIL_EXPORT_DTO +{ + /// + /// 结算单号 + /// + [Display(Name = "结算单号")] + [ExporterHeader(DisplayName = "结算单号")] + public string BillNum { set; get; } + + /// + /// 结算日期 + /// + [Display(Name = "结算日期")] + [ExporterHeader(DisplayName = "结算日期")] + public DateTime SettleDate { set; get; } + + /// + /// 发货单号 + /// + [Display(Name = "发货单号")] + [ExporterHeader(DisplayName = "发货单号")] + public string PN { get; set; } + + /// + /// 零件号 + /// + [Display(Name = "零件号")] + [ExporterHeader(DisplayName = "零件号")] + public string LU { get; set; } + + /// + /// 数量 + /// + [Display(Name = "数量")] + [ExporterHeader(DisplayName = "数量")] + public decimal Qty { get; set; } + + /// + /// 结算分组 + /// + [Display(Name = "结算分组")] + [ExporterHeader(DisplayName = "结算分组")] + public string GroupNum { get; set; } +} 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 213832ce..bb31d34a 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 @@ -53,6 +53,49 @@ public class HBPO_SA_DTO : EntityDto public EnumBusinessType BusinessType { get; set; } } +/// +/// HBPO结算明细 +/// +public class HBPO_SA_DETAIL_DTO : EntityDto +{ + /// + /// 结算单 + /// + public string BillNum { set; get; } + /// + /// 期间 + /// + public int Version { set; get; } + /// + /// 结算分组号 + /// + public string GroupNum { get; set; } + /// + /// 生产号 + /// + public string PN { get; set; } + /// + /// 客户物料号 + /// + public string LU { get; set; } + /// + /// 数量 + /// + public string Qty { get; set; } + /// + /// 结算日期 + /// + public DateTime SettleDate { set; get; } + /// + /// 单价 + /// + public decimal Price { set; get; } + /// + /// 厂内物料号 + /// + public string PartCode { get; set; } +} + /// /// HBPO结算明细导入 /// @@ -112,3 +155,64 @@ public class HBPO_SA_DETAIL_IMPORT_DTO [ImporterHeader(Name = "productionNumber")] public string PN { get; set; } } + +/// +/// 结算明细导出请求 +/// +public class HBPO_SA_DETAIL_EXPORT_REQUEST_DTO +{ + /// + /// 结算单号 + /// + [Display(Name = "结算单号")] + [Required(ErrorMessage = "{0}不能为空")] + public string BillNum { set; get; } +} + +/// +/// 结算明细导出 +/// +public class HBPO_SA_DETAIL_EXPORT_DTO +{ + /// + /// 结算单号 + /// + [Display(Name = "结算单号")] + [ExporterHeader(DisplayName = "结算单号")] + public string BillNum { set; get; } + + /// + /// 结算日期 + /// + [Display(Name = "结算日期")] + [ExporterHeader(DisplayName = "结算日期")] + public DateTime SettleDate { set; get; } + + /// + /// 发货单号 + /// + [Display(Name = "发货单号")] + [ExporterHeader(DisplayName = "发货单号")] + public string PN { get; set; } + + /// + /// 零件号 + /// + [Display(Name = "零件号")] + [ExporterHeader(DisplayName = "零件号")] + public string LU { get; set; } + + /// + /// 数量 + /// + [Display(Name = "数量")] + [ExporterHeader(DisplayName = "数量")] + public decimal Qty { get; set; } + + /// + /// 结算分组 + /// + [Display(Name = "结算分组")] + [ExporterHeader(DisplayName = "结算分组")] + public string GroupNum { 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 e387b2f8..2fcd600e 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 @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http; using System; using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities.Auditing; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos { @@ -198,13 +199,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// /// 备件导入 /// - public class BeiJianImportDto + public class BeiJianImportDto : BeiJianExtraImportDto { /// /// 结算日期 /// [Display(Name = "结算日期")] - [ImporterHeader(IsIgnore = true)] + [ImporterHeader(Name = "开票日期")] public DateTime SettleDate { set; get; } /// @@ -237,6 +238,116 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos [ImporterHeader(Name = "凭证号")] [Required(ErrorMessage = "{0}不能为空")] public string GroupNum { get; set; } + + ///// + ///// 备件扩展 + ///// + //[Display(Name = "备件扩展")] + //public BeiJianExtraImportDto beiJianExtraImportDto { get; set; } + } + + /// + /// 备件扩展 + /// + public class BeiJianExtraImportDto + { + /// + /// 交货号 + /// + [Display(Name = "交货号")] + [ImporterHeader(Name = "交货号")] + public string DeliveryNumber { set; get; } + + /// + /// 发票号 + /// + [Display(Name = "发票号")] + [ImporterHeader(Name = "发票号")] + public string InvoiceNumber { set; get; } + + /// + /// 供应商代码 + /// + [Display(Name = "供应商代码")] + [ImporterHeader(Name = "供应商代码")] + public string VendorCode { set; get; } + + /// + /// 供应商名称 + /// + [Display(Name = "供应商名称")] + [ImporterHeader(Name = "供应商名称")] + public string VendorName { set; get; } + + /// + /// 采购订单号 + /// + [Display(Name = "采购订单号")] + [ImporterHeader(Name = "采购订单号")] + public string PurchaseOrderNumber { set; get; } + + /// + /// 交付索引号 + /// + [Display(Name = "交付索引号")] + [ImporterHeader(Name = "交付索引号")] + public string DeliveryIndexNumber { set; get; } + + /// + /// 零件名称 + /// + [Display(Name = "零件名称")] + [ImporterHeader(Name = "零件名称")] + public string PartName { set; get; } + + /// + /// 价格 + /// + [Display(Name = "价格")] + [ImporterHeader(Name = "价格")] + public decimal Price { set; get; } + + /// + /// 金额 + /// + [Display(Name = "金额")] + [ImporterHeader(Name = "金额")] + public decimal Amount { set; get; } + + /// + /// 税额 + /// + [Display(Name = "税额")] + [ImporterHeader(Name = "税额")] + public decimal Tallage { set; get; } + + /// + /// 价税合计 + /// + [Display(Name = "价税合计")] + [ImporterHeader(Name = "价税合计")] + public decimal Total { set; get; } + + /// + /// 协议编号 + /// + [Display(Name = "协议编号")] + [ImporterHeader(Name = "协议编号")] + public string ProtocolNumber { set; get; } + + /// + /// 备注 + /// + [Display(Name = "备注")] + [ImporterHeader(Name = "备注")] + public string Remark { set; get; } + + /// + /// 商品组 + /// + [Display(Name = "商品组")] + [ImporterHeader(Name = "商品组")] + public string CommodityGroup { set; get; } } /// @@ -283,6 +394,49 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public string GroupNum { get; set; } } + /// + /// PUB结算明细 + /// + public class PUB_SA_DETAIL_DTO : AuditedAggregateRoot + { + /// + /// 结算单 + /// + public string BillNum { set; get; } + /// + /// 期间 + /// + public int Version { set; get; } + /// + /// 结算分组号 + /// + public string GroupNum { get; set; } + /// + /// 生产号 + /// + public string PN { get; set; } + /// + /// 客户物料号 + /// + public string LU { get; set; } + /// + /// 数量 + /// + public string Qty { get; set; } + /// + /// 结算日期 + /// + public DateTime SettleDate { set; get; } + /// + /// 单价 + /// + public decimal Price { set; get; } + /// + /// 厂内物料号 + /// + public string PartCode { get; set; } + } + /// /// 结算明细导出请求 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs index a293d9ca..aacc4594 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs @@ -1,7 +1,22 @@ using System; +using System.Collections.Generic; +using System.LinqAsync; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using SettleAccount.Domain.BQ; +using Shouldly; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Caching; +using Win.Abp.Snowflakes; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; +using Win.Sfs.SettleAccount.Entities.TaskJobs; +using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.Shared.Filter; +using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ; @@ -10,8 +25,82 @@ namespace Win.Sfs.SettleAccount.Entities.BQ; /// [AllowAnonymous] [Route("api/settleaccount/[controller]/[action]")] -public class BBAC_SA_DETAIL_SERVICE +public class BBAC_SA_DETAIL_SERVICE : SettleAccountApplicationBase { + /// + /// BBAC结算明细仓储 + /// + private readonly INormalEfCoreRepository _bbacSaDetailRepository; + + /// + /// BBAC结算仓储 + /// + private readonly INormalEfCoreRepository _bbacSaRepository; + + /// + /// 任务服务 + /// + private readonly TaskJobService _taskJobService; + + /// + /// 构造 + /// + public BBAC_SA_DETAIL_SERVICE(INormalEfCoreRepository bbacSaDetailRepository, + INormalEfCoreRepository bbacSaRepository, + TaskJobService taskJobService, + IDistributedCache cache, + IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _bbacSaDetailRepository = bbacSaDetailRepository; + _bbacSaRepository = bbacSaRepository; + _taskJobService = taskJobService; + } + + #region 导出 + /// + /// 导出 + /// + [HttpPost] + public async Task ExportAsync(BBAC_SA_DETAIL_EXPORT_REQUEST_DTO input) + { + var pubSaEntity = await _bbacSaRepository.FirstOrDefaultAsync(t => t.BillNum == input.BillNum).ConfigureAwait(false); + if (pubSaEntity == null) + { + throw new UserFriendlyException($"导出失败,结算单号不存在!", "400"); + } + string fileName = $"JisBBAC的结算数据_{Guid.NewGuid()}.xlsx"; + List filters = new List(); + filters.Add(new FilterCondition("BillNum", input.BillNum, EnumFilterAction.Equal, EnumFilterLogic.And)); + + var entities = await _bbacSaDetailRepository.GetListByFilterAsync(filters).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entities); + + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false); + result.ShouldNotBeNull(); + + await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false); + return fileName; + } + #endregion + + #region CURD + /// + /// 获取列表 + /// + [HttpPost] + public async Task> GetListAsync(RequestDto input) + { + var entities = await _bbacSaDetailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); + var totalCount = await _bbacSaDetailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entities); + return new PagedResultDto(totalCount, dtos); + } + #endregion + #region 对比 /// /// BBAC结算与发运比对 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 3ff82dcf..7790624d 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 @@ -312,13 +312,13 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase bbacSaDetails.ForEach(bbacSaDetail => { - List partCodes = bbacSaDetail.PartCode.Split(" ").ToList(); - bbacSaDetail.PartCode = partCodes[0].Replace(" ", ""); - if (partCodes.Count > 1) + List lus = bbacSaDetail.LU.Split(" ").ToList(); + bbacSaDetail.LU = lus[0].Replace(" ", ""); + if (lus.Count > 1) { - partCodes.RemoveAt(0); - var partCodeAssemble = partCodes.Select(t => t.Replace(" ", "")); - bbacSaDetail.PartCode += partCodeAssemble.Aggregate(" ", (current, index) => current + index); + lus.RemoveAt(0); + var luAssemble = lus.Select(t => t.Replace(" ", "")); + bbacSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); } bbacSaDetail.BillNum = bbacSaBillNum; @@ -351,8 +351,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships); bbacSaDetails.ForEach(bbacSaDetail => { - bbacSaDetail.LU = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == bbacSaDetail.PartCode)?.ErpMaterialCode ?? bbacSaDetail.PartCode.Replace(" ", "-"); - bbacSaDetail.KeyCode = bbacSaDetail.PN + bbacSaDetail.LU; + bbacSaDetail.PartCode = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == bbacSaDetail.LU)?.ErpMaterialCode ?? bbacSaDetail.LU.Replace(" ", "-"); }); #endregion diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs index 9cd66ac4..5f5a472d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs @@ -1,7 +1,22 @@ using System; +using System.Collections.Generic; +using System.LinqAsync; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using SettleAccount.Domain.BQ; +using Shouldly; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Caching; +using Win.Abp.Snowflakes; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; +using Win.Sfs.SettleAccount.Entities.TaskJobs; +using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.Shared.Filter; +using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ; @@ -10,8 +25,82 @@ namespace Win.Sfs.SettleAccount.Entities.BQ; /// [AllowAnonymous] [Route("api/settleaccount/[controller]/[action]")] -public class HBPO_SA_DETAIL_SERVICE +public class HBPO_SA_DETAIL_SERVICE : SettleAccountApplicationBase { + /// + /// HBPO结算明细仓储 + /// + private readonly INormalEfCoreRepository _hbpoSaDetailRepository; + + /// + /// HBPO结算仓储 + /// + private readonly INormalEfCoreRepository _hbpoSaRepository; + + /// + /// 任务服务 + /// + private readonly TaskJobService _taskJobService; + + /// + /// 构造 + /// + public HBPO_SA_DETAIL_SERVICE(INormalEfCoreRepository hbpoSaDetailRepository, + INormalEfCoreRepository hbpoSaRepository, + TaskJobService taskJobService, + IDistributedCache cache, + IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _hbpoSaDetailRepository = hbpoSaDetailRepository; + _hbpoSaRepository = hbpoSaRepository; + _taskJobService = taskJobService; + } + + #region 导出 + /// + /// 导出 + /// + [HttpPost] + public async Task ExportAsync(HBPO_SA_DETAIL_EXPORT_REQUEST_DTO input) + { + var pubSaEntity = await _hbpoSaRepository.FirstOrDefaultAsync(t => t.BillNum == input.BillNum).ConfigureAwait(false); + if (pubSaEntity == null) + { + throw new UserFriendlyException($"导出失败,结算单号不存在!", "400"); + } + string fileName = $"JisHBPO的结算数据_{Guid.NewGuid()}.xlsx"; + List filters = new List(); + filters.Add(new FilterCondition("BillNum", input.BillNum, EnumFilterAction.Equal, EnumFilterLogic.And)); + + var entities = await _hbpoSaDetailRepository.GetListByFilterAsync(filters).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entities); + + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false); + result.ShouldNotBeNull(); + + await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false); + return fileName; + } + #endregion + + #region CURD + /// + /// 获取列表 + /// + [HttpPost] + public async Task> GetListAsync(RequestDto input) + { + var entities = await _hbpoSaDetailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); + var totalCount = await _hbpoSaDetailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entities); + return new PagedResultDto(totalCount, dtos); + } + #endregion + #region 对比 /// /// HBPO结算与发运比对 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 460565f6..c907cfe4 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 @@ -319,30 +319,31 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase #region 处理结算数据 //销售价格 - var priceListEntitys = await _priceListRepository.GetAllAsync(); + var priceListEntitys = await _priceListRepository.GetAllAsync().ConfigureAwait(false); hbpoSaDetails.ForEach(hbpoSaDetail => { - List partCodes = hbpoSaDetail.PartCode.Split(" ").ToList(); - hbpoSaDetail.PartCode = partCodes[0].Replace(" ", ""); - if (partCodes.Count > 1) + List lus = hbpoSaDetail.LU.Split(" ").ToList(); + hbpoSaDetail.LU = lus[0].Replace(" ", ""); + if (lus.Count > 1) { - partCodes.RemoveAt(0); - var partCodeAssemble = partCodes.Select(t => t.Replace(" ", "")); - hbpoSaDetail.PartCode += partCodeAssemble.Aggregate(" ", (current, index) => current + index); + lus.RemoveAt(0); + var luAssemble = lus.Select(t => t.Replace(" ", "")); + hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); } hbpoSaDetail.BillNum = hbpoSaBillNum; + hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU; //根据物料号、结算日期获取价格 - var priceListEntity = priceListEntitys.Find(t => t.LU == hbpoSaDetail.PartCode && hbpoSaDetail.SettleDate > t.BeginTime && hbpoSaDetail.SettleDate < t.EndTime); + var priceListEntity = priceListEntitys.Find(t => t.LU == hbpoSaDetail.LU && hbpoSaDetail.SettleDate > t.BeginTime && hbpoSaDetail.SettleDate < t.EndTime); hbpoSaDetail.Price = priceListEntity?.Price ?? default; hbpoSaDetail.BusinessType = _businessType; }); //导入的零件号集合 var importPubSaLUs = hbpoSaDetails.Select(t => t.LU).Distinct(); - var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)); + var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false); var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct(); /* @@ -361,8 +362,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase 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; + hbpoSaDetail.PartCode = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == hbpoSaDetail.LU)?.ErpMaterialCode ?? hbpoSaDetail.LU.Replace(" ", "-"); }); #endregion @@ -378,8 +378,8 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase #endregion #region 添加入库 - await _hbpoSaRepository.InsertAsync(hbpoSa); - await _hbpoSaDetailRepository.InsertManyAsync(hbpoSaDetails); + await _hbpoSaRepository.InsertAsync(hbpoSa).ConfigureAwait(false); + await _hbpoSaDetailRepository.InsertManyAsync(hbpoSaDetails).ConfigureAwait(false); if (hbpoCanSaDetails.Count > 0) { hbpoCanSa.InvGroupNum = hbpoCanSaDetails.Count.ToString(); @@ -389,8 +389,8 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase hbpoCanSaDetail.BusinessType = _businessType; }); - await _hbpoCanSaRepository.InsertAsync(hbpoCanSa); - await _hbpoCanSaDetailRepository.InsertManyAsync(hbpoCanSaDetails); + await _hbpoCanSaRepository.InsertAsync(hbpoCanSa).ConfigureAwait(false); + await _hbpoCanSaDetailRepository.InsertManyAsync(hbpoCanSaDetails).ConfigureAwait(false); } if (hbpoNotSaDetails.Count > 0) { @@ -399,11 +399,11 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase hbpoNotSaDetail.BusinessType = _businessType; }); - await _hbpoNotSaDetailRepository.InsertManyAsync(hbpoNotSaDetails); + await _hbpoNotSaDetailRepository.InsertManyAsync(hbpoNotSaDetails).ConfigureAwait(false); } if (materialRelationships.Count > 0) { - await _materialRelationshipRepository.InsertManyAsync(materialRelationships); + await _materialRelationshipRepository.InsertManyAsync(materialRelationships).ConfigureAwait(false); } #endregion } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs index c1c25efc..e73fa369 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs @@ -11,6 +11,7 @@ using SettleAccount.Job.Services.Report; using Shouldly; using TaskJob.EventArgs; using Volo.Abp; +using Volo.Abp.Application.Dtos; using Volo.Abp.Caching; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; @@ -99,6 +100,20 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase } #endregion + #region CURD + /// + /// 获取列表 + /// + [HttpPost] + public async Task> GetListAsync(RequestDto input) + { + var entities = await _pubSaDetailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); + var totalCount = await _pubSaDetailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entities); + return new PagedResultDto(totalCount, dtos); + } + #endregion + #region 对比 /// /// Pub结算与发运比对 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 372e884f..de1c8c62 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 @@ -125,21 +125,21 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase case EnumBusinessType.JisHBPO: break; case EnumBusinessType.ZhiGongJianBBAC: - result = await ImportZhiGongJianBBACAsync(pubSaImportRequestDto.Files); + result = await ImportZhiGongJianBBACAsync(pubSaImportRequestDto.Files).ConfigureAwait(false); break; case EnumBusinessType.ZhiGongJianHBPO: - result = await ImportZhiGongJianHBPOAsync(pubSaImportRequestDto.Files); + result = await ImportZhiGongJianHBPOAsync(pubSaImportRequestDto.Files).ConfigureAwait(false); break; case EnumBusinessType.MaiDanJianBBAC: break; case EnumBusinessType.MaiDanJianHBPO: - result = await ImportMaiDanJianHBPOAsync(pubSaImportRequestDto.Files); + result = await ImportMaiDanJianHBPOAsync(pubSaImportRequestDto.Files).ConfigureAwait(false); break; case EnumBusinessType.BeiJian: - result = await ImportBeiJianAsync(pubSaImportRequestDto.Files); + result = await ImportBeiJianAsync(pubSaImportRequestDto.Files).ConfigureAwait(false); break; case EnumBusinessType.YinDuJian: - result = await ImportYinDuJianAsync(pubSaImportRequestDto.Files); + result = await ImportYinDuJianAsync(pubSaImportRequestDto.Files).ConfigureAwait(false); break; default: break; @@ -285,20 +285,20 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase { #region 导入数据转换 ExportImporter _exportImporter = new ExportImporter(); - var importResults = await _exportImporter.UploadExcelImport(files, _excelImportService); + var importResults = await _exportImporter.UploadExcelImport(files, _excelImportService).ConfigureAwait(false); var importPubSaDetails = ObjectMapper.Map, List>(importResults); #endregion #region 数据校验 - var checkList = await CheckAsync(importPubSaDetails); + var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false); if (checkList.Count > 0) { - string fileName = await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); ; return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion - return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianBBAC); + return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianBBAC).ConfigureAwait(false); } /// @@ -308,7 +308,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase { #region 导入数据转换 ExportImporter _exportImporter = new ExportImporter(); - var importResults = await _exportImporter.UploadExcelImport(files, _excelImportService); + var importResults = await _exportImporter.UploadExcelImport(files, _excelImportService).ConfigureAwait(false); //截取结算分组前8位为结算日期 importResults.ForEach(importResult => @@ -328,7 +328,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase } #endregion - return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianHBPO); + return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianHBPO).ConfigureAwait(false); } /// @@ -338,7 +338,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase { #region 导入数据转换 ExportImporter _exportImporter = new ExportImporter(); - var importResults = await _exportImporter.UploadExcelImport(files, _excelImportService); + var importResults = await _exportImporter.UploadExcelImport(files, _excelImportService).ConfigureAwait(false); importResults.ForEach(importResult => { @@ -357,7 +357,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase } #endregion - return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian); + return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian).ConfigureAwait(false); } /// @@ -367,26 +367,20 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase { #region 导入数据转换 ExportImporter _exportImporter = new ExportImporter(); - var importResults = await _exportImporter.UploadExcelImport(files, _excelImportService); - - importResults.ForEach(importResult => - { - importResult.SettleDate = DateTime.Now; - }); - + var importResults = await _exportImporter.UploadExcelImport(files, _excelImportService).ConfigureAwait(false); var importPubSaDetails = ObjectMapper.Map, List>(importResults); #endregion #region 数据校验 - var checkList = await CheckAsync(importPubSaDetails); + var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false); if (checkList.Count > 0) { - string fileName = await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion - return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian); + return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian).ConfigureAwait(false); } /// @@ -401,15 +395,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase #endregion #region 数据校验 - var checkList = await CheckAsync(importPubSaDetails); + var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false); if (checkList.Count > 0) { - string fileName = await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion - return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.YinDuJian); + return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.YinDuJian).ConfigureAwait(false); } /// @@ -445,31 +439,32 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase #region 处理结算数据 //销售价格 - var priceListEntitys = await _priceListRepository.GetAllAsync(); + var priceListEntitys = await _priceListRepository.GetAllAsync().ConfigureAwait(false); pubSaDetails.ForEach(importPubSaDetail => { - List partCodes = importPubSaDetail.PartCode.Split(" ").ToList(); - importPubSaDetail.PartCode = partCodes[0].Replace(" ", ""); - if (partCodes.Count > 1) + List lus = importPubSaDetail.LU.Split(" ").ToList(); + importPubSaDetail.LU = lus[0].Replace(" ", ""); + if (lus.Count > 1) { - partCodes.RemoveAt(0); - var luAssemble = partCodes.Select(t => t.Replace(" ", "")); - importPubSaDetail.PartCode += luAssemble.Aggregate(" ", (current, index) => current + index); + lus.RemoveAt(0); + var luAssemble = lus.Select(t => t.Replace(" ", "")); + importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); } + importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU; importPubSaDetail.Version = _version; importPubSaDetail.BusinessType = businessType; importPubSaDetail.Site = "XX工厂"; //根据物料号、结算日期获取价格 - var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.PartCode && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime); + var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime); importPubSaDetail.Price = priceListEntity?.Price ?? 0; }); //导入的零件号集合 - var importPubSaPartCodes = pubSaDetails.Select(t => t.PartCode).Distinct(); - var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaPartCodes.Contains(t.SettleMaterialCode)); + var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct(); + var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false); ; var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct(); /* @@ -477,7 +472,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase * 转换为厂内零件号 * 转换规则6个空格替换成“-” */ - var noExistSettleMaterialCodes = importPubSaPartCodes.Except(materialRelationshipEntitySettleMaterialCodes); + var noExistSettleMaterialCodes = importPubSaLUs.Except(materialRelationshipEntitySettleMaterialCodes); noExistSettleMaterialCodes.ForEach(t => { @@ -488,16 +483,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase 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; + pubSaDetail.PartCode = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.LU)?.ErpMaterialCode ?? pubSaDetail.LU.Replace(" ", "-"); }); #endregion #region 添加入库 - await SeDataEntryAsync(pubSaDetails); + await SeDataEntryAsync(pubSaDetails).ConfigureAwait(false); if (materialRelationships.Count > 0) { - await _materialRelationshipRepository.InsertManyAsync(materialRelationships); + await _materialRelationshipRepository.InsertManyAsync(materialRelationships).ConfigureAwait(false); } #endregion @@ -586,13 +580,13 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase //不可结算 List pubNotSaDetails = new List(); - var pubSaEntity = await _repository.FirstOrDefaultAsync(t => t.Id.Equals(id)); + var pubSaEntity = await _repository.FirstOrDefaultAsync(t => t.Id.Equals(id)).ConfigureAwait(false); if (pubSaEntity != null) { //结算单据 string pubSaBillNum = pubSaEntity.BillNum; - pubCanSas = await _pubCanSaRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum); + pubCanSas = await _pubCanSaRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum).ConfigureAwait(false); //验证可结算主表状态 if (pubCanSas.Any() && pubCanSas.Any(t => t.State != SettleBillState.未结状态)) { @@ -600,9 +594,9 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase } pubSas.Add(pubSaEntity); - pubSaDetails = await _pubSaDetailRepository.GetListAsync(t => t.BillNum == pubSaBillNum); - pubCanSaDetails = await _pubCanSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum); - pubNotSaDetails = await _pubNotSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum); + pubSaDetails = await _pubSaDetailRepository.GetListAsync(t => t.BillNum == pubSaBillNum).ConfigureAwait(false); + pubCanSaDetails = await _pubCanSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum).ConfigureAwait(false); + pubNotSaDetails = await _pubNotSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum).ConfigureAwait(false); } return (pubSas, pubSaDetails, pubCanSas, pubCanSaDetails, pubNotSaDetails); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs index b38937f2..66125ae7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs @@ -70,13 +70,7 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService //同步表名称 var syncTableName = "JisBBACSeSync_Jit"; //BBAC类型集合 - var EnumDeliverSubBillTypes = new List - { - EnumDeliverSubBillType.保险杠BBAC, - EnumDeliverSubBillType.买单件保险杠BBAC, - EnumDeliverSubBillType.买单件小件BBAC, - EnumDeliverSubBillType.小件BBAC - }; + var EnumDeliverSubBillTypes = GetDeliverSubBillTypes(); Expression> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName); @@ -91,7 +85,11 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService var bbacSeDetails = ObjectMapper.Map, List>(wmsSeRecords); if (bbacSeDetails.Any()) { - bbacSeDetails.ForEach(bbacSeDetail => bbacSeDetail.KeyCode = bbacSeDetail.PN + bbacSeDetail.LU); + bbacSeDetails.ForEach(bbacSeDetail => + { + bbacSeDetail.KeyCode = bbacSeDetail.PN + bbacSeDetail.LU; + bbacSeDetail.BusinessType = EnumBusinessType.JisBBAC; + }); await _bbacSeDetailRepository.InsertManyAsync(bbacSeDetails); if (syncPositionFlag != null) @@ -119,13 +117,7 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService //同步表名称 var syncTableName = "JisBBACSeSync_Jis"; //BBAC类型集合 - var EnumDeliverSubBillTypes = new List - { - EnumDeliverSubBillType.保险杠BBAC, - EnumDeliverSubBillType.买单件保险杠BBAC, - EnumDeliverSubBillType.买单件小件BBAC, - EnumDeliverSubBillType.小件BBAC - }; + var EnumDeliverSubBillTypes = GetDeliverSubBillTypes(); Expression> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName); if (syncPositionFlag != null) @@ -158,4 +150,18 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService } } } + + /// + /// 获取BBAC类型集合 + /// + private List GetDeliverSubBillTypes() + { + return new List + { + EnumDeliverSubBillType.保险杠BBAC, + EnumDeliverSubBillType.买单件保险杠BBAC, + EnumDeliverSubBillType.买单件小件BBAC, + EnumDeliverSubBillType.小件BBAC + }; + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs index b1c1ca75..5934ffa8 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs @@ -37,30 +37,40 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService /// private readonly INormalEfCoreRepository _hbpoSeDetailRepository; + /// + /// PUB发运数据仓储 + /// + private readonly INormalEfCoreRepository _pubSeDetailRepository; + /// /// 构造 /// public HBPOSeSyncAppService( WMSBJBMPTDbContext wmsBJBMPTContext, INormalEfCoreRepository syncPositionFlagRepository, - INormalEfCoreRepository hbpoSeDetailRepository) + INormalEfCoreRepository hbpoSeDetailRepository, + INormalEfCoreRepository pubSeDetailRepository) { _wmsBJBMPTContext = wmsBJBMPTContext; _syncPositionFlagRepository = syncPositionFlagRepository; _hbpoSeDetailRepository = hbpoSeDetailRepository; + _pubSeDetailRepository = pubSeDetailRepository; } [ApiExplorerSettings(IgnoreApi = true)] public async Task Invoke(IServiceProvider serviceProvider) { - await this.Invoke(); + await this.Invoke().ConfigureAwait(false); } + /// + /// 执行 + /// [HttpPost] public async Task Invoke() { - await SyncJitRecordAsync(); - await SyncJisRecordAsync(); + await SyncJitRecordAsync().ConfigureAwait(false); + await SyncJisRecordAsync().ConfigureAwait(false); } /// @@ -71,42 +81,41 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService //同步表名称 var syncTableName = "JisHBPOSeSync_Jit"; //HBPO类型集合 - var EnumDeliverSubBillTypes = new List - { - EnumDeliverSubBillType.保险杠HBPO, - EnumDeliverSubBillType.买单件保险杠HBPO, - EnumDeliverSubBillType.买单件小件HBPO, - EnumDeliverSubBillType.小件HBPO - }; + var EnumDeliverSubBillTypes = GetDeliverSubBillTypes(); Expression> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); - var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName); + var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false); if (syncPositionFlag != null) { predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); } //WMS发运数据 - var wmsRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD.Where(predicate).OrderBy(b => b.UID).ToList(); - - var hbpoSeDetails = ObjectMapper.Map, List>(wmsRecords); - if (hbpoSeDetails.Any()) + var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD.Where(predicate).OrderBy(b => b.UID).ToList(); + if (wmsSeRecords.Any()) { - hbpoSeDetails.ForEach(hbpoSeDetail => hbpoSeDetail.KeyCode = hbpoSeDetail.PN + hbpoSeDetail.LU); - await _hbpoSeDetailRepository.InsertManyAsync(hbpoSeDetails); + //JisHBPO发运 + var hbpoWmsSeRecords = wmsSeRecords.FindAll(t => t.DeliverSubBillType == EnumDeliverSubBillType.保险杠HBPO || t.DeliverSubBillType == EnumDeliverSubBillType.小件HBPO); + //买单件HBPO发运 + var maiDanHBPOWmsSeRecords = wmsSeRecords.FindAll(t => t.DeliverSubBillType == EnumDeliverSubBillType.买单件保险杠HBPO || t.DeliverSubBillType == EnumDeliverSubBillType.买单件小件HBPO); + + var hbpoSeDetails = ObjectMapper.Map, List>(hbpoWmsSeRecords); + var maiDanHBPOSeDetails = ObjectMapper.Map, List>(maiDanHBPOWmsSeRecords); + + await SaveSeDataAsync(hbpoSeDetails, maiDanHBPOSeDetails).ConfigureAwait(false); if (syncPositionFlag != null) { - syncPositionFlag.Position = wmsRecords.Last().UID.ToString(); - await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag); + syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString(); + await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false); } else { syncPositionFlag = new SyncPositionFlag() { TableName = syncTableName, - Position = wmsRecords.Last().UID.ToString() + Position = wmsSeRecords.Last().UID.ToString() }; - await _syncPositionFlagRepository.InsertAsync(syncPositionFlag); + await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); ; } } } @@ -119,43 +128,71 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService //同步表名称 var syncTableName = "JisHBPOSeSync_Jis"; //BBAC类型集合 - var EnumDeliverSubBillTypes = new List - { - EnumDeliverSubBillType.保险杠BBAC, - EnumDeliverSubBillType.买单件保险杠BBAC, - EnumDeliverSubBillType.买单件小件BBAC, - EnumDeliverSubBillType.小件BBAC - }; + var EnumDeliverSubBillTypes = GetDeliverSubBillTypes(); Expression> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); - var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName); + var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false); if (syncPositionFlag != null) { predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); } //WMS发运数据 - var wmsRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD.Where(predicate).OrderBy(b => b.UID).ToList(); - - var hbpoSeDetails = ObjectMapper.Map, List>(wmsRecords); - if (hbpoSeDetails.Any()) + var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD.Where(predicate).OrderBy(b => b.UID).ToList(); + if (wmsSeRecords.Any()) { - hbpoSeDetails.ForEach(hbpoSeDetail => hbpoSeDetail.KeyCode = hbpoSeDetail.PN + hbpoSeDetail.LU); - await _hbpoSeDetailRepository.InsertManyAsync(hbpoSeDetails); + //JisHBPO发运 + var hbpoWmsSeRecords = wmsSeRecords.FindAll(t => t.DeliverSubBillType == EnumDeliverSubBillType.保险杠HBPO || t.DeliverSubBillType == EnumDeliverSubBillType.小件HBPO); + //买单件HBPO发运 + var maiDanHBPOWmsSeRecords = wmsSeRecords.FindAll(t => t.DeliverSubBillType == EnumDeliverSubBillType.买单件保险杠HBPO || t.DeliverSubBillType == EnumDeliverSubBillType.买单件小件HBPO); + + var hbpoSeDetails = ObjectMapper.Map, List>(hbpoWmsSeRecords); + var maiDanHBPOSeDetails = ObjectMapper.Map, List>(maiDanHBPOWmsSeRecords); + + await SaveSeDataAsync(hbpoSeDetails, maiDanHBPOSeDetails).ConfigureAwait(false); if (syncPositionFlag != null) { - syncPositionFlag.Position = wmsRecords.Last().UID.ToString(); - await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag); + syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString(); + await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false); } else { syncPositionFlag = new SyncPositionFlag() { TableName = syncTableName, - Position = wmsRecords.Last().UID.ToString() + Position = wmsSeRecords.Last().UID.ToString() }; - await _syncPositionFlagRepository.InsertAsync(syncPositionFlag); + await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); } } } + + /// + /// 获取HBPO类型集合 + /// + private List GetDeliverSubBillTypes() + { + return new List + { + EnumDeliverSubBillType.保险杠HBPO, + EnumDeliverSubBillType.买单件保险杠HBPO, + EnumDeliverSubBillType.买单件小件HBPO, + EnumDeliverSubBillType.小件HBPO + }; + } + + /// + /// 保存发运树 + /// + private async Task SaveSeDataAsync(List hbpoSeDetails, List maiDanHBPOSeDetails) + { + hbpoSeDetails.ForEach(hbpoSeDetail => hbpoSeDetail.KeyCode = hbpoSeDetail.PN + hbpoSeDetail.LU); + maiDanHBPOSeDetails.ForEach(maiDanHBPOSeDetail => + { + maiDanHBPOSeDetail.KeyCode = maiDanHBPOSeDetail.PN + maiDanHBPOSeDetail.LU; + maiDanHBPOSeDetail.BusinessType = EnumBusinessType.MaiDanJianHBPO; + }); + await _hbpoSeDetailRepository.InsertManyAsync(hbpoSeDetails).ConfigureAwait(false); + await _pubSeDetailRepository.InsertManyAsync(maiDanHBPOSeDetails).ConfigureAwait(false); + } } 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 314ed0a8..2b62a223 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 @@ -28,17 +28,49 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable /// public async Task Invoke() { + await HandDelEdiDataAsync().ConfigureAwait(false); + //using var serviceScope = _serviceProvider.CreateScope(); + //var db = serviceScope.ServiceProvider.GetRequiredService(); + //var query = db.Set().Join(db.Set(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false && t.edi.IsDeleted == false); + //query.ForEach(t => + //{ + // t.edi.SeId = t.se.Id; + // t.edi.IsHaveSeData = true; + // t.se.IsHaveEdiData = true; + //}); + //var ses = query.Select(t => t.se); + //var edis = query.Select(t => t.edi); + + //db.Set().UpdateRange(ses); + //db.Set().UpdateRange(edis); + //await db.SaveChangesAsync().ConfigureAwait(false); + } + + /// + /// 处理删除的EDI数据 + /// + private async Task HandDelEdiDataAsync() + { + /* + * 处理有发运数据状态是删除的数据 + * 获取对应的发运数据 + * 设置发运数据状态为无EDI数据 + * 设置EDI数据状态为无发运数据 + */ using var serviceScope = _serviceProvider.CreateScope(); var db = serviceScope.ServiceProvider.GetRequiredService(); - var query = db.Set().Join(db.Set(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false); - var ses = query.Select(t => t.se); - var edis = query.Select(t => t.edi); - - ses.ForEach(t => t.IsHaveEdiData = true); - edis.ForEach(t => t.IsHaveSeData = true); + var query = db.Set().Join(db.Set(), a => a.SeId, b => b.Id, (edi, se) => new { se, edi }).Where(t => t.edi.IsDeleted == true && t.edi.IsHaveSeData == true); + //query.ForEach(t => + //{ + // t.edi.SeId = default; + // t.edi.IsHaveSeData = false; + // t.se.IsHaveEdiData = false; + //}); + //var ses = query.Select(t => t.se); + //var edis = query.Select(t => t.edi); - db.Set().UpdateRange(ses); - db.Set().UpdateRange(edis); - await db.SaveChangesAsync().ConfigureAwait(false); + //db.Set().UpdateRange(ses); + //db.Set().UpdateRange(edis); + //await db.SaveChangesAsync().ConfigureAwait(false); } } 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 427fc39f..04fdd8f3 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 @@ -66,7 +66,7 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable // se, // edi // }; - var query = db.Set().Join(db.Set(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false); + var query = db.Set().Join(db.Set(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false && t.edi.IsDeleted == false); var ses = query.Select(t => t.se); var edis = query.Select(t => t.edi); @@ -79,4 +79,26 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable Debug.WriteLine($"处理数量:{query.Count()}"); } + + /// + /// 处理删除的EDI数据 + /// + private async Task HandDelEdiDataAsync() + { + using var serviceScope = _serviceProvider.CreateScope(); + var db = serviceScope.ServiceProvider.GetRequiredService(); + var query = db.Set().Join(db.Set(), a => a.SeId, b => b.Id, (edi, se) => new { se, edi }).Where(t => t.edi.IsDeleted == true && t.edi.IsHaveSeData == true); + query.ForEach(t => + { + t.edi.SeId = default; + t.edi.IsHaveSeData = false; + t.se.IsHaveEdiData = false; + }); + var ses = query.Select(t => t.se); + var edis = query.Select(t => t.edi); + + db.Set().UpdateRange(ses); + db.Set().UpdateRange(edis); + await db.SaveChangesAsync().ConfigureAwait(false); + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs index d06d4edb..81bf357d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs @@ -9,6 +9,7 @@ using SettleAccount.Domain.BQ; using Volo.Abp.Application.Services; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.EntityFrameworkCore; +using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; @@ -34,6 +35,11 @@ public class JitSeSyncAppService : ApplicationService, IInvocable /// private readonly INormalEfCoreRepository _pubSeDetailRepository; + /// + /// 客户零件关系仓储 + /// + private readonly INormalEfCoreRepository _materialRelationshipRepository; + private readonly IVmiService _vmiService; /// @@ -84,6 +90,19 @@ public class JitSeSyncAppService : ApplicationService, IInvocable var pubSeDetails = ObjectMapper.Map, List>(wmsSeRecords); if (pubSeDetails.Any()) { + //客户零件号和厂内零件号 + var luRePartCodes = pubSeDetails.Select(t => new { t.LU, t.PartCode }); + + var haveLuRePartCodes = (await _materialRelationshipRepository.GetListAsync(t => luRePartCodes.Contains(new { LU = t.ErpMaterialCode, PartCode = t.SettleMaterialCode })).ConfigureAwait(false)).Select(t => new { LU = t.ErpMaterialCode, PartCode = t.SettleMaterialCode }); + + var noHaveLuRePartCodes = luRePartCodes.Except(haveLuRePartCodes); + + if (noHaveLuRePartCodes.Any()) + { + var materialRelationships = noHaveLuRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.PartCode, "")); + await _materialRelationshipRepository.InsertManyAsync(materialRelationships).ConfigureAwait(false); + } + pubSeDetails.ForEach(t => { t.BusinessType = businessType; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index 80296cbf..7cd9b1af 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -1,65 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Reflection; using AutoMapper; -using Win.Sfs.SettleAccount.EstimatedStockDiffReports; +using Newtonsoft.Json; +using SettleAccount.Domain.BQ; using Win.Sfs.SettleAccount.Boms; +using Win.Sfs.SettleAccount.BTNotConsignReports; +using Win.Sfs.SettleAccount.BTSeqKBDiffReports; +using Win.Sfs.SettleAccount.Entities; using Win.Sfs.SettleAccount.Entities.Boms; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos.SettleAccount.Domain.BQ; +using Win.Sfs.SettleAccount.Entities.BQ.Syncs; using Win.Sfs.SettleAccount.Entities.CodeSettings; -using Win.Sfs.SettleAccount.FISes; -using Win.Sfs.SettleAccount.Entities.Materials; -using Win.Sfs.SettleAccount.Entities.SettleAccounts; - -using Win.Sfs.SettleAccount.Inventories; -using Win.Sfs.SettleAccount.Items; -using Win.Sfs.SettleAccount.MaterialRelationships; -using Win.Sfs.SettleAccount.Entities.SettleAccountVersion; - -using Win.Sfs.SettleAccount.Prebatches; using Win.Sfs.SettleAccount.Entities.Controls; -using Win.Sfs.SettleAccount.SendUnsettledDiffReports; -using Win.Sfs.SettleAccount.StockSettledDiffReports; -using Win.Sfs.SettleAccount.StockUnsettledDiffReports; -using Win.Sfs.SettleAccount.StockFisDiffReports; -using Win.Sfs.SettleAccount.SecondaryActuralAdjustmentReports; -using Win.Sfs.SettleAccount.SecondaryActuralDiffReports; -using Win.Sfs.SettleAccount.Entities.StorageLocations; -using Win.Sfs.SettleAccount.Entities.Inventories; -using Win.Sfs.SettleAccount.Entities.InventoryDetialVersion; +using Win.Sfs.SettleAccount.Entities.Errors; using Win.Sfs.SettleAccount.Entities.Factories; -using Win.Sfs.SettleAccount.SecondaryExportReports; -using System; -using Win.Sfs.SettleAccount.SupplierItemSetUps; - -using Win.Sfs.SettleAccount.BTSeqKBDiffReports; -using Win.Sfs.SettleAccount.BTNotConsignReports; - - -using Win.Sfs.SettleAccount.HQNotConsignReports; -using Win.Sfs.SettleAccount.HQSPNotConsignReports; -using Win.Sfs.SettleAccount.Reports.SendUnsettledDiffReports; -using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.ImportColumnMaps; +using Win.Sfs.SettleAccount.Entities.ImportMap; +using Win.Sfs.SettleAccount.Entities.Inventories; +using Win.Sfs.SettleAccount.Entities.InventoryDetialVersion; using Win.Sfs.SettleAccount.Entities.Invoices; using Win.Sfs.SettleAccount.Entities.Invoices.Win.Sfs.SettleAccount.Entities.Invoices; -using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; -using Win.Sfs.SettleAccount.Entities.Prices; -using Win.Sfs.SettleAccount.Entities.MaterialRelationships; -using Win.Sfs.SettleAccount.Entities.SettlementParts; using Win.Sfs.SettleAccount.Entities.ItemInvoicePrices; -using Win.Sfs.SettleAccount.Entities.SettlementPartss; -using Win.Sfs.SettleAccount.Entities.SettlementPakAndSparePartss; +using Win.Sfs.SettleAccount.Entities.MaterialRelationships; +using Win.Sfs.SettleAccount.Entities.Materials; +using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.SecMatch; -using Win.Sfs.SettleAccount.Entities.VWKanBan; -using Win.Sfs.SettleAccount.Entities.VWKanBanVersion; -using Win.Sfs.SettleAccount.Entities; +using Win.Sfs.SettleAccount.Entities.SettleAccounts; +using Win.Sfs.SettleAccount.Entities.SettleAccountVersion; +using Win.Sfs.SettleAccount.Entities.SettlementParts; +using Win.Sfs.SettleAccount.Entities.StorageLocations; using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts; using Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput; using Win.Sfs.SettleAccount.Errors; -using Win.Sfs.SettleAccount.Entities.Errors; -using Win.Sfs.SettleAccount.Entities.BQ.Dtos; -using SettleAccount.Domain.BQ; -using System.ComponentModel.DataAnnotations; -using System.Reflection; -using Win.Sfs.SettleAccount.Entities.BQ.Syncs; -using Win.Sfs.SettleAccount.Entities.BQ.Dtos.SettleAccount.Domain.BQ; +using Win.Sfs.SettleAccount.EstimatedStockDiffReports; +using Win.Sfs.SettleAccount.FISes; +using Win.Sfs.SettleAccount.HQNotConsignReports; +using Win.Sfs.SettleAccount.HQSPNotConsignReports; +using Win.Sfs.SettleAccount.Inventories; +using Win.Sfs.SettleAccount.MaterialRelationships; +using Win.Sfs.SettleAccount.Prebatches; +using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; +using Win.Sfs.SettleAccount.Reports.SendUnsettledDiffReports; +using Win.Sfs.SettleAccount.SecondaryActuralAdjustmentReports; +using Win.Sfs.SettleAccount.SecondaryActuralDiffReports; +using Win.Sfs.SettleAccount.SecondaryExportReports; +using Win.Sfs.SettleAccount.SendUnsettledDiffReports; +using Win.Sfs.SettleAccount.StockFisDiffReports; +using Win.Sfs.SettleAccount.StockSettledDiffReports; +using Win.Sfs.SettleAccount.StockUnsettledDiffReports; +using Win.Sfs.SettleAccount.SupplierItemSetUps; namespace Win.Sfs.SettleAccount { @@ -344,7 +336,7 @@ namespace Win.Sfs.SettleAccount CreateMap().ReverseMap(); CreateMap().ReverseMap(); //CreateMap().ReverseMap(); - + } private void CreateMapHBPO_PD_DETAIL() @@ -360,7 +352,7 @@ namespace Win.Sfs.SettleAccount CreateMap().ReverseMap(); CreateMap().ReverseMap(); //CreateMap().ReverseMap(); - + } private void CreateMapPUB_PD_DETAIL() @@ -1025,13 +1017,14 @@ namespace Win.Sfs.SettleAccount /// private void CreateMapBBAC_SA_DETAIL() { + CreateMap(); CreateMap() .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); CreateMap() .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); + CreateMap(); CreateMap(); - CreateMap(); } /// @@ -1065,11 +1058,12 @@ namespace Win.Sfs.SettleAccount /// private void CreateMapHBPO_SA_DETAIL() { + CreateMap(); CreateMap() .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); CreateMap() .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); - //CreateMap(); + CreateMap(); CreateMap(); } @@ -1096,6 +1090,8 @@ namespace Win.Sfs.SettleAccount /// private void CreateMapPUB_SA_DETAIL() { + + CreateMap(); CreateMap() .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); CreateMap() @@ -1105,7 +1101,25 @@ namespace Win.Sfs.SettleAccount CreateMap(); CreateMap(); CreateMap(); - CreateMap(); + CreateMap() + .ForMember(x => x.ExtraProperties, y => y.MapFrom(d => + new Dictionary() + { + { "DeliveryNumber", d.DeliveryNumber}, + { "InvoiceNumber", d.InvoiceNumber}, + { "VendorCode", d.VendorCode}, + { "VendorName", d.VendorName}, + { "PurchaseOrderNumber", d.PurchaseOrderNumber}, + { "DeliveryIndexNumber", d.DeliveryIndexNumber}, + { "PartName", d.PartName}, + { "Price", d.Price}, + { "Amount", d.Amount}, + { "Tallage", d.Tallage}, + { "Total", d.Total}, + { "ProtocolNumber", d.ProtocolNumber}, + { "Remark", d.Remark}, + { "CommodityGroup", d.CommodityGroup} + })); CreateMap(); } @@ -1114,6 +1128,16 @@ namespace Win.Sfs.SettleAccount /// private void CreateMapSeSync() { + CreateMap() + .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum)) + .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode)) + .ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.DeliverCode)) + .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum)) + .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) + .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) + .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); CreateMap() .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum)) .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode)) @@ -1124,7 +1148,24 @@ namespace Win.Sfs.SettleAccount .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); - + CreateMap() + .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum)) + .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) + .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) + .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); + + CreateMap() + .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum)) + .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode)) + .ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.DeliverCode)) + .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum)) + .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) + .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) + .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); CreateMap() .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum)) .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode)) @@ -1135,6 +1176,13 @@ namespace Win.Sfs.SettleAccount .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); + CreateMap() + .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum)) + .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) + .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) + .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); CreateMap() .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.DnBillTime)) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs index 3ecc0cde..8e7ca83d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs @@ -1,16 +1,19 @@ -using SettleAccount.Bases; using System; -using System.ComponentModel; using System.ComponentModel.DataAnnotations; - - - +using SettleAccount.Bases; +using Win.Sfs.SettleAccount; namespace SettleAccount.Domain.BQ; [Display(Name = "BBAC发运单")] public class BBAC_SE_DETAIL:SE_BASE { + /// + /// 业务分类 + /// + [Display(Name = "业务分类")] + public EnumBusinessType BusinessType { get; set; } + //[Display(Name = "LU+生产码")] //public string KeyCode { get; set; } = null!; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs index b152d1ad..fa96e418 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs @@ -50,6 +50,12 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot [Display(Name = "是否有发运数据")] public bool IsHaveSeData { get; set; } + /// + /// 发运Id + /// + [Display(Name = "是否有发运数据")] + public Guid SeId { get; set; } + public BBAC_SE_EDI() { } public BBAC_SE_EDI(Guid guid, string keyCode, string version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs index cf20f14d..e5979e91 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs @@ -53,6 +53,12 @@ public class HBPO_SE_EDI :FullAuditedAggregateRoot [Display(Name = "是否有发运数据")] public bool IsHaveSeData { get; set; } + /// + /// 发运Id + /// + [Display(Name = "是否有发运数据")] + public Guid SeId { get; set; } + public HBPO_SE_EDI(Guid guid ,string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, string site, string extend1, string extend2, string extend3, string extend4) { Id = guid;