|
|
|
@ -16,7 +16,6 @@ using DS.WMS.Core.TaskPlat.Interface;
|
|
|
|
|
using Masuit.Tools;
|
|
|
|
|
using Masuit.Tools.Systems;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Org.BouncyCastle.Crypto;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
@ -33,6 +32,11 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected ITaskManageService ManagerService { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 日志服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected ITaskLogService LogService { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工作流服务
|
|
|
|
|
/// </summary>
|
|
|
|
@ -45,6 +49,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
public TaskService(IServiceProvider provider) : base(provider)
|
|
|
|
|
{
|
|
|
|
|
ManagerService = provider.GetRequiredService<ITaskManageService>();
|
|
|
|
|
LogService = provider.GetRequiredService<ITaskLogService>();
|
|
|
|
|
FlowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -117,15 +122,16 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//重置任务为待处理
|
|
|
|
|
var result = await SetTaskStatusAsync(new TaskUpdateRequest
|
|
|
|
|
var req = new TaskUpdateRequest
|
|
|
|
|
{
|
|
|
|
|
AutoCreateNext = false,
|
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
|
BusinessType = request.BusinessType,
|
|
|
|
|
TaskStatus = TaskStatusEnum.Create,
|
|
|
|
|
TaskTypeName = TaskBaseTypeEnum.WAIT_ORDER_AUDIT.ToString()
|
|
|
|
|
}, false);
|
|
|
|
|
};
|
|
|
|
|
//重置任务为待处理
|
|
|
|
|
var result = await SetTaskStatusAsync(req, false);
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return DataResult.Failed(result.Message, result.MultiCode);
|
|
|
|
|
|
|
|
|
@ -138,6 +144,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
.Where(x => x.BusinessId == request.BusinessId && x.BusinessType == request.BusinessType && x.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
//记录日志
|
|
|
|
|
await LogService.WriteLogAsync(req, "重新审批");
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return result2;
|
|
|
|
|
}
|
|
|
|
@ -309,6 +317,9 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
//记录日志
|
|
|
|
|
await LogService.WriteLogAsync(task);
|
|
|
|
|
|
|
|
|
|
if (useTransaction)
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
|
|
|
|
@ -436,6 +447,9 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//记录日志
|
|
|
|
|
await LogService.WriteLogAsync(request);
|
|
|
|
|
|
|
|
|
|
if (useTransaction)
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
|
|
|
|
@ -473,14 +487,28 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
|
|
|
|
|
long userId = long.Parse(User.UserId);
|
|
|
|
|
var users = await GetRecvUsers(userId);
|
|
|
|
|
var dt = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
await ManagerService.SetTaskUserStatus(
|
|
|
|
|
callback.BusinessId,
|
|
|
|
|
TaskBaseTypeEnum.WAIT_ORDER_AUDIT,
|
|
|
|
|
TaskStatusEnum.Complete,
|
|
|
|
|
//callback.Status == FlowStatusEnum.Approve ? TaskStatusEnum.Complete : TaskStatusEnum.Pending
|
|
|
|
|
DateTime.Now,
|
|
|
|
|
dt,
|
|
|
|
|
users);
|
|
|
|
|
|
|
|
|
|
//记录日志
|
|
|
|
|
await LogService.WriteLogAsync(new BusinessTaskLog
|
|
|
|
|
{
|
|
|
|
|
AuditStatus = callback.Status,
|
|
|
|
|
BusinessId = callback.BusinessId,
|
|
|
|
|
BusinessType = callback.BusinessType.Value,
|
|
|
|
|
CreateBy = userId,
|
|
|
|
|
CreateTime = dt,
|
|
|
|
|
TaskStatus = TaskStatusEnum.Complete,
|
|
|
|
|
TaskType = TaskBaseTypeEnum.WAIT_ORDER_AUDIT,
|
|
|
|
|
RecvUsers = users.Count > 0 ? users[0].RecvUserName : null
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -493,14 +521,31 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
{
|
|
|
|
|
ArgumentNullException.ThrowIfNull(callback, nameof(callback));
|
|
|
|
|
|
|
|
|
|
//根据审批结果更新任务状态
|
|
|
|
|
await SetTaskStatusAsync(new TaskUpdateRequest
|
|
|
|
|
var req = new TaskUpdateRequest
|
|
|
|
|
{
|
|
|
|
|
BusinessId = callback.BusinessId,
|
|
|
|
|
BusinessType = callback.BusinessType.Value,
|
|
|
|
|
TaskTypeName = TaskBaseTypeEnum.WAIT_ORDER_AUDIT.ToString(),
|
|
|
|
|
TaskStatus = callback.FlowStatus == FlowStatusEnum.Approve ? TaskStatusEnum.Complete : TaskStatusEnum.Pending,
|
|
|
|
|
AutoCreateNext = false //审批完成后需根据业务需要自定义任务类型,因此设置为不自动创建下一任务
|
|
|
|
|
};
|
|
|
|
|
//根据审批结果更新任务状态
|
|
|
|
|
await SetTaskStatusAsync(req);
|
|
|
|
|
|
|
|
|
|
long userId = long.Parse(User.UserId);
|
|
|
|
|
var users = await GetRecvUsers(userId);
|
|
|
|
|
//记录日志
|
|
|
|
|
await LogService.WriteLogAsync(new BusinessTaskLog
|
|
|
|
|
{
|
|
|
|
|
AuditStatus = callback.FlowStatus,
|
|
|
|
|
BusinessId = callback.BusinessId,
|
|
|
|
|
BusinessType = callback.BusinessType.Value,
|
|
|
|
|
CreateBy = userId,
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
TaskStatus = req.TaskStatus,
|
|
|
|
|
TaskType = req.TaskType,
|
|
|
|
|
RecvUsers = users.Count > 0 ? users[0].RecvUserName : null,
|
|
|
|
|
Remark = "终审完成"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (callback.FlowStatus == FlowStatusEnum.Reject)
|
|
|
|
|