|
|
|
@ -6,6 +6,8 @@ using DS.WMS.Core.Fee.Method;
|
|
|
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
|
using DS.WMS.Core.Flow.Interface;
|
|
|
|
|
using DS.WMS.Core.Op.Dtos.TaskInteraction;
|
|
|
|
|
using DS.WMS.Core.Op.Interface.TaskInteraction;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Application.Method
|
|
|
|
@ -22,6 +24,7 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
public abstract TaskBaseTypeEnum AuditType { get; }
|
|
|
|
|
|
|
|
|
|
readonly IClientFlowInstanceService flowService;
|
|
|
|
|
readonly ITaskService taskService;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化
|
|
|
|
@ -30,6 +33,7 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
public ApplicationAuditService(IServiceProvider serviceProvider) : base(serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
flowService = serviceProvider.GetRequiredService<IClientFlowInstanceService>();
|
|
|
|
|
taskService = serviceProvider.GetRequiredService<ITaskService>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -69,23 +73,41 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
var flows = await flowService.GetInstanceByBSIdAsync(AuditType, null, request.Ids);
|
|
|
|
|
if (flows.Count != request.Ids.Length)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FlowNotFound));
|
|
|
|
|
|
|
|
|
|
List<string> list = [];
|
|
|
|
|
foreach (var item in flows)
|
|
|
|
|
bool hasAuthorized = await taskService.HasAuthorizedAsync();
|
|
|
|
|
if (hasAuthorized)
|
|
|
|
|
{
|
|
|
|
|
result = flowService.AuditFlowInstance(new FlowAuditInfo
|
|
|
|
|
result = await taskService.AuditAsync(new TaskAuditRequest
|
|
|
|
|
{
|
|
|
|
|
Instance = item,
|
|
|
|
|
Status = request.Result,
|
|
|
|
|
AuditNote = request.Remark
|
|
|
|
|
Ids = request.Ids,
|
|
|
|
|
Remark = request.Remark,
|
|
|
|
|
Result = request.Result,
|
|
|
|
|
TaskTypeName = AuditType.ToString()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var flows = await flowService.GetInstanceByBSIdAsync(AuditType, null, request.Ids);
|
|
|
|
|
if (flows.Count != request.Ids.Length)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FlowNotFound));
|
|
|
|
|
|
|
|
|
|
List<string> list = [];
|
|
|
|
|
foreach (var item in flows)
|
|
|
|
|
{
|
|
|
|
|
result = flowService.AuditFlowInstance(new FlowAuditInfo
|
|
|
|
|
{
|
|
|
|
|
Instance = item,
|
|
|
|
|
Status = request.Result,
|
|
|
|
|
AuditNote = request.Remark
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
|