Пример #1
0
 public ActionResult RollBackTask(TaskLogEditForm inputlog, string[] deslogs)
 {
     var log = _tasklogRepository.Find(inputlog.Id);
     bool canrollback = (deslogs != null && deslogs.Any());//有没有选中回退目标节点检查
     if (!canrollback) return Json(new JsonResponse { Success = false, Message = "未选择回退目标节点,不能回退" });
     foreach (var previouLog in log.GetPreviouLogs())
     {
         canrollback = previouLog.IsEnded();
         if (!canrollback) return Json(new JsonResponse { Success = false, Message = "没有该项目的前置节点流转记录,不能回退" });
     }
     try
     {
         log.RollBack(deslogs);
         UnitOfWork.Commit();
         return Json(new JsonResponse {Success = true, Message = "回退成功" });
     }
     catch (Exception)
     {
         return Json(new JsonResponse {Success = false, Message = "未能回退"});
     }
 }
Пример #2
0
        public ActionResult SaveTaskLog(TaskLogEditForm inputlog)
        {
            if (ModelState.IsValid)
             {
                 var log = _tasklogRepository.Find(inputlog.Id);
                 log.PlanStartDate = inputlog.PlanStartDate;
                 log.PlanEndDate = inputlog.PlanEndDate;
                 log.DateBeginOn = inputlog.DateBeginOn;
                 if (inputlog.DoneBy == null)
                     log.UserId = null;
                 else log.UserId = _userRepository.FindByName(inputlog.DoneBy).UserId;

                 //log.DateEndOn = inputlog.DateEndOn;
                 if (inputlog.DateEndOn.HasValue)
                 {
                   //  if (log.TaskNode.StageEnd && !log.CheckStageDocments())
                   //  return Json(new JsonResponse { Success = false, Message = "不能完成该节点,该阶段的文件包目录中存在未建档或上传的文挡,请在文件包中完成该阶段的所有文件建档工作" });
                         if (log.CheckNodeDocments() == false)
                         return Json(new JsonResponse { Success = false, Message = "不能完成该节点,您的节点文件包目录中存在未确认归档或上传的文挡" });
                     log.Finish(inputlog.DateEndOn.Value);
                 }
                 log.DelayReason = inputlog.DelayReason;
                 UnitOfWork.Commit();
                 var msg = log.DateEndOn.HasValue ? "该节点已完成,系统已自动启动了后续节点,并智能调整了后续节点的计划时间":"节点信息保存成功";
                 return Json(new JsonResponse { Success = true, Message = msg });
             }
             return Json(new JsonResponse { Success = false,Message = "不能保存节点操作,请检查录入信息是否正确"});
        }
Пример #3
0
        public ActionResult EditTaskLog(int id)
        {
            var log = _tasklogRepository.Find(id);
            var model = new TaskLogEditForm(log);
            ViewBag.AvailableUsers = log.TaskNode.DutyRole.Users.ToList();

            if (  String.IsNullOrEmpty(model.DoneBy) && CurrentUser.IsInRole(log.TaskNode.DutyRole.Name)  && log.IsActive())
            {
                  model.CanEdit = true;
                  model.DoneBy = User.Identity.Name;
            }
                // 如果节点已指派处理人,且登录人员是指派的节点处理人员则有权限编辑处理节点信息
            else if (!String.IsNullOrEmpty(model.DoneBy) && CurrentUser.UserId == log.TodoBy.UserId && log.IsActive())
            {
                model.CanEdit = true;
            }
                // 工程部负责人可以指派施工阶段的岗位处理人员,分配项目任务
            else if ( (CurrentUser.UserName == "徐洁鸣" || CurrentUser.UserName == "蒋陈忠") && log.TaskNode.StageValue == 3)
            {
                model.CanEdit = true;
                // model.DoneBy = string.Join(",", users);
            }
                //最后,如果是查看节点,正确显示岗位处理人员信息
            else
            {
                model.CanEdit = false;
                if (log.TodoBy !=null)
                {
                    model.DoneBy = log.TodoBy.UserName;
                }
                else
                {
                    var users = log.TaskNode.DutyRole.Users.Select(x => x.UserName).ToArray();
                    model.DoneBy = string.Join(",", users);
                }
            }

            return PartialView("_TaskLogForm",model);
        }