jianghaiqing 4 months ago
commit 3cacf03e5c

@ -983,7 +983,7 @@ public class ClientCommonService : IClientCommonService
foreach (var item in list) foreach (var item in list)
{ {
var orgs = db.Queryable<SysOrgUser>().Filter(null, true) var orgs = db.Queryable<SysOrgUser>().Filter(null, true)
.LeftJoin<SysOrg>((a, b) => a.OrgId == b.Id) .InnerJoin<SysOrg>((a, b) => a.OrgId == b.Id && b.IsDepartment == false)
.Where(a => a.UserId == item.Id) .Where(a => a.UserId == item.Id)
.Select((a, b) => new OrgList .Select((a, b) => new OrgList
{ {

@ -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>
/// 获取登陆人相关的任务统计信息 /// 获取登陆人相关的任务统计信息
/// </summary> /// </summary>
/// <param name="isReCalc">是否强制计算</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(bool isReCalc); Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(GetCurrentTotalStatQueryDto querySearch);
/// <summary> /// <summary>
/// 任务台台账列表查询 /// 任务台台账列表查询

@ -375,22 +375,25 @@ namespace DS.WMS.Core.TaskPlat.Method
// 查出涉及到的订单 // 查出涉及到的订单
var seaExportList = await tenantDb.Queryable<SeaExport>() var seaExportList = await tenantDb.Queryable<SeaExport>()
.Where(x => waitQuerySeaExportWithMblnoList.Contains(x.MBLNO) && x.ParentId == 0) .Where(x => x.ParentId == 0
.Select(x => new && (
{ (x.SplitOrMergeFlag != 0 && waitQuerySeaExportWithMblnoList.Contains(x.MBLNO))
x.Id, || (x.SplitOrMergeFlag == 1 && waitQuerySeaExportWithMblnoList.Contains(x.BookingNo))
x.MBLNO, )).Select(x => new
x.OperatorId, {
x.OperatorName, x.Id,
x.Doc, x.MBLNO,
x.DocName, x.OperatorId,
x.SaleId, x.OperatorName,
x.Sale, x.Doc,
x.CustomerService, x.DocName,
x.CustomerServiceName, x.SaleId,
x.ForeignCustomerService, x.Sale,
x.ForeignCustomerServiceName x.CustomerService,
}).ToListAsync(); x.CustomerServiceName,
x.ForeignCustomerService,
x.ForeignCustomerServiceName
}).ToListAsync();
foreach (var item in allotData) foreach (var item in allotData)
{ {

@ -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
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 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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <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> </PropertyGroup>
</Project> </Project>

@ -102,11 +102,10 @@ public class TaskManageController : ApiController
/// <summary> /// <summary>
/// 获取登陆人相关的任务统计信息 /// 获取登陆人相关的任务统计信息
/// </summary> /// </summary>
/// <param name="isReCalc">是否强制计算</param>
[HttpPost("GetCurrentTotalStat")] [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; return result;
} }

Loading…
Cancel
Save