修改测试方法

usertest
嵇文龙 4 months ago
parent 7db60be931
commit 9cb137d29b

@ -23,6 +23,6 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <returns></returns> /// <returns></returns>
Task TriggerAction(BusinessTask businessTask); Task TriggerAction(BusinessTask businessTask);
Task TriggerTest(TaskBaseTypeEnum taskType, long? id); Task<DataResult> TriggerTest(TaskBaseTypeEnum taskType, long? id);
} }
} }

@ -83,7 +83,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
//} //}
} }
public async Task TriggerTest(TaskBaseTypeEnum taskType, long? id) public async Task<DataResult> TriggerTest(TaskBaseTypeEnum taskType, long? id)
{ {
var task = await TenantDb.Queryable<BusinessTask>() var task = await TenantDb.Queryable<BusinessTask>()
.Where(t => t.TaskType == taskType .Where(t => t.TaskType == taskType
@ -95,14 +95,17 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (task != null) if (task != null)
{ {
TaskFlowDataContext dataContext = new( TaskFlowDataContext dataContext = new(
(TaskFlowDataNameConst.BusinessTask, task), (TaskFlowDataNameConst.BusinessTask, task)
("ActionType", 1),
("Name", "订舱代理通知")
); );
TaskFlowRuner taskFlow = new(TenantDb, ServiceProvider); TaskFlowRuner taskFlow = new(TenantDb, ServiceProvider);
await taskFlow.RunWithBsno(task.TaskType, task.BusinessId, dataContext); await taskFlow.RunWithBsno(task.TaskType, task.BusinessId, dataContext);
return DataResult.Success;
} }
var result = DataResult.Failed("找不到指定类型的任务");
result.Data = 404;
return result;
} }
} }

@ -36,16 +36,25 @@ namespace DS.WMS.OpApi.Controllers
HttpStatusCode statusCode; HttpStatusCode statusCode;
try try
{ {
await actionManager.TriggerTest(taskype, id); var result = await actionManager.TriggerTest(taskype, id);
if (result.Succeeded)
{
statusCode = HttpStatusCode.NoContent; statusCode = HttpStatusCode.NoContent;
return new StatusCodeResult((int)statusCode);
}
return new ContentResult
{
Content = result.Message,
StatusCode = result.Data == null ? null : (int)result.Data
};
} }
catch catch
{ {
statusCode = HttpStatusCode.InternalServerError; statusCode = HttpStatusCode.InternalServerError;
}
return new StatusCodeResult((int)statusCode); return new StatusCodeResult((int)statusCode);
} }
}
/// <summary> /// <summary>
/// 获取分页列表 /// 获取分页列表

Loading…
Cancel
Save