public ActionResult ModifyTaskExtensionCheckList(string shortCode, string groupName, string checkItemName, string checkItemGuid, string checkItemType) { return(ActionUtils.Json(() => { CheckPermission(PermissionObjectType.Task, shortCode, PermissionType.Execute); var task = m_dbAdapter.Task.GetTaskWithExInfo(shortCode); m_dbAdapter.Task.CheckPrevIsFinished(task); CommUtils.Assert(CommUtils.ParseEnum <TaskExtensionType>(task.TaskExtension.TaskExtensionType) == TaskExtensionType.CheckList, "工作[" + task.Description + "]的工作扩展类型不是[工作要点检查]"); var oldItemStatus = CommUtils.ParseEnum <TaskExCheckType>(checkItemType); var revisionCheckType = string.Empty; CommUtils.AssertHasContent(task.TaskExtension.TaskExtensionInfo, "当前工作不包含扩展信息。"); var taskExInfo = task.TaskExtension.TaskExtensionInfo; var taskExCheckListInfo = CommUtils.FromJson <TaskExCheckListInfo>(taskExInfo); CommUtils.AssertEquals(taskExCheckListInfo.CheckGroups.Count(x => x.GroupName == groupName), 1, "找不到检查项分组{0}", groupName); var group = taskExCheckListInfo.CheckGroups.Single(x => x.GroupName == groupName); CommUtils.AssertEquals(group.CheckItems.Count(x => x.Name == checkItemName), 1, "检查项分组{0}中,找不到检查项{1}", checkItemName); var checkItem = group.CheckItems.Single(x => x.Name == checkItemName); CommUtils.AssertEquals(checkItem.Guid, checkItemGuid, "检查项分组{0}中,检查项{1}匹配失败", groupName, checkItemName); CommUtils.AssertEquals(checkItem.CheckStatus, checkItemType, "检查项分组{0}中,检查项{1}状态有误,请刷新后再试", groupName, checkItemName); if (oldItemStatus == TaskExCheckType.Unchecked) { checkItem.CheckStatus = TaskExCheckType.Checked.ToString(); } else if (oldItemStatus == TaskExCheckType.Checked) { checkItem.CheckStatus = TaskExCheckType.Unchecked.ToString(); } else { CommUtils.Assert(false, "无法识别的检查项内容[{0}]", oldItemStatus.ToString()); } revisionCheckType = checkItem.CheckStatus; task.TaskExtension.TaskExtensionInfo = CommUtils.ToJson(taskExCheckListInfo); task.TaskHandler = CurrentUserName; m_dbAdapter.Task.UpdateTaskExtension(task.TaskExtension); var logicModel = Platform.GetProject(task.ProjectId); new TaskLogicModel(logicModel, task).Start(); m_dbAdapter.Task.UpdateTask(task); m_dbAdapter.Task.AddTaskLog(task, "校验分组[" + groupName + "]中的工作要点[" + checkItemName + "],状态为:" + Toolkit.ConvertTaskExCheckType(revisionCheckType)); return ActionUtils.Success(1); })); }