|
|
|
@ -410,22 +410,36 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
if (result.Succeeded)
|
|
|
|
|
{
|
|
|
|
|
var instance = result.Data as FlowInstance;
|
|
|
|
|
task.FlowId = instance.Id;
|
|
|
|
|
task.FlowId = instance!.Id;
|
|
|
|
|
await TenantDb.Updateable(task).UpdateColumns(x => x.FlowId).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
result = FlowService.Value.StartFlowInstance(instance.Id.ToString());
|
|
|
|
|
instance = result.Data as FlowInstance;
|
|
|
|
|
|
|
|
|
|
if (result.Succeeded && changeMarker)
|
|
|
|
|
if (instance.FlowStatus == FlowStatusEnum.Approve)
|
|
|
|
|
{
|
|
|
|
|
string[] ids = FlowInstanceService.GetMarkers(instance);
|
|
|
|
|
//变更任务接收人为所有审批执行人
|
|
|
|
|
var users = await FillInUserInfoAsync(ids.Select(long.Parse).ToArray());
|
|
|
|
|
result = await ManagerService.TransferTask(task.BusinessId, task.TaskType, users, TenantDb);
|
|
|
|
|
if (result.Succeeded)
|
|
|
|
|
await SetTaskStatusAsync(new TaskUpdateRequest
|
|
|
|
|
{
|
|
|
|
|
BusinessId = task.BusinessId,
|
|
|
|
|
BusinessType = task.BusinessType,
|
|
|
|
|
RejectReason = instance.Note,
|
|
|
|
|
TaskTypeName = task.TaskType.ToString(),
|
|
|
|
|
TaskStatus = TaskStatusEnum.Complete
|
|
|
|
|
}, false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = FlowService.Value.StartFlowInstance(instance.Id.ToString());
|
|
|
|
|
instance = result.Data as FlowInstance;
|
|
|
|
|
|
|
|
|
|
if (result.Succeeded && changeMarker)
|
|
|
|
|
{
|
|
|
|
|
task.RecvUsers = string.Join(",", ids);
|
|
|
|
|
await TenantDb.Updateable(task).UpdateColumns(x => x.RecvUsers).ExecuteCommandAsync();
|
|
|
|
|
string[] ids = FlowInstanceService.GetMarkers(instance);
|
|
|
|
|
//变更任务接收人为所有审批执行人
|
|
|
|
|
var users = await FillInUserInfoAsync(ids.Select(long.Parse).ToArray());
|
|
|
|
|
result = await ManagerService.TransferTask(task.BusinessId, task.TaskType, users, TenantDb);
|
|
|
|
|
if (result.Succeeded)
|
|
|
|
|
{
|
|
|
|
|
task.RecvUsers = string.Join(",", ids);
|
|
|
|
|
await TenantDb.Updateable(task).UpdateColumns(x => x.RecvUsers).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -774,25 +788,30 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
Instance = instance
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (result.Succeeded)
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
var req = new TaskUpdateRequest
|
|
|
|
|
{
|
|
|
|
|
var req = new TaskUpdateRequest
|
|
|
|
|
{
|
|
|
|
|
BusinessId = instance.BusinessId,
|
|
|
|
|
BusinessType = instance.BusinessType,
|
|
|
|
|
RejectReason = request.Remark,
|
|
|
|
|
TaskTypeName = request.TaskType.ToString(),
|
|
|
|
|
TaskStatus = request.Result == 1 ? TaskStatusEnum.Complete : TaskStatusEnum.Pending,
|
|
|
|
|
AutoCreateNext = true
|
|
|
|
|
};
|
|
|
|
|
//根据审批结果更新任务状态
|
|
|
|
|
await SetTaskStatusAsync(req);
|
|
|
|
|
BusinessId = instance.BusinessId,
|
|
|
|
|
BusinessType = instance.BusinessType,
|
|
|
|
|
RejectReason = request.Remark,
|
|
|
|
|
TaskTypeName = request.TaskType.ToString(),
|
|
|
|
|
TaskStatus = request.Result == 1 ? TaskStatusEnum.Complete : TaskStatusEnum.Pending,
|
|
|
|
|
AutoCreateNext = true
|
|
|
|
|
};
|
|
|
|
|
//根据审批结果更新任务状态
|
|
|
|
|
await SetTaskStatusAsync(req);
|
|
|
|
|
|
|
|
|
|
if (instance.FlowStatus == FlowStatusEnum.Approve)
|
|
|
|
|
{
|
|
|
|
|
//终审通过且任务类型为审单,则生成费用
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT && instance.FlowStatus == FlowStatusEnum.Approve && instance.IsCompleted)
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT && instance.IsCompleted)
|
|
|
|
|
{
|
|
|
|
|
UriBuilder builder = new UriBuilder(configuration["FeeService:BaseUrl"]);
|
|
|
|
|
builder.Path = configuration["FeeService:GenerateFees"];
|
|
|
|
|
UriBuilder builder = new(configuration["FeeService:BaseUrl"])
|
|
|
|
|
{
|
|
|
|
|
Path = configuration["FeeService:GenerateFees"]
|
|
|
|
|
};
|
|
|
|
|
string url = builder.ToString();
|
|
|
|
|
if (string.IsNullOrEmpty(url))
|
|
|
|
|
{
|
|
|
|
@ -808,6 +827,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
Api.SendRequestAsync(HttpMethod.Post, url, json);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (instance.FlowStatus == FlowStatusEnum.Reject)
|
|
|
|
|
{
|
|
|
|
|
result.Message = MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.TaskRejected));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IsOrderType(request.TaskType))
|
|
|
|
|
result.Data = new { instance.IsCompleted, instance.FlowStatus };
|
|
|
|
|