|
|
|
@ -50,6 +50,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<ServiceWorkFlowRunLogInfo> _serviceWorkFlowRunLogInfoRepository;
|
|
|
|
|
private readonly ICache _cache;
|
|
|
|
|
private readonly CacheOptions _cacheOptions;
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
|
|
|
|
|
|
|
|
|
|
private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService;
|
|
|
|
|
|
|
|
|
@ -71,7 +72,8 @@ namespace Myshipping.Application
|
|
|
|
|
IServiceWorkFlowBaseService serviceWorkFlowBaseService, SqlSugarRepository<SysUser> sysUserRepository,
|
|
|
|
|
SqlSugarRepository<ServiceProjectBaseInfo> serviceProjectBaseInfoRepository,
|
|
|
|
|
SqlSugarRepository<ServiceWorkFlowRunLogInfo> serviceWorkFlowRunLogInfoRepository,
|
|
|
|
|
IOptions<CacheOptions> cacheOptions, Func<string, ISingleton, object> resolveNamed)
|
|
|
|
|
IOptions<CacheOptions> cacheOptions, Func<string, ISingleton, object> resolveNamed,
|
|
|
|
|
SqlSugarRepository<BookingOrder> bookingOrderRepository)
|
|
|
|
|
{
|
|
|
|
|
_serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository;
|
|
|
|
|
_serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository;
|
|
|
|
@ -88,6 +90,7 @@ namespace Myshipping.Application
|
|
|
|
|
_sysUserRepository = sysUserRepository;
|
|
|
|
|
_serviceProjectBaseInfoRepository = serviceProjectBaseInfoRepository;
|
|
|
|
|
_serviceWorkFlowRunLogInfoRepository = serviceWorkFlowRunLogInfoRepository;
|
|
|
|
|
_bookingOrderRepository = bookingOrderRepository;
|
|
|
|
|
|
|
|
|
|
_cacheOptions = cacheOptions.Value;
|
|
|
|
|
_cache = resolveNamed(_cacheOptions.CacheType.ToString(), default) as ICache;
|
|
|
|
@ -1949,5 +1952,187 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存服务状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">修改服务状态详情</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SaveServiceStatus(ModifyServiceProjectStatusDto model)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(a => a.Id == model.BookingId);
|
|
|
|
|
|
|
|
|
|
if (bookingOrder == null)
|
|
|
|
|
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 请求保存服务项目 modifyjson={msg}", batchNo, JSON.Serialize(model));
|
|
|
|
|
|
|
|
|
|
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 = model.BookingId.ToString(),
|
|
|
|
|
BusiSystemCode = "BOOKING_ORDER",
|
|
|
|
|
MBlNo = bookingOrder.MBLNO,
|
|
|
|
|
VesselVoyno = $"{bookingOrder.VESSEL}/{bookingOrder.VOYNO}",
|
|
|
|
|
OrderNo = bookingOrder.BSNO,
|
|
|
|
|
PushType = TrackingPushTypeEnum.Status,
|
|
|
|
|
OperTenantId = bookingOrder.TenantId.Value,
|
|
|
|
|
OperTenantName = bookingOrder.TenantName,
|
|
|
|
|
OpertType = TrackingOperTypeEnum.MANUAL,
|
|
|
|
|
OperUserId = UserManager.UserId.ToString(),
|
|
|
|
|
OperUserName = UserManager.Name,
|
|
|
|
|
SourceType = model.SourceType,
|
|
|
|
|
StatusList = model.StatusCodes.Select(a => new TrackingMessageMainStatusInfo
|
|
|
|
|
{
|
|
|
|
|
StatusCode = a.StatusCode,
|
|
|
|
|
StatusDate = a.SetActDate,
|
|
|
|
|
StatusVal = a.SetActVal,
|
|
|
|
|
Remark = a.ActRemark
|
|
|
|
|
}).ToList()
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
DateTime bDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 推送保存服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo));
|
|
|
|
|
|
|
|
|
|
var rlt = await 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 取消服务状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">修改服务状态详情</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> CancelServiceStatus(ModifyServiceProjectStatusDto model)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(a => a.Id == model.BookingId);
|
|
|
|
|
|
|
|
|
|
if (bookingOrder == null)
|
|
|
|
|
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 请求保存服务项目 modifyjson={msg}", batchNo, JSON.Serialize(model));
|
|
|
|
|
|
|
|
|
|
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 = model.BookingId.ToString(),
|
|
|
|
|
BusiSystemCode = "BOOKING_ORDER",
|
|
|
|
|
MBlNo = bookingOrder.MBLNO,
|
|
|
|
|
VesselVoyno = $"{bookingOrder.VESSEL}/{bookingOrder.VOYNO}",
|
|
|
|
|
OrderNo = bookingOrder.BSNO,
|
|
|
|
|
PushType = TrackingPushTypeEnum.Status,
|
|
|
|
|
OperTenantId = bookingOrder.TenantId.Value,
|
|
|
|
|
OperTenantName = bookingOrder.TenantName,
|
|
|
|
|
OpertType = TrackingOperTypeEnum.MANUAL,
|
|
|
|
|
OperUserId = UserManager.UserId.ToString(),
|
|
|
|
|
OperUserName = UserManager.Name,
|
|
|
|
|
SourceType = model.SourceType,
|
|
|
|
|
StatusList = model.StatusCodes.Select(a => new TrackingMessageMainStatusInfo
|
|
|
|
|
{
|
|
|
|
|
StatusCode = a.StatusCode,
|
|
|
|
|
StatusDate = a.SetActDate,
|
|
|
|
|
StatusVal = a.SetActVal,
|
|
|
|
|
Remark = a.ActRemark
|
|
|
|
|
}).ToList()
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
DateTime bDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 推送保存服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo));
|
|
|
|
|
|
|
|
|
|
var rlt = await CancelStatus(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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|