|
|
@ -11,10 +11,12 @@ using DS.Module.UserModule;
|
|
|
|
using DS.WMS.Core.Code.Dtos;
|
|
|
|
using DS.WMS.Core.Code.Dtos;
|
|
|
|
using DS.WMS.Core.Code.Entity;
|
|
|
|
using DS.WMS.Core.Code.Entity;
|
|
|
|
using DS.WMS.Core.Code.Interface;
|
|
|
|
using DS.WMS.Core.Code.Interface;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
using DS.WMS.Core.Map.Dtos;
|
|
|
|
using DS.WMS.Core.Map.Dtos;
|
|
|
|
using DS.WMS.Core.Map.Interface;
|
|
|
|
using DS.WMS.Core.Map.Interface;
|
|
|
|
using DS.WMS.Core.Op.Dtos;
|
|
|
|
using DS.WMS.Core.Op.Dtos;
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Op.Entity.TaskInteraction;
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
|
using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
@ -2805,7 +2807,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
|
|
|
|
|
|
|
// 下属任务统计
|
|
|
|
// 下属任务统计
|
|
|
|
/* 备注:在之前已经清除了删除过滤器
|
|
|
|
/* 备注:在之前已经清除了删除过滤器
|
|
|
|
* 未配置: 登陆人所属机构下的人员【接收】的任务(需要调整为“无权限查询”)
|
|
|
|
* 未配置的情况: 登陆人所属机构下的人员【接收】的任务(需要调整为“无权限查询”)
|
|
|
|
* 超级管理员: 登陆人所属机构下的人员【接收】的任务(带了机构筛选)(与self_org相同)
|
|
|
|
* 超级管理员: 登陆人所属机构下的人员【接收】的任务(带了机构筛选)(与self_org相同)
|
|
|
|
* all: 登陆人所属租户下的全部数据
|
|
|
|
* all: 登陆人所属租户下的全部数据
|
|
|
|
* none: 无权限查询
|
|
|
|
* none: 无权限查询
|
|
|
@ -3419,6 +3421,105 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 领取任务到当前登陆人(可批量)
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public async Task<DataResult> PullTask(long[] ids)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (ids == null || ids.Length == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ArgumentNullException(nameof(ids));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
tenantDb.QueryFilter.Clear<IOrgId>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var taskList = await tenantDb.Queryable<TaskBaseInfo>().Where(x => ids.Contains(x.Id)).ToListAsync(x => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
x.Id,
|
|
|
|
|
|
|
|
x.STATUS,
|
|
|
|
|
|
|
|
x.STATUS_NAME,
|
|
|
|
|
|
|
|
x.TASK_TYPE,
|
|
|
|
|
|
|
|
x.OUT_BS_NO,
|
|
|
|
|
|
|
|
x.TASK_SOURCE
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var taskIdList = taskList.Select(x => x.Id).ToList();
|
|
|
|
|
|
|
|
var taskTypeList = taskList.Where(x => x.TASK_SOURCE == TaskSourceEnum.WORK_FLOW.ToString() && x.OUT_BS_NO != null).Select(x => x.TASK_TYPE).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var taskCompleteStatusCodeList = taskTypeList.Count > 0 ? await tenantDb.Queryable<TaskFlowModule>()
|
|
|
|
|
|
|
|
.Where(x => x.ModuleType == 2 && taskTypeList.Contains(x.TaskType))
|
|
|
|
|
|
|
|
.Select(x => new { x.TaskType, x.CompletedBusinessStatusCode })
|
|
|
|
|
|
|
|
.ToListAsync()
|
|
|
|
|
|
|
|
: [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var userOrgId = await db.Queryable<SysUser>().Where(x => x.Id == userId).Select(x => x.DefaultOrgId).FirstAsync();
|
|
|
|
|
|
|
|
List<TaskBaseAllocation> allocationList = new();
|
|
|
|
|
|
|
|
foreach (var item in taskList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
allocationList.Add(new TaskBaseAllocation()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TaskId = item.Id,
|
|
|
|
|
|
|
|
UserId = userId,
|
|
|
|
|
|
|
|
UserName = user.UserName,
|
|
|
|
|
|
|
|
Status = item.STATUS,
|
|
|
|
|
|
|
|
StatusName = item.STATUS_NAME,
|
|
|
|
|
|
|
|
StatusTime = DateTime.Now,
|
|
|
|
|
|
|
|
BusinessId = item.OUT_BS_NO,
|
|
|
|
|
|
|
|
GoodStatusCode = taskCompleteStatusCodeList.FirstOrDefault(x => x.TaskType == item.TASK_TYPE)?.CompletedBusinessStatusCode,
|
|
|
|
|
|
|
|
OrgId = userOrgId
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
await tenantDb.AsTenant().BeginTranAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var idList = await tenantDb.Queryable<TaskBaseAllocation>().Where(x => taskIdList.Contains(x.TaskId)).Select(x => x.Id).ToListAsync();
|
|
|
|
|
|
|
|
await tenantDb.Deleteable<TaskBaseAllocation>(x => idList.Contains(x.Id)).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await tenantDb.Insertable(allocationList).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable<TaskBaseInfo>()
|
|
|
|
|
|
|
|
.SetColumns(x => x.IS_PUBLIC == 0)
|
|
|
|
|
|
|
|
.Where(x => taskIdList.Contains(x.Id))
|
|
|
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
foreach (var item in taskList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (item.OUT_BS_NO is not null or 0 && Enum.TryParse(typeof(TaskBaseTypeEnum), item.TASK_TYPE, out object? taskType))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await tenantDb.Updateable<BusinessTask>()
|
|
|
|
|
|
|
|
.SetColumns(x => x.RecvUsers == user.UserId)
|
|
|
|
|
|
|
|
.Where(x => x.BusinessId == item.OUT_BS_NO && x.TaskType == (TaskBaseTypeEnum)taskType)
|
|
|
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var flowInstanceId = await db.Queryable<FlowInstance>()
|
|
|
|
|
|
|
|
.ClearFilter(typeof(ITenantId))
|
|
|
|
|
|
|
|
.Where(y => y.BusinessId == item.OUT_BS_NO && y.AuditType == (TaskBaseTypeEnum)taskType)
|
|
|
|
|
|
|
|
.OrderByDescending(y => y.Id)
|
|
|
|
|
|
|
|
.Select(y => y.Id)
|
|
|
|
|
|
|
|
.FirstAsync();
|
|
|
|
|
|
|
|
if (flowInstanceId != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await db.Updateable<FlowInstance>()
|
|
|
|
|
|
|
|
.SetColumns(x => x.MakerList == user.UserId)
|
|
|
|
|
|
|
|
.Where(x => x.Id == flowInstanceId)
|
|
|
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
await tenantDb.AsTenant().CommitTranAsync();
|
|
|
|
|
|
|
|
return DataResult.Successed("操作成功", MultiLanguageConst.OperationSuccess);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await tenantDb.AsTenant().RollbackTranAsync();
|
|
|
|
|
|
|
|
return DataResult.Failed("任务领取失败,原因:" + ex.Message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -3451,15 +3552,16 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await tenantDb.Ado.BeginTranAsync();
|
|
|
|
await tenantDb.Ado.BeginTranAsync();
|
|
|
|
var t1 = tenantDb.ContextID;
|
|
|
|
await tenantDb.Deleteable<SeaExport>().Where(x => x.BusinessStatus == "0123123").ExecuteCommandAsync();
|
|
|
|
var t2 = await tenantDb.Queryable<TaskFlowLogDetail>().Where(x => x.Id == taskId).ToListAsync();
|
|
|
|
//var t1 = tenantDb.ContextID;
|
|
|
|
var m = new TaskFlowLogDetail()
|
|
|
|
//var t2 = await tenantDb.Queryable<TaskFlowLogDetail>().Where(x => x.Id == taskId).ToListAsync();
|
|
|
|
{
|
|
|
|
//var m = new TaskFlowLogDetail()
|
|
|
|
ModuleName = taskId.ToString()
|
|
|
|
//{
|
|
|
|
};
|
|
|
|
// ModuleName = taskId.ToString()
|
|
|
|
var t3 = await tenantDb.Insertable(m).ExecuteCommandAsync();
|
|
|
|
//};
|
|
|
|
|
|
|
|
//var t3 = await tenantDb.Insertable(m).ExecuteCommandAsync();
|
|
|
|
var service = serviceProvider.GetRequiredService<ITaskManageBCService>();
|
|
|
|
|
|
|
|
|
|
|
|
//var service = serviceProvider.GetRequiredService<ITaskManageBCService>();
|
|
|
|
//await service.TestDelete(taskId);
|
|
|
|
//await service.TestDelete(taskId);
|
|
|
|
|
|
|
|
|
|
|
|
await tenantDb.Ado.CommitTranAsync();
|
|
|
|
await tenantDb.Ado.CommitTranAsync();
|
|
|
|