任务台台账查询调整

usertest
zhangxiaofeng 4 months ago
parent 3c7d0722c8
commit 749f6e6968

@ -0,0 +1,10 @@
namespace DS.WMS.Core.TaskPlat.Dtos
{
public class GetCurrentTotalStatQueryDto
{
/// <summary>
/// 查询条件
/// </summary>
public string QueryCondition { get; set; } = string.Empty;
}
}

@ -24,9 +24,8 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <summary>
/// 获取登陆人相关的任务统计信息
/// </summary>
/// <param name="isReCalc">是否强制计算</param>
/// <returns>返回回执</returns>
Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(bool isReCalc);
Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(GetCurrentTotalStatQueryDto querySearch);
/// <summary>
/// 任务台台账列表查询

@ -375,8 +375,11 @@ namespace DS.WMS.Core.TaskPlat.Method
// 查出涉及到的订单
var seaExportList = await tenantDb.Queryable<SeaExport>()
.Where(x => waitQuerySeaExportWithMblnoList.Contains(x.MBLNO) && x.ParentId == 0)
.Select(x => new
.Where(x => x.ParentId == 0
&& (
(x.SplitOrMergeFlag != 0 && waitQuerySeaExportWithMblnoList.Contains(x.MBLNO))
|| (x.SplitOrMergeFlag == 1 && waitQuerySeaExportWithMblnoList.Contains(x.BookingNo))
)).Select(x => new
{
x.Id,
x.MBLNO,

@ -36,6 +36,11 @@ namespace DS.WMS.Core.TaskPlat.Method
// 按需构建
/// <summary>
/// 上一次进行全局任务匹配的时间
/// </summary>
public static DateTime LastMatchTaskTime = DateTime.Now;
public TaskManageService(IUser user,
ILogger<TaskManageService> logger,
ISaasDbService saasDbService,
@ -2125,45 +2130,20 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <summary>
/// 获取登陆人相关的任务统计信息
/// </summary>
/// <param name="isReCalc">是否强制计算</param>
/// <returns>返回回执</returns>
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(bool isReCalc)
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(GetCurrentTotalStatQueryDto querySearch)
{
TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo
{
LevelTop = new List<TaskUserStatItem>(),
LevelNext = new List<TaskUserStatItemNext>(),
LevelTree = new List<TaskUserStatItemTree>()
};
/*
1
2isReCalc=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 sql = tenantDb.Queryable<SeaExport>().Where(x => x.Id > 232).ToSqlString();
//var a = user.UserId;
//var aa = user.TenantId;
//var a343 = user.GetTenantId();
@ -2171,12 +2151,40 @@ namespace DS.WMS.Core.TaskPlat.Method
//var b = user.GetOrgId();
//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 groupList = await tenantDb.Queryable<TaskBaseInfo>()
.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)))
.GroupBy((t, a) => new { t.TASK_TYPE, t.STATUS, a.Status, t.IS_PUBLIC })
.Select((t, a) => new

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NameOfLastUsedPublishProfile>D:\Code\DS\ds8-solution-pro\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile1.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
</Project>

@ -102,11 +102,10 @@ public class TaskManageController : ApiController
/// <summary>
/// 获取登陆人相关的任务统计信息
/// </summary>
/// <param name="isReCalc">是否强制计算</param>
[HttpPost("GetCurrentTotalStat")]
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat([FromQuery] bool isReCalc = false)
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(GetCurrentTotalStatQueryDto querySearch)
{
var result = await taskManageService.GetCurrentTotalStat(isReCalc);
var result = await taskManageService.GetCurrentTotalStat(querySearch);
return result;
}

Loading…
Cancel
Save