예제 #1
0
 public bool Create(ref ValidationErrors errors, Flow_FormContentStepCheckStateModel model)
 {
     try
     {
         Flow_FormContentStepCheckState entity = m_Rep.GetById(model.Id);
         if (entity != null)
         {
             errors.Add(Suggestion.PrimaryRepeat);
             return(false);
         }
         entity             = new Flow_FormContentStepCheckState();
         entity.CheckFlag   = model.CheckFlag;
         entity.CreateTime  = model.CreateTime;
         entity.Id          = model.Id;
         entity.Reamrk      = model.Reamrk;
         entity.StepCheckId = model.StepCheckId;
         entity.TheSeal     = model.TheSeal;
         entity.UserId      = model.UserId;
         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);
     }
 }
예제 #2
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);
            }
        }
        public ActionResult Edit(string id)
        {
            ViewBag.Perm = GetPermission();
            Flow_FormContentStepCheckStateModel entity = m_BLL.GetById(id);

            return(View(entity));
        }
예제 #4
0
        /// <summary>
        /// 校验Excel数据,这个方法一般用于重写校验逻辑
        /// </summary>
        public virtual bool CheckImportData(string fileName, List <Flow_FormContentStepCheckStateModel> list, ref ValidationErrors errors)
        {
            var targetFile = new FileInfo(fileName);

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

            var excelFile = new ExcelQueryFactory(fileName);

            //对应列头
            excelFile.AddMapping <Flow_FormContentStepCheckStateModel>(x => x.StepCheckId, "所属步骤");
            excelFile.AddMapping <Flow_FormContentStepCheckStateModel>(x => x.UserId, "审核人");
            excelFile.AddMapping <Flow_FormContentStepCheckStateModel>(x => x.CheckFlag, "1通过0不通过2审核中");
            excelFile.AddMapping <Flow_FormContentStepCheckStateModel>(x => x.Reamrk, "审核说明");
            excelFile.AddMapping <Flow_FormContentStepCheckStateModel>(x => x.TheSeal, "印章");
            excelFile.AddMapping <Flow_FormContentStepCheckStateModel>(x => x.CreateTime, "创建时间");

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

            //检查数据正确性
            foreach (var row in excelContent)
            {
                var errorMessage = new StringBuilder();
                var entity       = new Flow_FormContentStepCheckStateModel();
                entity.Id          = row.Id;
                entity.StepCheckId = row.StepCheckId;
                entity.UserId      = row.UserId;
                entity.CheckFlag   = row.CheckFlag;
                entity.Reamrk      = row.Reamrk;
                entity.TheSeal     = row.TheSeal;
                entity.CreateTime  = row.CreateTime;

                //=============================================================================
                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);
        }
예제 #5
0
        //创建审核人
        private void CreateCheckState(string stepCheckId, string userId)
        {
            Flow_FormContentStepCheckStateModel stepCheckModelState = new Flow_FormContentStepCheckStateModel();

            stepCheckModelState.Id          = ResultHelper.NewId;
            stepCheckModelState.StepCheckId = stepCheckId;
            stepCheckModelState.UserId      = userId;
            stepCheckModelState.CheckFlag   = 2;
            stepCheckModelState.Reamrk      = "";
            stepCheckModelState.TheSeal     = "";
            stepCheckModelState.CreateTime  = ResultHelper.NowTime;
            stepCheckStateBLL.Create(ref errors, stepCheckModelState);
        }
예제 #6
0
        //获取环节所有信息
        public string GetCurrentStepCheckMes(string formId, string contentId)
        {
            string stepCheckMes = "";
            string stepCheckId  = GetCurrentStepCheckId(formId, contentId);

            List <Flow_FormContentStepCheckModel> stepCheckModelList = stepCheckBLL.GetListByFormId(formId, contentId);

            for (int i = 0; i < stepCheckModelList.Count; i++)
            {
                Flow_FormContentStepCheckStateModel stepCheckStateModel = stepCheckStateBLL.GetByStepCheckId(stepCheckModelList[i].Id);
                stepCheckMes = stepCheckMes + "第" + (i + 1) + "步:审核人:" + stepCheckStateModel.UserId + " 审核意见:" + stepCheckStateModel.Reamrk + " 审核意见:" + (stepCheckStateModel.CheckFlag == 1 ? "通过" : stepCheckStateModel.CheckFlag == 0 ? "不通过" : "审核中") + "</br>";
            }

            return(stepCheckMes);
        }
예제 #7
0
        public Flow_FormContentStepCheckStateModel GetByStepCheckId(string id)
        {
            Flow_FormContentStepCheckStateModel model  = new Flow_FormContentStepCheckStateModel();
            Flow_FormContentStepCheckState      entity = m_Rep.GetByStepCheckId(id);

            if (entity == null)
            {
                return(model);
            }

            model.Id          = entity.Id;
            model.StepCheckId = entity.StepCheckId;
            model.UserId      = entity.UserId;
            model.CheckFlag   = entity.CheckFlag;
            model.Reamrk      = entity.Reamrk;
            model.TheSeal     = entity.TheSeal;
            model.CreateTime  = entity.CreateTime;
            return(model);
        }
예제 #8
0
        public virtual Flow_FormContentStepCheckStateModel GetById(object id)
        {
            if (IsExists(id))
            {
                Flow_FormContentStepCheckState      entity = m_Rep.GetById(id);
                Flow_FormContentStepCheckStateModel model  = new Flow_FormContentStepCheckStateModel();
                model.Id          = entity.Id;
                model.StepCheckId = entity.StepCheckId;
                model.UserId      = entity.UserId;
                model.CheckFlag   = entity.CheckFlag;
                model.Reamrk      = entity.Reamrk;
                model.TheSeal     = entity.TheSeal;
                model.CreateTime  = entity.CreateTime;

                return(model);
            }
            else
            {
                return(null);
            }
        }
 public JsonResult Edit(Flow_FormContentStepCheckStateModel model)
 {
     if (model != null && ModelState.IsValid)
     {
         if (m_BLL.Edit(ref errors, model))
         {
             LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",StepCheckId" + model.StepCheckId, "成功", "修改", "Flow_FormContentStepCheckState");
             return(Json(JsonHandler.CreateMessage(1, Suggestion.EditSucceed)));
         }
         else
         {
             string ErrorCol = errors.Error;
             LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",StepCheckId" + model.StepCheckId + "," + ErrorCol, "失败", "修改", "Flow_FormContentStepCheckState");
             return(Json(JsonHandler.CreateMessage(0, Suggestion.EditFail + ErrorCol)));
         }
     }
     else
     {
         return(Json(JsonHandler.CreateMessage(0, Suggestion.EditFail)));
     }
 }
예제 #10
0
        public virtual async Task <Tuple <ValidationErrors, bool> > CreateAsync(Flow_FormContentStepCheckStateModel model)
        {
            ValidationErrors errors = new ValidationErrors();

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

                if (entity != null)
                {
                    errors.Add(Resource.PrimaryRepeat);
                    return(new Tuple <ValidationErrors, bool>(errors, false));
                }
                entity             = new Flow_FormContentStepCheckState();
                entity.Id          = model.Id;
                entity.StepCheckId = model.StepCheckId;
                entity.UserId      = model.UserId;
                entity.CheckFlag   = model.CheckFlag;
                entity.Reamrk      = model.Reamrk;
                entity.TheSeal     = model.TheSeal;
                entity.CreateTime  = model.CreateTime;


                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));
            }
        }
예제 #11
0
        public virtual bool Edit(ref ValidationErrors errors, Flow_FormContentStepCheckStateModel model)
        {
            try
            {
                Flow_FormContentStepCheckState entity = m_Rep.GetById(model.Id);
                if (entity == null)
                {
                    errors.Add(Resource.Disable);
                    return(false);
                }
                entity.Id          = model.Id;
                entity.StepCheckId = model.StepCheckId;
                entity.UserId      = model.UserId;
                entity.CheckFlag   = model.CheckFlag;
                entity.Reamrk      = model.Reamrk;
                entity.TheSeal     = model.TheSeal;
                entity.CreateTime  = model.CreateTime;



                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);
            }
        }
예제 #12
0
        public JsonResult Create(Flow_FormContentModel model)
        {
            model.Id         = ResultHelper.NewId;
            model.CreateTime = ResultHelper.NowTime;
            model.UserId     = GetUserId();

            if (model != null && ModelState.IsValid)
            {
                if (formContentBLL.Create(ref errors, model))
                {
                    //当前的Form模版
                    Flow_FormModel formModel = formBLL.GetById(model.FormId);

                    //创建成功后把步骤取出
                    List <Flow_StepModel> stepModelList = stepBLL.GetList(ref setNoPagerAscBySort, model.FormId);

                    //查询步骤
                    bool IsEnd = false;
                    foreach (Flow_StepModel stepModel in stepModelList)
                    {
                        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")
                                {
                                    IsEnd = false;
                                }
                            }
                        }

                        //插入步骤审核表
                        Flow_FormContentStepCheckModel stepCheckModel = new Flow_FormContentStepCheckModel();
                        stepCheckModel.Id         = ResultHelper.NewId;
                        stepCheckModel.ContentId  = model.Id;
                        stepCheckModel.StepId     = stepModel.Id;
                        stepCheckModel.State      = 2;                                  //0不通过1通过2审核中
                        stepCheckModel.StateFlag  = false;                              //true此步骤审核完成
                        stepCheckModel.CreateTime = ResultHelper.NowTime;
                        stepCheckModel.IsEnd      = IsEnd;                              //是否流程的最后一步

                        if (formContentStepCheckBLL.Create(ref errors, stepCheckModel)) //新建步骤成功
                        {
                            //获得流转规则下的审核人员
                            List <string> userIdList = GetStepCheckMemberList(stepModel.Id, model.Id);
                            if (userIdList.Count > 0)
                            {
                                foreach (string userId in userIdList)
                                {
                                    //批量建立步骤审核人表
                                    Flow_FormContentStepCheckStateModel stepCheckStateModel = new Flow_FormContentStepCheckStateModel();
                                    stepCheckStateModel.Id          = ResultHelper.NewId;
                                    stepCheckStateModel.StepCheckId = stepCheckModel.Id;
                                    stepCheckStateModel.UserId      = userId;
                                    stepCheckStateModel.CheckFlag   = 2;
                                    stepCheckStateModel.Reamrk      = "";
                                    stepCheckStateModel.TheSeal     = "";
                                    stepCheckStateModel.CreateTime  = ResultHelper.NowTime;
                                    stepCheckStateBLL.Create(ref errors, stepCheckStateModel);
                                }
                            }
                        }

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

                    LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA, "成功", "创建", "Flow_FormContent");
                    return(Json(JsonHandler.CreateMessage(1, Suggestion.InsertSucceed)));
                }
                else
                {
                    string ErrorCol = errors.Error;
                    LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA + "," + ErrorCol, "失败", "创建", "Flow_FormContent");
                    return(Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail + ErrorCol)));
                }
            }
            else
            {
                return(Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail)));
            }
        }
예제 #13
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)));
            }
        }