修改测试方法

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

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

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

Loading…
Cancel
Save