Пример #1
0
        public string SaveDesignate()
        {
            string taskid = Request.Querys("taskid");
            string user   = Request.Forms("user");

            if (!taskid.IsGuid(out Guid taskId))
            {
                return("任务ID错误!");
            }
            if (user.IsNullOrWhiteSpace())
            {
                return("没有选择要指派的人员!");
            }
            Business.FlowTask flowTask = new Business.FlowTask();
            var taskModel = flowTask.Get(taskId);

            if (null == taskModel)
            {
                return("没有找到当前任务!");
            }
            string msg = flowTask.Designate(taskModel, new Business.Organize().GetAllUsers(user));

            Business.Log.Add("指派了任务-" + taskModel.Title, taskModel.ToString() + "-" + msg, Business.Log.Type.流程运行, others: user);
            return("1".Equals(msg) ? "指派成功!" : msg);
        }
Пример #2
0
        public string SaveStatus()
        {
            string status = Request.Forms("status");
            string taskId = Request.Querys("taskid");

            if (!taskId.IsGuid(out Guid guid))
            {
                return("任务ID错误!");
            }
            if (!status.IsInt(out int i))
            {
                return("状态错误!");
            }
            Business.FlowTask flowTask = new Business.FlowTask();
            var    taskModel           = flowTask.Get(guid);
            string oldModel            = taskModel.ToString();

            if (null == taskModel)
            {
                return("未找到当前任务!");
            }
            taskModel.ExecuteType = i;
            if (i < 2)
            {
                taskModel.Status = i;
            }
            else
            {
                taskModel.Status = 2;
            }
            flowTask.Update(taskModel);
            Business.Log.Add("改变了任务状态-" + taskModel.Title, "", Business.Log.Type.流程运行, oldModel, taskModel.ToString());
            return("保存成功!");
        }
Пример #3
0
        /// <summary>
        /// 收回委托事项
        /// </summary>
        /// <returns></returns>
        public string EntrustWithdrawTask()
        {
            string taskid = Request.Querys("taskid");

            if (!taskid.IsGuid(out Guid tid))
            {
                return("任务ID错误!");
            }
            Business.FlowTask flowTask = new Business.FlowTask();
            var taskModel = flowTask.Get(tid);

            if (null == taskModel)
            {
                return("未找到任务!");
            }
            if (!taskModel.EntrustUserId.HasValue)
            {
                return("该任务不是委托任务!");
            }
            taskModel.ReceiveId     = taskModel.EntrustUserId.Value;
            taskModel.ReceiveName   = new Business.User().GetName(taskModel.EntrustUserId.Value);
            taskModel.EntrustUserId = new Guid?();
            taskModel.Note          = "";
            flowTask.Update(taskModel);
            return("收回成功,请到待办事项中查看!");
        }
Пример #4
0
        public IActionResult ChangeStatus()
        {
            string taskId = Request.Querys("taskid");

            Business.FlowTask flowTask = new Business.FlowTask();
            var taskModel = flowTask.Get(taskId.ToGuid());

            if (null == taskModel)
            {
                return(new ContentResult()
                {
                    Content = "未找到当前任务!"
                });
            }
            ViewData["queryString"]   = Request.UrlQuery();
            ViewData["statusOptions"] = new Business.FlowTask().GetExecuteTypeOptions(taskModel.ExecuteType);
            return(View());
        }
Пример #5
0
        public string SaveGoTo()
        {
            string taskid = Request.Querys("taskid");
            string steps  = Request.Forms("step");

            if (!taskid.IsGuid(out Guid taskId))
            {
                return("任务ID错误!");
            }
            Business.FlowTask flowTask = new Business.FlowTask();
            var taskModel = flowTask.Get(taskId);

            if (null == taskModel)
            {
                return("未找到当前任务!");
            }
            Dictionary <Guid, List <Model.User> > dicts = new Dictionary <Guid, List <Model.User> >();

            Business.Organize organize = new Business.Organize();
            foreach (string step in steps.Split(','))
            {
                if (!step.IsGuid(out Guid stepId))
                {
                    continue;
                }
                string member = Request.Forms("member_" + step);
                if (member.IsNullOrWhiteSpace())
                {
                    continue;
                }
                dicts.Add(stepId, organize.GetAllUsers(member));
            }
            string msg = new Business.FlowTask().GoTo(taskModel, dicts);

            Business.Log.Add("跳转了任务-" + taskModel.Title, taskModel.ToString() + "-" + msg, Business.Log.Type.流程运行, others: Newtonsoft.Json.JsonConvert.SerializeObject(dicts));
            return("1".Equals(msg) ? "跳转成功!" : msg);
        }
Пример #6
0
        /// <summary>
        /// 作废任务
        /// </summary>
        /// <returns></returns>
        public string DeleteTask()
        {
            string deltaskid = Request.Querys("deltaskid");

            if (!deltaskid.IsGuid(out Guid taskId))
            {
                return("Id错误!");
            }
            Business.FlowTask flowTask = new Business.FlowTask();
            var taskModel = flowTask.Get(taskId);

            if (null == taskModel)
            {
                return("作废成功!");
            }
            flowTask.DeleteByGroupId(taskModel.GroupId);
            var flowrunModel = new Business.Flow().GetFlowRunModel(taskModel.FlowId);

            if (null == flowrunModel)
            {
                return("作废成功!");
            }
            var stepModel = flowrunModel.Steps.Find(p => p.Id == taskModel.StepId);

            if (null == stepModel)
            {
                return("作废成功!");
            }
            var applibrary = new Business.AppLibrary().Get(stepModel.StepForm.Id);

            if (null != applibrary && applibrary.Code.IsGuid(out Guid formId))
            {
                new Business.Form().DeleteFormData(formId, taskModel.InstanceId);
            }
            return("作废成功!");
        }
Пример #7
0
        public IActionResult DetailSubFlow()
        {
            string taskid   = Request.Querys("taskid");
            string ismobile = Request.Querys("ismobile");

            if (!taskid.IsGuid(out Guid taskId))
            {
                return(new ContentResult()
                {
                    Content = "任务ID错误!"
                });
            }
            Business.FlowTask flowTask = new Business.FlowTask();
            var currentTask            = flowTask.Get(taskId);

            if (null == currentTask)
            {
                return(new ContentResult()
                {
                    Content = "未找到当前任务!"
                });
            }
            if (currentTask.SubFlowGroupId.IsNullOrWhiteSpace())
            {
                return(new ContentResult()
                {
                    Content = "未找到当前任务的子流程任务!"
                });
            }
            string[] subFlowGroupIds = currentTask.SubFlowGroupId.Split(',');

            if (subFlowGroupIds.Length == 1)
            {
                var groupTasks = flowTask.GetListByGroupId(subFlowGroupIds[0].ToGuid());
                if (groupTasks.Count > 0)
                {
                    return(Redirect("Detail?flowid=" + groupTasks.First().FlowId + "&stepid=" + groupTasks.First().StepId +
                                    "&groupid=" + subFlowGroupIds[0] + "&taskid=" + groupTasks.First().Id + "&appid=" + Request.Querys("appid")
                                    + "&tabid=" + Request.Querys("tabid") + "&iframeid=" + Request.Querys("iframeid") + "&ismobile=" + ismobile));
                }
            }
            else
            {
                Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray();
                foreach (var id in subFlowGroupIds)
                {
                    var groupTasks = flowTask.GetListByGroupId(id.ToGuid());
                    if (groupTasks.Count == 0)
                    {
                        continue;
                    }
                    var groupTask = groupTasks.First();
                    Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject
                    {
                        { "FlowName", groupTask.FlowName },
                        { "StepName", groupTask.StepName },
                        { "SenderName", groupTask.SenderName },
                        { "SenderTime", groupTask.ReceiveTime.ToDateTimeString() },
                        { "ReceiveName", groupTask.ReceiveName },
                        { "CompletedTime1", groupTask.CompletedTime1.HasValue ? groupTask.CompletedTime1.Value.ToShortDateString() : "" },
                        { "StatusTitle", flowTask.GetExecuteTypeTitle(groupTask.ExecuteType) },
                        { "Show", "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"detail('" + groupTask.FlowId + "', '" + groupTask.GroupId + "');return false;\"><i class=\"fa fa-search\"></i>查看</a>" }
                    };
                    jArray.Add(jObject);
                }
                ViewData["json"]     = jArray.ToString();
                ViewData["ismobile"] = ismobile;
            }
            return(View());
        }