From 4b4ae3eece7f5d9eec02c2f3b2f33cb139b285fa Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 24 Jul 2024 15:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BC=E7=94=9F=E6=88=90=E8=AE=A2?= =?UTF-8?q?=E8=88=B1=E6=B8=AF=E5=8F=A3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EmbedProjectGoodsStatusService.cs | 16 +- .../TaskManagePlat/TaskManageBCService.cs | 219 +++++++++++++++++- Myshipping.Core/Myshipping.Core.xml | 14 ++ .../Service/CommonDB/CommonDBService.cs | 10 + .../Service/CommonDB/ICommonDBService.cs | 7 + 5 files changed, 261 insertions(+), 5 deletions(-) diff --git a/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedProjectGoodsStatusService.cs b/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedProjectGoodsStatusService.cs index febca956..04f2acf9 100644 --- a/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedProjectGoodsStatusService.cs +++ b/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedProjectGoodsStatusService.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Myshipping.Core; +using Myshipping.Core.Service; using StackExchange.Profiling.Internal; using System; using System.Collections.Generic; @@ -27,16 +28,18 @@ namespace Myshipping.Application { private readonly ILogger _logger; private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService; + private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService; /// /// /// /// - public EmbedProjectGoodsStatusService(ILogger logger, IServiceWorkFlowManageService serviceWorkFlowManageService) + public EmbedProjectGoodsStatusService(ILogger logger, IServiceWorkFlowManageService serviceWorkFlowManageService, IServiceWorkFlowBaseService serviceWorkFlowBaseService) { _logger = logger; _serviceWorkFlowManageService = serviceWorkFlowManageService; + _serviceWorkFlowBaseService = serviceWorkFlowBaseService; } #region 保存服务项目 @@ -498,5 +501,16 @@ namespace Myshipping.Application return result; } #endregion + + /// + /// 获取可用的服务项目字典列表 + /// + /// 是否重新加载缓存 + /// + [AllowAnonymous, HttpGet("/EmbedProjectGoodsStatus/GetEnableProjectDictTreeList"), ApiUser(ApiCode = "EmbedServiceProjectStatus")] + public async Task> GetEnableProjectDictTreeList([FromQuery] bool isAvoidCache = false) + { + return await _serviceWorkFlowBaseService.GetEnableStatusDictTreeList(isAvoidCache); + } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs index 3b1c85c6..b23f7889 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs @@ -1422,6 +1422,101 @@ namespace Myshipping.Application bkModel.VOYNOINNER = taskBCInfo.CARRIER_VOYNO; } } + //增加装货港、卸货港的对应 + // 解析收货地,得到装货港名称及五字码 + if (!string.IsNullOrWhiteSpace(taskBCInfo.PLACERECEIPT)) + { + var portEnName = taskBCInfo.PLACERECEIPT.Split(',')[0]?.Trim(); + + //这里CMA的收货地全称放在了括号里面 + if (taskBCInfo.CARRIERID.Equals("CMA", StringComparison.OrdinalIgnoreCase)) + { + if (!string.IsNullOrWhiteSpace(taskBCInfo.PLACERECEIPT)) + taskBCInfo.PLACERECEIPT = taskBCInfo.PLACERECEIPT.Replace("(", "(").Replace(")", ")"); + + if (taskBCInfo.PLACERECEIPT.IndexOf("(") >= 0) + { + string currStr = Regex.Match(taskBCInfo.PLACERECEIPT, "(?<=\\().*(?=\\))").Value?.Trim(); + + portEnName = currStr.Split(',')[0]?.Trim(); + } + } + + + if (!string.IsNullOrWhiteSpace(portEnName)) + { + var cachePortLoad = await _cache.GetAllCodePortLoad(); + var portInfo = await PlaceToPortHelper.PlaceReceiptToPortload(portEnName, cachePortLoad, () => _cache.GetAllMappingPortLoad()); + + if (portInfo == null) + { + _logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{MBL_NO}", taskBCInfo.MBL_NO); + } + else + { + bkModel.PORTLOAD = portInfo.EnName; + bkModel.PORTLOADID = portInfo.EdiCode; + + bkModel.PLACERECEIPT = portInfo.EnName; + bkModel.PLACERECEIPTID = portInfo.EdiCode; + } + } + else + { + _logger.LogInformation("收货地分割后得到的城市名称为空,订舱编号:{MBL_NO}", taskBCInfo.MBL_NO); + } + } + else + { + _logger.LogInformation("收货地为空,订舱编号:{MBL_NO}", taskBCInfo.MBL_NO); + } + // 解析交货地,得到为卸货港名称及五字码, 以及国家信息 + if (!string.IsNullOrWhiteSpace(taskBCInfo.PLACEDELIVERY)) + { + var portEnName = taskBCInfo.PLACEDELIVERY.Split(',')[0]?.Trim(); + + //这里CMA的收货地全称放在了括号里面 + if (taskBCInfo.CARRIERID.Equals("CMA", StringComparison.OrdinalIgnoreCase)) + { + if (!string.IsNullOrWhiteSpace(taskBCInfo.PLACEDELIVERY)) + taskBCInfo.PLACEDELIVERY = taskBCInfo.PLACEDELIVERY.Replace("(", "(").Replace(")", ")"); + + if (taskBCInfo.PLACEDELIVERY.IndexOf("(") >= 0) + { + string currStr = Regex.Match(taskBCInfo.PLACEDELIVERY, "(?<=\\().*(?=\\))").Value?.Trim(); + + portEnName = currStr.Split(',')[0]?.Trim(); + } + } + + if (!string.IsNullOrWhiteSpace(portEnName)) + { + var cachePort = await _cache.GetAllCodePort(); + + var portInfo = await PlaceToPortHelper.PlaceDeliveryToPort(portEnName, cachePort, () => _cache.GetAllMappingPort()); + + if (portInfo == null) + { + _logger.LogInformation("通过交货地城市名称未匹配到港口信息,订舱编号:{MBL_NO}", taskBCInfo.MBL_NO); + } + else + { + bkModel.PORTDISCHARGE = portInfo.EnName; + bkModel.PORTDISCHARGEID = portInfo.EdiCode; + + bkModel.PLACEDELIVERY = portInfo.EnName; + bkModel.PLACEDELIVERYID = portInfo.EdiCode; + } + } + else + { + _logger.LogInformation("交货地分割后得到的城市名称为空,订舱编号:{MBL_NO}", taskBCInfo.MBL_NO); + } + } + else + { + _logger.LogInformation("交货地为空,订舱编号:{MBL_NO}", taskBCInfo.MBL_NO); + } var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList(); @@ -2793,6 +2888,103 @@ namespace Myshipping.Application ctnInputs = new List() }; + //增加装货港、卸货港的对应 + // 解析收货地,得到装货港名称及五字码 + if (!string.IsNullOrWhiteSpace(bcOrder.PLACERECEIPT)) + { + var portEnName = bcOrder.PLACERECEIPT.Split(',')[0]?.Trim(); + + //这里CMA的收货地全称放在了括号里面 + if (bcOrder.CARRIERID.Equals("CMA", StringComparison.OrdinalIgnoreCase)) + { + if (!string.IsNullOrWhiteSpace(bcOrder.PLACERECEIPT)) + bcOrder.PLACERECEIPT = bcOrder.PLACERECEIPT.Replace("(", "(").Replace(")", ")"); + + if (bcOrder.PLACERECEIPT.IndexOf("(") >= 0) + { + string currStr = Regex.Match(bcOrder.PLACERECEIPT, "(?<=\\().*(?=\\))").Value?.Trim(); + + portEnName = currStr.Split(',')[0]?.Trim(); + } + } + + + if (!string.IsNullOrWhiteSpace(portEnName)) + { + var cachePortLoad = await _cache.GetAllCodePortLoad(); + var portInfo = await PlaceToPortHelper.PlaceReceiptToPortload(portEnName, cachePortLoad, () => _cache.GetAllMappingPortLoad()); + + if (portInfo == null) + { + _logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{MBL_NO}", bcOrder.MBL_NO); + } + else + { + bkModel.PORTLOAD = portInfo.EnName; + bkModel.PORTLOADID = portInfo.EdiCode; + + bkModel.PLACERECEIPT = portInfo.EnName; + bkModel.PLACERECEIPTID = portInfo.EdiCode; + } + } + else + { + _logger.LogInformation("收货地分割后得到的城市名称为空,订舱编号:{MBL_NO}", bcOrder.MBL_NO); + } + } + else + { + _logger.LogInformation("收货地为空,订舱编号:{MBL_NO}", bcOrder.MBL_NO); + } + // 解析交货地,得到为卸货港名称及五字码, 以及国家信息 + if (!string.IsNullOrWhiteSpace(bcOrder.PLACEDELIVERY)) + { + var portEnName = bcOrder.PLACEDELIVERY.Split(',')[0]?.Trim(); + + //这里CMA的收货地全称放在了括号里面 + if (bcOrder.CARRIERID.Equals("CMA", StringComparison.OrdinalIgnoreCase)) + { + if (!string.IsNullOrWhiteSpace(bcOrder.PLACEDELIVERY)) + bcOrder.PLACEDELIVERY = bcOrder.PLACEDELIVERY.Replace("(", "(").Replace(")", ")"); + + if (bcOrder.PLACEDELIVERY.IndexOf("(") >= 0) + { + string currStr = Regex.Match(bcOrder.PLACEDELIVERY, "(?<=\\().*(?=\\))").Value?.Trim(); + + portEnName = currStr.Split(',')[0]?.Trim(); + } + } + + if (!string.IsNullOrWhiteSpace(portEnName)) + { + var cachePort = await _cache.GetAllCodePort(); + + var portInfo = await PlaceToPortHelper.PlaceDeliveryToPort(portEnName, cachePort, () => _cache.GetAllMappingPort()); + + if (portInfo == null) + { + _logger.LogInformation("通过交货地城市名称未匹配到港口信息,订舱编号:{MBL_NO}", bcOrder.MBL_NO); + } + else + { + bkModel.PORTDISCHARGE = portInfo.EnName; + bkModel.PORTDISCHARGEID = portInfo.EdiCode; + + bkModel.PLACEDELIVERY = portInfo.EnName; + bkModel.PLACEDELIVERYID = portInfo.EdiCode; + } + } + else + { + _logger.LogInformation("交货地分割后得到的城市名称为空,订舱编号:{MBL_NO}", bcOrder.MBL_NO); + } + } + else + { + _logger.LogInformation("交货地为空,订舱编号:{MBL_NO}", bcOrder.MBL_NO); + } + + StringBuilder err = new StringBuilder(); if(string.IsNullOrWhiteSpace(bcOrder.MBL_NO)) @@ -2847,6 +3039,16 @@ namespace Myshipping.Application bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.CLOSINGDATE)); bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.CLOSEDOCDATE)); + bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.PORTDISCHARGE)); + bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.PORTDISCHARGEID)); + bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.PLACEDELIVERY)); + bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.PLACEDELIVERYID)); + + bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.PORTLOAD)); + bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.PORTLOADID)); + bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.PLACERECEIPT)); + bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.PLACERECEIPTID)); + var taskBCCtnList = _taskBCCTNInfoRepository.AsQueryable().Filter(null, true).Where(a => a.P_ID == bcOrder.PK_ID && a.TenantId == UserManager.TENANT_ID).ToList(); var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList(); @@ -3840,15 +4042,24 @@ namespace Myshipping.Application #endregion /// - /// 同步更新船期表 + /// 同步更新船名基础表 /// /// BC任务主键 /// public async Task SyncDjyVesselInfo(string taskPKId) { - /* - 将BC的船名、航次、开船日期、装货港、卸货港写入船期表 - */ + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPKId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息"); + + var taskBCInfo = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (taskBCInfo == null) + throw Oops.Oh($"BC任务主键{taskPKId}无法获取业务信息"); + + + return null; } } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 05f69abc..d3d21a98 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -9540,6 +9540,13 @@ 公开数据:获取箱型映射代码 + + + 同步船名 + + 请求参数 + 返回主键 + 代码 @@ -10866,6 +10873,13 @@ 查询条件 + + + 同步船名 + + 请求参数 + 返回主键 + 获取库表信息 diff --git a/Myshipping.Core/Service/CommonDB/CommonDBService.cs b/Myshipping.Core/Service/CommonDB/CommonDBService.cs index 3121a640..b5290cef 100644 --- a/Myshipping.Core/Service/CommonDB/CommonDBService.cs +++ b/Myshipping.Core/Service/CommonDB/CommonDBService.cs @@ -2400,4 +2400,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie return null; } #endregion + + /// + /// 同步船名 + /// + /// 请求参数 + /// 返回主键 + public async Task SyncVesselInfo(CodeVesselDto model) + { + return null; + } } diff --git a/Myshipping.Core/Service/CommonDB/ICommonDBService.cs b/Myshipping.Core/Service/CommonDB/ICommonDBService.cs index ca8809ff..2b587ef5 100644 --- a/Myshipping.Core/Service/CommonDB/ICommonDBService.cs +++ b/Myshipping.Core/Service/CommonDB/ICommonDBService.cs @@ -193,4 +193,11 @@ public interface ICommonDBService /// 查询条件 /// Task CodeCountryList([FromQuery] NameQueryDto input); + + /// + /// 同步船名 + /// + /// 请求参数 + /// 返回主键 + Task SyncVesselInfo(CodeVesselDto model); }