修改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.DependencyInjection;
using Furion.DistributedIDGenerator; using Furion.DistributedIDGenerator;
using Furion.DynamicApiController; using Furion.DynamicApiController;
@ -82,6 +83,8 @@ namespace Myshipping.Application
private readonly IDjyCustomerService _djyCustomerService; private readonly IDjyCustomerService _djyCustomerService;
private readonly INamedServiceProvider<IBookingMSKAPIService> _namedBookingMSKAPIServiceProvider; private readonly INamedServiceProvider<IBookingMSKAPIService> _namedBookingMSKAPIServiceProvider;
private readonly IDjyTenantParamService _djyTenantParamService; private readonly IDjyTenantParamService _djyTenantParamService;
private readonly ICommonDBService _commonDBService;
private readonly INamedServiceProvider<IBookingSlotService> _namedBookingSlotServiceProvider; private readonly INamedServiceProvider<IBookingSlotService> _namedBookingSlotServiceProvider;
@ -126,7 +129,7 @@ namespace Myshipping.Application
SqlSugarRepository<BookingSlotAllocation> bookingSlotAllocationRepository, SqlSugarRepository<BookingSlotAllocation> bookingSlotAllocationRepository,
SqlSugarRepository<BookingSlotAllocationCtn> bookingSlotAllocationCtnRepository, SqlSugarRepository<BookingSlotAllocationCtn> bookingSlotAllocationCtnRepository,
SqlSugarRepository<BookingOrderContact> bookingOrderContactRepository, SqlSugarRepository<BookingOrderContact> bookingOrderContactRepository,
SqlSugarRepository<BookingSlotCompare> bookingSlotCompareRepository) SqlSugarRepository<BookingSlotCompare> bookingSlotCompareRepository, ICommonDBService commonDBService)
{ {
_taskBaseRepository = taskBaseRepository; _taskBaseRepository = taskBaseRepository;
_taskBCInfoRepository = taskBCInfoRepository; _taskBCInfoRepository = taskBCInfoRepository;
@ -153,6 +156,7 @@ namespace Myshipping.Application
_namedBookingMSKAPIServiceProvider = namedBookingMSKAPIServiceProvider; _namedBookingMSKAPIServiceProvider = namedBookingMSKAPIServiceProvider;
_namedBookingSlotServiceProvider = namedBookingSlotServiceProvider; _namedBookingSlotServiceProvider = namedBookingSlotServiceProvider;
_djyTenantParamService = djyTenantParamService; _djyTenantParamService = djyTenantParamService;
_commonDBService = commonDBService;
_logger = logger; _logger = logger;
} }
@ -4041,27 +4045,60 @@ namespace Myshipping.Application
} }
#endregion #endregion
#region 同步更新船名基础表
/// <summary> /// <summary>
/// 同步更新船名基础表 /// 同步更新船名基础表
/// </summary> /// </summary>
/// <param name="taskPKId">BC任务主键</param> /// <param name="taskPKId">BC任务主键</param>
/// <returns></returns> /// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SyncDjyVesselInfo(string taskPKId) public async Task<TaskManageOrderResultDto> SyncDjyVesselInfo(string taskPKId)
{ {
var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPKId); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
if (taskBase == null) try
throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息"); {
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) var taskBCInfo = _taskBCInfoRepository.AsQueryable().Filter(null, true).First(a => a.TASK_ID == taskBase.PK_ID);
throw Oops.Oh($"BC任务主键{taskPKId}无法获取业务信息");
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> /// <summary>

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

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

@ -13,6 +13,7 @@ using Myshipping.Core.Service.CommonDB.Dto;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Myshipping.Core.Entity.CommonDB; using Myshipping.Core.Entity.CommonDB;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using System.Reflection.Metadata.Ecma335;
namespace Myshipping.Core.Service; namespace Myshipping.Core.Service;
/// <summary> /// <summary>
@ -276,6 +277,29 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
await GetAllVessel(); 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>
/// 获取船名映射 /// 获取船名映射
/// </summary> /// </summary>
@ -2401,13 +2425,4 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
} }
#endregion #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> /// </summary>
/// <param name="model">请求参数</param> /// <param name="model">请求参数</param>
/// <returns>返回主键</returns> /// <returns>返回主键</returns>
Task<string> SyncVesselInfo(CodeVesselDto model); Task<string> SyncVessel([FromBody] CodeVesselDto dto);
} }

Loading…
Cancel
Save