public void init(int[] taskStateArray, TaskGridShownStyle style) { this._taskStateArray = taskStateArray; this._style = style; var classList = CodeCache.getClass(); var brandList = CodeCache.getBrand(); var modelList = CodeCache.getModel(); var taskList = TaskCache.getCache(); var tasklifecycleList = TaskLifecycleCache.getCache(); var taskModelMapList = TaskModelMapCache.getCache(); taskModelAllList = (from task in taskList from classCode in classList from tasklifecycle in tasklifecycleList //from brandCode in brandList //from taskModelMap in taskModelMapList //where (taskStateArray == (int)TaskStateEnum.Completed ? // (task.taskState == taskStateArray || task.taskState == (int)TaskStateEnum.Rejected || task.taskState == (int)TaskStateEnum.Closed) // : (task.taskState == taskStateArray))//如果是展示已完成任务,则需要附带已关闭、已驳回的任务 where taskStateArray.Contains(task.taskState) && task.taskClass == classCode.id //&& taskModelMap.taskId == task.id && taskModelMap.brandId == brandCode.id //todo 跟当前用户相关 && task.id == tasklifecycle.taskId && tasklifecycle.taskState == 5001 && (task.taskExecutor.Contains(User.currentUser.name) || tasklifecycle.taskStateChangeExecutor == User.currentUser.name) //当前用户创建或测试人包含当前用户 orderby task.createTime descending select new TaskModel { taskId = task.id, taskName = task.taskName, taskStateId = task.taskState, taskStateName = taskStateDic[task.taskState], taskBrandModelName = string.Join(Environment.NewLine, from brandCode in brandList from modelCode in modelList from taskModelMap in taskModelMapList where taskModelMap.taskId == task.id && taskModelMap.brandId == brandCode.id && taskModelMap.ModelId == modelCode.id select brandCode.codeName + " " + modelCode.codeName), taskClassName = classCode.codeName, taskStartTime = task.createTime, taskCode = task.taskCode, percent = task.percent, taskRound = task.taskRound }).ToList(); doQuery(new TaskQueryItem()); showStyle(style); }