修改BC生成订舱港口问题

master
jianghaiqing 4 months ago
parent 834a13524d
commit 4b4ae3eece

@ -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<BookingTruckService> _logger;
private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService;
private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService;
/// <summary>
///
/// </summary>
/// <param name="logger"></param>
public EmbedProjectGoodsStatusService(ILogger<BookingTruckService> logger, IServiceWorkFlowManageService serviceWorkFlowManageService)
public EmbedProjectGoodsStatusService(ILogger<BookingTruckService> logger, IServiceWorkFlowManageService serviceWorkFlowManageService, IServiceWorkFlowBaseService serviceWorkFlowBaseService)
{
_logger = logger;
_serviceWorkFlowManageService = serviceWorkFlowManageService;
_serviceWorkFlowBaseService = serviceWorkFlowBaseService;
}
#region 保存服务项目
@ -498,5 +501,16 @@ namespace Myshipping.Application
return result;
}
#endregion
/// <summary>
/// 获取可用的服务项目字典列表
/// </summary>
/// <param name="isAvoidCache">是否重新加载缓存</param>
/// <returns></returns>
[AllowAnonymous, HttpGet("/EmbedProjectGoodsStatus/GetEnableProjectDictTreeList"), ApiUser(ApiCode = "EmbedServiceProjectStatus")]
public async Task<List<Myshipping.Core.Service.DictTreeOutput>> GetEnableProjectDictTreeList([FromQuery] bool isAvoidCache = false)
{
return await _serviceWorkFlowBaseService.GetEnableStatusDictTreeList(isAvoidCache);
}
}
}

@ -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<BookingCtnDto>()
};
//增加装货港、卸货港的对应
// 解析收货地,得到装货港名称及五字码
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
/// <summary>
/// 同步更新船
/// 同步更新船名基础
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <returns></returns>
public async Task<TaskManageOrderResultDto> 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;
}
}

@ -9540,6 +9540,13 @@
公开数据:获取箱型映射代码
</summary>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.SyncVesselInfo(Myshipping.Core.Service.CommonDB.Dto.CodeVesselDto)">
<summary>
同步船名
</summary>
<param name="model">请求参数</param>
<returns>返回主键</returns>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCarrierDto.Code">
<summary>
代码
@ -10866,6 +10873,13 @@
<param name="input">查询条件</param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ICommonDBService.SyncVesselInfo(Myshipping.Core.Service.CommonDB.Dto.CodeVesselDto)">
<summary>
同步船名
</summary>
<param name="model">请求参数</param>
<returns>返回主键</returns>
</member>
<member name="M:Myshipping.Core.Service.CommonService.GetEntityInfos(System.Boolean)">
<summary>
获取库表信息

@ -2400,4 +2400,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
return null;
}
#endregion
/// <summary>
/// 同步船名
/// </summary>
/// <param name="model">请求参数</param>
/// <returns>返回主键</returns>
public async Task<string> SyncVesselInfo(CodeVesselDto model)
{
return null;
}
}

@ -193,4 +193,11 @@ public interface ICommonDBService
/// <param name="input">查询条件</param>
/// <returns></returns>
Task<dynamic> CodeCountryList([FromQuery] NameQueryDto input);
/// <summary>
/// 同步船名
/// </summary>
/// <param name="model">请求参数</param>
/// <returns>返回主键</returns>
Task<string> SyncVesselInfo(CodeVesselDto model);
}

Loading…
Cancel
Save