You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.3 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.TaskPlat;
using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Entity;
using DS.WMS.Core.TaskPlat.Interface;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.TaskApi.Controllers;
/// <summary>
/// 任务台分配设置维护接口
/// </summary>
public class TaskAllocationController : ApiController
{
private readonly ITaskAllocationService taskAllocationService;
protected readonly IServiceProvider serviceProvider;
public TaskAllocationController(ITaskAllocationService taskAllocationService, IServiceProvider serviceProvider)
{
this.taskAllocationService = taskAllocationService;
this.serviceProvider = serviceProvider;
}
/// <summary>
/// 获取任务分配列表
/// </summary>
/// <param name="carrierId">船公司Id可选</param>
[HttpGet("GetList")]
public async Task<DataResult<TaskAllocationtSetQueryListDto>> GetList(long? carrierId)
{
var result = await taskAllocationService.GetList(carrierId);
return result;
}
/// <summary>
/// 获取任务分配列表中已存在的船公司列表(用于查询)
/// </summary>
[HttpGet("GetContainsCarrierList")]
public async Task<DataResult<List<CarrierInfoDto>>> GetContainsCarrierList()
{
var result = await taskAllocationService.GetContainsCarrierList();
return result;
}
/// <summary>
/// 保存任务分配设置
/// </summary>
[HttpPost("Save")]
public async Task<DataResult> Save([FromBody] TaskAllocationtSetSaveDto saveDto)
{
var result = await taskAllocationService.Save(saveDto);
return result;
}
/// <summary>
/// (测试)任务台任务分配
/// </summary>
/// <returns></returns>
[HttpPost("Test")]
public async Task Test()
{
var saasDbService = serviceProvider.GetService<ISaasDbService>();
var user = serviceProvider.GetService<IUser>();
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
var order = await tenantDb.Queryable<SeaExport>().Select<Core.Op.Dtos.SeaExportRes>().FirstAsync(x => x.Id == 1816649497120477184);
TaskFlowDataContext dataContext = new(
(TaskFlowDataNameConst.Business, order)
);
// 分配测试
var result = await taskAllocationService.GetAllotUserBySeaExportId(new List<TaskBaseTypeEnum>() {
TaskBaseTypeEnum.INVOICE_BILL_MAIL,
TaskBaseTypeEnum.NOT_LOADED,
TaskBaseTypeEnum.NOT_SHIPMENG,
}, 1816649497120477184, dataContext);
// 工作流节点测试
//TaskFlowRuner runer = new TaskFlowRuner(tenantDb, serviceProvider);
//var result1 = await runer.GetWorkFlowNextConfig(dataContext, null); // 首位
//var result2 = await runer.GetWorkFlowNextConfig(dataContext, 20001); // 正常
//var result3 = await runer.GetWorkFlowNextConfig(dataContext, 20002); // 分支判断
//var result4 = await runer.GetWorkFlowNextConfig(dataContext, 20003); // 分支结尾判断
//var result5 = await runer.GetWorkFlowNextConfig(dataContext, 20007); // 末位
}
}