示例#1
0
        public ActionResult CreateExternal(string id)
        {
            Flow_FormModel formModel = formBLL.GetById(id);

            //属于外部的页面,直接用于外部

            ViewBag.Html = formModel.ExternalURL.Split(',')[0];


            Flow_FormContentModel model = new Flow_FormContentModel();

            model.FormId = id;
            //创建成功取出步骤
            List <Flow_StepModel> stepModelList = stepBLL.GetList(ref setNoPagerAscById, model.FormId);
            Flow_StepModel        stepModel     = stepBLL.GetById(stepModelList[0].Id);

            if (stepModel.FlowRule == (int)FlowRuleEnum.Customer)
            {
                ViewBag.Checker = null;
            }
            else
            {
                List <string> users = GetStepCheckMemberList(stepModel.Id, id);
                ViewBag.Checker = users;
            }
            return(View(model));
        }
示例#2
0
        public ActionResult Edit(string id)
        {
            ViewBag.Perm = GetPermission();
            Flow_StepModel entity = m_BLL.GetById(id);

            return(View(entity));
        }
示例#3
0
        public ActionResult Create(string id)
        {
            Flow_FormModel formModel = formBLL.GetById(id);


            //是否已经设置布局
            if (!string.IsNullOrEmpty(formModel.HtmlForm))
            {
                ViewBag.Html = formModel.HtmlForm;
            }
            else
            {
                ViewBag.Html = ExceHtmlJs(id);
            }

            Flow_FormContentModel model = new Flow_FormContentModel();

            model.FormId = id;
            //创建成功取出步骤
            List <Flow_StepModel> stepModelList = stepBLL.GetList(ref setNoPagerAscById, model.FormId);
            Flow_StepModel        stepModel     = stepBLL.GetById(stepModelList[0].Id);

            if (stepModel.FlowRule == (int)FlowRuleEnum.Customer)
            {
                ViewBag.Checker = null;
            }
            else
            {
                List <string> users = GetStepCheckMemberList(stepModel.Id, id);
                ViewBag.Checker = users;
            }
            return(View(model));
        }
示例#4
0
        private void InsertChecker(Flow_FormContentModel model, int i, Flow_StepModel stepModel, Flow_FormContentStepCheckModel stepCheckModel)
        {
            //获得流转规则下的审核人员
            List <string> userIdList = new List <string>();

            if (stepModel.FlowRule == (int)FlowRuleEnum.Customer)
            {
                string[] arrUserList = model.CustomMember.Split(',');
                foreach (string s in arrUserList)
                {
                    userIdList.Add(s);
                }
            }
            else
            {
                userIdList = GetStepCheckMemberList(stepModel.Id, model.Id);
            }

            foreach (string userId in userIdList)
            {
                //批量建立步骤审核人表
                Flow_FormContentStepCheckStateModel stepCheckModelState = new Flow_FormContentStepCheckStateModel();
                stepCheckModelState.Id          = ResultHelper.NewId;
                stepCheckModelState.StepCheckId = stepCheckModel.Id;
                stepCheckModelState.UserId      = userId;
                stepCheckModelState.CheckFlag   = 2;
                stepCheckModelState.Reamrk      = "";
                stepCheckModelState.TheSeal     = "";
                stepCheckModelState.CreateTime  = ResultHelper.NowTime;
                stepCheckStateBLL.Create(ref errors, stepCheckModelState);
            }
        }
示例#5
0
        public virtual async Task <Flow_StepModel> GetByIdAsync(object id)
        {
            if (IsExists(id))
            {
                Flow_Step entity = await m_Rep.GetByIdAsync(id);

                Flow_StepModel model = new Flow_StepModel();
                model.Id             = entity.Id;
                model.Name           = entity.Name;
                model.Remark         = entity.Remark;
                model.Sort           = entity.Sort;
                model.FormId         = entity.FormId;
                model.FlowRule       = entity.FlowRule;
                model.IsCustom       = entity.IsCustom;
                model.IsAllCheck     = entity.IsAllCheck;
                model.Execution      = entity.Execution;
                model.CompulsoryOver = entity.CompulsoryOver;
                model.IsEditAttr     = entity.IsEditAttr;

                return(model);
            }
            else
            {
                return(null);
            }
        }
示例#6
0
        public ActionResult EditStep(string id)
        {
            ViewBag.Perm = GetPermission();
            Flow_FormModel flowFormModel        = m_BLL.GetById(id);
            GridPager      setNoPagerDescBySort = new GridPager
            {
                sort  = "Id",
                rows  = 100,
                order = "desc",
                page  = 1
            };
            List <Flow_StepModel> stepList = step_BLL.GetList(ref setNoPagerDescBySort, flowFormModel.Id);

            foreach (var r in stepList)
            {
                r.stepRuleList = GetStepRuleListByStepId(r.Id);
            }

            flowFormModel.stepList = stepList;//获取表单关联的步骤
            ViewBag.Form           = flowFormModel;
            Flow_StepModel model = new Flow_StepModel();

            model.FormId     = flowFormModel.Id;
            model.IsEditAttr = true;
            return(View(model));
        }
示例#7
0
        //获得审核人列表
        private List <string> GetStepCheckMemberList(string stepId)
        {
            List <string>  userModelList = new List <string>();
            Flow_StepModel model         = stepBLL.GetById(stepId);

            if (model.FlowRule == (int)FlowRuleEnum.Lead)
            {
                SysUserModel userModel = userBLL.GetById(GetUserId());
                string[]     array     = userModel.Lead.Split(',');//获得领导,可能有多个领导
                foreach (string str in array)
                {
                    userModelList.Add(str);
                }
            }
            else if (model.FlowRule == (int)FlowRuleEnum.Position)
            {
                string[] array = model.Execution.Split(',');//获得领导,可能有多个领导
                foreach (string str in array)
                {
                    List <SysUserModel> userList = userBLL.GetListByPosId(str);
                    foreach (SysUserModel userModel in userList)
                    {
                        userModelList.Add(userModel.Id);
                    }
                }
            }
            else if (model.FlowRule == (int)FlowRuleEnum.Department)
            {
                GridPager pager = new GridPager()
                {
                    rows  = 10000,
                    page  = 1,
                    sort  = "Id",
                    order = "desc"
                };
                string[] array = model.Execution.Split(',');//获得领导,可能有多个领导
                foreach (string str in array)
                {
                    List <SysUserModel> userList = userBLL.GetUserByDepId(ref pager, str, "");
                    foreach (SysUserModel userModel in userList)
                    {
                        userModelList.Add(userModel.Id);
                    }
                }
            }
            else if (model.FlowRule == (int)FlowRuleEnum.Person)
            {
                string[] array = model.Execution.Split(',');//获得领导,可能有多个领导
                foreach (string str in array)
                {
                    userModelList.Add(str);
                }
            }

            return(userModelList);
        }
示例#8
0
        public ActionResult EditStep(string id)
        {
            Flow_FormModel        flowFormModel = m_BLL.GetById(id);
            List <Flow_StepModel> stepList      = stepBLL.GetList(ref setNoPagerAscById, flowFormModel.Id); //获得全部步骤

            foreach (var r in stepList)                                                                     //获取步骤下面的步骤规则
            {
                r.stepRuleList = GetStepRuleListByStepId(r.Id);
            }
            flowFormModel.stepList = stepList;//获取表单关联的步骤
            ViewBag.Form           = flowFormModel;
            Flow_StepModel model = new Flow_StepModel();

            model.FormId     = flowFormModel.Id;
            model.IsEditAttr = true;
            return(View(model));
        }
示例#9
0
        public virtual async Task <Tuple <ValidationErrors, bool> > CreateAsync(Flow_StepModel model)
        {
            ValidationErrors errors = new ValidationErrors();

            try
            {
                Flow_Step entity = await m_Rep.GetByIdAsync(model.Id);

                if (entity != null)
                {
                    errors.Add(Resource.PrimaryRepeat);
                    return(new Tuple <ValidationErrors, bool>(errors, false));
                }
                entity                = new Flow_Step();
                entity.Id             = model.Id;
                entity.Name           = model.Name;
                entity.Remark         = model.Remark;
                entity.Sort           = model.Sort;
                entity.FormId         = model.FormId;
                entity.FlowRule       = model.FlowRule;
                entity.IsCustom       = model.IsCustom;
                entity.IsAllCheck     = model.IsAllCheck;
                entity.Execution      = model.Execution;
                entity.CompulsoryOver = model.CompulsoryOver;
                entity.IsEditAttr     = model.IsEditAttr;


                if (await m_Rep.CreateAsync(entity))
                {
                    return(new Tuple <ValidationErrors, bool>(errors, true));
                }
                else
                {
                    errors.Add(Resource.InsertFail);
                    return(new Tuple <ValidationErrors, bool>(errors, false));
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
                return(new Tuple <ValidationErrors, bool>(errors, false));
            }
        }
示例#10
0
        public virtual bool Edit(ref ValidationErrors errors, Flow_StepModel model)
        {
            try
            {
                Flow_Step entity = m_Rep.GetById(model.Id);
                if (entity == null)
                {
                    errors.Add(Resource.Disable);
                    return(false);
                }
                entity.Id             = model.Id;
                entity.Name           = model.Name;
                entity.Remark         = model.Remark;
                entity.Sort           = model.Sort;
                entity.FormId         = model.FormId;
                entity.FlowRule       = model.FlowRule;
                entity.IsCustom       = model.IsCustom;
                entity.IsAllCheck     = model.IsAllCheck;
                entity.Execution      = model.Execution;
                entity.CompulsoryOver = model.CompulsoryOver;
                entity.IsEditAttr     = model.IsEditAttr;



                if (m_Rep.Edit(entity))
                {
                    return(true);
                }
                else
                {
                    errors.Add(Resource.NoDataChange);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
                return(false);
            }
        }
示例#11
0
 public Flow_StepModel GetById(string id)
 {
     if (IsExist(id))
     {
         Flow_Step      entity = m_Rep.GetById(id);
         Flow_StepModel model  = new Flow_StepModel();
         model.CompulsoryOver = entity.CompulsoryOver;
         model.Execution      = entity.Execution;
         model.FlowRule       = entity.FlowRule;
         model.FormId         = entity.FormId;
         model.Id             = entity.Id;
         model.IsAllCheck     = entity.IsAllCheck;
         model.IsCustom       = entity.IsCustom;
         model.IsEditAttr     = entity.IsEditAttr;
         model.Name           = entity.Name;
         model.Remark         = entity.Remark;
         model.Sort           = entity.Sort;
         return(model);
     }
     return(null);
 }
示例#12
0
 public JsonResult Edit(Flow_StepModel model)
 {
     if (model != null && ModelState.IsValid)
     {
         if (m_BLL.Edit(ref errors, model))
         {
             LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name, "成功", "修改", "Flow_Step");
             return(Json(JsonHandler.CreateMessage(1, Suggestion.EditSucceed)));
         }
         else
         {
             string ErrorCol = errors.Error;
             LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name + "," + ErrorCol, "失败", "修改", "Flow_Step");
             return(Json(JsonHandler.CreateMessage(0, Suggestion.EditFail + ErrorCol)));
         }
     }
     else
     {
         return(Json(JsonHandler.CreateMessage(0, Suggestion.EditFail)));
     }
 }
示例#13
0
 public bool Create(ref ValidationErrors errors, Flow_StepModel model)
 {
     try
     {
         Flow_Step entity = m_Rep.GetById(model.Id);
         if (entity != null)
         {
             errors.Add(Suggestion.PrimaryRepeat);
             return(false);
         }
         entity = new Flow_Step();
         entity.CompulsoryOver = model.CompulsoryOver;
         entity.Execution      = model.Execution;
         entity.FlowRule       = model.FlowRule;
         entity.FormId         = model.FormId;
         entity.Id             = model.Id;
         entity.IsAllCheck     = model.IsAllCheck;
         entity.IsCustom       = model.IsCustom;
         entity.IsEditAttr     = model.IsEditAttr;
         entity.Name           = model.Name;
         entity.Remark         = model.Remark;
         entity.Sort           = model.Sort;
         if (m_Rep.Create(entity) == 1)
         {
             return(true);
         }
         else
         {
             errors.Add(Suggestion.InsertFail);
             return(false);
         }
     }
     catch (Exception ex)
     {
         errors.Add(ex.Message);
         ExceptionHander.WriteException(ex);
         return(false);
     }
 }
示例#14
0
 public JsonResult EditStep(Flow_StepModel model)
 {
     model.Id = ResultHelper.NewId;
     if (model != null && ModelState.IsValid)
     {
         if (stepBLL.Create(ref errors, model))
         {
             LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name, "成功", "创建", "Flow_Step");
             return(Json(JsonHandler.CreateMessage(1, Resource.InsertSucceed, model.Id)));
         }
         else
         {
             string ErrorCol = errors.Error;
             LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name + "," + ErrorCol, "失败", "创建", "Flow_Step");
             return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + ErrorCol)));
         }
     }
     else
     {
         return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail)));
     }
 }
示例#15
0
        public JsonResult Create(Flow_FormContentModel model)
        {
            //当前的Form模版
            Flow_FormModel formModel = formBLL.GetById(model.FormId);

            //初始化部分数据
            model.Id         = ResultHelper.NewId;
            model.CreateTime = ResultHelper.NowTime;
            model.UserId     = GetUserId();
            model.Title      = formModel.Name;
            model.TimeOut    = DateTime.Now.AddDays(30);
            if (model != null && ModelState.IsValid)
            {
                if (formContentBLL.Create(ref errors, model))
                {
                    //创建成功后把步骤取出
                    List <Flow_StepModel> stepModelList = stepBLL.GetList(ref setNoPagerAscBySort, model.FormId);
                    //查询步骤
                    int  listCount = stepModelList.Count();
                    bool IsEnd     = false;
                    for (int i = 0; i < listCount; i++)
                    {
                        string                    nextStep          = "";
                        Flow_StepModel            stepModel         = stepModelList[i];
                        List <Flow_StepRuleModel> stepRuleModelList = stepRuleBLL.GetList(stepModel.Id);
                        //获取规则判断流转方向
                        foreach (Flow_StepRuleModel stepRuleModel in stepRuleModelList)
                        {
                            string val = new FlowHelper().GetFormAttrVal(stepRuleModel.AttrId, formModel, model);
                            //有满足流程结束的条件
                            if (!JudgeVal(stepRuleModel.AttrId, val, stepRuleModel.Operator, stepRuleModel.Result))
                            {
                                if (stepRuleModel.NextStep != "0")
                                {
                                    //获得跳转的步骤
                                    nextStep = stepRuleModel.NextStep;
                                    //跳到跳转后的下一步
                                    for (int j = 0; j < listCount; j++)
                                    {
                                        if (stepModelList[j].Id == nextStep)
                                        {
                                            i = j;//跳到分支后的下一步
                                        }
                                    }
                                }
                                else
                                {
                                    //nextStep=0流程结束
                                    IsEnd = true;
                                }
                            }
                        }

                        #region 插入步骤
                        //插入步骤审核表
                        Flow_FormContentStepCheckModel stepCheckModel = new Flow_FormContentStepCheckModel();
                        stepCheckModel.Id         = ResultHelper.NewId;
                        stepCheckModel.ContentId  = model.Id;
                        stepCheckModel.StepId     = stepModel.Id;
                        stepCheckModel.State      = (int)FlowStateEnum.Progress;
                        stepCheckModel.StateFlag  = false;//true此步骤审核完成
                        stepCheckModel.CreateTime = ResultHelper.NowTime;
                        if (nextStep != "" && nextStep != "0")
                        {
                            stepCheckModel.IsEnd = (i == listCount) ? true : IsEnd;//是否流程的最后一步
                        }
                        else
                        {
                            stepCheckModel.IsEnd = (i == listCount - 1) ? true : IsEnd;//是否流程的最后一步
                        }

                        stepCheckModel.IsCustom = stepModel.FlowRule == (int)FlowRuleEnum.Customer ? true : false;
                        if (stepCheckBLL.Create(ref errors, stepCheckModel))//新建步骤成功
                        {
                            InsertChecker(model, i, stepModel, stepCheckModel);
                        }
                        #endregion
                        #region 插入分支步骤
                        if (nextStep != "" && nextStep != "0")
                        {
                            //不是最后一个审核人
                            if (listCount < 1 || i != listCount - 1)
                            {
                                IsEnd = false;
                            }
                            else
                            {
                                IsEnd = true;
                            }

                            stepCheckModel            = new Flow_FormContentStepCheckModel();
                            stepCheckModel.Id         = ResultHelper.NewId;
                            stepCheckModel.ContentId  = model.Id;
                            stepCheckModel.StepId     = stepModel.Id;
                            stepCheckModel.State      = (int)FlowStateEnum.Progress;
                            stepCheckModel.StateFlag  = false; //true此步骤审核完成
                            stepCheckModel.CreateTime = ResultHelper.NowTime;
                            stepCheckModel.IsEnd      = IsEnd; //是否流程的最后一步


                            stepCheckModel.IsCustom = stepModel.FlowRule == (int)FlowRuleEnum.Customer ? true : false;
                            if (stepCheckBLL.Create(ref errors, stepCheckModel))//新建步骤成功
                            {
                                InsertChecker(model, i, stepModel, stepCheckModel);
                            }
                        }
                        #endregion

                        if (IsEnd)//如果是最后一步就无需要下面继续了
                        {
                            break;
                        }
                        IsEnd = true;
                    }



                    LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA, "成功", "创建", "Flow_FormContent");
                    return(Json(JsonHandler.CreateMessage(1, Resource.InsertSucceed)));
                }
                else
                {
                    string ErrorCol = errors.Error;
                    LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA + "," + ErrorCol, "失败", "创建", "Flow_FormContent");
                    return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + ErrorCol)));
                }
            }
            else
            {
                return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail)));
            }
        }
示例#16
0
        public JsonResult Create(Flow_FormContentModel model)
        {
            //当前的Form模版
            Flow_FormModel formModel = formBLL.GetById(model.FormId);

            //初始化部分数据
            model.Id         = ResultHelper.NewId;
            model.CreateTime = ResultHelper.NowTime;
            model.UserId     = GetUserId();
            model.Title      = formModel.Name;
            model.TimeOut    = DateTime.Now.AddDays(30);
            if (model != null && ModelState.IsValid)
            {
                //内容提交数据库
                if (formContentBLL.Create(ref errors, model))
                {
                    try
                    {
                        List <Flow_StepModel> stepModelList = stepBLL.GetList(ref setNoPagerAscBySort, model.FormId);
                        //查询步骤
                        int  listCount = stepModelList.Count();
                        bool IsEnd     = false;
                        //循环表单的所有步骤
                        for (int i = 0; i < listCount; i++)
                        {
                            string         nextStep  = "";
                            Flow_StepModel stepModel = stepModelList[i];
                            //获得步骤对应的规则
                            List <Flow_StepRuleModel> stepRuleModelList = stepRuleBLL.GetList(stepModel.Id);
                            //获取规则判断流转方向
                            foreach (Flow_StepRuleModel stepRuleModel in stepRuleModelList)
                            {
                                //获取需要判断的数值,比如请假天数
                                string val = new FlowHelper().GetFormAttrVal(stepRuleModel.AttrId, formModel, model);
                                //有满足流程结束的条件,判断请假天数是否处于这个规则内
                                if (!JudgeVal(stepRuleModel.AttrId, val, stepRuleModel.Operator, stepRuleModel.Result))
                                {
                                    //如果符合规则,判断是否还有下一步
                                    if (stepRuleModel.NextStep != "0")
                                    {
                                        //跳转后的下一步
                                        for (int j = 0; j < listCount; j++)
                                        {
                                            //看看当前步骤是哪一步
                                            if (stepModelList[j].Id == nextStep)
                                            {
                                                i = j;//跳到分支后的下一步,从这一步开始循环
                                                continue;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        IsEnd = true;
                                        continue;
                                    }
                                }
                            }
                            #region 插入步骤
                            //插入步骤审核表
                            Flow_FormContentStepCheckModel stepCheckModel = new Flow_FormContentStepCheckModel();
                            stepCheckModel.Id         = ResultHelper.NewId;
                            stepCheckModel.ContentId  = model.Id;
                            stepCheckModel.StepId     = stepModel.Id;
                            stepCheckModel.State      = (int)FlowStateEnum.Progress;
                            stepCheckModel.StateFlag  = false;//true此步骤审核完成
                            stepCheckModel.CreateTime = ResultHelper.NowTime;
                            stepCheckModel.IsEnd      = IsEnd;
                            stepCheckModel.IsCustom   = stepModel.FlowRule == (int)FlowRuleEnum.Customer ? true : false;

                            if (stepCheckBLL.Create(ref errors, stepCheckModel))//新建步骤成功
                            {
                                InsertChecker(model, i, stepModel, stepCheckModel);
                            }

                            if (IsEnd)//如果是最后一步就无需要下面继续了
                            {
                                break;
                            }
                            #endregion
                        }



                        LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA, "成功", "创建", "Flow_FormContent");
                        return(Json(JsonHandler.CreateMessage(1, Resource.InsertSucceed)));
                    }
                    catch (Exception ex)
                    {
                        //创建失败,删除表单
                        formContentBLL.Delete(ref errors, model.Id);
                        return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + "流程发生异常,请联系管理员")));
                    }
                }
                else
                {
                    string ErrorCol = errors.Error;
                    LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA + "," + ErrorCol, "失败", "创建", "Flow_FormContent");
                    return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + ErrorCol)));
                }
            }
            else
            {
                return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail)));
            }
        }
示例#17
0
        public List <string> GetStepCheckMemberList(string stepId, string formContentId)
        {
            List <string>  userModelList = new List <string>();
            Flow_StepModel stepModel     = stepBLL.GetById(stepId);

            if (stepModel.FlowRule == "上级")
            {
                SysUserModel userModel = userBLL.GetById(GetUserId());
                string[]     array     = userModel.Lead.Split(',');//获得领导,可能有多个领导
                if (array.Length > 0)
                {
                    foreach (var item in array)
                    {
                        userModelList.Add(item);
                    }
                }
            }
            else if (stepModel.FlowRule == "职位")
            {
                string[] array = stepModel.Execution.Split(',');//获得领导,可能有多个领导
                foreach (var item in array)
                {
                    List <SysUserModel> userList = userBLL.GetListByPostId(item);
                    if (userList.Count > 0)
                    {
                        foreach (SysUserModel userModel in userList)
                        {
                            userModelList.Add(userModel.Id);
                        }
                    }
                }
            }
            else if (stepModel.FlowRule == "部门")
            {
                GridPager pager = new GridPager()
                {
                    rows  = 10000,
                    page  = 1,
                    sort  = "Id",
                    order = "desc"
                };
                string[] array = stepModel.Execution.Split(',');//获得领导,可能有多个领导
                if (array.Length > 0)
                {
                    foreach (string str in array)
                    {
                        List <SysUserModel> userList = userBLL.GetUserByDepId(ref pager, str, "");
                        foreach (SysUserModel user in userList)
                        {
                            userModelList.Add(user.Id);
                        }
                    }
                }
            }
            else if (stepModel.FlowRule == "人员")
            {
                string[] array = stepModel.Execution.Split(',');
                if (array.Length > 0)
                {
                    foreach (var item in array)
                    {
                        userModelList.Add(item);
                    }
                }
            }
            else if (stepModel.FlowRule == "自选")
            {
                string   users = formContentBLL.GetById(formContentId).CustomMember;
                string[] array = users.Split(',');
                if (array.Length > 0)
                {
                    foreach (var item in array)
                    {
                        userModelList.Add(item);
                    }
                }
            }
            return(userModelList);
        }
示例#18
0
        /// <summary>
        /// 校验Excel数据,这个方法一般用于重写校验逻辑
        /// </summary>
        public virtual bool CheckImportData(string fileName, List <Flow_StepModel> list, ref ValidationErrors errors)
        {
            var targetFile = new FileInfo(fileName);

            if (!targetFile.Exists)
            {
                errors.Add("导入的数据文件不存在");
                return(false);
            }

            var excelFile = new ExcelQueryFactory(fileName);

            //对应列头
            excelFile.AddMapping <Flow_StepModel>(x => x.Name, "步骤名称");
            excelFile.AddMapping <Flow_StepModel>(x => x.Remark, "步骤说明");
            excelFile.AddMapping <Flow_StepModel>(x => x.Sort, "排序");
            excelFile.AddMapping <Flow_StepModel>(x => x.FormId, "所属表单");
            excelFile.AddMapping <Flow_StepModel>(x => x.FlowRule, "流转规则");
            excelFile.AddMapping <Flow_StepModel>(x => x.IsCustom, "该流程的 发起人/创建者 是否可以 自行选择 该步骤的审批者");
            excelFile.AddMapping <Flow_StepModel>(x => x.IsAllCheck, "当规则或者角色被选择为多人时候,是否启用多人审核才通过");
            excelFile.AddMapping <Flow_StepModel>(x => x.Execution, "执行者与规则对应");
            excelFile.AddMapping <Flow_StepModel>(x => x.CompulsoryOver, "是否可以强制完成整个流程");
            excelFile.AddMapping <Flow_StepModel>(x => x.IsEditAttr, "审核者是否可以编辑发起者的附件");

            //SheetName
            var excelContent = excelFile.Worksheet <Flow_StepModel>(0);
            int rowIndex     = 1;

            //检查数据正确性
            foreach (var row in excelContent)
            {
                var errorMessage = new StringBuilder();
                var entity       = new Flow_StepModel();
                entity.Id             = row.Id;
                entity.Name           = row.Name;
                entity.Remark         = row.Remark;
                entity.Sort           = row.Sort;
                entity.FormId         = row.FormId;
                entity.FlowRule       = row.FlowRule;
                entity.IsCustom       = row.IsCustom;
                entity.IsAllCheck     = row.IsAllCheck;
                entity.Execution      = row.Execution;
                entity.CompulsoryOver = row.CompulsoryOver;
                entity.IsEditAttr     = row.IsEditAttr;

                //=============================================================================
                if (errorMessage.Length > 0)
                {
                    errors.Add(string.Format(
                                   "第 {0} 列发现错误:{1}{2}",
                                   rowIndex,
                                   errorMessage,
                                   "<br/>"));
                }
                list.Add(entity);
                rowIndex += 1;
            }
            if (errors.Count > 0)
            {
                return(false);
            }
            return(true);
        }
示例#19
0
        /// <summary>
        /// 校验Excel数据,这个方法一般用于重写校验逻辑
        /// </summary>
        public virtual bool CheckImportData(string fileName, List <Flow_StepModel> list, ref ValidationErrors errors)
        {
            var targetFile = new FileInfo(fileName);

            if (!targetFile.Exists)
            {
                errors.Add("导入的数据文件不存在");
                return(false);
            }

            var excelFile = new ExcelQueryFactory(fileName);

            //对应列头
            excelFile.AddMapping <Flow_StepModel>(x => x.Name, "Name");
            excelFile.AddMapping <Flow_StepModel>(x => x.Remark, "Remark");
            excelFile.AddMapping <Flow_StepModel>(x => x.Sort, "Sort");
            excelFile.AddMapping <Flow_StepModel>(x => x.FormId, "FormId");
            excelFile.AddMapping <Flow_StepModel>(x => x.FlowRule, "FlowRule");
            excelFile.AddMapping <Flow_StepModel>(x => x.IsCustom, "IsCustom");
            excelFile.AddMapping <Flow_StepModel>(x => x.IsAllCheck, "IsAllCheck");
            excelFile.AddMapping <Flow_StepModel>(x => x.Execution, "Execution");
            excelFile.AddMapping <Flow_StepModel>(x => x.CompulsoryOver, "CompulsoryOver");
            excelFile.AddMapping <Flow_StepModel>(x => x.IsEditAttr, "IsEditAttr");

            //SheetName
            var excelContent = excelFile.Worksheet <Flow_StepModel>(0);
            int rowIndex     = 1;

            //检查数据正确性
            foreach (var row in excelContent)
            {
                var errorMessage = new StringBuilder();
                var entity       = new Flow_StepModel();
                entity.Id             = row.Id;
                entity.Name           = row.Name;
                entity.Remark         = row.Remark;
                entity.Sort           = row.Sort;
                entity.FormId         = row.FormId;
                entity.FlowRule       = row.FlowRule;
                entity.IsCustom       = row.IsCustom;
                entity.IsAllCheck     = row.IsAllCheck;
                entity.Execution      = row.Execution;
                entity.CompulsoryOver = row.CompulsoryOver;
                entity.IsEditAttr     = row.IsEditAttr;

                //=============================================================================
                if (errorMessage.Length > 0)
                {
                    errors.Add(string.Format(
                                   "第 {0} 列发现错误:{1}{2}",
                                   rowIndex,
                                   errorMessage,
                                   "<br/>"));
                }
                list.Add(entity);
                rowIndex += 1;
            }
            if (errors.Count > 0)
            {
                return(false);
            }
            return(true);
        }
示例#20
0
        public JsonResult Edit(string Remark, string TheSeal, string FormId, int Flag, string ContentId, string UserList)
        {
            string stepCheckId = formContentBLL.GetCurrentStepCheckId(FormId, ContentId);

            if (stepCheckId == "")
            {
                return(Json(JsonHandler.CreateMessage(0, Resource.EditFail)));
            }
            Flow_FormContentStepCheckStateModel stepCheckStateModel = stepCheckStateBLL.GetByStepCheckId(stepCheckId);

            if (stepCheckStateModel.UserId != GetUserId())
            {
                return(Json(JsonHandler.CreateMessage(0, "越权操作!")));
            }
            stepCheckStateModel.Reamrk    = Remark;
            stepCheckStateModel.TheSeal   = TheSeal;
            stepCheckStateModel.CheckFlag = Flag;
            if (stepCheckStateBLL.Edit(ref errors, stepCheckStateModel))
            {
                //获取当前步骤
                Flow_FormContentStepCheckModel stepCheckModel = stepCheckBLL.GetById(stepCheckStateModel.StepCheckId);
                //获得当前的步骤模板
                Flow_StepModel currentStepModel = stepBLL.GetById(stepCheckModel.StepId);
                //驳回直接终止审核
                if (Flag == (int)FlowStateEnum.Reject)
                {
                    stepCheckModel.State     = Flag;
                    stepCheckModel.StateFlag = false;
                    stepCheckBLL.Edit(ref errors, stepCheckModel);
                    //重置所有步骤的状态
                    stepCheckBLL.ResetCheckStateByFormCententId(stepCheckModel.Id, ContentId, (int)FlowStateEnum.Progress, (int)FlowStateEnum.Progress);
                    LogHandler.WriteServiceLog(GetUserId(), "Id" + stepCheckStateModel.Id + ",StepCheckId" + stepCheckStateModel.Reamrk, "成功", "修改", "Flow_FormContentStepCheckState");
                    return(Json(JsonHandler.CreateMessage(1, Resource.CheckSucceed)));
                }
                else if (currentStepModel.IsAllCheck)
                {
                    //启用会签
                    //获得同步骤的同批审核人
                    List <Flow_FormContentStepCheckStateModel> stepCheckStateList = stepCheckStateBLL.GetListByStepCheckId(ref setNoPagerAscById, stepCheckStateModel.StepCheckId);
                    //查看自己是否是最后一个审核人
                    bool complete = stepCheckStateList.Where(a => a.CheckFlag == (int)FlowStateEnum.Progress).Count() == 1;
                    if (complete)
                    {
                        stepCheckModel.State     = Flag;
                        stepCheckModel.StateFlag = true;
                        stepCheckBLL.Edit(ref errors, stepCheckModel);
                    }
                    else
                    {
                        //让审核人继续执行这个步骤直到完成
                        LogHandler.WriteServiceLog(GetUserId(), "Id" + stepCheckStateModel.Id + ",StepCheckId" + stepCheckStateModel.Reamrk, "成功", "修改", "Flow_FormContentStepCheckState");
                        return(Json(JsonHandler.CreateMessage(1, Resource.CheckSucceed)));
                    }
                }
                else
                {
                    //不是会签,任何一个审批都通过
                    stepCheckModel.State     = Flag;
                    stepCheckModel.StateFlag = true;
                    stepCheckBLL.Edit(ref errors, stepCheckModel);
                }
                //查看下一步是否为自创建
                if (!stepCheckModel.IsEnd && !string.IsNullOrEmpty(UserList))
                {
                    List <Flow_FormContentStepCheckModel> stepCheckList = stepCheckBLL.GetListByFormId(FormId, ContentId);
                    int j = 0;
                    for (int i = stepCheckList.Count() - 1; i >= 0; i--)
                    {
                        if (stepCheckId == stepCheckList[i].Id)
                        {
                            j = i;
                        }
                    }
                    //查看是否还有下一步步骤
                    if (j - 1 <= stepCheckList.Count())
                    {
                        //查有第二步骤,查看是否是自选
                        Flow_StepModel stepModel = stepBLL.GetById(stepCheckList[j + 1].StepId);
                        if (stepModel.FlowRule == (int)FlowRuleEnum.Customer)
                        {
                            foreach (string userId in UserList.Split(','))
                            {
                                //批量建立步骤审核人表
                                CreateCheckState(stepCheckList[j + 1].Id, userId);
                            }
                        }
                        else
                        {
                            //批量建立审核人员表
                            foreach (string userId in GetStepCheckMemberList(stepCheckList[j + 1].StepId))
                            {
                                //批量建立步骤审核人表
                                CreateCheckState(stepCheckList[j + 1].Id, userId);
                            }
                        }
                    }
                }


                LogHandler.WriteServiceLog(GetUserId(), "Id" + stepCheckStateModel.Id + ",StepCheckId" + stepCheckStateModel.Reamrk, "成功", "修改", "Flow_FormContentStepCheckState");
                return(Json(JsonHandler.CreateMessage(1, Resource.CheckSucceed)));
            }
            else
            {
                string ErrorCol = errors.Error;
                LogHandler.WriteServiceLog(GetUserId(), "Id" + stepCheckStateModel.Id + ",StepCheckId" + stepCheckStateModel.Reamrk + "," + ErrorCol, "失败", "修改", "Flow_FormContentStepCheckState");
                return(Json(JsonHandler.CreateMessage(0, Resource.CheckFail + ErrorCol)));
            }
        }