修改BC任务,增加船名自动新增功能

master
jianghaiqing 4 months ago
parent a4035a01c6
commit a7d44ba22e

@ -1,4 +1,5 @@
using Furion;
using DocumentFormat.OpenXml.Office2010.Excel;
using Furion;
using Furion.DependencyInjection;
using Furion.DistributedIDGenerator;
using Furion.DynamicApiController;
@ -82,6 +83,8 @@ namespace Myshipping.Application
private readonly IDjyCustomerService _djyCustomerService;
private readonly INamedServiceProvider<IBookingMSKAPIService> _namedBookingMSKAPIServiceProvider;
private readonly IDjyTenantParamService _djyTenantParamService;
private readonly ICommonDBService _commonDBService;
private readonly INamedServiceProvider<IBookingSlotService> _namedBookingSlotServiceProvider;
@ -126,7 +129,7 @@ namespace Myshipping.Application
SqlSugarRepository<BookingSlotAllocation> bookingSlotAllocationRepository,
SqlSugarRepository<BookingSlotAllocationCtn> bookingSlotAllocationCtnRepository,
SqlSugarRepository<BookingOrderContact> bookingOrderContactRepository,
SqlSugarRepository<BookingSlotCompare> bookingSlotCompareRepository)
SqlSugarRepository<BookingSlotCompare> bookingSlotCompareRepository, ICommonDBService commonDBService)
{
_taskBaseRepository = taskBaseRepository;
_taskBCInfoRepository = taskBCInfoRepository;
@ -153,6 +156,7 @@ namespace Myshipping.Application
_namedBookingMSKAPIServiceProvider = namedBookingMSKAPIServiceProvider;
_namedBookingSlotServiceProvider = namedBookingSlotServiceProvider;
_djyTenantParamService = djyTenantParamService;
_commonDBService = commonDBService;
_logger = logger;
}
@ -4041,27 +4045,60 @@ namespace Myshipping.Application
}
#endregion
#region 同步更新船名基础表
/// <summary>
/// 同步更新船名基础表
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <returns></returns>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SyncDjyVesselInfo(string taskPKId)
{
var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPKId);
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
if (taskBase == null)
throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息");
try
{
var taskBase = _taskBaseRepository.AsQueryable().Filter(null,true).First(a => a.PK_ID == taskPKId);
var taskBCInfo = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID);
if (taskBase == null)
throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息");
if (taskBCInfo == null)
throw Oops.Oh($"BC任务主键{taskPKId}无法获取业务信息");
var taskBCInfo = _taskBCInfoRepository.AsQueryable().Filter(null, true).First(a => a.TASK_ID == taskBase.PK_ID);
if (taskBCInfo == null)
throw Oops.Oh($"BC任务主键{taskPKId}无法获取业务信息");
if(!string.IsNullOrWhiteSpace(taskBCInfo.VESSEL))
{
var syncRlt = await _commonDBService.SyncVessel(new Core.Service.CommonDB.Dto.CodeVesselDto { Name = taskBCInfo.VESSEL });
if (string.IsNullOrWhiteSpace(syncRlt))
{
result.succ = true;
return null;
_logger.LogInformation($"任务BC MBLNO:{taskBCInfo.MBL_NO} 同步船名成功 新增船名{taskBCInfo.VESSEL}");
}
else
{
result.succ = false;
result.msg = syncRlt;
}
}
else
{
result.succ = false;
result.msg = "BC的船名为空";
}
}
catch(Exception ex)
{
result.succ = false;
result.msg = $"同步船名到船名基础表异常,原因:{ex.Message}";
}
return result;
}
#endregion
}
/// <summary>

@ -1061,33 +1061,34 @@ namespace Myshipping.Application
_logger.LogInformation($"入库完BC自动推送状态到API订舱列表 mblno={info.Main.BCInfo.MBLNo} synRlt={JSON.Serialize(synRlt)}");
}
if (info.Main.TaskType == TaskBaseTypeEnum.BC_MODIFY)
{
var name = _namedTaskManageBCServiceProvider
var name = _namedTaskManageBCServiceProvider
.GetService<ITransient>(nameof(TaskManageBCService));
if (info.Main.TaskType == TaskBaseTypeEnum.BC_MODIFY)
{
await name.SyncBookingSlotChange(bcInfo.TASK_ID, bcInfo.TenantId.Value);
}
await name.SyncDjyVesselInfo(bcInfo.TASK_ID);
#region 自动化处理
if (taskInfo.CARRIER_ID =="CMA")
{
var flow = _taskFlowTenant.AsQueryable().Filter(null, true).Where(t => t.FlowCode == "CMABC" && t.IsMain == true &&t.TenantId== taskInfo.TenantId.Value).First();
if (flow!=null)
{
//方法请求参数
RecursiveMethodModel mt = new RecursiveMethodModel();
//TODO待完善请求参数
mt.parse_attachment = info.Main.parse_attachment;
//if (taskInfo.CARRIER_ID =="CMA")
//{
// var flow = _taskFlowTenant.AsQueryable().Filter(null, true).Where(t => t.FlowCode == "CMABC" && t.IsMain == true &&t.TenantId== taskInfo.TenantId.Value).First();
// if (flow!=null)
// {
// //方法请求参数
// RecursiveMethodModel mt = new RecursiveMethodModel();
// //TODO待完善请求参数
// mt.parse_attachment = info.Main.parse_attachment;
RecursiveMethod(flow, 0, mt);
}
// RecursiveMethod(flow, 0, mt);
// }
}
//}

@ -9229,6 +9229,11 @@
新增船名信息
</summary>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.SyncVessel(Myshipping.Core.Service.CommonDB.Dto.CodeVesselDto)">
<summary>
同步船名信息
</summary>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.MappingVesselList(Myshipping.Core.Service.MappingQueryDto)">
<summary>
获取船名映射
@ -9540,13 +9545,6 @@
公开数据:获取箱型映射代码
</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>
代码
@ -10873,7 +10871,7 @@
<param name="input">查询条件</param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ICommonDBService.SyncVesselInfo(Myshipping.Core.Service.CommonDB.Dto.CodeVesselDto)">
<member name="M:Myshipping.Core.Service.ICommonDBService.SyncVessel(Myshipping.Core.Service.CommonDB.Dto.CodeVesselDto)">
<summary>
同步船名
</summary>

@ -13,6 +13,7 @@ using Myshipping.Core.Service.CommonDB.Dto;
using Microsoft.Extensions.Logging;
using Myshipping.Core.Entity.CommonDB;
using Microsoft.AspNetCore.Authorization;
using System.Reflection.Metadata.Ecma335;
namespace Myshipping.Core.Service;
/// <summary>
@ -276,6 +277,29 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
await GetAllVessel();
}
/// <summary>
/// 同步船名信息
/// </summary>
[HttpPost("/commondb/syncvessel")]
public async Task<string> SyncVessel([FromBody] CodeVesselDto dto)
{
var list = await _sysCacheService.GetAllCodeVessel();
var count = list.Where(x => x.Name.Trim() == dto.Name.Trim()).Count();
if (count > 0)
{
return "已存在记录";
}
var entity = dto.Adapt<CodeVessel>();
entity.GID = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
await _codeVesselRep.InsertAsync(entity);
await GetAllVessel();
return string.Empty;
}
/// <summary>
/// 获取船名映射
/// </summary>
@ -2401,13 +2425,4 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
}
#endregion
/// <summary>
/// 同步船名
/// </summary>
/// <param name="model">请求参数</param>
/// <returns>返回主键</returns>
public async Task<string> SyncVesselInfo(CodeVesselDto model)
{
return null;
}
}

@ -199,5 +199,5 @@ public interface ICommonDBService
/// </summary>
/// <param name="model">请求参数</param>
/// <returns>返回主键</returns>
Task<string> SyncVesselInfo(CodeVesselDto model);
Task<string> SyncVessel([FromBody] CodeVesselDto dto);
}

Loading…
Cancel
Save