From f5e00e77b0cafb411ea079b7019ae5dc7c2d0672 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Sat, 3 Aug 2024 18:13:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8D=95=E6=AF=94=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Method/BookingSlot/BookingSlotService.cs | 19 ++- .../DS.WMS.Core/Sys/Method/SysFileService.cs | 10 +- .../Dtos/Mapper/AddTaskPlatMapsterSetup.cs | 27 ++++ .../Method/Draft/TaskDraftCompareService.cs | 124 +++++++++++++++--- .../TaskShippingOrderCompareService.cs | 8 +- .../TaskPlat/Method/TaskManageBCService.cs | 71 ++++++---- .../DS.WMS.TaskApi/appsettings.json | 4 + 7 files changed, 204 insertions(+), 59 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs index 0c5e7b24..3804d77a 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs @@ -937,13 +937,22 @@ namespace DS.WMS.Core.Op.Method { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var taskBcInfo = await tenantDb.Queryable().Where(x => x.Id == taskBcId).FirstAsync(); - if (taskBcInfo != null && taskBcInfo.BOOKING_SLOT_ID == null) + if (taskBcInfo != null) { - taskBcInfo.BOOKING_SLOT_ID = rlt.Data.Id; - await tenantDb.Updateable(taskBcInfo).UpdateColumns(x => new + if(taskBcInfo.BOOKING_SLOT_ID == null) { - x.BOOKING_SLOT_ID - }).ExecuteCommandAsync(); + taskBcInfo.BOOKING_SLOT_ID = rlt.Data.Id; + await tenantDb.Updateable(taskBcInfo).UpdateColumns(x => new + { + x.BOOKING_SLOT_ID + }).ExecuteCommandAsync(); + } + + var taskBaseInfo = await tenantDb.Queryable().Where(x => x.Id == taskBcInfo.TASK_ID).FirstAsync(); + if (taskBaseInfo.IS_PUBLIC == 1) + { + + } } } return rlt; diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/SysFileService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/SysFileService.cs index 8017a8a8..2a847cf3 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/SysFileService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/SysFileService.cs @@ -206,11 +206,11 @@ namespace DS.WMS.Core.Sys.Method string relativePath = AppSetting.app(new string[] { "FileSettings", "RelativePath" }); - if (!string.IsNullOrWhiteSpace(attachFileType)) - relativePath += $"\\{attachFileType}"; + //if (!string.IsNullOrWhiteSpace(attachFileType)) + // relativePath += $"\\{attachFileType}"; - if (!string.IsNullOrWhiteSpace(fileDictKey)) - relativePath += $"\\{fileDictKey}"; + //if (!string.IsNullOrWhiteSpace(fileDictKey)) + // relativePath += $"\\{fileDictKey}"; string? dirAbs; if (string.IsNullOrEmpty(fileRoot)) @@ -294,7 +294,7 @@ namespace DS.WMS.Core.Sys.Method // bookFilePath = System.Text.RegularExpressions.Regex.Match(fileFullName, relativePath.Replace("\\", "\\\\") + ".*").Value; //} - return DataResult>.Success(new Tuple(fileAbsPath, fileSaveName, Path.GetFileName(sourceFilePath),fileSize)); + return DataResult>.Success(new Tuple(fileAbsPath, fileSaveName, Path.GetFileName(fileAbsPath),fileSize)); } #endregion } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/Mapper/AddTaskPlatMapsterSetup.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/Mapper/AddTaskPlatMapsterSetup.cs index bd23e748..d382097d 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/Mapper/AddTaskPlatMapsterSetup.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/Mapper/AddTaskPlatMapsterSetup.cs @@ -433,6 +433,33 @@ namespace DS.WMS.Core.TaskPlat.Dtos.Mapper .Map(dest => dest.CBM, src => src.CBM) .Map(dest => dest.CtnNum, src => src.CtnNum); } + + { + TypeAdapterConfig.NewConfig().TwoWays() + .Map(dest => dest.BookingNo, src => src.BookingNo) + //.Map(dest => dest.YardCode, src => src.YARDID) + .Map(dest => dest.YardCName, src => src.Yard) + .Map(dest => dest.VesselName, src => src.Vessel) + .Map(dest => dest.VoyNo, src => src.Voyno) + .Map(dest => dest.MasterBlNo, src => src.MBLNO) + .Map(dest => dest.HouseBlNo, src => src.HBLNO) + //.Map(dest => dest.PortLoadId, src => src.PORTLOADID) + .Map(dest => dest.PortLoad, src => src.LoadPort) + //.Map(dest => dest.PortDischargeId, src => src.PORTDISCHARGEID) + .Map(dest => dest.PortDischarge, src => src.DischargePort) + //.Map(dest => dest.TransportId, src => src.TRANSPORTID) + .Map(dest => dest.Transport, src => src.TransPort) + //.Map(dest => dest.PlaceDeliveryId, src => src.PLACEDELIVERYID) + .Map(dest => dest.PlaceDelivery, src => src.DeliveryPlace) + //.Map(dest => dest.DestinationId, src => src.DESTINATIONID) + .Map(dest => dest.Destination, src => src.Destination) + .Map(dest => dest.PKGs, src => src.PKGS) + .Map(dest => dest.KGs, src => src.KGS) + .Map(dest => dest.CBM, src => src.CBM) + .Map(dest => dest.GoodsDescription, src => src.Description) + .Map(dest => dest.KindPKGs, src => src.KindPkgs); + + } } } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/Draft/TaskDraftCompareService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/Draft/TaskDraftCompareService.cs index 14c3f8bc..ef55c5c7 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/Draft/TaskDraftCompareService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/Draft/TaskDraftCompareService.cs @@ -31,6 +31,8 @@ using Microsoft.Extensions.DependencyInjection; using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.Sys.Method; using NPOI.HPSF; +using DS.WMS.Core.Code.Interface; +using DS.WMS.Core.Map.Interface; namespace DS.WMS.Core.TaskPlat.Method { @@ -42,6 +44,9 @@ namespace DS.WMS.Core.TaskPlat.Method private readonly ISaasDbService saasService; private readonly IDjyServiceStatusService _djyServiceStatusService; private readonly ISysFileService _sysFileService; + private readonly IMappingYardService _mappingYardService; + private readonly IMappingCarrierService _mappingCarrierService; + private readonly ICodePortService _codePortService; private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); @@ -52,6 +57,9 @@ namespace DS.WMS.Core.TaskPlat.Method const string CONST_DRAFT_FILE_CODE = "draft"; const string CONST_DRAFT_FILE_NAME = "格式单"; + const string CONST_MAPPING_YARD_MODULE = "BillTrace"; + const string CONST_MAPPING_CARRIER_MODULE = "CarrierBaseMapping"; + public TaskDraftCompareService(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; @@ -60,6 +68,9 @@ namespace DS.WMS.Core.TaskPlat.Method saasService = _serviceProvider.GetRequiredService(); _djyServiceStatusService = _serviceProvider.GetRequiredService(); _sysFileService = _serviceProvider.GetRequiredService(); + _mappingYardService = _serviceProvider.GetRequiredService(); + _mappingCarrierService = _serviceProvider.GetRequiredService(); + _codePortService = _serviceProvider.GetRequiredService(); draftReadUrl = AppSetting.app(new string[] { "DraftCompare", "ReadUrl" }); draftCompareUrl = AppSetting.app(new string[] { "DraftCompare", "Url" }); @@ -113,7 +124,7 @@ namespace DS.WMS.Core.TaskPlat.Method var fileRlt = await _sysFileService.SaveFileDirect(model.Head.GID, file.ToByteArray(), batchNo, file.FileName, "bcfiles"); - var fileFullName = fileRlt.Data.Item2; + var fileFullName = fileRlt.Data.Item1; //附件暂存 //var fileFullName = "";//await FileAttachHelper.TempSaveWebFile(model.Head.GID, file, batchNo, CONST_DRAFT_FILE_CODE); @@ -166,7 +177,7 @@ namespace DS.WMS.Core.TaskPlat.Method throw new Exception($"请求Draft文件解析未获取到有效提单号"); } - var bookingOrder = tenantDb.Queryable().First(a => a.MBLNO.Equals(billNo) && a.OrgId == 1750335875591573504); + var bookingOrder = tenantDb.Queryable().First(a => a.MBLNO.Equals(billNo)); if (bookingOrder == null) { @@ -197,6 +208,42 @@ namespace DS.WMS.Core.TaskPlat.Method //请求格式单比对接口 var mainInfo = bookingOrder.Adapt(); + //这里需要对场站进行映射翻译 + var mapYardList = _mappingYardService.GetAllList().GetAwaiter().GetResult().Data; + + if (mapYardList.Count > 0) + mapYardList = mapYardList.Where(a => a.Module.Equals(CONST_MAPPING_YARD_MODULE, StringComparison.OrdinalIgnoreCase)).ToList(); + + if (mapYardList.Any(a => a.LinkId == bookingOrder.YardId)) + { + mainInfo.YardCode = mapYardList.FirstOrDefault(a => a.LinkId == bookingOrder.YardId).MapCode; + } + + var codePortList = _codePortService.GetAllList().GetAwaiter().GetResult().Data; + + if (codePortList.Any(a => a.Id == bookingOrder.LoadPortId)) + mainInfo.PortLoadId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.LoadPortId).EdiCode; + + if (codePortList.Any(a => a.Id == bookingOrder.DischargePortId)) + mainInfo.PortDischargeId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DischargePortId).EdiCode; + + if (codePortList.Any(a => a.Id == bookingOrder.DeliveryPlaceId)) + mainInfo.PlaceDeliveryId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DeliveryPlaceId).EdiCode; + + if (codePortList.Any(a => a.Id == bookingOrder.DestinationId)) + mainInfo.DestinationId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DestinationId).EdiCode; + + + //var mapCarrierList = _mappingCarrierService.GetAllList().GetAwaiter().GetResult().Data; + + //if (mapCarrierList.Count > 0) + // mapCarrierList = mapCarrierList.Where(a => a.Module.Equals(CONST_MAPPING_CARRIER_MODULE, StringComparison.OrdinalIgnoreCase)).ToList(); + + //if (mapYardList.Any(a => a.LinkId == bookingOrder.CarrierId)) + //{ + // mainInfo.CarrierCode = mapYardList.FirstOrDefault(a => a.LinkId == model.CarrierId).MapCode; + //} + //var userInfo = _sysUserRepository.AsQueryable().First(a => a.Id == bookingOrder.CreatedUserId); mainInfo.BusiPKId = bookingOrder.Id.ToString(); @@ -273,10 +320,10 @@ namespace DS.WMS.Core.TaskPlat.Method Logger.Log(NLog.LogLevel.Info, "批次={no} 推送状态 HDGSD-核对格式单 id={id}", batchNo, bookingOrder.Id); } - ////如果确认文件读取成功 + //如果确认文件读取成功 var bookFilePath = await _sysFileService.MoveFile(bookingOrder.Id.ToString(), fileFullName, batchNo, false, "draftfiles"); - ////将格式单附件写入订舱的附件 + //将格式单附件写入订舱的附件 await SaveEDIFile(bookingOrder.Id, bookFilePath.Data.Item2, new System.IO.FileInfo(fileFullName).Name, long.Parse(user.TenantId), bookFilePath.Data.Item4, CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME); @@ -530,7 +577,6 @@ namespace DS.WMS.Core.TaskPlat.Method /// /// 订舱主键 /// 返回回执 - [HttpPost("/TaskDraftCompare/GetDraftCompareResultInfo")] public async Task GetDraftCompareResultInfo([FromQuery] long bookingId) { string batchNo = GuidHelper.GetSnowflakeId(); @@ -661,7 +707,6 @@ namespace DS.WMS.Core.TaskPlat.Method /// 请求附件文件 /// 邮件Draft比对请求报文 /// 返回回执 - [AllowAnonymous, HttpPost("/TaskDraftCompare/ExcuteEmailAttachedSheetDraftCompare"), ApiUser(ApiCode = "BCTaskManage")] public async Task ExcuteEmailAttachedSheetDraftCompareAsync(IFormFile file, IFormFile fileAttach, string jsonData) { string batchNo = GuidHelper.GetSnowflakeId(); @@ -700,14 +745,17 @@ namespace DS.WMS.Core.TaskPlat.Method } }; + var fileRlt = await _sysFileService.SaveFileDirect(model.Head.GID, file.ToByteArray(), batchNo, file.FileName, "bcfiles"); + + var fileFullName = fileRlt.Data.Item1; //附件暂存 - var fileFullName = "";//await FileAttachHelper.TempSaveWebFile(model.Head.GID, file, batchNo, CONST_DRAFT_FILE_CODE); string fileAttchedFullName = string.Empty; if (fileAttach != null) { - //fileAttchedFullName = await FileAttachHelper.TempSaveWebFile(model.Head.GID, fileAttach, batchNo, CONST_DRAFT_FILE_CODE); + var fileAttachRlt = await _sysFileService.SaveFileDirect(model.Head.GID, fileAttach.ToByteArray(), batchNo, file.FileName, "bcfiles"); + fileAttchedFullName = fileAttachRlt.Data.Item1; } //Draft文件解析 NameValueCollection par = new NameValueCollection(); @@ -811,6 +859,31 @@ namespace DS.WMS.Core.TaskPlat.Method //var userInfo = _sysUserRepository.AsQueryable().First(a => a.Id == bookingOrder.CreatedUserId); + //这里需要对场站进行映射翻译 + var mapYardList = _mappingYardService.GetAllList().GetAwaiter().GetResult().Data; + + if (mapYardList.Count > 0) + mapYardList = mapYardList.Where(a => a.Module.Equals(CONST_MAPPING_YARD_MODULE, StringComparison.OrdinalIgnoreCase)).ToList(); + + if (mapYardList.Any(a => a.LinkId == bookingOrder.YardId)) + { + mainInfo.YardCode = mapYardList.FirstOrDefault(a => a.LinkId == bookingOrder.YardId).MapCode; + } + + var codePortList = _codePortService.GetAllList().GetAwaiter().GetResult().Data; + + if (codePortList.Any(a => a.Id == bookingOrder.LoadPortId)) + mainInfo.PortLoadId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.LoadPortId).EdiCode; + + if (codePortList.Any(a => a.Id == bookingOrder.DischargePortId)) + mainInfo.PortDischargeId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DischargePortId).EdiCode; + + if (codePortList.Any(a => a.Id == bookingOrder.DeliveryPlaceId)) + mainInfo.PlaceDeliveryId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DeliveryPlaceId).EdiCode; + + if (codePortList.Any(a => a.Id == bookingOrder.DestinationId)) + mainInfo.DestinationId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DestinationId).EdiCode; + mainInfo.BusiPKId = bookingOrder.Id.ToString(); mainInfo.UserId = user.UserId; mainInfo.UserName = user.UserName; @@ -869,25 +942,38 @@ namespace DS.WMS.Core.TaskPlat.Method //推送状态 HDGSD-核对格式单 //await _bookingOrderService.SetGoodsStatusPush("HDGSD", bookingOrder.Id, true); + var pushModel = new EmbedServiceProjectStatusDto + { + businessId = bookingOrder.Id.ToString(), + SourceType = 1, + StatusCodes = new List { + new EmbedServiceProjectStatusDetailDto{ + StatusCode = "HDGSD" + } + } + }; + + var saveStatusRlt = await _djyServiceStatusService.SaveServiceStatus(pushModel); + //写日志 Logger.Log(NLog.LogLevel.Info, "批次={no} 推送状态 HDGSD-核对格式单 id={id}", batchNo, bookingOrder.Id); } //如果确认文件读取成功 - //var bookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), fileFullName, batchNo); + var bookFilePath = await _sysFileService.MoveFile(bookingOrder.Id.ToString(), fileFullName, batchNo); - ////将格式单附件写入订舱的附件 - //await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(fileFullName).Name, entity.TenantId.Value, - // CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME); + //将格式单附件写入订舱的附件 + await SaveEDIFile(bookingOrder.Id, bookFilePath.Data.Item2, new System.IO.FileInfo(fileFullName).Name, long.Parse(user.TenantId), bookFilePath.Data.Item4, + CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME); - //if (!string.IsNullOrWhiteSpace(fileAttchedFullName)) - //{ - // var currBookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), fileAttchedFullName, batchNo); + if (!string.IsNullOrWhiteSpace(fileAttchedFullName)) + { + var currBookFilePath = await _sysFileService.MoveFile(bookingOrder.Id.ToString(), fileAttchedFullName, batchNo); - // //将格式单附件写入订舱的附件 - // await SaveEDIFile(bookingOrder.Id, currBookFilePath, new System.IO.FileInfo(fileAttchedFullName).Name, entity.TenantId.Value, - // CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME); - //} + //将格式单附件写入订舱的附件 + await SaveEDIFile(bookingOrder.Id, currBookFilePath.Data.Item2, new System.IO.FileInfo(fileAttchedFullName).Name, long.Parse(user.TenantId), currBookFilePath.Data.Item4, + CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME); + } result = compareResult; } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/ShippingOrderCompare/TaskShippingOrderCompareService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/ShippingOrderCompare/TaskShippingOrderCompareService.cs index 88c3ff9a..b63c947c 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/ShippingOrderCompare/TaskShippingOrderCompareService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/ShippingOrderCompare/TaskShippingOrderCompareService.cs @@ -155,16 +155,16 @@ namespace DS.WMS.Core.TaskPlat.Method var codePortList = _codePortService.GetAllList().GetAwaiter().GetResult().Data; if (codePortList.Any(a => a.Id == model.LoadPortId)) - mainInfo.PortLoad = codePortList.FirstOrDefault(a => a.Id == model.LoadPortId).PortName; + mainInfo.PortLoadId = codePortList.FirstOrDefault(a => a.Id == model.LoadPortId).EdiCode; if (codePortList.Any(a => a.Id == model.DischargePortId)) - mainInfo.PortDischarge = codePortList.FirstOrDefault(a => a.Id == model.DischargePortId).PortName; + mainInfo.PortDischargeId = codePortList.FirstOrDefault(a => a.Id == model.DischargePortId).EdiCode; if (codePortList.Any(a => a.Id == model.DeliveryPlaceId)) - mainInfo.PlaceDelivery = codePortList.FirstOrDefault(a => a.Id == model.DeliveryPlaceId).PortName; + mainInfo.PlaceDeliveryId = codePortList.FirstOrDefault(a => a.Id == model.DeliveryPlaceId).EdiCode; if (codePortList.Any(a => a.Id == model.DestinationId)) - mainInfo.Destination = codePortList.FirstOrDefault(a => a.Id == model.DestinationId).PortName; + mainInfo.DestinationId = codePortList.FirstOrDefault(a => a.Id == model.DestinationId).EdiCode; var mapCarrierList = _mappingCarrierService.GetAllList().GetAwaiter().GetResult().Data; diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs index a407d6ca..f01e6527 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs @@ -29,11 +29,13 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using NLog; using NPOI.XWPF.UserModel; using SqlSugar; +using System; using System.Security.Cryptography; using System.Text.RegularExpressions; @@ -52,7 +54,7 @@ namespace DS.WMS.Core.TaskPlat.Method private readonly ICodeCtnService codeCtnService; private readonly IUserService _userService; private readonly IUserEmailService _userEmailService; - + private readonly IWebHostEnvironment _environment; // 按需构建 private Lazy bookingSlotService; @@ -89,10 +91,12 @@ namespace DS.WMS.Core.TaskPlat.Method this.codeCtnService = codeCtnService; _userService = userService; _userEmailService = userEmailService; + _environment = environment; bookingSlotService = new Lazy(serviceProvider.GetRequiredService); seaExportService = new Lazy(serviceProvider.GetRequiredService); djyServiceStatusService = new Lazy(serviceProvider.GetRequiredService); + } /// @@ -1415,14 +1419,19 @@ namespace DS.WMS.Core.TaskPlat.Method Logger.Log(NLog.LogLevel.Info, $"获取订舱附件地址,结果:{fileInfo.FILE_PATH}"); - //var opt = App.GetOptions(); - //var dirAbs = opt.basePath; - //if (string.IsNullOrEmpty(dirAbs)) - //{ - // dirAbs = App.WebHostEnvironment.WebRootPath; - //} + string fileRoot = AppSetting.app(new string[] { "FileSettings", "BasePath" }); + + string? dirAbs; + if (string.IsNullOrEmpty(fileRoot)) + { + dirAbs = Path.Combine(_environment.WebRootPath ?? ""); + } + else + { + dirAbs = Path.Combine(fileRoot); + } - filePath = "";//Path.Combine(dirAbs, fileInfo.FILE_PATH); + filePath = Path.Combine(dirAbs, fileInfo.FILE_PATH); EmailApiUserDefinedDto emailApiUserDefinedDto = new EmailApiUserDefinedDto @@ -1507,17 +1516,21 @@ namespace DS.WMS.Core.TaskPlat.Method */ try { - //string templatePath = App.Configuration["EmailTemplateFilePath"]; + var basePath = AppSetting.app(new string[] { "EmailTemplate", "BasePath" }); + var relativePath = AppSetting.app(new string[] { "EmailTemplate", "RelativePath" }); - string templatePath = ""; + string dirAbs = string.Empty; - //var opt = App.GetOptions(); - //var dirAbs = opt.basePath; - //if (string.IsNullOrEmpty(dirAbs)) - //{ - // dirAbs = App.WebHostEnvironment.WebRootPath; - //} - //templatePath = $"{dirAbs}{templatePath}\\BCEmailTemplate.html"; + if (string.IsNullOrEmpty(basePath)) + { + dirAbs = Path.Combine(_environment.WebRootPath, relativePath); + } + else + { + dirAbs = Path.Combine(basePath, relativePath); + } + + string templatePath = $"{dirAbs}\\BCEmailTemplate.html"; string baseHtml = File.ReadAllText(templatePath); @@ -1662,15 +1675,21 @@ namespace DS.WMS.Core.TaskPlat.Method */ try { - string templatePath = ""; //App.Configuration["EmailTemplateFilePath"]; - string dirAbs = ""; - //var opt = App.GetOptions(); - //var dirAbs = opt.basePath; - //if (string.IsNullOrEmpty(dirAbs)) - //{ - // dirAbs = App.WebHostEnvironment.WebRootPath; - //} - templatePath = $"{dirAbs}{templatePath}\\BCModifyEmailTemplate.html"; + var basePath = AppSetting.app(new string[] { "EmailTemplate", "BasePath" }); + var relativePath = AppSetting.app(new string[] { "EmailTemplate", "RelativePath" }); + + string dirAbs = string.Empty; + + if (string.IsNullOrEmpty(basePath)) + { + dirAbs = Path.Combine(_environment.WebRootPath, relativePath); + } + else + { + dirAbs = Path.Combine(basePath, relativePath); + } + + string templatePath = $"{dirAbs}\\BCModifyEmailTemplate.html"; string baseHtml = File.ReadAllText(templatePath); diff --git a/ds-wms-service/DS.WMS.TaskApi/appsettings.json b/ds-wms-service/DS.WMS.TaskApi/appsettings.json index 65aa6077..e0abbc7a 100644 --- a/ds-wms-service/DS.WMS.TaskApi/appsettings.json +++ b/ds-wms-service/DS.WMS.TaskApi/appsettings.json @@ -87,5 +87,9 @@ }, "RedisInfo": { "RedisConfig": "127.0.0.1:6379,password=,defaultDatabase=15" + }, + "EmailTemplate": { + "BasePath": "", //基础路径,不配置则使用当前系统目录 + "RelativePath": "TaskEmailTemplate" } } From a4f4bca1b94a6f15a392d1d9fee462f5032037e7 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Mon, 5 Aug 2024 09:00:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.TaskApi/Controllers/TaskDraftCompareController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskDraftCompareController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskDraftCompareController.cs index 16e0d0ea..99a7b515 100644 --- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskDraftCompareController.cs +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskDraftCompareController.cs @@ -70,7 +70,7 @@ namespace DS.WMS.TaskApi.Controllers /// /// 请求详情 /// 返回回执 - [HttpPost("/TaskDraftCompare/SaveDraftCompareManual")] + [HttpPost("SaveDraftCompareManual")] public async Task SaveDraftCompareManual(TaskDraftCompareFeedBackDto model) { await _taskDraftCompareService.SaveDraftCompareManual(model);