审批工作流执行人任务所有权转交

usertest
嵇文龙 4 months ago
parent eea46a9c77
commit 6384da4ef8

@ -129,7 +129,7 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
{ {
if (!wfruntime.CurrentNode.Users.Contains(User.UserId)) if (!wfruntime.CurrentNode.Users.Contains(User.UserId))
{ {
return DataResult.Failed("该工作流指定用户非本人!", MultiLanguageConst.FlowInstanceAssignUser); return DataResult.Failed("该工作流指定用户非本人,没有发起审批的权限", MultiLanguageConst.FlowInstanceAssignUser);
} }
} }
@ -140,7 +140,7 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
var intersectRoles = wfruntime.CurrentNode.Roles.Intersect(userRoles).ToList(); var intersectRoles = wfruntime.CurrentNode.Roles.Intersect(userRoles).ToList();
if (intersectRoles.Count == 0) if (intersectRoles.Count == 0)
{ {
return DataResult.Failed("该工作流指定角色非本人!", MultiLanguageConst.FlowInstanceAssignRole); return DataResult.Failed("该工作流指定角色非本人,没有发起审批的权限", MultiLanguageConst.FlowInstanceAssignRole);
} }
} }

@ -79,6 +79,11 @@ public class ClientBankReq
/// </summary> /// </summary>
public long? CountryId { get; set; } public long? CountryId { get; set; }
/// <summary>
/// 国家名称
/// </summary>
public string? CountryName { get; set; }
/// <summary> /// <summary>
/// Desc:是否开票默认账户 /// Desc:是否开票默认账户
/// </summary> /// </summary>
@ -92,8 +97,7 @@ public class ClientBankReq
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
public string Note { get; set; } = ""; public string? Note { get; set; }
} }

@ -78,6 +78,11 @@ public class ClientBankRes
/// </summary> /// </summary>
public long? CountryId { get; set; } public long? CountryId { get; set; }
/// <summary>
/// 国家名称
/// </summary>
public string? CountryName { get; set; }
/// <summary> /// <summary>
/// Desc:是否开票默认账户 /// Desc:是否开票默认账户
/// </summary> /// </summary>

@ -88,6 +88,12 @@ public class InfoClientBank : BaseModelV2<long>
[SugarColumn(ColumnDescription = "国家Id", IsNullable = true)] [SugarColumn(ColumnDescription = "国家Id", IsNullable = true)]
public long? CountryId { get; set; } public long? CountryId { get; set; }
/// <summary>
/// 国家名称
/// </summary>
[SugarColumn(ColumnDescription = "国家名称", Length = 50,IsNullable = true)]
public string? CountryName { get; set; }
/// <summary> /// <summary>
/// Desc:是否开票默认账户 /// Desc:是否开票默认账户
/// </summary> /// </summary>

@ -57,10 +57,10 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
Task UpdateBusinessAsync(FlowCallback callback); Task UpdateBusinessAsync(FlowCallback callback);
/// <summary> /// <summary>
/// 通知更新任务接收人 /// 通知审批执行人变更
/// </summary> /// </summary>
/// <param name="callback">回调信息</param> /// <param name="callback">回调信息</param>
/// <returns></returns> /// <returns></returns>
Task UpdateReceiverAsync(MarkerChangedCallback callback); Task MarkerChangedAsync(MarkerChangedCallback callback);
} }
} }

@ -199,12 +199,12 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
return extArray.Select(x => x["projectName"]?.Value<string>() ?? string.Empty).ToArray(); return extArray.Select(x => x["projectName"]?.Value<string>() ?? string.Empty).ToArray();
} }
public override async Task UpdateReceiverAsync(MarkerChangedCallback callback) public override async Task MarkerChangedAsync(MarkerChangedCallback callback)
{ {
if (callback.Type != AuditType.SeaExport) if (callback.Type != AuditType.SeaExport)
return; return;
await base.UpdateReceiverAsync(callback); await base.MarkerChangedAsync(callback);
} }
/// <summary> /// <summary>

@ -131,7 +131,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
return result; return result;
//创建&启动工作流 //创建&启动工作流
result = await Create_StartWorkflow(task); result = await Create_StartWorkflow(task, false);
if (!result.Succeeded) if (!result.Succeeded)
return result; return result;
@ -267,10 +267,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
try try
{ {
var result = await ManagerService.InitTaskJob(info);
if (!result.Succeeded)
return result;
task = new BusinessTask task = new BusinessTask
{ {
BusinessId = request.BusinessId, BusinessId = request.BusinessId,
@ -284,8 +280,12 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
task.NextType = GetNextType(task); task.NextType = GetNextType(task);
await TenantDb.Insertable(task).ExecuteCommandAsync(); await TenantDb.Insertable(task).ExecuteCommandAsync();
DataResult result = await ManagerService.InitTaskJob(info);
if (!result.Succeeded)
return result;
//待审核,需创建工作流 //待审核,需创建工作流
if (task.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT) if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
{ {
result = await Create_StartWorkflow(task); result = await Create_StartWorkflow(task);
if (!result.Succeeded) if (!result.Succeeded)
@ -343,14 +343,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
{ {
string[] ids = FlowInstanceService.GetMarkers(instance); string[] ids = FlowInstanceService.GetMarkers(instance);
//变更任务接收人为所有审批执行人 //变更任务接收人为所有审批执行人
await UpdateReceiverAsync(new MarkerChangedCallback var users = await GetRecvUsers(ids.Select(long.Parse).ToArray());
{ await ManagerService.TransferTask(task.BusinessId, task.TaskType, users);
BusinessId = task.BusinessId,
BusinessType = task.BusinessType,
InstanceId = instance.Id,
Type = instance.Type,
NextUserId = ids.Select(long.Parse).ToArray()
});
} }
} }
@ -448,17 +442,18 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
} }
/// <summary> /// <summary>
/// 通知更新任务接收人 /// 通知审批执行人变更
/// </summary> /// </summary>
/// <param name="callback">回调信息</param> /// <param name="callback">回调信息</param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="ArgumentNullException"><paramref name="callback"/>为null时引发</exception> /// <exception cref="ArgumentNullException"><paramref name="callback"/>为null时引发</exception>
public virtual async Task UpdateReceiverAsync(MarkerChangedCallback callback) public virtual async Task MarkerChangedAsync(MarkerChangedCallback callback)
{ {
ArgumentNullException.ThrowIfNull(callback, nameof(callback)); ArgumentNullException.ThrowIfNull(callback, nameof(callback));
long userId = long.Parse(User.UserId); long userId = long.Parse(User.UserId);
var users = await GetRecvUsers(userId); var users = await GetRecvUsers(userId);
await ManagerService.SetTaskUserStatus( await ManagerService.SetTaskUserStatus(
callback.BusinessId, callback.BusinessId,
TaskBaseTypeEnum.WAIT_ORDER_AUDIT, TaskBaseTypeEnum.WAIT_ORDER_AUDIT,

@ -94,14 +94,14 @@ namespace DS.WMS.OpApi.Controllers
} }
/// <summary> /// <summary>
/// 通知更新任务接收人(无需客户端手动调用) /// 通知审批执行人变更(无需客户端手动调用)
/// </summary> /// </summary>
/// <param name="callback">回调信息</param> /// <param name="callback">回调信息</param>
/// <returns></returns> /// <returns></returns>
[HttpPost, Route("UpdateReceiver")] [HttpPost, Route("MarkerChanged")]
public virtual async Task<IActionResult> UpdateReceiverAsync([FromBody] MarkerChangedCallback callback) public virtual async Task<IActionResult> MarkerChangedAsync([FromBody] MarkerChangedCallback callback)
{ {
await taskService.UpdateReceiverAsync(callback); await taskService.MarkerChangedAsync(callback);
return StatusCode((int)HttpStatusCode.NoContent); return StatusCode((int)HttpStatusCode.NoContent);
} }
} }

Loading…
Cancel
Save