|
|
|
@ -11,10 +11,12 @@ using DS.WMS.Core.Op.Entity.TaskInteraction;
|
|
|
|
|
using DS.WMS.Core.Op.Interface.TaskInteraction;
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Entity;
|
|
|
|
|
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
|
|
|
|
@ -239,10 +241,19 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
|
|
|
|
|
if (request.RecvUserIdList == null || request.RecvUserIdList.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
//默认接收人=当前订单的操作员
|
|
|
|
|
var opr = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == request.BusinessId)
|
|
|
|
|
.Select(x => new { x.OperatorId, x.OperatorName }).FirstAsync();
|
|
|
|
|
info.Main.RecvUserInfoList = [new RecvUserInfo { RecvUserId = opr.OperatorId, RecvUserName = opr.OperatorName }];
|
|
|
|
|
//根据配置获取默认接收人
|
|
|
|
|
info.Main.RecvUserInfoList = await GetRecvUsers(request.BusinessId, request.BusinessType, request.TaskType);
|
|
|
|
|
if (info.Main.RecvUserInfoList == null || info.Main.RecvUserInfoList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
|
{
|
|
|
|
|
info.Main.RecvUserInfoList = await GetRecvUsers(long.Parse(User.UserId));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskReceiverNotFound));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -346,7 +357,12 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
string[] ids = FlowInstanceService.GetMarkers(instance);
|
|
|
|
|
//变更任务接收人为所有审批执行人
|
|
|
|
|
var users = await GetRecvUsers(ids.Select(long.Parse).ToArray());
|
|
|
|
|
await ManagerService.TransferTask(task.BusinessId, task.TaskType, users);
|
|
|
|
|
result = await ManagerService.TransferTask(task.BusinessId, task.TaskType, users);
|
|
|
|
|
if (result.Succeeded)
|
|
|
|
|
{
|
|
|
|
|
task.RecvUsers = string.Join(",", ids);
|
|
|
|
|
await TenantDb.Updateable(task).UpdateColumns(x => x.RecvUsers).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -514,6 +530,65 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
x.BusinessId == id && x.BusinessType == businessType && x.TaskType == taskType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取任务接收用户列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">业务ID</param>
|
|
|
|
|
/// <param name="businessType">业务类型</param>
|
|
|
|
|
/// <param name="taskType">任务类型</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected internal async Task<List<RecvUserInfo>?> GetRecvUsers(long id, BusinessType businessType, TaskBaseTypeEnum taskType)
|
|
|
|
|
{
|
|
|
|
|
string typeCode = taskType.ToString();
|
|
|
|
|
var allocations = await TenantDb.Queryable<TaskAllocationtSet>().Where(x => x.TaskTypeCode == typeCode)
|
|
|
|
|
.Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.CarrierId,
|
|
|
|
|
x.IsAllotCustomerService, //客服
|
|
|
|
|
x.IsAllotOperator, //操作
|
|
|
|
|
x.IsAllotSale, //销售
|
|
|
|
|
x.IsAllotVouchingClerk //单证
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
long? carrierId = null;
|
|
|
|
|
switch (businessType)
|
|
|
|
|
{
|
|
|
|
|
case BusinessType.OceanShippingExport:
|
|
|
|
|
carrierId = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == id).Select(x => x.CarrierId).FirstAsync();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var allocation = allocations.Find(x => x.CarrierId == carrierId);
|
|
|
|
|
//未找到匹配值
|
|
|
|
|
if (allocation == null)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
var expr = Expressionable.Create<SysUser>();
|
|
|
|
|
if (allocation.IsAllotCustomerService)
|
|
|
|
|
{
|
|
|
|
|
expr = expr.Or(x => x.IsCustomerService);
|
|
|
|
|
}
|
|
|
|
|
else if (allocation.IsAllotOperator)
|
|
|
|
|
{
|
|
|
|
|
expr = expr.Or(x => x.IsOperator);
|
|
|
|
|
}
|
|
|
|
|
else if (allocation.IsAllotSale)
|
|
|
|
|
{
|
|
|
|
|
expr = expr.Or(x => x.IsSale);
|
|
|
|
|
}
|
|
|
|
|
else if (allocation.IsAllotVouchingClerk)
|
|
|
|
|
{
|
|
|
|
|
expr = expr.Or(x => x.IsVouchingClerk);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var condition = expr.ToExpression();
|
|
|
|
|
if (condition.IsNullOrEmpty())
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
return await Db.Queryable<SysUser>().Where(condition).Select(
|
|
|
|
|
x => new RecvUserInfo { RecvUserId = x.Id, RecvUserName = x.UserName }).ToListAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取任务接收用户列表
|
|
|
|
|
/// </summary>
|
|
|
|
|