|
|
@ -36,6 +36,11 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
|
|
|
|
|
|
|
// 按需构建
|
|
|
|
// 按需构建
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 上一次进行全局任务匹配的时间
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public static DateTime LastMatchTaskTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
public TaskManageService(IUser user,
|
|
|
|
public TaskManageService(IUser user,
|
|
|
|
ILogger<TaskManageService> logger,
|
|
|
|
ILogger<TaskManageService> logger,
|
|
|
|
ISaasDbService saasDbService,
|
|
|
|
ISaasDbService saasDbService,
|
|
|
@ -2125,45 +2130,20 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 获取登陆人相关的任务统计信息
|
|
|
|
/// 获取登陆人相关的任务统计信息
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="isReCalc">是否强制计算</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(bool isReCalc)
|
|
|
|
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(GetCurrentTotalStatQueryDto querySearch)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo
|
|
|
|
TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LevelTop = new List<TaskUserStatItem>(),
|
|
|
|
LevelTop = new List<TaskUserStatItem>(),
|
|
|
|
LevelNext = new List<TaskUserStatItemNext>(),
|
|
|
|
LevelNext = new List<TaskUserStatItemNext>(),
|
|
|
|
LevelTree = new List<TaskUserStatItemTree>()
|
|
|
|
LevelTree = new List<TaskUserStatItemTree>()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
1、首先判断当前登陆人是否有统计记录,如果没有触发统计生成统计记录。
|
|
|
|
|
|
|
|
2、如果isReCalc=true,表示强制重新统计数据,并重新更新统计数据。
|
|
|
|
|
|
|
|
3、按照统计类型(个人/公共)、任务状态、是否异常分组汇总,并写入统计表。
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var userTendInfo = await _sysUserRepository.AsQueryable()
|
|
|
|
|
|
|
|
// .LeftJoin<SysTenant>((usr, ten) => usr.TenantId == ten.Id)
|
|
|
|
|
|
|
|
// .Where(usr => usr.Id == UserManager.UserId)
|
|
|
|
|
|
|
|
// .Select((usr, ten) => new { User = usr, Tend = ten }).FirstAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (userTendInfo == null)
|
|
|
|
|
|
|
|
// throw Oops.Oh($"当前用户关联租户信息获取失败");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////var statList = _taskStatManageInfoRepository.AsQueryable().Where(t => (t.USER_ID == userTendInfo.User.Id
|
|
|
|
|
|
|
|
////&& t.STAT_TYPE == TaskStatLevelEnum.PERSON.ToString()) || (t.COMP_ID == userTendInfo.Tend.Id && t.STAT_TYPE == TaskStatLevelEnum.PUBLIC.ToString())).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////菜单375504048771141=我的任务台账
|
|
|
|
|
|
|
|
//List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuTaskManage);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bool isAdmin = userlist == null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 人员信息测试用
|
|
|
|
//var sql = tenantDb.Queryable<SeaExport>().Where(x => x.Id > 232).ToSqlString();
|
|
|
|
//var sql = tenantDb.Queryable<SeaExport>().Where(x => x.Id > 232).ToSqlString();
|
|
|
|
|
|
|
|
|
|
|
|
//var a = user.UserId;
|
|
|
|
//var a = user.UserId;
|
|
|
|
//var aa = user.TenantId;
|
|
|
|
//var aa = user.TenantId;
|
|
|
|
//var a343 = user.GetTenantId();
|
|
|
|
//var a343 = user.GetTenantId();
|
|
|
@ -2171,12 +2151,40 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
//var b = user.GetOrgId();
|
|
|
|
//var b = user.GetOrgId();
|
|
|
|
//var b232 = user.OrgId;
|
|
|
|
//var b232 = user.OrgId;
|
|
|
|
|
|
|
|
|
|
|
|
//await MatchTask();
|
|
|
|
// 任务匹配
|
|
|
|
|
|
|
|
if (LastMatchTaskTime < DateTime.Now.AddSeconds(-5)) // 效果:距上一次全局任务匹配执行如果超过5秒,才进行匹配
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await MatchTask();
|
|
|
|
|
|
|
|
LastMatchTaskTime = DateTime.Now;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
|
|
|
List<IConditionalModel>? whereList = null;
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(querySearch.QueryCondition))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
whereList = tenantDb.Utilities.JsonToConditionalModels(querySearch.QueryCondition);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (whereList != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var item in whereList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (item is ConditionalModel model)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!model.FieldName.StartsWith("t."))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
model.FieldName = "t." + model.FieldName;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
//任务列表分组统计
|
|
|
|
//任务列表分组统计
|
|
|
|
var groupList = await tenantDb.Queryable<TaskBaseInfo>()
|
|
|
|
var groupList = await tenantDb.Queryable<TaskBaseInfo>()
|
|
|
|
.LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
.LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
|
|
|
.Where(whereList)
|
|
|
|
.Where((t, a) => t.IS_PUBLIC == 1 || (t.IS_PUBLIC == 0 && a.Status != null && (t.CreateBy == userId || a.UserId == userId)))
|
|
|
|
.Where((t, a) => t.IS_PUBLIC == 1 || (t.IS_PUBLIC == 0 && a.Status != null && (t.CreateBy == userId || a.UserId == userId)))
|
|
|
|
.GroupBy((t, a) => new { t.TASK_TYPE, t.STATUS, a.Status, t.IS_PUBLIC })
|
|
|
|
.GroupBy((t, a) => new { t.TASK_TYPE, t.STATUS, a.Status, t.IS_PUBLIC })
|
|
|
|
.Select((t, a) => new
|
|
|
|
.Select((t, a) => new
|
|
|
|