|
|
|
@ -10,6 +10,7 @@ using Mapster;
|
|
|
|
|
using MathNet.Numerics;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.AspNetCore.Rewrite;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Myshipping.Application.ConfigOption;
|
|
|
|
@ -31,6 +32,7 @@ using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Net.NetworkInformation;
|
|
|
|
|
using System.Reflection.Metadata;
|
|
|
|
|
using System.Reflection.Metadata.Ecma335;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Text;
|
|
|
|
@ -41,6 +43,7 @@ using System.Threading.Tasks;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using Ubiety.Dns.Core;
|
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
|
using static Aliyun.OSS.Model.CreateSelectObjectMetaInputFormatModel;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
@ -66,6 +69,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<BookingRemark> _bookingRemarkRepository;
|
|
|
|
|
|
|
|
|
|
private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService;
|
|
|
|
|
private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService;
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_BC_MODULE_ROUTE = "BC_DOWN_RT";
|
|
|
|
|
const string CONST_MAPPING_DRAFT_MODULE_ROUTE = "DRAFT_DOWN_RT";
|
|
|
|
@ -87,7 +91,8 @@ namespace Myshipping.Application
|
|
|
|
|
, SqlSugarRepository<TaskBCInfo> taskBCInfoRepository, IServiceWorkFlowBaseService serviceWorkFlowBaseService,
|
|
|
|
|
SqlSugarRepository<BookingStatusLog> statuslogRepository, SqlSugarRepository<BookingStatusLogDetail> statuslogdetailRepository,
|
|
|
|
|
SqlSugarRepository<BookingLog> bookinglogRepository, SqlSugarRepository<BookingLogDetail> bookinglogdetailRepository,
|
|
|
|
|
SqlSugarRepository<BookingRemark> bookingRemarkRepository, SqlSugarRepository<BookingFile> bookingFileRepository)
|
|
|
|
|
SqlSugarRepository<BookingRemark> bookingRemarkRepository, SqlSugarRepository<BookingFile> bookingFileRepository,
|
|
|
|
|
IServiceWorkFlowManageService serviceWorkFlowManageService)
|
|
|
|
|
{
|
|
|
|
|
_cache = cache;
|
|
|
|
|
_logger = logger;
|
|
|
|
@ -107,6 +112,8 @@ namespace Myshipping.Application
|
|
|
|
|
_bookinglogdetailRepository = bookinglogdetailRepository;
|
|
|
|
|
_bookingRemarkRepository = bookingRemarkRepository;
|
|
|
|
|
_bookingFileRepository = bookingFileRepository;
|
|
|
|
|
|
|
|
|
|
_serviceWorkFlowManageService = serviceWorkFlowManageService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2037,6 +2044,186 @@ namespace Myshipping.Application
|
|
|
|
|
return resultDto;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存服务项目
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存服务项目
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bookingId">订舱ID</param>
|
|
|
|
|
/// <param name="projectCode">服务项目代码</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SaveServiceProject(long bookingId, string projectCode)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null,true)
|
|
|
|
|
.First(a=>a.Id == bookingId);
|
|
|
|
|
|
|
|
|
|
if(bookingOrder == null)
|
|
|
|
|
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 请求保存服务项目 bookingid={id} project={prj} ", batchNo, bookingId, projectCode);
|
|
|
|
|
|
|
|
|
|
TrackingMessageInfo msgInfo = new TrackingMessageInfo {
|
|
|
|
|
Head = new TrackingMessageHeadInfo {
|
|
|
|
|
GID = IDGen.NextID().ToString(),
|
|
|
|
|
MessageType = "PROJECT",
|
|
|
|
|
ReceiverId = "ServiceProjectStatus",
|
|
|
|
|
ReceiverName= "服务项目和状态",
|
|
|
|
|
SenderId = "BookingOrder",
|
|
|
|
|
SenderName = "海运订舱",
|
|
|
|
|
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
|
|
|
|
Version = "2.0",
|
|
|
|
|
RequestAction = "AddOrModify",
|
|
|
|
|
},
|
|
|
|
|
Main = new TrackingMessageMainInfo
|
|
|
|
|
{
|
|
|
|
|
BusiId = bookingId.ToString(),
|
|
|
|
|
BusiSystemCode = "BOOKING_ORDER",
|
|
|
|
|
MBlNo = bookingOrder.MBLNO,
|
|
|
|
|
VesselVoyno = $"{bookingOrder.VESSEL}/{bookingOrder.VOYNO}",
|
|
|
|
|
OrderNo = bookingOrder.BSNO,
|
|
|
|
|
PushType = TrackingPushTypeEnum.Project,
|
|
|
|
|
OperTenantId = bookingOrder.TenantId.Value,
|
|
|
|
|
OperTenantName = bookingOrder.TenantName,
|
|
|
|
|
OpertType = TrackingOperTypeEnum.MANUAL,
|
|
|
|
|
OperUserId = UserManager.UserId.ToString(),
|
|
|
|
|
OperUserName = UserManager.Name,
|
|
|
|
|
ProjectList = new List<TrackingMessageMainProjectInfo> {
|
|
|
|
|
new TrackingMessageMainProjectInfo{
|
|
|
|
|
ServiceProjectCode = projectCode,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
DateTime bDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 推送保存服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo));
|
|
|
|
|
|
|
|
|
|
var rlt = await _serviceWorkFlowManageService.PushStatus(msgInfo);
|
|
|
|
|
|
|
|
|
|
DateTime eDate = DateTime.Now;
|
|
|
|
|
TimeSpan ts = eDate.Subtract(bDate);
|
|
|
|
|
var timeDiff = ts.TotalMilliseconds;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg} result={rlt}", batchNo, timeDiff, (rlt.succ ? "成功" : "失败")
|
|
|
|
|
,JSON.Serialize(rlt));
|
|
|
|
|
|
|
|
|
|
if (!rlt.succ)
|
|
|
|
|
{
|
|
|
|
|
result = rlt;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "保存成功";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"服务项目保存失败,原因:{ex.Message}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 取消服务项目
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 取消服务项目
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bookingId">订舱ID</param>
|
|
|
|
|
/// <param name="projectCode">服务项目代码</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> CancelServiceProject(long bookingId, string projectCode)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(a => a.Id == bookingId);
|
|
|
|
|
|
|
|
|
|
if (bookingOrder == null)
|
|
|
|
|
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 请求保存服务项目 bookingid={id} project={prj} ", batchNo, bookingId, projectCode);
|
|
|
|
|
|
|
|
|
|
TrackingMessageInfo msgInfo = new TrackingMessageInfo
|
|
|
|
|
{
|
|
|
|
|
Head = new TrackingMessageHeadInfo
|
|
|
|
|
{
|
|
|
|
|
GID = IDGen.NextID().ToString(),
|
|
|
|
|
MessageType = "PROJECT",
|
|
|
|
|
ReceiverId = "ServiceProjectStatus",
|
|
|
|
|
ReceiverName = "服务项目和状态",
|
|
|
|
|
SenderId = "BookingOrder",
|
|
|
|
|
SenderName = "海运订舱",
|
|
|
|
|
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
|
|
|
|
Version = "2.0",
|
|
|
|
|
RequestAction = "AddOrModify",
|
|
|
|
|
},
|
|
|
|
|
Main = new TrackingMessageMainInfo
|
|
|
|
|
{
|
|
|
|
|
BusiId = bookingId.ToString(),
|
|
|
|
|
BusiSystemCode = "BOOKING_ORDER",
|
|
|
|
|
MBlNo = bookingOrder.MBLNO,
|
|
|
|
|
VesselVoyno = $"{bookingOrder.VESSEL}/{bookingOrder.VOYNO}",
|
|
|
|
|
OrderNo = bookingOrder.BSNO,
|
|
|
|
|
PushType = TrackingPushTypeEnum.Project,
|
|
|
|
|
OperTenantId = bookingOrder.TenantId.Value,
|
|
|
|
|
OperTenantName = bookingOrder.TenantName,
|
|
|
|
|
OpertType = TrackingOperTypeEnum.MANUAL,
|
|
|
|
|
OperUserId = UserManager.UserId.ToString(),
|
|
|
|
|
OperUserName = UserManager.Name,
|
|
|
|
|
ProjectList = new List<TrackingMessageMainProjectInfo> {
|
|
|
|
|
new TrackingMessageMainProjectInfo{
|
|
|
|
|
ServiceProjectCode = projectCode,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
DateTime bDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 推送取消服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo));
|
|
|
|
|
|
|
|
|
|
var rlt = await _serviceWorkFlowManageService.CancelProject(msgInfo);
|
|
|
|
|
|
|
|
|
|
DateTime eDate = DateTime.Now;
|
|
|
|
|
TimeSpan ts = eDate.Subtract(bDate);
|
|
|
|
|
var timeDiff = ts.TotalMilliseconds;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg} result={rlt}", batchNo, timeDiff, (rlt.succ ? "成功" : "失败")
|
|
|
|
|
, JSON.Serialize(rlt));
|
|
|
|
|
|
|
|
|
|
if (!rlt.succ)
|
|
|
|
|
{
|
|
|
|
|
result = rlt;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "取消成功";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"服务项目取消失败,原因:{ex.Message}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DateTimeJsonConverter : System.Text.Json.Serialization.JsonConverter<Nullable<DateTime>>
|
|
|
|
|