修改增加嵌入的服务项目和货物状态

master
jianghaiqing 7 months ago
parent 6c7080c8b9
commit 03277b5c12

@ -1333,6 +1333,8 @@ namespace Myshipping.Application
CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE, CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE,
CLOSINGDATE = bookingSlotBase.CY_CUT_DATE, CLOSINGDATE = bookingSlotBase.CY_CUT_DATE,
CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE, CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE,
CUSTSERVICEID = generateModel.CustServiceId.HasValue? generateModel.CustServiceId.Value.ToString():null,
CUSTSERVICE = generateModel.CustServiceName,
ctnInputs = new List<BookingCtnDto>() ctnInputs = new List<BookingCtnDto>()
}; };

@ -97,5 +97,15 @@ namespace Myshipping.Application
/// 是否直接发送邮件给订舱联系人 /// 是否直接发送邮件给订舱联系人
/// </summary> /// </summary>
public bool IsDirectSend { get; set; } = false; public bool IsDirectSend { get; set; } = false;
/// <summary>
/// 客服ID
/// </summary>
public Nullable<long> CustServiceId { get; set; }
/// <summary>
/// 客服名称
/// </summary>
public string CustServiceName { get; set; }
} }
} }

@ -20,5 +20,78 @@ namespace Myshipping.Application
/// 服务项目代码 /// 服务项目代码
/// </summary> /// </summary>
public string[] ProjectCodes { get; set; } public string[] ProjectCodes { get; set; }
/// <summary>
/// 状态操作类型 MANUAL-手工 AUTO-自动
/// </summary>
public TrackingOperTypeEnum OpertType { get; set; }
}
/// <summary>
/// 修改服务项目状态
/// </summary>
public class EmbedServiceProjectStatusDto
{
/// <summary>
/// 业务主键
/// </summary>
public string businessId { get; set; }
/// <summary>
/// 来源类型
/// </summary>
public TrackingSourceTypeEnum SourceType { get; set; } = TrackingSourceTypeEnum.MANUAL;
/// <summary>
/// 服务项目状态明细
/// </summary>
public List<EmbedServiceProjectStatusDetailDto> StatusCodes { get; set; }
}
public class EmbedServiceProjectStatusDetailDto
{
/// <summary>
/// 状态代码
/// </summary>
public string StatusCode { get; set; }
/// <summary>
/// 人工设定状态完成时间
/// </summary>
public Nullable<DateTime> SetActDate { get; set; }
/// <summary>
/// 人工设定状态值(可传箱使天数)
/// </summary>
public string SetActVal { get; set; }
/// <summary>
/// 状态备注
/// </summary>
public string ActRemark { get; set; }
}
public class EmbedQueryServiceProjectWithStatus
{
/// <summary>
/// 业务主键(可为空,不为空时需要查询已触发的记录和未触发的记录,为空时只查询已启用的)
/// </summary>
public string businessId { get; set; }
/// <summary>
/// 0-查服务项目 1-查服务项目下的状态
/// </summary>
public TrackingQueryTypeEnum QueryType { get; set; }
/// <summary>
/// 服务项目代码组
/// </summary>
public string[] ProjectCodes { get; set; }
/// <summary>
/// 租户ID
/// </summary>
public long TenantId { get; set; }
} }
} }

@ -1,4 +1,5 @@
using Furion.DependencyInjection; using Furion.ClayObject.Extensions;
using Furion.DependencyInjection;
using Furion.DistributedIDGenerator; using Furion.DistributedIDGenerator;
using Furion.DynamicApiController; using Furion.DynamicApiController;
using Furion.FriendlyException; using Furion.FriendlyException;
@ -6,10 +7,12 @@ using Furion.JsonSerialization;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Myshipping.Core;
using StackExchange.Profiling.Internal; using StackExchange.Profiling.Internal;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection.Emit;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -23,23 +26,26 @@ namespace Myshipping.Application
public class EmbedProjectGoodsStatusService: IEmbedProjectGoodsStatusService, IDynamicApiController, ITransient public class EmbedProjectGoodsStatusService: IEmbedProjectGoodsStatusService, IDynamicApiController, ITransient
{ {
private readonly ILogger<BookingTruckService> _logger; private readonly ILogger<BookingTruckService> _logger;
private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="logger"></param> /// <param name="logger"></param>
public EmbedProjectGoodsStatusService(ILogger<BookingTruckService> logger) public EmbedProjectGoodsStatusService(ILogger<BookingTruckService> logger, IServiceWorkFlowManageService serviceWorkFlowManageService)
{ {
_logger = logger; _logger = logger;
}
_serviceWorkFlowManageService = serviceWorkFlowManageService;
}
#region 保存服务项目
/// <summary> /// <summary>
/// 保存服务项目 /// 保存服务项目
/// </summary> /// </summary>
/// <param name="model">修改服务项目详情</param> /// <param name="model">修改服务项目详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
[HttpPost("/EmbedProjectGoodsStatus/SaveServiceProject")] [AllowAnonymous, HttpPost("/EmbedProjectGoodsStatus/SaveServiceProject"), ApiUser(ApiCode = "EmbedServiceProjectStatus")]
public async Task<TaskManageOrderResultDto> SaveServiceProject(EmbedServiceProjectDto model) public async Task<TaskManageOrderResultDto> SaveServiceProject(EmbedServiceProjectDto model)
{ {
TaskManageOrderResultDto result = new TaskManageOrderResultDto(); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -75,11 +81,11 @@ namespace Myshipping.Application
VesselVoyno = "", VesselVoyno = "",
OrderNo = "", OrderNo = "",
PushType = TrackingPushTypeEnum.Project, PushType = TrackingPushTypeEnum.Project,
OperTenantId = 0, OperTenantId = UserManager.TENANT_ID,
OperTenantName = "", OperTenantName = UserManager.TENANT_NAME,
OpertType = TrackingOperTypeEnum.MANUAL, OpertType = model.OpertType,
OperUserId = "", OperUserId = UserManager.UserId.ToString(),
OperUserName = "", OperUserName = UserManager.Name,
SourceType = TrackingSourceTypeEnum.MANUAL, SourceType = TrackingSourceTypeEnum.MANUAL,
ProjectList = model.ProjectCodes.Select(a => new TrackingMessageMainProjectInfo ProjectList = model.ProjectCodes.Select(a => new TrackingMessageMainProjectInfo
{ {
@ -92,24 +98,24 @@ namespace Myshipping.Application
_logger.LogInformation("批次={no} 推送保存服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo)); _logger.LogInformation("批次={no} 推送保存服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo));
//var rlt = await _serviceWorkFlowManageService.PushStatus(msgInfo); var rlt = await _serviceWorkFlowManageService.PushStatus(msgInfo);
//DateTime eDate = DateTime.Now; DateTime eDate = DateTime.Now;
//TimeSpan ts = eDate.Subtract(bDate); TimeSpan ts = eDate.Subtract(bDate);
//var timeDiff = ts.TotalMilliseconds; var timeDiff = ts.TotalMilliseconds;
//_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg} result={rlt}", batchNo, timeDiff, (rlt.succ ? "成功" : "失败") _logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg} result={rlt}", batchNo, timeDiff, (rlt.succ ? "成功" : "失败")
// , JSON.Serialize(rlt)); , JSON.Serialize(rlt));
//if (!rlt.succ) if (!rlt.succ)
//{ {
// result = rlt; result = rlt;
//} }
//else else
//{ {
// result.succ = true; result.succ = true;
// result.msg = "保存成功"; result.msg = "保存成功";
//} }
} }
catch (Exception ex) catch (Exception ex)
@ -120,56 +126,377 @@ namespace Myshipping.Application
return result; return result;
} }
#endregion
#region 取消服务项目
/// <summary> /// <summary>
/// 取消服务项目 /// 取消服务项目
/// </summary> /// </summary>
/// <param name="model">修改服务项目详情</param> /// <param name="model">修改服务项目详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CancelServiceProject(ModifyServiceProjectDto model) [AllowAnonymous, HttpPost("/EmbedProjectGoodsStatus/CancelServiceProject"), ApiUser(ApiCode = "EmbedServiceProjectStatus")]
public async Task<TaskManageOrderResultDto> CancelServiceProject(EmbedServiceProjectDto model)
{ {
return null; TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
try
{
if (string.IsNullOrWhiteSpace(model.businessId))
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.businessId,
BusiSystemCode = "BOOKING_ORDER",
MBlNo = "",
VesselVoyno = "",
OrderNo = "",
PushType = TrackingPushTypeEnum.Project,
OperTenantId = UserManager.TENANT_ID,
OperTenantName = UserManager.TENANT_NAME,
OpertType = model.OpertType,
OperUserId = UserManager.UserId.ToString(),
OperUserName = UserManager.Name,
SourceType = TrackingSourceTypeEnum.MANUAL,
ProjectList = model.ProjectCodes.Select(a => new TrackingMessageMainProjectInfo
{
ServiceProjectCode = a,
}).ToList()
}
};
DateTime bDate = DateTime.Now;
_logger.LogInformation("批次={no} 推送取消服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo));
var rlt = await _serviceWorkFlowManageService.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;
} }
#endregion
#region 获取服务项目列表
/// <summary> /// <summary>
/// 获取服务项目列表 /// 获取服务项目列表
/// </summary> /// </summary>
/// <param name="model">查询服务项目和状态详情</param> /// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetServiceProjectList(QueryServiceProjectWithStatus model) [AllowAnonymous, HttpPost("/EmbedProjectGoodsStatus/GetServiceProjectList"), ApiUser(ApiCode = "EmbedServiceProjectStatus")]
public async Task<TaskManageOrderResultDto> GetServiceProjectList(EmbedQueryServiceProjectWithStatus model)
{ {
return null; TaskManageOrderResultDto result = new TaskManageOrderResultDto();
}
string batchNo = IDGen.NextID().ToString();
try
{
DateTime bDate = DateTime.Now;
EmbedQueryServiceProjectWithStatus queryInfo = new EmbedQueryServiceProjectWithStatus
{
businessId = model.businessId,
QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_PROJECT,
TenantId = UserManager.TENANT_ID
};
result = await _serviceWorkFlowManageService.GetEnableProjectListCommon(queryInfo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("批次={no} id={id} 单票请求服务项目结果 耗时:{timeDiff}ms. ", batchNo, model.businessId, timeDiff);
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"获取服务项目列表失败,原因:{ex.Message}";
}
return result;
}
#endregion
#region 获取服务项目下的状态列表
/// <summary> /// <summary>
/// 获取服务项目下的状态列表 /// 获取服务项目下的状态列表
/// </summary> /// </summary>
/// <param name="model">查询服务项目和状态详情</param> /// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetServiceStatusList(QueryServiceProjectWithStatus model) [AllowAnonymous, HttpPost("/EmbedProjectGoodsStatus/GetServiceStatusList"), ApiUser(ApiCode = "EmbedServiceProjectStatus")]
public async Task<TaskManageOrderResultDto> GetServiceStatusList(EmbedQueryServiceProjectWithStatus model)
{ {
return null; TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
try
{
//查询所有服务服务项目和状态时,需要先获取订舱详情
if (model.QueryType == TrackingQueryTypeEnum.QUERY_SERVICE_ALL)
{
DateTime bDate = DateTime.Now;
EmbedQueryServiceProjectWithStatus queryInfo = new EmbedQueryServiceProjectWithStatus
{
businessId = model.businessId,
QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_PROJECT,
TenantId = UserManager.TENANT_ID
};
result = await _serviceWorkFlowManageService.GetEnableStatusListByBusinessCommon(queryInfo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("批次={no} id={id} 单票请求服务状态结果 耗时:{timeDiff}ms. ", batchNo, model.businessId, timeDiff);
}
else
{
if (model.ProjectCodes == null || (model.ProjectCodes != null && model.ProjectCodes.Length == 0))
throw Oops.Oh($"服务项目代码不能为空");
//model.TenantId = UserManager.TENANT_ID;
result = await _serviceWorkFlowManageService.GetEnableStatusListByProject(new QueryServiceProjectWithStatus {
ProjectCodes = model.ProjectCodes,
QueryType = model.QueryType,
TenantId = UserManager.TENANT_ID
});
}
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"获取服务项目下的状态列表失败,原因:{ex.Message}";
}
return result;
} }
#endregion
#region 保存服务状态
/// <summary> /// <summary>
/// 保存服务状态 /// 保存服务状态
/// </summary> /// </summary>
/// <param name="model">修改服务状态详情</param> /// <param name="model">修改服务状态详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SaveServiceStatus(ModifyServiceProjectStatusDto model) [AllowAnonymous, HttpPost("/EmbedProjectGoodsStatus/SaveServiceStatus"), ApiUser(ApiCode = "EmbedServiceProjectStatus")]
public async Task<TaskManageOrderResultDto> SaveServiceStatus(EmbedServiceProjectStatusDto model)
{ {
return null; TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
try
{
if (string.IsNullOrWhiteSpace(model.businessId))
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.businessId,
BusiSystemCode = "BOOKING_ORDER",
MBlNo = "",
VesselVoyno = "",
OrderNo = "",
PushType = TrackingPushTypeEnum.Status,
OperTenantId = UserManager.TENANT_ID,
OperTenantName = UserManager.TENANT_NAME,
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 _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 = "推送成功";
//这里预留保存完货物状态主动推送东胜
//var _bookingOrderService = _namedBookingOrderServiceProvider.GetService<ITransient>(nameof(BookingOrderService));
// await _bookingOrderService.SetBookingGoodsStatus(bookingOrder.Id, true, "手动更新货物状态");
}
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"服务项目状态推送失败,原因:{ex.Message}";
}
return result;
} }
#endregion
#region 取消服务状态
/// <summary> /// <summary>
/// 取消服务状态 /// 取消服务状态
/// </summary> /// </summary>
/// <param name="model">修改服务状态详情</param> /// <param name="model">修改服务状态详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CancelServiceStatus(ModifyServiceProjectStatusDto model) [AllowAnonymous, HttpPost("/EmbedProjectGoodsStatus/CancelServiceStatus"), ApiUser(ApiCode = "EmbedServiceProjectStatus")]
public async Task<TaskManageOrderResultDto> CancelServiceStatus(EmbedServiceProjectStatusDto model)
{ {
return null; TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
try
{
_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.businessId,
BusiSystemCode = "BOOKING_ORDER",
MBlNo = "",
VesselVoyno = "",
OrderNo = "",
PushType = TrackingPushTypeEnum.Status,
OperTenantId = UserManager.TENANT_ID,
OperTenantName = UserManager.TENANT_NAME,
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 _serviceWorkFlowManageService.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;
} }
#endregion
} }
} }

@ -20,14 +20,14 @@ namespace Myshipping.Application
/// </summary> /// </summary>
/// <param name="model">修改服务项目详情</param> /// <param name="model">修改服务项目详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelServiceProject(ModifyServiceProjectDto model); Task<TaskManageOrderResultDto> CancelServiceProject(EmbedServiceProjectDto model);
/// <summary> /// <summary>
/// 获取服务项目列表 /// 获取服务项目列表
/// </summary> /// </summary>
/// <param name="model">查询服务项目和状态详情</param> /// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetServiceProjectList(QueryServiceProjectWithStatus model); Task<TaskManageOrderResultDto> GetServiceProjectList(EmbedQueryServiceProjectWithStatus model);
/// <summary> /// <summary>
@ -35,20 +35,20 @@ namespace Myshipping.Application
/// </summary> /// </summary>
/// <param name="model">查询服务项目和状态详情</param> /// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetServiceStatusList(QueryServiceProjectWithStatus model); Task<TaskManageOrderResultDto> GetServiceStatusList(EmbedQueryServiceProjectWithStatus model);
/// <summary> /// <summary>
/// 保存服务状态 /// 保存服务状态
/// </summary> /// </summary>
/// <param name="model">修改服务状态详情</param> /// <param name="model">修改服务状态详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SaveServiceStatus(ModifyServiceProjectStatusDto model); Task<TaskManageOrderResultDto> SaveServiceStatus(EmbedServiceProjectStatusDto model);
/// <summary> /// <summary>
/// 取消服务状态 /// 取消服务状态
/// </summary> /// </summary>
/// <param name="model">修改服务状态详情</param> /// <param name="model">修改服务状态详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelServiceStatus(ModifyServiceProjectStatusDto model); Task<TaskManageOrderResultDto> CancelServiceStatus(EmbedServiceProjectStatusDto model);
} }
} }

@ -120,6 +120,16 @@ namespace Myshipping.Application
/// 是否默认使用用户个人邮箱发送 false-使用公共邮箱 true-使用个人邮箱 /// 是否默认使用用户个人邮箱发送 false-使用公共邮箱 true-使用个人邮箱
/// </summary> /// </summary>
public bool usePersonalEmailSend { get; set; } = false; public bool usePersonalEmailSend { get; set; } = false;
/// <summary>
/// 客服ID
/// </summary>
public Nullable<long> CustServiceId { get; set; }
/// <summary>
/// 客服名称
/// </summary>
public string CustServiceName { get; set; }
} }
public class CustomerContact public class CustomerContact

@ -1273,6 +1273,9 @@ namespace Myshipping.Application
CLOSEVGMDATE = taskBCInfo.VGM_CUTOFF_TIME, CLOSEVGMDATE = taskBCInfo.VGM_CUTOFF_TIME,
CLOSINGDATE = taskBCInfo.CY_CUTOFF_TIME, CLOSINGDATE = taskBCInfo.CY_CUTOFF_TIME,
CLOSEDOCDATE = taskBCInfo.CUT_SINGLE_TIME, CLOSEDOCDATE = taskBCInfo.CUT_SINGLE_TIME,
CUSTSERVICEID = generateModel.CustServiceId.HasValue? generateModel.CustServiceId.Value.ToString(): null,
CUSTSERVICE = generateModel.CustServiceName,
ctnInputs = new List<BookingCtnDto>() ctnInputs = new List<BookingCtnDto>()
}; };

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.TrackingSystem.Dtos
{
/// <summary>
///
/// </summary>
public class QueryServiceProjectWithStatusCommon
{
/// <summary>
/// 业务主键(可为空,不为空时需要查询已触发的记录和未触发的记录,为空时只查询已启用的)
/// </summary>
public string businessId { get; set; }
/// <summary>
/// 0-查服务项目 1-查服务项目下的状态
/// </summary>
public TrackingQueryTypeEnum QueryType { get; set; }
/// <summary>
/// 服务项目代码组
/// </summary>
public string[] ProjectCodes { get; set; }
/// <summary>
/// 租户ID
/// </summary>
public long TenantId { get; set; }
}
}

@ -1,4 +1,5 @@
using System; using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -106,5 +107,20 @@ namespace Myshipping.Application
/// <param name="tenantId">租户ID</param> /// <param name="tenantId">租户ID</param>
/// <returns></returns> /// <returns></returns>
Task<TaskManageOrderResultDto> ManualSyncHistoryServiceStatus(long tenantId); Task<TaskManageOrderResultDto> ManualSyncHistoryServiceStatus(long tenantId);
/// <summary>
/// 检索已选中并且可用的服务项目列表(标准)
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetEnableProjectListCommon(EmbedQueryServiceProjectWithStatus model);
/// <summary>
/// 单票检索服务项目下的状态列表(标准)
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetEnableStatusListByBusinessCommon(EmbedQueryServiceProjectWithStatus model);
} }
} }

@ -1510,36 +1510,39 @@ namespace Myshipping.Application
tskList.ForEach(async tsk => { tskList.ForEach(async tsk => {
if (tsk.OperType == "Update") if (tsk.OperType == "Update")
{ {
var runInfo = _serviceWorkFlowRunInfoRepository.AsQueryable() var runInfo = _serviceWorkFlowRunInfoRepository.AsQueryable().Filter(null,true)
.First(a => a.PK_ID == tsk.Run.PK_ID); .First(a => a.PK_ID == tsk.Run.PK_ID);
runInfo.IS_YIELD = 0; if (runInfo != null)
runInfo.ACT_DATE = null;
runInfo.UpdatedTime = nowDate;
runInfo.UpdatedUserId = long.Parse(info.Main.OperUserId);
runInfo.UpdatedUserName = info.Main.OperUserName;
await _serviceWorkFlowRunInfoRepository.AsUpdateable(runInfo).UpdateColumns(it => new
{ {
it.ACT_DATE, runInfo.IS_YIELD = 0;
it.IS_YIELD, runInfo.ACT_DATE = null;
it.UpdatedTime, runInfo.UpdatedTime = nowDate;
it.UpdatedUserId, runInfo.UpdatedUserId = long.Parse(info.Main.OperUserId);
it.UpdatedUserName runInfo.UpdatedUserName = info.Main.OperUserName;
}).ExecuteCommandAsync();
#region 写入运行日志 await _serviceWorkFlowRunInfoRepository.AsUpdateable(runInfo).UpdateColumns(it => new
var runLog = runInfo.Adapt<ServiceWorkFlowRunLogInfo>(); {
runLog.PK_ID = IDGen.NextID().ToString(); it.ACT_DATE,
runLog.RUN_ID = runInfo.PK_ID; it.IS_YIELD,
runLog.BATCH_NO = batchNo; it.UpdatedTime,
runLog.OPER_TYPE = TrackingRunOperTypeEnum.CANCEL_PROJECT.ToString(); it.UpdatedUserId,
runLog.EXEC_RESULT = "SUCC"; it.UpdatedUserName
runLog.EXEC_NOTE = "Update"; }).ExecuteCommandAsync();
runLog.SOURCE_TYPE = info.Main.SourceType.ToString();
await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #region 写入运行日志
#endregion var runLog = runInfo.Adapt<ServiceWorkFlowRunLogInfo>();
runLog.PK_ID = IDGen.NextID().ToString();
runLog.RUN_ID = runInfo.PK_ID;
runLog.BATCH_NO = batchNo;
runLog.OPER_TYPE = TrackingRunOperTypeEnum.CANCEL_PROJECT.ToString();
runLog.EXEC_RESULT = "SUCC";
runLog.EXEC_NOTE = "Update";
runLog.SOURCE_TYPE = info.Main.SourceType.ToString();
await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
#endregion
}
} }
}); });
@ -2930,5 +2933,328 @@ namespace Myshipping.Application
return result; return result;
} }
#region 检索已选中并且可用的服务项目列表(标准)
/// <summary>
/// 检索已选中并且可用的服务项目列表(标准)
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetEnableProjectListCommon(EmbedQueryServiceProjectWithStatus model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
//先获取可用的服务项目
var projectList = await _serviceWorkFlowBaseService.GetEnableProjectList(model.TenantId.ToString());
TrackingQueryMessageInfo messageInfo = new TrackingQueryMessageInfo
{
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 TrackingMessageQueryMainInfo
{
BusiId = model.businessId,
BusiSystemCode = "BOOKING_ORDER",
TenantId = model.TenantId.ToString(),
}
};
//在获取运行表已有的记录
var runList = InnerGetRunListBySingleBusiness(messageInfo);
var resultList = projectList.GroupJoin(runList, l => l.PKId, r => r.ServiceProjectId, (l, r) => {
var currList = r.ToList();
var runInfo = currList.FirstOrDefault();
var dto = new ServiceProjectWithStatusDto
{
ProjectPKId = l.PKId,
ProjectCode = l.ServiceProjectCode,
ProjectName = l.ServiceProjectName,
SortNo = l.SortNo
};
if (runInfo != null)
{
dto.IsYield = runInfo.IsYield == 1 ? true : false;
dto.ActDate = runInfo.ActDate;
}
return dto;
}).ToList();
result.succ = true;
result.ext = resultList;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"检索已选中并且可用的服务项目列表失败,原因:{ex.Message}";
}
return result;
}
#endregion
#region 单票检索服务项目下的状态列表
/// <summary>
/// 单票检索服务项目下的状态列表
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
[HttpPost("/ServiceWorkFlowManage/GetEnableStatusListByBusinessCommon")]
public async Task<TaskManageOrderResultDto> GetEnableStatusListByBusinessCommon([FromBody] EmbedQueryServiceProjectWithStatus model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var statuList = await _serviceWorkFlowBaseService.GetEnableProjectWithStatusList(model.TenantId.ToString());
TrackingQueryMessageInfo messageInfo = new TrackingQueryMessageInfo
{
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 TrackingMessageQueryMainInfo
{
BusiId = model.businessId,
BusiSystemCode = "BOOKING_ORDER",
TenantId = model.TenantId.ToString(),
}
};
DateTime bDate = DateTime.Now;
//在获取运行表已有的记录
var runList = InnerGetRunListBySingleBusiness(messageInfo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("测试读取服务状态-读取数据库记录 耗时:{timeDiff}ms. ", timeDiff);
int lastWFSortNo = 0;
int calcNum = 1;
//var allStatus = statuList.SelectMany(b => {
// var curArg = b.StatusList.SelectMany(x => x.SubStatusList).ToList();
// if (curArg == null)
// curArg = new List<ServiceProjectStatusDto>();
// curArg.AddRange(b.StatusList);
// return curArg;
//}).ToList();
var resultList = statuList.Join(runList, l => l.WFPKId,
r => r.WFPKId,
(l, r) => {
var runInfo = r;
var rltList = new List<ServiceProjectStatusDto>();
if (runInfo.ActivitiesList == null || (runInfo.ActivitiesList != null && runInfo.ActivitiesList.Count == 0))
{
l.StatusList.ForEach(b => {
rltList.Add(new ServiceProjectStatusDto
{
ActPKId = b.ActPKId,
ActSortNo = b.ActSortNo,
ShowName = b.ShowName,
IsYield = false,
StatusSKUCode = b.StatusSKUCode,
ActRemark = b.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ActSortNo,
SortNo = b.SortNo
});
if (b.SubStatusList != null && b.SubStatusList.Count > 0)
{
rltList.AddRange(b.SubStatusList.Select(c => new ServiceProjectStatusDto
{
ActPKId = c.ActPKId,
ActSortNo = c.ActSortNo,
ShowName = c.ShowName,
IsYield = false,
StatusSKUCode = c.StatusSKUCode,
ActRemark = c.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ActSortNo + (c.ActSortNo * 0.001m),
SortNo = c.SortNo
}).ToList());
}
});
}
else
{
l.StatusList.ForEach(b => {
var eRunInfo = runInfo.ActivitiesList
.FirstOrDefault(p => p.ActId == b.ActPKId);
if (eRunInfo != null)
{
rltList.Add(new ServiceProjectStatusDto
{
ActPKId = eRunInfo.ActId,
ActSortNo = eRunInfo.ExecSortNo,
ShowName = eRunInfo.ShowName,
IsYield = eRunInfo.IsYield == 1 ? true : false,
StatusSKUCode = eRunInfo.StatusSKUCode,
ActDate = eRunInfo.ActDate,
ActVal = eRunInfo.ActVal,
ActRemark = eRunInfo.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)eRunInfo.ExecSortNo,
SortNo = b.SortNo
});
}
else
{
rltList.Add(new ServiceProjectStatusDto
{
ActPKId = b.ActPKId,
ActSortNo = b.ActSortNo,
ShowName = b.ShowName,
IsYield = false,
StatusSKUCode = b.StatusSKUCode,
ActRemark = b.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ActSortNo,
SortNo = b.SortNo
});
}
if (b.SubStatusList != null && b.SubStatusList.Count > 0)
{
b.SubStatusList.ForEach(sb => {
ServiceWorkFlowActivitiesRunSubDto eSubRunInfo = null;
if (eRunInfo != null && eRunInfo.SubList != null)
{
eSubRunInfo = eRunInfo.SubList
.FirstOrDefault(p => p.ActId == sb.ActPKId);
}
if (eSubRunInfo != null)
{
decimal calcSort = (decimal)b.ActSortNo + (eSubRunInfo.ExecSortNo * 0.001m);
if (eRunInfo != null)
{
calcSort = (decimal)eRunInfo.ExecSortNo + (eSubRunInfo.ExecSortNo * 0.001m);
}
rltList.Add(new ServiceProjectStatusDto
{
ActPKId = eSubRunInfo.ActId,
ActSortNo = eSubRunInfo.ExecSortNo,
ShowName = eSubRunInfo.ShowName,
IsYield = eSubRunInfo.IsYield == 1 ? true : false,
StatusSKUCode = eSubRunInfo.StatusSKUCode,
ActDate = eSubRunInfo.ActDate,
ActVal = eSubRunInfo.ActVal,
ActRemark = eSubRunInfo.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = calcSort,
SortNo = sb.SortNo
});
}
else
{
decimal calcSort = (decimal)b.ActSortNo + (sb.ActSortNo * 0.001m);
if (eRunInfo != null)
{
calcSort = (decimal)eRunInfo.ExecSortNo + (sb.ActSortNo * 0.001m);
}
rltList.Add(new ServiceProjectStatusDto
{
ActPKId = sb.ActPKId,
ActSortNo = sb.ActSortNo,
ShowName = sb.ShowName,
IsYield = false,
StatusSKUCode = sb.StatusSKUCode,
ActRemark = sb.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = calcSort,
SortNo = sb.SortNo
});
}
});
}
});
}
if (rltList != null && rltList.Count > 0)
{
var maxSort = rltList.Max(t => t.CalcSortNo);
rltList.FirstOrDefault(t => t.CalcSortNo == maxSort).IsEnd = true;
}
return rltList;
}).SelectMany(b => b).OrderBy(b => b.WFSortNo).Select(b => {
if (lastWFSortNo == 0)
{
b.GroupName = calcNum.ToString();
lastWFSortNo = b.WFSortNo;
}
else if (b.WFSortNo == lastWFSortNo)
{
b.GroupName = calcNum.ToString();
}
else
{
++calcNum;
lastWFSortNo = b.WFSortNo;
b.GroupName = calcNum.ToString();
}
return b;
}).OrderBy(b => b.WFSortNo).ThenBy(b => b.CalcSortNo).ToList();
result.succ = true;
result.ext = resultList;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"检索服务项目下的状态列表失败,原因:{ex.Message}";
}
return result;
}
#endregion
} }
} }

@ -10247,6 +10247,11 @@
船代名称 船代名称
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.Module">
<summary>
模块(公用时为空字符串)
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.Remark"> <member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.Remark">
<summary> <summary>
备注 备注

Loading…
Cancel
Save