|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
using DS.Module.Core.Condition;
|
|
|
|
|
using DS.Module.Core.Constants;
|
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
using DS.Module.DjyServiceStatus;
|
|
|
|
|
using DS.Module.SqlSugar;
|
|
|
|
|
using DS.Module.UserModule;
|
|
|
|
|
using DS.WMS.Core.Code.Dtos;
|
|
|
|
@ -39,6 +40,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
// 按需构建
|
|
|
|
|
protected Lazy<ITaskAllocationService> allocationService;
|
|
|
|
|
protected Lazy<ISeaExportCommonService> seaExportCommonService;
|
|
|
|
|
protected Lazy<IDjyServiceStatusService> djyServiceStatusService;
|
|
|
|
|
|
|
|
|
|
public TaskManageBaseService(IUser user,
|
|
|
|
|
ILogger<T> logger,
|
|
|
|
@ -54,6 +56,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
|
|
|
|
|
allocationService = new Lazy<ITaskAllocationService>(serviceProvider.GetRequiredService<ITaskAllocationService>());
|
|
|
|
|
seaExportCommonService = new Lazy<ISeaExportCommonService>(serviceProvider.GetRequiredService<ISeaExportCommonService>());
|
|
|
|
|
djyServiceStatusService = new Lazy<IDjyServiceStatusService>(serviceProvider.GetRequiredService<IDjyServiceStatusService>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -365,7 +368,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
|
|
|
|
|
var allotSetCache = await allocationService.Value.GetAllList();
|
|
|
|
|
|
|
|
|
|
if (!allotSetCache.Succeeded || allotSetCache.Data?.Any() != true)
|
|
|
|
|
if (!allotSetCache.Succeeded || (allotSetCache.Data?.Count ?? 0) == 0)
|
|
|
|
|
{
|
|
|
|
|
return DataResult<MatchTaskResultDto>.Success("操作成功!", result, MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
@ -548,24 +551,48 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果任务状态为已完成,则查询任务完成时任务对应模块的配置中要设置的业务状态,然后进行设置
|
|
|
|
|
// 任务状态为“完成”且来源为工作流时要做的工作:
|
|
|
|
|
if (taskStatusEnum == TaskStatusEnum.Complete && taskInfo.TASK_SOURCE == TaskSourceEnum.WORK_FLOW.ToString())
|
|
|
|
|
{
|
|
|
|
|
long? orderId = bsno;
|
|
|
|
|
if (orderId == null)
|
|
|
|
|
if (orderId == null || orderId == 0)
|
|
|
|
|
{
|
|
|
|
|
if (long.TryParse(taskInfo.BOOK_ORDER_NO, out long temp))
|
|
|
|
|
{
|
|
|
|
|
orderId = temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (orderId != null)
|
|
|
|
|
if (orderId != null && orderId != 0)
|
|
|
|
|
{
|
|
|
|
|
string? statusCode = await tenantDb.Queryable<TaskFlowModule>().Where(x => x.ModuleType == 2 && x.TaskType == taskInfo.TASK_TYPE).Select(x => x.CompletedBusinessStatusCode).FirstAsync();
|
|
|
|
|
if (!string.IsNullOrEmpty(statusCode))
|
|
|
|
|
{
|
|
|
|
|
await seaExportCommonService.Value.SetGoodsStatus(statusCode, (long)orderId, tenantDb);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// 1.设置相关订单的业务状态
|
|
|
|
|
await seaExportCommonService.Value.SetGoodsStatus(statusCode, (long)orderId, tenantDb);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logger.LogError(ex, "任务完成时,设置订单业务状态的过程中发生异常,orderId={0},taskType={1}", orderId, taskInfo.TASK_TYPE);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// 2.设置货物状态为已完成
|
|
|
|
|
await djyServiceStatusService.Value.SaveServiceStatus(new EmbedServiceProjectStatusDto()
|
|
|
|
|
{
|
|
|
|
|
businessId = orderId.ToString()!,
|
|
|
|
|
SourceType = 1,
|
|
|
|
|
StatusCodes = [new() { StatusCode = statusCode }]
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logger.LogError(ex, "任务完成时,设置订单的货物状态时发生异常,orderId={0},taskType={1}", orderId, taskInfo.TASK_TYPE);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|