cjy 4 weeks ago
commit e62e730be6

@ -4,6 +4,7 @@ using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.TaskInteraction.Method;
using Masuit.Tools.Systems;
using NPOI.POIFS.Properties;
namespace DS.WMS.Core.TaskInteraction.Dtos
{
@ -27,12 +28,11 @@ namespace DS.WMS.Core.TaskInteraction.Dtos
/// </summary>
public BusinessType? BusinessType { get; set; }
static readonly TaskBaseTypeEnum _defaultTaskType = TaskBaseTypeEnum.NOT_SPECIFIED;
/// <summary>
/// 任务类型;该属性为只读
/// </summary>
[IgnoreDataMember]
public TaskBaseTypeEnum TaskType => string.IsNullOrEmpty(TaskTypeName) ? _defaultTaskType : Enum.Parse<TaskBaseTypeEnum>(TaskTypeName);
public TaskBaseTypeEnum TaskType => string.IsNullOrEmpty(TaskTypeName) ? TaskBaseTypeEnum.NOT_SPECIFIED : Enum.Parse<TaskBaseTypeEnum>(TaskTypeName);
/// <summary>
/// 任务类型名称
@ -40,7 +40,18 @@ namespace DS.WMS.Core.TaskInteraction.Dtos
public string TaskTypeName { get; set; } = string.Empty;
/// <summary>
/// 父级ID用于子任务
/// 父级任务类型名称(用于子任务)
/// </summary>
public string? ParentTaskTypeName { get; set; }
/// <summary>
/// 父级任务类型;该属性为只读
/// </summary>
[IgnoreDataMember]
public TaskBaseTypeEnum? ParentTaskType => string.IsNullOrEmpty(ParentTaskTypeName) ? null : Enum.Parse<TaskBaseTypeEnum>(ParentTaskTypeName);
/// <summary>
/// 父级任务ID用于子任务
/// </summary>
public long? ParentId { get; set; }

@ -0,0 +1,10 @@
namespace DS.WMS.Core.TaskInteraction.Interface
{
/// <summary>
/// PA任务
/// </summary>
public interface IPreAlertTaskService : ITaskService
{
}
}

@ -16,7 +16,7 @@ namespace DS.WMS.Core.TaskInteraction.Interface
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
Task<DataResult<List<BusinessTaskLog>>> ReadLogAsync(long id, BusinessType businessType);
Task<DataResult<List<BusinessTaskLog>>> ReadLogAsync(long id, BusinessType? businessType);
/// <summary>
/// 写入任务日志

@ -61,7 +61,7 @@ namespace DS.WMS.Core.TaskInteraction.Interface
Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true);
/// <summary>
/// 设置任务步骤状态
/// 设置任务步骤
/// </summary>
/// <param name="request"></param>
/// <param name="useTransaction">是否使用事务</param>

@ -1,4 +1,7 @@
using DS.WMS.Core.TaskInteraction.Dtos;
using DS.Module.Core;
using DS.WMS.Core.TaskInteraction.Dtos;
using DS.WMS.Core.TaskInteraction.Interface;
using Microsoft.Extensions.DependencyInjection;
namespace DS.WMS.Core.TaskInteraction.Method.ActionExecutor.BLConfirm
{
@ -9,7 +12,9 @@ namespace DS.WMS.Core.TaskInteraction.Method.ActionExecutor.BLConfirm
{
public override async Task ExecuteAsync(ActionExecutionContext context)
{
//var taskService = context.ServiceProvider.GetRequiredService<ISeaExportTaskService>();
//await CreateTaskIfNotExistAsync(context.TaskInfo.BusinessId, context.TaskInfo.BusinessType.GetValueOrDefault(),
// TaskBaseTypeEnum.WAIT_BILL_CONFIRM, taskService);
}
}
}

@ -63,6 +63,7 @@ namespace DS.WMS.Core.TaskInteraction.Method.ActionExecutor.BLConfirm
BusinessId = bill.Id,
BusinessType = context.TaskInfo.BusinessType,
TaskTypeName = TaskBaseTypeEnum.WAIT_SUB_BILL_CONFIRM.ToString(),
ParentTaskTypeName = TaskBaseTypeEnum.WAIT_BILL_CONFIRM.ToString(),
TaskTitle = $"【{TaskBaseTypeEnum.WAIT_SUB_BILL_CONFIRM.GetDescription()}】{bill.BillType} {bill.HBLNO} {bill.ETD?.ToString("yyyy-MM-dd")} {bill.Vessel}|{bill.Voyno}",
Steps = []
};

@ -0,0 +1,42 @@
using DS.Module.Core;
using DS.WMS.Core.TaskInteraction.Dtos;
using DS.WMS.Core.TaskInteraction.Interface;
namespace DS.WMS.Core.TaskInteraction.Method
{
/// <summary>
/// PA任务服务
/// </summary>
public class PreAlertTaskService : TaskService, IPreAlertTaskService
{
/// <summary>
/// 初始化
/// </summary>
/// <param name="provider"></param>
public PreAlertTaskService(IServiceProvider provider) : base(provider)
{
}
/// <summary>
/// 创建PA任务
/// </summary>
/// <param name="request"></param>
/// <param name="useTransaction"></param>
/// <returns></returns>
public override Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true)
{
return base.CreateTaskAsync(request, useTransaction);
}
/// <summary>
/// 设置任务状态
/// </summary>
/// <param name="request"></param>
/// <param name="useTransaction"></param>
/// <returns></returns>
public override Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true)
{
return base.SetTaskStatusAsync(request, useTransaction);
}
}
}

@ -26,9 +26,10 @@ namespace DS.WMS.Core.TaskInteraction.Method
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
public async Task<DataResult<List<BusinessTaskLog>>> ReadLogAsync(long id, BusinessType businessType)
public async Task<DataResult<List<BusinessTaskLog>>> ReadLogAsync(long id, BusinessType? businessType)
{
var list = await TenantDb.Queryable<BusinessTaskLog>().Where(x => x.BusinessId == id && x.BusinessType == businessType)
var list = await TenantDb.Queryable<BusinessTaskLog>().Where(x => x.BusinessId == id)
.WhereIF(businessType.HasValue, x => x.BusinessType == businessType)
.OrderBy(x => x.CreateTime).ToListAsync();
var result = DataResult<List<BusinessTaskLog>>.Success(list);
result.Count = list.Count;

@ -103,7 +103,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
/// <summary>
/// 任务分配
/// </summary>
protected ITaskAllocationService TaskAllocationService { get; private set; }
protected Lazy<ITaskAllocationService> TaskAllocationService { get; private set; }
/// <summary>
/// 工作流服务
@ -130,9 +130,9 @@ namespace DS.WMS.Core.TaskInteraction.Method
{
ManagerService = provider.GetRequiredService<ITaskManageService>();
LogService = provider.GetRequiredService<ITaskLogService>();
TaskAllocationService = provider.GetRequiredService<ITaskAllocationService>();
ActionService = provider.GetRequiredService<IActionManagerService>();
TaskAllocationService = new Lazy<ITaskAllocationService>(provider.GetRequiredService<ITaskAllocationService>());
ClientParamService = new Lazy<IClientParamService>(provider.GetRequiredService<IClientParamService>());
FlowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>());
RuleEngineService = new Lazy<IRuleEngineService>(provider.GetRequiredService<IRuleEngineService>());
@ -179,7 +179,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
/// <param name="request"></param>
/// <param name="useTransaction">是否使用事务</param>
/// <returns></returns>
public async Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true)
public virtual async Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true)
{
if (!await HasAuthorizedAsync())
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
@ -193,20 +193,6 @@ namespace DS.WMS.Core.TaskInteraction.Method
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TypeOrName));
}
//if (request.BusinessType.HasValue)
//{
// bool isBizValid = false;
// switch (request.BusinessType.Value)
// {
// case BusinessType.OceanShippingExport:
// isBizValid = await TenantDb.Queryable<SeaExport>().AnyAsync(x => x.Id == request.BusinessId);
// break;
// }
// if (!isBizValid)
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Biz_Not_Valid));
//}
if (request.HasCabin.GetValueOrDefault() && request.BusinessType.HasValue)
{
//如果为现舱,获取下一任务类型进行创建
@ -263,19 +249,19 @@ namespace DS.WMS.Core.TaskInteraction.Method
Head = new TaskManageOrderMessageHeadInfo
{
GID = Guid.NewGuid().ToString(),
BSNO = request.BusinessId,
BSNO = request.ParentBusinessId ?? request.BusinessId,
MessageType = "WORK_FLOW_TASK",
SenderId = "WorkFlow",
SenderName = "工作流平台",
ReceiverId = "TaskManage",
ReceiverName = "任务管理平台",
Version = "1.0",
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
RequestAction = "Add"
IsChild = request.ParentBusinessId.HasValue,
ChildBSNO = request.ParentBusinessId.HasValue ? request.BusinessId : 0
},
Main = new TaskManageOrderMessageMainInfo
{
TaskType = request.TaskType,
TaskType = request.ParentTaskType ?? request.TaskType,
TaskSource = TaskSourceEnum.WORK_FLOW,
TaskTitle = request.TaskTitle,
TaskDesp = request.TaskDescription,
@ -283,7 +269,8 @@ namespace DS.WMS.Core.TaskInteraction.Method
TaskUserName = User.UserName,
TaskTenatId = long.Parse(User.TenantId),
TaskTenatName = User.TenantName,
IsCheckExistsByTaskType = true
IsCheckExistsByTaskType = true,
ChildTaskType = request.TaskType
}
};
@ -548,7 +535,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
/// <param name="request"></param>
/// <param name="useTransaction">是否使用事务</param>
/// <returns></returns>
public async Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true)
public virtual async Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true)
{
if (!await HasAuthorizedAsync())
return DataResult.FailedWithDesc(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ModuleUnauthorized)));
@ -651,7 +638,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
/// <param name="request"></param>
/// <param name="useTransaction">是否使用事务</param>
/// <returns></returns>
public async Task<DataResult> SetStepsAsync(TaskRequest request, bool useTransaction = true)
public virtual async Task<DataResult> SetStepsAsync(TaskRequest request, bool useTransaction = true)
{
if (!await HasAuthorizedAsync())
return DataResult.FailedWithDesc(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ModuleUnauthorized)));
@ -679,6 +666,8 @@ namespace DS.WMS.Core.TaskInteraction.Method
IsCompleted = x.IsCompleted,
SortOrder = x.SortOrder
}).ToListAsync();
if (allSteps.All(x => x.IsCompleted))
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCompleted));
//获取未完成的优先级最高的步骤
var topSteps = allSteps.Where(x => !x.IsCompleted).GroupBy(x => x.SortOrder).OrderBy(x => x.Key).FirstOrDefault();
@ -811,14 +800,14 @@ namespace DS.WMS.Core.TaskInteraction.Method
/// <summary>
/// 返回指定类型的任务是否已存在
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="bsId">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="type">任务类型</param>
/// <returns></returns>
public async Task<DataResult<bool>> ExistsAsync(long id, BusinessType businessType, TaskBaseTypeEnum type)
public async Task<DataResult<bool>> ExistsAsync(long bsId, BusinessType businessType, TaskBaseTypeEnum type)
{
var value = await TenantDb.Queryable<BusinessTask>().AnyAsync(x =>
x.BusinessId == id && x.BusinessType == businessType && x.TaskType == type);
x.BusinessId == bsId && x.BusinessType == businessType && x.TaskType == type);
return DataResult<bool>.Success(value);
}
@ -1338,7 +1327,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
if (businessType.HasValue)
biz = await ActionService.GetBusinessDataAsync(id, businessType.Value);
var result = await TaskAllocationService.GetAllotUserBySeaExportId(taskTypes, id, new TaskFlowDataContext(
var result = await TaskAllocationService.Value.GetAllotUserBySeaExportId(taskTypes, id, new TaskFlowDataContext(
(TaskFlowDataNameConst.Business, biz)
));
return result.Succeeded ? result.Data : [];

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl>
<History>True|2024-10-25T07:09:27.7029075Z||;True|2024-10-25T10:29:26.9218878+08:00||;True|2024-10-22T17:58:39.9582805+08:00||;True|2024-10-21T17:57:21.7047579+08:00||;True|2024-10-21T14:30:54.4520206+08:00||;True|2024-10-21T10:19:05.7405749+08:00||;True|2024-10-18T16:11:05.4049685+08:00||;True|2024-10-18T14:59:49.1162741+08:00||;True|2024-10-16T16:29:15.3185348+08:00||;True|2024-10-16T14:12:58.1754214+08:00||;True|2024-10-16T14:08:06.5805581+08:00||;True|2024-10-16T11:55:29.8273176+08:00||;True|2024-10-15T17:39:40.4090324+08:00||;True|2024-10-15T17:06:43.0181578+08:00||;True|2024-10-15T15:07:38.9601925+08:00||;True|2024-10-12T13:33:32.4412583+08:00||;True|2024-10-11T17:00:54.0916209+08:00||;True|2024-10-11T10:54:50.3307087+08:00||;True|2024-10-11T10:45:07.8181500+08:00||;True|2024-10-11T10:40:44.2066046+08:00||;True|2024-10-11T10:21:25.7226983+08:00||;True|2024-10-11T10:09:05.5257478+08:00||;True|2024-10-10T14:58:29.1228618+08:00||;True|2024-10-10T14:05:59.4501659+08:00||;True|2024-10-10T11:08:58.9765455+08:00||;True|2024-10-08T17:59:07.5583287+08:00||;True|2024-09-27T19:01:59.6945760+08:00||;True|2024-09-27T18:45:48.2812860+08:00||;True|2024-09-27T18:10:25.5697467+08:00||;True|2024-09-27T17:39:06.3169139+08:00||;True|2024-09-27T17:30:14.1043193+08:00||;True|2024-09-27T16:02:09.0703159+08:00||;True|2024-09-27T15:53:05.1789245+08:00||;True|2024-09-27T15:32:52.1934490+08:00||;True|2024-09-27T13:51:24.9197626+08:00||;True|2024-09-27T13:48:17.2817346+08:00||;True|2024-09-27T11:51:46.8193040+08:00||;True|2024-09-27T10:58:33.1059648+08:00||;True|2024-09-27T10:37:35.0336563+08:00||;False|2024-09-27T10:31:52.6302264+08:00||;True|2024-09-26T19:50:15.5513195+08:00||;True|2024-09-26T19:47:14.0781788+08:00||;True|2024-09-26T19:01:26.5428388+08:00||;True|2024-09-26T18:35:28.7455319+08:00||;True|2024-09-26T18:24:30.8084807+08:00||;True|2024-09-26T18:20:47.3005460+08:00||;True|2024-09-26T18:04:39.8012913+08:00||;True|2024-09-26T17:48:13.8526872+08:00||;True|2024-09-26T16:08:20.1746970+08:00||;True|2024-09-26T16:01:01.1501975+08:00||;False|2024-09-26T16:00:34.1516745+08:00||;True|2024-09-26T14:33:03.4007570+08:00||;True|2024-09-25T19:14:27.8906774+08:00||;True|2024-09-25T18:57:40.1435131+08:00||;True|2024-09-25T17:38:44.0915841+08:00||;True|2024-09-25T15:33:58.4630618+08:00||;True|2024-09-25T15:10:31.3022063+08:00||;False|2024-09-25T14:14:40.9640545+08:00||;True|2024-09-25T10:09:32.2558600+08:00||;True|2024-09-25T09:59:17.1525160+08:00||;False|2024-09-25T09:57:58.7265103+08:00||;False|2024-09-25T09:53:36.7732713+08:00||;False|2024-09-24T18:40:10.0166224+08:00||;True|2024-09-24T08:59:56.1995425+08:00||;True|2024-09-23T18:07:54.7222163+08:00||;True|2024-09-23T17:23:57.7568406+08:00||;True|2024-09-23T16:28:49.3169826+08:00||;True|2024-09-23T15:57:31.8052490+08:00||;True|2024-09-23T11:47:21.1445419+08:00||;True|2024-09-23T09:24:36.0732229+08:00||;True|2024-09-21T11:59:19.0549926+08:00||;True|2024-09-21T11:24:32.4451752+08:00||;True|2024-09-21T10:39:11.5297411+08:00||;True|2024-09-20T18:24:31.7827684+08:00||;True|2024-09-19T17:55:53.1666689+08:00||;True|2024-09-19T17:42:47.9061485+08:00||;True|2024-09-19T16:08:21.7225571+08:00||;False|2024-09-19T14:15:42.9318446+08:00||;True|2024-09-19T11:20:03.5567568+08:00||;True|2024-09-18T11:35:18.1509724+08:00||;True|2024-09-18T09:08:59.1152574+08:00||;True|2024-09-14T15:48:22.9374486+08:00||;True|2024-09-14T15:42:19.0503983+08:00||;True|2024-09-14T11:51:53.3339222+08:00||;True|2024-09-14T11:41:38.3542237+08:00||;True|2024-09-14T11:19:13.1037012+08:00||;True|2024-09-13T14:31:12.4598160+08:00||;True|2024-09-13T10:44:56.1241214+08:00||;False|2024-09-13T10:44:26.6088271+08:00||;False|2024-09-13T10:44:06.1615137+08:00||;False|2024-09-13T10:43:19.2432517+08:00||;False|2024-09-13T10:38:18.1663387+08:00||;True|2024-09-06T18:49:17.9435308+08:00||;True|2024-09-06T17:01:39.6646353+08:00||;True|2024-09-06T10:27:36.9990456+08:00||;True|2024-09-06T09:48:23.4236094+08:00||;True|2024-09-05T13:57:23.8452431+08:00||;True|2024-09-05T10:21:34.6675149+08:00||;True|2024-09-05T09:12:44.5610882+08:00||;True|2024-09-04T10:07:38.3707398+08:00||;</History>
<History>True|2024-10-29T02:27:49.1623527Z||;True|2024-10-25T15:09:27.7029075+08:00||;True|2024-10-25T10:29:26.9218878+08:00||;True|2024-10-22T17:58:39.9582805+08:00||;True|2024-10-21T17:57:21.7047579+08:00||;True|2024-10-21T14:30:54.4520206+08:00||;True|2024-10-21T10:19:05.7405749+08:00||;True|2024-10-18T16:11:05.4049685+08:00||;True|2024-10-18T14:59:49.1162741+08:00||;True|2024-10-16T16:29:15.3185348+08:00||;True|2024-10-16T14:12:58.1754214+08:00||;True|2024-10-16T14:08:06.5805581+08:00||;True|2024-10-16T11:55:29.8273176+08:00||;True|2024-10-15T17:39:40.4090324+08:00||;True|2024-10-15T17:06:43.0181578+08:00||;True|2024-10-15T15:07:38.9601925+08:00||;True|2024-10-12T13:33:32.4412583+08:00||;True|2024-10-11T17:00:54.0916209+08:00||;True|2024-10-11T10:54:50.3307087+08:00||;True|2024-10-11T10:45:07.8181500+08:00||;True|2024-10-11T10:40:44.2066046+08:00||;True|2024-10-11T10:21:25.7226983+08:00||;True|2024-10-11T10:09:05.5257478+08:00||;True|2024-10-10T14:58:29.1228618+08:00||;True|2024-10-10T14:05:59.4501659+08:00||;True|2024-10-10T11:08:58.9765455+08:00||;True|2024-10-08T17:59:07.5583287+08:00||;True|2024-09-27T19:01:59.6945760+08:00||;True|2024-09-27T18:45:48.2812860+08:00||;True|2024-09-27T18:10:25.5697467+08:00||;True|2024-09-27T17:39:06.3169139+08:00||;True|2024-09-27T17:30:14.1043193+08:00||;True|2024-09-27T16:02:09.0703159+08:00||;True|2024-09-27T15:53:05.1789245+08:00||;True|2024-09-27T15:32:52.1934490+08:00||;True|2024-09-27T13:51:24.9197626+08:00||;True|2024-09-27T13:48:17.2817346+08:00||;True|2024-09-27T11:51:46.8193040+08:00||;True|2024-09-27T10:58:33.1059648+08:00||;True|2024-09-27T10:37:35.0336563+08:00||;False|2024-09-27T10:31:52.6302264+08:00||;True|2024-09-26T19:50:15.5513195+08:00||;True|2024-09-26T19:47:14.0781788+08:00||;True|2024-09-26T19:01:26.5428388+08:00||;True|2024-09-26T18:35:28.7455319+08:00||;True|2024-09-26T18:24:30.8084807+08:00||;True|2024-09-26T18:20:47.3005460+08:00||;True|2024-09-26T18:04:39.8012913+08:00||;True|2024-09-26T17:48:13.8526872+08:00||;True|2024-09-26T16:08:20.1746970+08:00||;True|2024-09-26T16:01:01.1501975+08:00||;False|2024-09-26T16:00:34.1516745+08:00||;True|2024-09-26T14:33:03.4007570+08:00||;True|2024-09-25T19:14:27.8906774+08:00||;True|2024-09-25T18:57:40.1435131+08:00||;True|2024-09-25T17:38:44.0915841+08:00||;True|2024-09-25T15:33:58.4630618+08:00||;True|2024-09-25T15:10:31.3022063+08:00||;False|2024-09-25T14:14:40.9640545+08:00||;True|2024-09-25T10:09:32.2558600+08:00||;True|2024-09-25T09:59:17.1525160+08:00||;False|2024-09-25T09:57:58.7265103+08:00||;False|2024-09-25T09:53:36.7732713+08:00||;False|2024-09-24T18:40:10.0166224+08:00||;True|2024-09-24T08:59:56.1995425+08:00||;True|2024-09-23T18:07:54.7222163+08:00||;True|2024-09-23T17:23:57.7568406+08:00||;True|2024-09-23T16:28:49.3169826+08:00||;True|2024-09-23T15:57:31.8052490+08:00||;True|2024-09-23T11:47:21.1445419+08:00||;True|2024-09-23T09:24:36.0732229+08:00||;True|2024-09-21T11:59:19.0549926+08:00||;True|2024-09-21T11:24:32.4451752+08:00||;True|2024-09-21T10:39:11.5297411+08:00||;True|2024-09-20T18:24:31.7827684+08:00||;True|2024-09-19T17:55:53.1666689+08:00||;True|2024-09-19T17:42:47.9061485+08:00||;True|2024-09-19T16:08:21.7225571+08:00||;False|2024-09-19T14:15:42.9318446+08:00||;True|2024-09-19T11:20:03.5567568+08:00||;True|2024-09-18T11:35:18.1509724+08:00||;True|2024-09-18T09:08:59.1152574+08:00||;True|2024-09-14T15:48:22.9374486+08:00||;True|2024-09-14T15:42:19.0503983+08:00||;True|2024-09-14T11:51:53.3339222+08:00||;True|2024-09-14T11:41:38.3542237+08:00||;True|2024-09-14T11:19:13.1037012+08:00||;True|2024-09-13T14:31:12.4598160+08:00||;True|2024-09-13T10:44:56.1241214+08:00||;False|2024-09-13T10:44:26.6088271+08:00||;False|2024-09-13T10:44:06.1615137+08:00||;False|2024-09-13T10:43:19.2432517+08:00||;False|2024-09-13T10:38:18.1663387+08:00||;True|2024-09-06T18:49:17.9435308+08:00||;True|2024-09-06T17:01:39.6646353+08:00||;True|2024-09-06T10:27:36.9990456+08:00||;True|2024-09-06T09:48:23.4236094+08:00||;True|2024-09-05T13:57:23.8452431+08:00||;True|2024-09-05T10:21:34.6675149+08:00||;True|2024-09-05T09:12:44.5610882+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

@ -5,7 +5,6 @@ using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.TaskInteraction.Dtos;
using DS.WMS.Core.TaskInteraction.Entity;
using DS.WMS.Core.TaskInteraction.Interface;
using Masuit.Tools.Dynamics;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
@ -28,18 +27,17 @@ namespace DS.WMS.OpApi.Controllers
}
/// <summary>
/// 获取业务的任务信息
/// 获取任务列表
/// </summary>
/// <param name="businessId">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="businessType">业务类型(可选参数)</param>
/// <param name="withSubTask">是否获取子任务,默认为否</param>
/// <param name="taskTypes">任务类型名称(支持多个,可选参数)</param>
/// <returns></returns>
/// <remarks>/GetTasks?taskTypes=任务类型1&amp;taskTypes=任务类型2</remarks>
[HttpGet, HttpPost, Route("GetTasks")]
public async Task<DataResult<List<BusinessTask>>> GetTasksAsync(
long businessId, BusinessType businessType, bool withSubTask = false,
params string[] taskTypes)
[HttpGet, Route("GetTasks")]
public async Task<DataResult<List<BusinessTask>>> GetTasksAsync(long businessId, BusinessType? businessType,
bool withSubTask = false, params string[] taskTypes)
{
TaskBaseTypeEnum[]? types = null;
if (taskTypes?.Length > 0)
@ -48,16 +46,37 @@ namespace DS.WMS.OpApi.Controllers
return await taskService.GetTasks(businessId, businessType, withSubTask, types);
}
/// <summary>
/// 获取任务及其子任务信息
/// </summary>
/// <param name="businessId">业务ID</param>
/// <param name="businessType">业务类型(可选参数)</param>
/// <param name="taskType">任务类型名称</param>
/// <returns></returns>
[HttpGet, Route("GetTask")]
public async Task<DataResult<BusinessTask>> GetTaskAsync(long businessId, BusinessType? businessType, string taskType)
{
if (!Enum.TryParse(taskType, out TaskBaseTypeEnum typeVal))
return DataResult<BusinessTask>.Failed($"参数:{nameof(taskType)} 的值无效", MultiLanguageConst.IllegalRequest);
var result = await taskService.GetTasks(businessId, businessType, true, typeVal);
BusinessTask? task = null;
if (result.Data?.Count > 0)
task = result.Data.OrderByDescending(x => x.CreateTime).FirstOrDefault();
return DataResult<BusinessTask>.Success(task!);
}
/// <summary>
/// 获取指定业务的任务日志
/// </summary>
/// <param name="logService"></param>
/// <param name="businessId">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="businessType">业务类型(可选参数)</param>
/// <returns></returns>
[HttpGet, Route("GetLogs")]
public async Task<DataResult<List<BusinessTaskLog>>> GetLogsAsync([FromServices] ITaskLogService logService,
[FromQuery] long businessId, [FromQuery] BusinessType businessType)
[FromQuery] long businessId, [FromQuery] BusinessType? businessType)
{
return await logService.ReadLogAsync(businessId, businessType);
}
@ -181,7 +200,7 @@ namespace DS.WMS.OpApi.Controllers
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("SetSteps")]
public async Task<DataResult> SetStepsAsync(TaskRequest request)
public async Task<DataResult> SetStepsAsync([FromBody] TaskRequest request)
{
if (!ModelState.IsValid)
return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
@ -195,7 +214,7 @@ namespace DS.WMS.OpApi.Controllers
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("SubmitAudit")]
public async Task<DataResult> SubmitAuditAsync(TaskRequest request)
public async Task<DataResult> SubmitAuditAsync([FromBody] TaskRequest request)
{
if (!ModelState.IsValid)
return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);

Loading…
Cancel
Save