|
|
@ -1,28 +1,28 @@
|
|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
using DS.WMS.Core.Fee.Method;
|
|
|
|
using DS.Module.DjyServiceStatus;
|
|
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
using DS.WMS.Core.Flow.Interface;
|
|
|
|
using DS.WMS.Core.Flow.Interface;
|
|
|
|
using DS.WMS.Core.Op.Dtos.TaskInteraction;
|
|
|
|
using DS.WMS.Core.Op.Dtos.TaskInteraction;
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
using DS.WMS.Core.Op.Entity.TaskInteraction;
|
|
|
|
using DS.WMS.Core.Op.Entity.TaskInteraction;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Op.Interface.TaskInteraction;
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
|
using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
|
using DS.WMS.Core.TaskPlat.Interface;
|
|
|
|
|
|
|
|
using Masuit.Tools.Systems;
|
|
|
|
using Masuit.Tools.Systems;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using SqlSugar;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 海运出口任务服务
|
|
|
|
/// 海运出口任务交互服务
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public class SeaExportTaskService : FeeServiceBase
|
|
|
|
public class SeaExportTaskService : TaskService, ISeaExportTaskService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ITaskManageService taskService;
|
|
|
|
readonly Lazy<IDjyServiceStatusService> djyService;
|
|
|
|
Lazy<IClientFlowInstanceService> flowService;
|
|
|
|
readonly Lazy<IClientFlowInstanceService> flowService;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 初始化
|
|
|
|
/// 初始化
|
|
|
@ -30,198 +30,193 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
/// <param name="provider"></param>
|
|
|
|
/// <param name="provider"></param>
|
|
|
|
public SeaExportTaskService(IServiceProvider provider) : base(provider)
|
|
|
|
public SeaExportTaskService(IServiceProvider provider) : base(provider)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
taskService = provider.GetRequiredService<ITaskManageService>();
|
|
|
|
djyService = new Lazy<IDjyServiceStatusService>(provider.GetRequiredService<IDjyServiceStatusService>());
|
|
|
|
flowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>());
|
|
|
|
flowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 创建关联任务
|
|
|
|
/// 当任务创建时调用
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <param name="task"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public async Task<DataResult> CreateTaskAsync(TaskCreationRequest request)
|
|
|
|
protected override async Task<DataResult> OnTaskCreated(BusinessTask task)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var task = await GetTaskAsync(request.BusinessId, request.BusinessType, request.TaskType);
|
|
|
|
if (task.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
if (task != null)
|
|
|
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Task_Exists));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long tenatId = long.Parse(User.TenantId);
|
|
|
|
|
|
|
|
string tenatName = Db.Queryable<SysTenant>().Where(x => x.Id == tenatId).Select(x => x.Name).First();
|
|
|
|
|
|
|
|
var info = new TaskManageOrderMessageInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Head = new TaskManageOrderMessageHeadInfo
|
|
|
|
//待审核,需创建工作流
|
|
|
|
|
|
|
|
var template = await FindTemplateAsync(AuditType.SeaExport);
|
|
|
|
|
|
|
|
if (template == null)
|
|
|
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = flowService.Value.CreateFlowInstance(new CreateFlowInstanceReq
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GID = Guid.NewGuid().ToString(),
|
|
|
|
BusinessId = task.BusinessId,
|
|
|
|
BSNO = request.BusinessId,
|
|
|
|
BusinessType = BusinessType.OceanShippingExport,
|
|
|
|
MessageType = "WORK_FLOW_TASK",
|
|
|
|
TemplateId = template.Id
|
|
|
|
SenderId = "WorkFlow",
|
|
|
|
});
|
|
|
|
SenderName = "工作流平台",
|
|
|
|
|
|
|
|
ReceiverId = "TaskManage",
|
|
|
|
if (result.Succeeded)
|
|
|
|
ReceiverName = "任务管理平台",
|
|
|
|
|
|
|
|
Version = "1.0",
|
|
|
|
|
|
|
|
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
|
|
|
|
|
RequestAction = "Add"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Main = new TaskManageOrderMessageMainInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TaskType = request.TaskType,
|
|
|
|
var instance = result.Data as FlowInstance;
|
|
|
|
TaskSource = TaskSourceEnum.WORK_FLOW,
|
|
|
|
task.FlowId = instance.Id;
|
|
|
|
TaskTitle = request.TaskTitle,
|
|
|
|
await TenantDb.Updateable(task).UpdateColumns(x => x.FlowId).ExecuteCommandAsync();
|
|
|
|
TaskDesp = request.TaskDescription,
|
|
|
|
|
|
|
|
TaskUserId = User.UserId,
|
|
|
|
|
|
|
|
TaskUserName = User.UserName,
|
|
|
|
|
|
|
|
RecvUserId = User.UserId,
|
|
|
|
|
|
|
|
RecvUserName = User.UserName,
|
|
|
|
|
|
|
|
TaskTenatId = tenatId,
|
|
|
|
|
|
|
|
TaskTenatName = tenatName
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 创建关联子任务
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public async Task<DataResult> CreateSubTaskAsync(IEnumerable<TaskCreationRequest> request)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
long userId = long.Parse(User.UserId);
|
|
|
|
|
|
|
|
long tenatId = long.Parse(User.TenantId);
|
|
|
|
|
|
|
|
string tenatName = Db.Queryable<SysTenant>().Where(x => x.Id == tenatId).Select(x => x.Name).First();
|
|
|
|
|
|
|
|
var dt = DateTime.Now;
|
|
|
|
|
|
|
|
var taskList = new List<BusinessTask>();
|
|
|
|
|
|
|
|
|
|
|
|
if (info.Main.TaskTitle.IsNullOrEmpty())
|
|
|
|
var first = request.FirstOrDefault();
|
|
|
|
|
|
|
|
var biz = await TenantDb.Queryable<SeaExport>().Select(x => new
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var biz = await TenantDb.Queryable<SeaExport>().Select(x => new
|
|
|
|
x.Id,
|
|
|
|
|
|
|
|
x.MBLNO,
|
|
|
|
|
|
|
|
x.Vessel,
|
|
|
|
|
|
|
|
x.Voyno,
|
|
|
|
|
|
|
|
x.ETD,
|
|
|
|
|
|
|
|
}).FirstAsync(x => x.Id == first.BusinessId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in request)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var info = new TaskManageOrderMessageInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
|
x.Id,
|
|
|
|
Head = new TaskManageOrderMessageHeadInfo
|
|
|
|
x.MBLNO,
|
|
|
|
{
|
|
|
|
x.Vessel,
|
|
|
|
GID = Guid.NewGuid().ToString(),
|
|
|
|
x.Voyno,
|
|
|
|
BSNO = item.BusinessId,
|
|
|
|
x.ETD,
|
|
|
|
MessageType = "WORK_FLOW_TASK",
|
|
|
|
}).FirstAsync();
|
|
|
|
SenderId = "WorkFlow",
|
|
|
|
|
|
|
|
SenderName = "工作流平台",
|
|
|
|
info.Main.TaskDesp = info.Main.TaskTitle = $"{request.TaskType.GetDescription()} {biz.Vessel} {biz.Voyno} ETD:{biz.ETD?.ToString("yyyy-MM-dd")} BLNo:{biz.MBLNO}";
|
|
|
|
ReceiverId = "TaskManage",
|
|
|
|
}
|
|
|
|
ReceiverName = "任务管理平台",
|
|
|
|
|
|
|
|
Version = "1.0",
|
|
|
|
|
|
|
|
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
|
|
|
|
|
RequestAction = "Add"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Main = new TaskManageOrderMessageMainInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TaskType = item.TaskType,
|
|
|
|
|
|
|
|
TaskSource = TaskSourceEnum.WORK_FLOW,
|
|
|
|
|
|
|
|
TaskUserId = User.UserId,
|
|
|
|
|
|
|
|
TaskUserName = User.UserName,
|
|
|
|
|
|
|
|
RecvUserInfoList = [new RecvUserInfo { RecvUserId = long.Parse(User.UserId), RecvUserName = User.UserName }],
|
|
|
|
|
|
|
|
TaskTenatId = tenatId,
|
|
|
|
|
|
|
|
TaskTenatName = tenatName
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
info.Main.TaskDesp = info.Main.TaskTitle = $"{item.TaskType.GetDescription()} {biz.Vessel} {biz.Voyno} ETD:{biz.ETD?.ToString("yyyy-MM-dd")} BLNo:{biz.MBLNO}";
|
|
|
|
|
|
|
|
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
var result = await ManagerService.InitTaskJob(info);
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var result = await taskService.InitTaskJob(info);
|
|
|
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
if (!result.Succeeded)
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
|
|
task = new BusinessTask
|
|
|
|
var task = new BusinessTask
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
BusinessId = item.BusinessId,
|
|
|
|
BusinessType = request.BusinessType,
|
|
|
|
BusinessType = item.BusinessType,
|
|
|
|
TaskType = request.TaskType,
|
|
|
|
TaskType = item.TaskType,
|
|
|
|
TaskStatus = TaskStatusEnum.Create,
|
|
|
|
TaskStatus = TaskStatusEnum.Create,
|
|
|
|
CreateBy = long.Parse(User.UserId),
|
|
|
|
CreateBy = userId,
|
|
|
|
CreateTime = DateTime.Now
|
|
|
|
CreateTime = dt
|
|
|
|
};
|
|
|
|
};
|
|
|
|
task.NextType = GetNextType(task);
|
|
|
|
taskList.Add(task);
|
|
|
|
await TenantDb.Insertable(task).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//待审核,需创建工作流
|
|
|
|
|
|
|
|
var template = await FindTemplateAsync(AuditType.SeaExport);
|
|
|
|
|
|
|
|
if (template == null)
|
|
|
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = flowService.Value.CreateFlowInstance(new CreateFlowInstanceReq
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
|
|
|
|
BusinessType = BusinessType.OceanShippingExport,
|
|
|
|
|
|
|
|
TemplateId = template.Id
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.Succeeded)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var instance = result.Data as FlowInstance;
|
|
|
|
|
|
|
|
task.FlowId = instance.Id;
|
|
|
|
|
|
|
|
await TenantDb.Updateable(task).UpdateColumns(x => x.FlowId).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await TenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
|
|
|
await ex.LogAsync(Db);
|
|
|
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await TenantDb.Insertable(taskList).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 设置任务状态
|
|
|
|
/// 当任务状态发生变化时调用
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public async Task<DataResult> UpdateTaskStatusAsync(TaskUpdateRequest request)
|
|
|
|
protected override async Task OnTaskStatusChanged(TaskUpdateRequest request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
//放舱结束,根据业务所选服务,生成子任务
|
|
|
|
try
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_SPACE_RELEASE)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var result = await taskService.SetTaskStatus(request.BusinessId, request.TaskType, request.TaskStatus, DateTime.Now);
|
|
|
|
var list = await GetSubRequestAsync(request.BusinessId, request.BusinessType);
|
|
|
|
if (!result.Succeeded)
|
|
|
|
await CreateSubTaskAsync(list);
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新当前任务状态
|
|
|
|
|
|
|
|
BusinessTask task = await GetTaskAsync(request.BusinessId, request.BusinessType, request.TaskType);
|
|
|
|
|
|
|
|
if (task == null)
|
|
|
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
task.TaskStatus = request.TaskStatus;
|
|
|
|
|
|
|
|
await TenantDb.Updateable(task).UpdateColumns(x => x.TaskStatus).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//若存在下一任务,则创建
|
|
|
|
|
|
|
|
if (task.NextType.HasValue)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var req = new TaskCreationRequest
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
|
|
|
|
BusinessType = request.BusinessType,
|
|
|
|
|
|
|
|
TaskType = task.NextType.Value
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
await CreateTaskAsync(req);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//放舱结束,根据业务所选服务,生成子任务
|
|
|
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_SPACE_RELEASE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal async Task<TaskCreationRequest[]> GetSubRequestAsync(long id, BusinessType businessType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var svcList = await GetServicesAsync(id);
|
|
|
|
|
|
|
|
var list = new TaskCreationRequest[svcList.Length];
|
|
|
|
|
|
|
|
for (int i = 0; i < svcList.Length; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await TenantDb.Ado.RollbackTranAsync();
|
|
|
|
var dto = new TaskCreationRequest { BusinessId = id, BusinessType = businessType };
|
|
|
|
await ex.LogAsync(Db);
|
|
|
|
var svcName = svcList[i];
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
|
|
|
|
|
|
|
if (svcName == "报关")
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_BAOGUAN;
|
|
|
|
|
|
|
|
else if (svcName == "订舱")
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_CANGDAN;
|
|
|
|
|
|
|
|
else if (svcName.Equals("VGM", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_VGM;
|
|
|
|
|
|
|
|
else if (svcName.Equals("AFR", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_AFR;
|
|
|
|
|
|
|
|
else if (svcName.Equals("AMS", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_AMS;
|
|
|
|
|
|
|
|
else if (svcName.Equals("ISF", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_ISF;
|
|
|
|
|
|
|
|
else if (svcName == "熏蒸")
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_XUNZHENG;
|
|
|
|
|
|
|
|
else if (svcName == "商检")
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_SHANGJIAN;
|
|
|
|
|
|
|
|
else if (svcName.Equals("COA证书", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_COA;
|
|
|
|
|
|
|
|
else if (svcName == "产地证")
|
|
|
|
|
|
|
|
dto.TaskType = TaskBaseTypeEnum.WAIT_CHANDIZHENG;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list[i] = dto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal async Task<string[]> GetServicesAsync(long id)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var result = await djyService.Value.GetServiceProjectList(
|
|
|
|
|
|
|
|
new EmbedQueryServiceProjectWithStatus { BusinessId = id.ToString() });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!result.success)
|
|
|
|
|
|
|
|
return [];
|
|
|
|
|
|
|
|
|
|
|
|
internal async Task<BusinessTask> GetTaskAsync(long id, BusinessType businessType, TaskBaseTypeEnum taskType)
|
|
|
|
if (((JObject)result.data)["ext"] is not JArray extArray || extArray.Count == 0)
|
|
|
|
{
|
|
|
|
return [];
|
|
|
|
return await TenantDb.Queryable<BusinessTask>().FirstAsync(x =>
|
|
|
|
|
|
|
|
x.BusinessId == id && x.BusinessType == businessType && x.TaskType == taskType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal async Task<BusinessTask> GetCurrentTaskAsync(long id, BusinessType businessType)
|
|
|
|
return extArray.Select(x => x["projectName"]?.Value<string>() ?? string.Empty).ToArray();
|
|
|
|
{
|
|
|
|
|
|
|
|
return await TenantDb.Queryable<BusinessTask>().Where(x => x.BusinessId == id && x.BusinessType == businessType)
|
|
|
|
|
|
|
|
.OrderByDescending(x => x.CreateTime).Take(1).FirstAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 获取给定任务的下一任务类型
|
|
|
|
/// 审批完成回调更新
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="current">任务信息</param>
|
|
|
|
/// <param name="callback">回调信息</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
internal static TaskBaseTypeEnum? GetNextType(BusinessTask current)
|
|
|
|
public override async Task UpdateBusinessAsync(FlowCallback callback)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (current.TaskType == TaskBaseTypeEnum.WAIT_CHECKOUT_BILL)
|
|
|
|
await base.UpdateBusinessAsync(callback);
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
//todo:海运出口主表信息
|
|
|
|
|
|
|
|
|
|
|
|
int currentTypeVal = (int)current.TaskType;
|
|
|
|
|
|
|
|
if (currentTypeVal >= 300) //300开始的枚举值为可选服务项目,不存在前后关联性
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (TaskBaseTypeEnum)currentTypeVal++;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|