Exemplo n.º 1
0
        public bool GetCurUserWfAuth(string rankid, string workflow, string endflow, string mark, string submittype, string arg1 = "", string arg2 = "", string arg3 = "", string businessid = "")
        {
            Operator     curUser  = OperatorProvider.Provider.Current();
            WfControlObj wfentity = new WfControlObj();

            wfentity.businessid = businessid;
            wfentity.startflow  = workflow;
            wfentity.endflow    = endflow;
            wfentity.submittype = submittype;
            wfentity.rankid     = rankid;
            wfentity.user       = curUser;
            wfentity.mark       = mark;
            wfentity.isvaliauth = true;
            wfentity.argument1  = arg1;
            wfentity.argument2  = arg2;
            wfentity.argument3  = arg3;

            //获取下一流程的操作人
            WfControlResult result = wfcontrolbll.GetWfControl(wfentity);

            return(result.ishave);
        }
Exemplo n.º 2
0
        public ActionResult ToTargetContent(string keyValue, int mode)
        {
            //当前用户
            Operator curUser  = OperatorProvider.Provider.Current();
            var      entity   = findquestioninfobll.GetEntity(keyValue);                                     //发现问题对象
            var      userInfo = userbll.GetUserInfoEntity(entity.CREATEUSERID);                              //创建人对象
            List <FileInfoEntity> filelist  = fileinfobll.GetImageListByObject(entity.QUESTIONPIC).ToList(); //问题图片集合
            string          resultMsg       = string.Empty;                                                  //返回结果信息
            bool            isSucess        = false;                                                         //创建流程是否成功
            bool            isSucessful     = true;                                                          //返回流程推进结果
            string          wfFlag          = string.Empty;                                                  //流程流转标记
            string          participant     = string.Empty;                                                  //下一步流程参与者
            string          workFlow        = string.Empty;                                                  //流程实例代码
            string          applicationId   = string.Empty;                                                  //关联的应用id
            string          applicationType = string.Empty;                                                  //关联的应用类型
            WfControlObj    wfentity        = new WfControlObj();
            WfControlResult result          = new WfControlResult();

            switch (mode)
            {
            //转隐患
            case 0:
                applicationType = "yh";
                #region 转隐患
                string HidCode = DateTime.Now.ToString("yyyyMMddHHmmssfff").ToString();
                try
                {
                    #region 隐患基本信息
                    HTBaseInfoEntity bentity = new HTBaseInfoEntity();
                    bentity.ADDTYPE            = "0";
                    bentity.CREATEUSERID       = userInfo.UserId;
                    bentity.CREATEUSERNAME     = userInfo.RealName;
                    bentity.CREATEUSERDEPTCODE = userInfo.DepartmentCode;
                    bentity.CREATEUSERORGCODE  = userInfo.OrganizeCode;
                    bentity.HIDCODE            = HidCode;
                    bentity.HIDDEPART          = userInfo.OrganizeId;
                    bentity.HIDDEPARTNAME      = userInfo.OrganizeName;
                    bentity.HIDPHOTO           = Guid.NewGuid().ToString(); //图片

                    foreach (FileInfoEntity fentity in filelist)
                    {
                        string sourcefile     = Server.MapPath(fentity.FilePath);
                        string targetFileName = Guid.NewGuid().ToString() + "." + fentity.FileType;
                        string targetUrl      = fentity.FilePath.Substring(0, fentity.FilePath.LastIndexOf("/"));
                        if (System.IO.File.Exists(sourcefile))
                        {
                            System.IO.FileInfo sfileInfo  = new System.IO.FileInfo(sourcefile);
                            string             targetDir  = sfileInfo.DirectoryName;
                            string             targetFile = targetDir + "\\" + targetFileName;
                            System.IO.File.Copy(sourcefile, targetFile);
                        }
                        FileInfoEntity newfileEntity = new FileInfoEntity();
                        newfileEntity          = fentity;
                        newfileEntity.FilePath = targetUrl + "/" + targetFileName;
                        newfileEntity.FileId   = string.Empty;
                        newfileEntity.RecId    = bentity.HIDPHOTO;
                        fileinfobll.SaveForm("", newfileEntity);
                    }

                    bentity.HIDBMID     = entity.DEPTID;          //所属部门id
                    bentity.HIDBMNAME   = entity.DEPTNAME;        //所属部门名称
                    bentity.HIDDESCRIBE = entity.QUESTIONCONTENT; //隐患描述(问题内容)

                    //排查信息
                    bentity.CHECKDATE       = DateTime.Now;
                    bentity.CHECKMAN        = userInfo.UserId;
                    bentity.CHECKMANNAME    = userInfo.RealName;
                    bentity.CHECKDEPARTID   = userInfo.DepartmentCode;
                    bentity.CHECKDEPARTNAME = userInfo.DeptName;
                    //bentity.CHECKTYPE = dataitemdetailbll.GetDataItemListByItemCode("'SaftyCheckType'").Where(p => p.ItemName.Contains("日常")).FirstOrDefault().ItemDetailId; //检查类型
                    //添加
                    htbaseinfobll.SaveForm("", bentity);

                    applicationId = bentity.ID;
                    #endregion

                    #region 创建隐患流程
                    workFlow = "01";    //隐患处理
                    isSucess = htworkflowbll.CreateWorkFlowObj(workFlow, applicationId, userInfo.UserId);
                    if (isSucess)
                    {
                        htworkflowbll.UpdateWorkStreamByObjectId(applicationId);      //更新业务流程状态
                    }
                    #endregion

                    #region 整改信息
                    HTChangeInfoEntity centity = new HTChangeInfoEntity();
                    centity.HIDCODE = HidCode;
                    htchangeinfobll.SaveForm("", centity);
                    #endregion

                    #region 验收信息
                    HTAcceptInfoEntity aentity = new HTAcceptInfoEntity();
                    aentity.HIDCODE = HidCode;
                    htacceptinfobll.SaveForm("", aentity);
                    #endregion

                    #region 推进流程

                    wfentity.businessid = applicationId;         //隐患主键
                    wfentity.argument1  = string.Empty;          //专业分类
                    wfentity.argument2  = userInfo.DepartmentId; //当前部门
                    wfentity.argument3  = string.Empty;          //隐患类别
                    wfentity.argument4  = bentity.HIDBMID;       //所属部门
                    wfentity.startflow  = "隐患登记";
                    wfentity.submittype = "提交";
                    wfentity.rankid     = string.Empty;
                    wfentity.spuser     = userInfo;
                    wfentity.mark       = "厂级隐患排查";
                    wfentity.organizeid = bentity.HIDDEPART;     //对应电厂id
                    //获取下一流程的操作人
                    result = wfcontrolbll.GetWfControl(wfentity);
                    //处理成功
                    if (result.code == WfCode.Sucess)
                    {
                        participant = result.actionperson;
                        wfFlag      = result.wfflag;
                        if (!string.IsNullOrEmpty(participant))
                        {
                            int count = htworkflowbll.SubmitWorkFlow(wfentity, result, applicationId, participant, wfFlag, userInfo.UserId);

                            if (count > 0)
                            {
                                htworkflowbll.UpdateWorkStreamByObjectId(applicationId);      //更新业务流程状态
                            }
                        }
                        else
                        {
                            isSucessful = false;
                            resultMsg   = "请联系系统管理员,添加本单位及相关单位评估人员!";
                        }
                        resultMsg = "已成功转为隐患,并进入对应流程,请知晓";
                    }
                    else
                    {
                        isSucessful = false;
                        resultMsg   = result.message;
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    isSucessful = false;
                    resultMsg   = ex.Message;
                }
                #endregion
                break;

            //转违章
            case 1:
                applicationType = "wz";
                #region 转违章
                try
                {
                    #region 违章基础信息
                    string lenNum = !string.IsNullOrEmpty(dataitemdetailbll.GetItemValue("LllegalSerialNumberLen")) ? dataitemdetailbll.GetItemValue("LllegalSerialNumberLen") : "3";
                    LllegalRegisterEntity wzentity = new LllegalRegisterEntity();
                    wzentity.ADDTYPE            = "0";
                    wzentity.LLLEGALNUMBER      = lllegalregisterbll.GenerateHidCode("bis_lllegalregister", "lllegalnumber", int.Parse(lenNum)); //违章编码
                    wzentity.CREATEUSERID       = userInfo.UserId;
                    wzentity.CREATEUSERNAME     = userInfo.RealName;
                    wzentity.CREATEUSERDEPTCODE = userInfo.DepartmentCode;
                    wzentity.CREATEUSERORGCODE  = userInfo.OrganizeCode;
                    wzentity.CREATEDEPTID       = userInfo.DepartmentId;
                    wzentity.CREATEDEPTNAME     = userInfo.DeptName;
                    //所属单位
                    wzentity.BELONGDEPARTID = userInfo.OrganizeId;
                    wzentity.BELONGDEPART   = userInfo.OrganizeName;

                    wzentity.LLLEGALPIC = Guid.NewGuid().ToString();
                    foreach (FileInfoEntity fentity in filelist)
                    {
                        string sourcefile     = Server.MapPath(fentity.FilePath);
                        string targetFileName = Guid.NewGuid().ToString() + "." + fentity.FileType;
                        string targetUrl      = fentity.FilePath.Substring(0, fentity.FilePath.LastIndexOf("/"));
                        if (System.IO.File.Exists(sourcefile))
                        {
                            System.IO.FileInfo sfileInfo  = new System.IO.FileInfo(sourcefile);
                            string             targetDir  = sfileInfo.DirectoryName;
                            string             targetFile = targetDir + "\\" + targetFileName;
                            System.IO.File.Copy(sourcefile, targetFile);
                        }
                        FileInfoEntity newfileEntity = new FileInfoEntity();
                        newfileEntity          = fentity;
                        newfileEntity.FilePath = targetUrl + "/" + targetFileName;
                        newfileEntity.FileId   = string.Empty;
                        newfileEntity.RecId    = wzentity.LLLEGALPIC;
                        fileinfobll.SaveForm("", newfileEntity);
                    }
                    wzentity.LLLEGALDESCRIBE = entity.QUESTIONCONTENT;
                    lllegalregisterbll.SaveForm("", wzentity);
                    applicationId = wzentity.ID;
                    #endregion

                    #region 创建流程
                    workFlow = "03";
                    isSucess = htworkflowbll.CreateWorkFlowObj(workFlow, applicationId, userInfo.UserId);
                    if (isSucess)
                    {
                        lllegalregisterbll.UpdateFlowStateByObjectId("bis_lllegalregister", "flowstate", applicationId);      //更新业务流程状态
                    }
                    #endregion

                    if (!string.IsNullOrEmpty(wzentity.ID))
                    {
                        wzentity = lllegalregisterbll.GetEntity(wzentity.ID);
                    }

                    #region 违章整改信息
                    LllegalReformEntity reformEntity = new LllegalReformEntity();
                    reformEntity.LLLEGALID = applicationId;
                    lllegalreformbll.SaveForm("", reformEntity);
                    #endregion

                    #region 违章验收信息
                    LllegalAcceptEntity acceptEntity = new LllegalAcceptEntity();
                    acceptEntity.LLLEGALID = applicationId;
                    lllegalacceptbll.SaveForm("", acceptEntity);
                    #endregion

                    #region 推进流程
                    wfentity.businessid = applicationId;         //主键
                    wfentity.argument3  = userInfo.DepartmentId; //当前部门id
                    wfentity.startflow  = wzentity.FLOWSTATE;
                    wfentity.submittype = "提交";
                    wfentity.rankid     = null;
                    wfentity.spuser     = userInfo;
                    wfentity.mark       = "厂级违章流程";
                    wfentity.organizeid = wzentity.BELONGDEPARTID;     //对应电厂id
                    //获取下一流程的操作人
                    result = wfcontrolbll.GetWfControl(wfentity);

                    //处理成功
                    if (result.code == WfCode.Sucess)
                    {
                        participant = result.actionperson;
                        wfFlag      = result.wfflag;

                        //提交流程到下一节点
                        if (!string.IsNullOrEmpty(participant))
                        {
                            int count = htworkflowbll.SubmitWorkFlow(wfentity, result, applicationId, participant, wfFlag, userInfo.UserId);

                            if (count > 0)
                            {
                                htworkflowbll.UpdateFlowStateByObjectId("bis_lllegalregister", "flowstate", applicationId);      //更新业务流程状态
                            }
                        }
                        resultMsg = "已成功转为违章,并进入对应流程,请知晓";
                    }
                    else
                    {
                        isSucessful = false;
                        resultMsg   = result.message;
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    isSucessful = false;
                    resultMsg   = ex.Message;
                }
                #endregion
                break;

            //转问题
            case 2:
                applicationType = "wt";
                #region 转问题
                try
                {
                    #region 基础信息
                    QuestionInfoEntity qtEntity = new QuestionInfoEntity();
                    qtEntity.QUESTIONNUMBER     = questioninfobll.GenerateCode("bis_questioninfo", "questionnumber", 4);
                    qtEntity.CREATEUSERID       = userInfo.UserId;
                    qtEntity.CREATEUSERNAME     = userInfo.RealName;
                    qtEntity.CREATEUSERDEPTCODE = userInfo.DepartmentCode;
                    qtEntity.CREATEUSERORGCODE  = userInfo.OrganizeCode;

                    qtEntity.BELONGDEPTID   = userInfo.OrganizeId;
                    qtEntity.BELONGDEPTNAME = userInfo.OrganizeName;

                    qtEntity.QUESTIONPIC = Guid.NewGuid().ToString();
                    foreach (FileInfoEntity fentity in filelist)
                    {
                        string sourcefile     = Server.MapPath(fentity.FilePath);
                        string targetFileName = Guid.NewGuid().ToString() + "." + fentity.FileType;
                        string targetUrl      = fentity.FilePath.Substring(0, fentity.FilePath.LastIndexOf("/"));
                        if (System.IO.File.Exists(sourcefile))
                        {
                            System.IO.FileInfo sfileInfo  = new System.IO.FileInfo(sourcefile);
                            string             targetDir  = sfileInfo.DirectoryName;
                            string             targetFile = targetDir + "\\" + targetFileName;
                            System.IO.File.Copy(sourcefile, targetFile);
                        }
                        FileInfoEntity newfileEntity = new FileInfoEntity();
                        newfileEntity          = fentity;
                        newfileEntity.FilePath = targetUrl + "/" + targetFileName;
                        newfileEntity.FileId   = string.Empty;
                        newfileEntity.RecId    = qtEntity.QUESTIONPIC;
                        fileinfobll.SaveForm("", newfileEntity);
                    }
                    qtEntity.QUESTIONDESCRIBE = entity.QUESTIONCONTENT;

                    qtEntity.CHECKDATE       = DateTime.Now;
                    qtEntity.CHECKPERSONID   = userInfo.UserId;
                    qtEntity.CHECKPERSONNAME = userInfo.RealName;
                    qtEntity.CHECKDEPTID     = userInfo.DepartmentId;
                    qtEntity.CHECKDEPTNAME   = userInfo.DeptName;
                    //qtEntity.CHECKTYPE = dataitemdetailbll.GetDataItemListByItemCode("'SaftyCheckType'").Where(p => p.ItemName.Contains("日常")).FirstOrDefault().ItemDetailId; //检查类型

                    questioninfobll.SaveForm("", qtEntity);
                    applicationId = qtEntity.ID;
                    #endregion

                    #region 创建流程
                    workFlow = "09";    //问题处理
                    isSucess = htworkflowbll.CreateWorkFlowObj(workFlow, applicationId, userInfo.UserId);
                    if (isSucess)
                    {
                        htworkflowbll.UpdateFlowStateByObjectId("bis_questioninfo", "flowstate", applicationId);      //更新业务流程状态
                    }
                    #endregion

                    #region 整改信息
                    QuestionReformEntity qtreformEntity = new QuestionReformEntity();
                    qtreformEntity.QUESTIONID = applicationId;
                    questionreformbll.SaveForm("", qtreformEntity);
                    #endregion

                    //极光消息推送
                    JPushApi.PushMessage(userInfo.Account, userInfo.RealName, "WT001", "您有一条问题需完善,请到问题登记进行处理", "您" + entity.CREATEDATE.Value.ToString("yyyy-MM-dd") + "发现的问题已确定为问题,请您到问题登记下对该问题进行完善并指定对应整改责任人。", applicationId);

                    resultMsg = "已成功转为问题,并进入对应流程,请知晓";
                }
                catch (Exception ex)
                {
                    isSucessful = false;
                    resultMsg   = ex.Message;
                }
                #endregion
                break;
            }

            try
            {
                if (isSucessful)
                {
                    //评估阶段转
                    if (entity.FLOWSTATE == "评估")
                    {
                        #region 推进发现问题流程
                        wfentity            = new WfControlObj();
                        wfentity.businessid = keyValue; //
                        wfentity.startflow  = entity.FLOWSTATE;
                        wfentity.submittype = "提交";
                        wfentity.rankid     = string.Empty;
                        wfentity.user       = curUser;
                        wfentity.spuser     = null;
                        wfentity.mark       = "发现问题流程";
                        wfentity.organizeid = entity.ORGANIZEID; //对应电厂id
                        //获取下一流程的操作人
                        result = wfcontrolbll.GetWfControl(wfentity);
                        //处理成功
                        if (result.code == WfCode.Sucess)
                        {
                            participant = result.actionperson;
                            wfFlag      = result.wfflag;
                            //提交流程到下一节点
                            if (!string.IsNullOrEmpty(participant))
                            {
                                int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);
                                if (count > 0)
                                {
                                    //返回成功的结果
                                    #region 返回成功的结果
                                    FindQuestionHandleEntity qentity = new FindQuestionHandleEntity();
                                    if (mode == 0)
                                    {
                                        qentity.HANDLESTATUS = "已转隐患";
                                    }
                                    else if (mode == 1)
                                    {
                                        qentity.HANDLESTATUS = "已转违章";
                                    }
                                    else if (mode == 2)
                                    {
                                        qentity.HANDLESTATUS = "已转问题";
                                    }
                                    qentity.HANDLEDATE    = DateTime.Now;
                                    qentity.HANDLERID     = curUser.UserId;
                                    qentity.HANDLERNAME   = curUser.UserName;
                                    qentity.QUESTIONID    = keyValue;
                                    qentity.RELEVANCEID   = applicationId;
                                    qentity.RELEVANCETYPE = applicationType;
                                    qentity.APPSIGN       = "Web";
                                    findquestionhandlebll.SaveForm("", qentity);
                                    #endregion

                                    htworkflowbll.UpdateFlowStateByObjectId("bis_findquestioninfo", "flowstate", keyValue);  //更新业务流程状态
                                }
                            }
                            return(Success(resultMsg));
                        }
                        else
                        {
                            return(Error(result.message));
                        }
                        #endregion
                    }
                    else  //结束阶段转 列表转
                    {
                        //返回成功的结果
                        #region 返回成功的结果
                        FindQuestionHandleEntity qentity = new FindQuestionHandleEntity();
                        if (mode == 0)
                        {
                            qentity.HANDLESTATUS = "已转隐患";
                        }
                        else if (mode == 1)
                        {
                            qentity.HANDLESTATUS = "已转违章";
                        }
                        else if (mode == 2)
                        {
                            qentity.HANDLESTATUS = "已转问题";
                        }
                        qentity.HANDLEDATE    = DateTime.Now;
                        qentity.HANDLERID     = curUser.UserId;
                        qentity.HANDLERNAME   = curUser.UserName;
                        qentity.QUESTIONID    = keyValue;
                        qentity.RELEVANCEID   = applicationId;
                        qentity.RELEVANCETYPE = applicationType;
                        qentity.APPSIGN       = "Web";
                        findquestionhandlebll.SaveForm("", qentity);
                        #endregion

                        return(Success(resultMsg));
                    }
                }
                else
                {
                    return(Error(resultMsg));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
Exemplo n.º 3
0
        public ActionResult SubmitForm(string keyValue, FindQuestionInfoEntity entity)
        {
            try
            {
                //创建流程,保存对应信息
                CommonSaveForm(keyValue, entity);
                //创建完流程实例后
                if (string.IsNullOrEmpty(keyValue))
                {
                    keyValue = entity.ID;
                }
                //此处需要判断当前人是否为安全管理员
                string wfFlag = string.Empty;
                //当前用户
                Operator curUser = OperatorProvider.Provider.Current();

                string mode = Request.Form["mode"];

                bool isback = !string.IsNullOrEmpty(mode) && mode == "3"; //是否退回

                var nEntity = findquestioninfobll.GetEntity(keyValue);

                //参与人员
                string       participant = string.Empty;
                WfControlObj wfentity    = new WfControlObj();
                wfentity.businessid = keyValue; //
                wfentity.startflow  = nEntity.FLOWSTATE;
                wfentity.submittype = "提交";
                if (isback)
                {
                    wfentity.submittype = "退回";
                }
                wfentity.rankid     = string.Empty;
                wfentity.user       = curUser;
                wfentity.mark       = "发现问题流程";
                wfentity.organizeid = entity.ORGANIZEID; //对应电厂id
                //获取下一流程的操作人
                WfControlResult result = wfcontrolbll.GetWfControl(wfentity);

                //处理成功
                if (result.code == WfCode.Sucess)
                {
                    participant = result.actionperson;
                    wfFlag      = result.wfflag;

                    //提交流程到下一节点
                    if (!string.IsNullOrEmpty(participant))
                    {
                        int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                        if (count > 0)
                        {
                            //退回操作记录内容
                            if (isback)
                            {
                                FindQuestionHandleEntity qentity = new FindQuestionHandleEntity();
                                qentity.HANDLESTATUS = "已退回";
                                qentity.HANDLEDATE   = DateTime.Now;
                                qentity.HANDLERID    = curUser.UserId;
                                qentity.HANDLERNAME  = curUser.UserName;
                                qentity.QUESTIONID   = keyValue;
                                qentity.APPSIGN      = "Web";
                                findquestionhandlebll.SaveForm("", qentity);
                            }
                            htworkflowbll.UpdateFlowStateByObjectId("bis_findquestioninfo", "flowstate", keyValue);  //更新业务流程状态
                        }
                    }
                    return(Success(result.message));
                }
                else
                {
                    return(Error(result.message));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
Exemplo n.º 4
0
        public WfControlResult GetWfControl(WfControlObj obj)
        {
            string organizeid = string.Empty;

            if (null != obj.user)
            {
                organizeid = obj.user.OrganizeId;
            }
            if (null != obj.spuser)
            {
                organizeid = obj.spuser.OrganizeId;
            }
            if (string.IsNullOrEmpty(obj.organizeid))
            {
                obj.organizeid = organizeid;
            }
            //是否启用
            var wfenablerank = dataitemdetailbll.GetDataItemListByItemCode("'WorkFlowEnableRank'").Where(p => p.ItemValue == obj.organizeid).ToList();

            //启用具体级别划分
            if (wfenablerank.Count() > 0)
            {
                //隐患专用级别id
                if (!string.IsNullOrEmpty(obj.rankid))
                {
                    //隐患级别
                    var detailItem = dataitemdetailbll.GetDataItemListByItemCode("'HidRank'").ToList().Where(p => p.ItemDetailId == obj.rankid).FirstOrDefault();
                    obj.rankname = detailItem.ItemName;
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(obj.rankname))
                {
                    //如果是一般隐患,则推送到整改阶段
                    if (obj.rankname.Contains("一般"))
                    {
                        obj.rankname = "一般隐患";
                    }
                    else
                    {
                        obj.rankname = "重大隐患";
                    }
                }
                //隐患专用级别id
                if (!string.IsNullOrEmpty(obj.rankid))
                {
                    string rankname = string.Empty;
                    //隐患级别
                    var detailItem = dataitemdetailbll.GetDataItemListByItemCode("'HidRank'").ToList().Where(p => p.ItemDetailId == obj.rankid).FirstOrDefault();
                    //如果是一般隐患,则推送到整改阶段
                    if (detailItem.ItemName.Contains("一般"))
                    {
                        rankname = "一般隐患";
                    }
                    else
                    {
                        rankname = "重大隐患";
                    }
                    obj.rankname = rankname;
                }
            }
            if (string.IsNullOrEmpty(obj.rankname))
            {
                obj.rankname = "无";
            }


            WfControlResult result = GetWfControlObject(obj);

            if (result.code == WfCode.Sucess)
            {
                result.message = "处理成功";
            }
            else if (result.code == WfCode.NoEnable)
            {
                result.message = "未启用流程实例";
            }
            else if (result.code == WfCode.NoInstance)
            {
                result.message = "未配置流程实例";
            }
            else if (result.code == WfCode.NoSetting)
            {
                result.message = "未配置流程流转项";
            }
            else if (result.code == WfCode.NoAutoHandle)
            {
                result.message = "非自动处理的流程";
            }
            else if (result.code == WfCode.NoScriptSQL)
            {
                result.message = "目标流程参与者脚本未定义";
            }
            else if (result.code == WfCode.NoAccount)
            {
                result.message = "目标流程参与者未定义";
            }
            else if (result.code == WfCode.Error)
            {
                result.message = "程序出错,请联系管理员";
            }
            else if (result.code == WfCode.InstanceError)
            {
                result.message = "获取流程实例出错,请联系管理员";
            }
            else if (result.code == WfCode.FilterError)
            {
                result.message = "过滤流程配置出错,请联系管理员";
            }
            else if (result.code == WfCode.TargetError)
            {
                result.message = "获取目标流程配置出错,请联系管理员";
            }
            else if (result.code == WfCode.StartSqlError)
            {
                result.message = "起始流程脚本设置出错,请联系管理员";
            }
            else if (result.code == WfCode.StartSettingError)
            {
                result.message = "起始流程条件设置出错,请联系管理员";
            }
            else if (result.code == WfCode.EndSqlError)
            {
                result.message = "目标流程脚本设置出错,请联系管理员";
            }
            else if (result.code == WfCode.EndSettingError)
            {
                result.message = "目标流程条件设置出错,请联系管理员";
            }

            return(result);
        }
Exemplo n.º 5
0
        public ActionResult SubmitForm(string keyValue, HTBaseInfoEntity bEntity, HTChangeInfoEntity entity, HTAcceptInfoEntity aEntity)
        {
            Operator curUser = OperatorProvider.Provider.Current();

            string CHANGERESULT = Request.Form["CHANGERESULT"] != null ? Request.Form["CHANGERESULT"].ToString() : ""; //整改结果
            string ISBACK       = Request.Form["ISBACK"] != null ? Request.Form["ISBACK"].ToString() : "";             //是否回退
            string CHANGEID     = Request.Form["CHANGEID"] != null ? Request.Form["CHANGEID"].ToString() : "";         //整改ID

            string participant = string.Empty;                                                                         //获取流程下一节点的参与人员
            string wfFlag      = string.Empty;                                                                         //流程标识

            try
            {
                if (!string.IsNullOrEmpty(CHANGEID))
                {
                    var tempEntity = htchangeinfobll.GetEntity(CHANGEID);
                    entity.AUTOID            = tempEntity.AUTOID;
                    entity.APPLICATIONSTATUS = tempEntity.APPLICATIONSTATUS;
                    entity.POSTPONEDAYS      = tempEntity.POSTPONEDAYS;
                    entity.POSTPONEDEPT      = tempEntity.POSTPONEDEPT;
                    entity.POSTPONEDEPTNAME  = tempEntity.POSTPONEDEPTNAME;
                }
                entity.APPSIGN = "Web";
                htchangeinfobll.SaveForm(CHANGEID, entity);

                //隐患基本信息
                var baseEntity = htbaseinfobll.GetEntity(keyValue);


                WfControlObj wfentity = new WfControlObj();
                wfentity.businessid = keyValue;
                wfentity.argument1  = bEntity.MAJORCLASSIFY; //专业分类
                wfentity.argument3  = bEntity.HIDTYPE;       //隐患类别
                wfentity.argument4  = bEntity.HIDBMID;       //所属部门
                wfentity.startflow  = baseEntity.WORKSTREAM;
                wfentity.rankid     = baseEntity.HIDRANK;
                wfentity.user       = curUser;
                wfentity.organizeid = baseEntity.HIDDEPART; //对应电厂id
                if (baseEntity.ADDTYPE == "2")
                {
                    wfentity.mark = "省级隐患排查";
                }
                else
                {
                    wfentity.mark = "厂级隐患排查";
                }
                //退回
                if (ISBACK == "1")
                {
                    //历史记录
                    var changeitem = htchangeinfobll.GetHistoryList(entity.HIDCODE).ToList();
                    //如果未整改可以退回
                    if (changeitem.Count() == 0)
                    {
                        wfentity.submittype = "退回";
                    }
                    else
                    {
                        return(Error("整改过后的隐患无法再次退回!"));
                    }
                }
                else //正常提交到验收流程
                {
                    wfentity.submittype = "提交";
                }


                //获取下一流程的操作人
                WfControlResult result = wfcontrolbll.GetWfControl(wfentity);
                //处理成功
                if (result.code == WfCode.Sucess)
                {
                    //参与者
                    participant = result.actionperson;
                    //状态
                    wfFlag = result.wfflag;

                    //如果是更改状态
                    if (result.ischangestatus)
                    {
                        if (!string.IsNullOrEmpty(participant) && !string.IsNullOrEmpty(wfFlag))
                        {
                            int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                            if (count > 0)
                            {
                                htworkflowbll.UpdateWorkStreamByObjectId(keyValue);  //更新业务流程状态
                            }

                            string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);
                            if (tagName == "制定整改计划" && wfentity.submittype == "退回")
                            {
                                UserInfoEntity userentity = userbll.GetUserInfoByAccount(participant);
                                entity.CHARGEPERSONNAME = userentity.RealName;
                                entity.CHARGEPERSON     = userentity.Account;
                                entity.CHARGEDEPTID     = userentity.DepartmentId;
                                entity.CHARGEDEPTNAME   = userentity.DeptName;
                                entity.ISAPPOINT        = "0";
                                htchangeinfobll.SaveForm(entity.ID, entity);
                            }
                        }
                    }
                    else
                    {
                        //获取
                        htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);

                        string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);

                        #region 当前还处于隐患整改阶段
                        if (tagName == "隐患整改")
                        {
                            UserInfoEntity userentity = userbll.GetUserInfoByAccount(participant);
                            entity.CHANGEPERSONNAME     = userentity.RealName;
                            entity.CHANGEPERSON         = userentity.UserId;
                            entity.CHANGEDUTYDEPARTNAME = userentity.DeptName;
                            entity.CHANGEDUTYDEPARTID   = userentity.DepartmentId;
                            entity.CHANGEDUTYDEPARTCODE = userentity.DepartmentCode;
                            entity.CHANGEDUTYTEL        = userentity.Telephone;
                            htchangeinfobll.SaveForm(entity.ID, entity);
                        }
                        #endregion
                    }
                }
                //非自动处理的流程
                else if (result.code == WfCode.NoAutoHandle)
                {
                    bool isupdate = false;//是否更改流程状态
                    //退回操作  单独处理
                    if (ISBACK == "1")
                    {
                        DataTable dt = htworkflowbll.GetBackFlowObjectByKey(keyValue);

                        if (dt.Rows.Count > 0)
                        {
                            wfFlag = dt.Rows[0]["wfflag"].ToString();            //流程走向

                            participant = dt.Rows[0]["participant"].ToString();  //指向人

                            isupdate = dt.Rows[0]["isupdate"].ToString() == "1"; //是否更改流程状态
                        }
                    }

                    //更改流程状态的情况下
                    if (isupdate)
                    {
                        if (!string.IsNullOrEmpty(participant) && !string.IsNullOrEmpty(wfFlag))
                        {
                            int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                            if (count > 0)
                            {
                                htworkflowbll.UpdateWorkStreamByObjectId(keyValue);  //更新业务流程状态
                            }

                            string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);
                            if (tagName == "制定整改计划" && wfentity.submittype == "退回")
                            {
                                UserInfoEntity userentity = userbll.GetUserInfoByAccount(participant);
                                entity.CHARGEPERSONNAME = userentity.RealName;
                                entity.CHARGEPERSON     = userentity.Account;
                                entity.CHARGEDEPTID     = userentity.DepartmentId;
                                entity.CHARGEDEPTNAME   = userentity.DeptName;
                                entity.ISAPPOINT        = "0";
                                htchangeinfobll.SaveForm(entity.ID, entity);
                            }

                            result.message = "处理成功";
                            result.code    = WfCode.Sucess;
                        }
                    }
                    else
                    {
                        //获取
                        htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);

                        string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);

                        #region 当前还处于隐患整改阶段
                        if (tagName == "隐患整改")
                        {
                            UserInfoEntity userentity = userbll.GetUserInfoByAccount(participant);
                            entity.CHANGEPERSONNAME     = userentity.RealName;
                            entity.CHANGEPERSON         = userentity.UserId;
                            entity.CHANGEDUTYDEPARTNAME = userentity.DeptName;
                            entity.CHANGEDUTYDEPARTID   = userentity.DepartmentId;
                            entity.CHANGEDUTYDEPARTCODE = userentity.DepartmentCode;
                            entity.CHANGEDUTYTEL        = userentity.Telephone;
                            htchangeinfobll.SaveForm(entity.ID, entity);
                        }
                        #endregion
                    }
                }

                if (result.code == WfCode.Sucess)
                {
                    return(Success(result.message));
                }
                else //其他返回状态
                {
                    return(Error(result.message));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
Exemplo n.º 6
0
        public ActionResult SaveSettingForm(string keyCode, HTChangeInfoEntity entity)
        {
            Operator         curUser  = new OperatorProvider().Current();
            string           hidid    = Request.Form["HIDID"] != null ? Request.Form["HIDID"].ToString() : ""; //隐患主键
            HTBaseInfoEntity bsentity = new HTBaseInfoBLL().GetEntity(hidid);                                  //主键
            string           rankname = string.Empty;

            bool isUpdateDate = false;                                                                                       //是否更新时间

            var    cEntity        = htchangeinfobll.GetEntityByCode(keyCode);                                                //根据HidCode获取整改对象
            string postponereason = Request.Form["POSTPONEREASON"] != null ? Request.Form["POSTPONEREASON"].ToString() : "";
            string controlmeasure = Request.Form["CONTROLMEASURE"] != null ? Request.Form["CONTROLMEASURE"].ToString() : ""; //管控措施

            try
            {
                WfControlObj wfentity = new WfControlObj();
                wfentity.businessid = hidid;            //
                wfentity.argument1  = bsentity.MAJORCLASSIFY;
                wfentity.argument3  = bsentity.HIDTYPE; //隐患类别
                wfentity.startflow  = "整改延期申请";
                wfentity.submittype = "提交";
                wfentity.rankid     = bsentity.HIDRANK;
                wfentity.user       = curUser;
                wfentity.mark       = "整改延期流程";
                wfentity.organizeid = bsentity.HIDDEPART; //对应电厂id

                //获取下一流程的操作人
                WfControlResult result = wfcontrolbll.GetWfControl(wfentity);
                //保存申请记录
                HTExtensionEntity exentity = new HTExtensionEntity();
                //处理成功
                if (result.code == WfCode.Sucess)
                {
                    string participant = result.actionperson;
                    string wfFlag      = result.wfflag;

                    cEntity.POSTPONEPERSON     = "," + participant + ","; // 用于当前人账户判断是否具有操作其权限
                    cEntity.POSTPONEDAYS       = entity.POSTPONEDAYS;     //申请天数
                    cEntity.POSTPONEDEPT       = result.deptcode;         //审批部门Code
                    cEntity.POSTPONEDEPTNAME   = result.deptname;         //审批部门名称
                    cEntity.POSTPONEPERSONNAME = result.username;
                    cEntity.APPLICATIONSTATUS  = wfFlag;
                    //是否更新时间,累加天数
                    if (wfFlag == "2")
                    {
                        isUpdateDate = true;
                    }
                    //如果安环部、生技部审批通过,则更改整改截至时间、验收时间,增加相应的整改天数
                    if (isUpdateDate)
                    {
                        //重新赋值整改截至时间
                        cEntity.CHANGEDEADINE = cEntity.CHANGEDEADINE.Value.AddDays(cEntity.POSTPONEDAYS);

                        //更新验收时间
                        HTAcceptInfoEntity aEntity = htacceptinfobll.GetEntityByHidCode(keyCode);
                        if (null != aEntity.ACCEPTDATE)
                        {
                            aEntity.ACCEPTDATE = aEntity.ACCEPTDATE.Value.AddDays(cEntity.POSTPONEDAYS);
                        }
                        htacceptinfobll.SaveForm(aEntity.ID, aEntity);

                        exentity.HANDLESIGN = "1"; //成功标记
                    }
                    cEntity.APPSIGN = "Web";
                    //更新整改信息
                    htchangeinfobll.SaveForm(cEntity.ID, cEntity); //更新延期设置

                    exentity.HIDCODE        = cEntity.HIDCODE;
                    exentity.HIDID          = hidid;
                    exentity.HANDLEDATE     = DateTime.Now;
                    exentity.POSTPONEDAYS   = entity.POSTPONEDAYS.ToString();
                    exentity.HANDLEUSERID   = curUser.UserId;
                    exentity.HANDLEUSERNAME = curUser.UserName;
                    exentity.HANDLEDEPTCODE = curUser.DeptCode;
                    exentity.HANDLEDEPTNAME = curUser.DeptName;
                    exentity.HANDLETYPE     = "0";            //申请类型  状态返回 2 时表示整改延期完成 (申请)
                    exentity.HANDLEID       = DateTime.Now.ToString("yyyyMMddhhmmss").ToString();
                    exentity.POSTPONEREASON = postponereason; //延期理由
                    exentity.CONTROLMEASURE = controlmeasure; //临时管控措施
                    exentity.APPSIGN        = "Web";
                    htextensionbll.SaveForm("", exentity);

                    //极光推送
                    htworkflowbll.PushMessageForWorkFlow("隐患处理审批", "整改延期审批", wfentity, result);

                    return(Success(result.message));
                }
                else
                {
                    return(Error(result.message));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message.ToString()));
            }
        }
Exemplo n.º 7
0
        public ActionResult SaveForm(string keyValue, HTBaseInfoEntity bentity, HTAcceptInfoEntity entity, HTChangeInfoEntity centity)
        {
            Operator curUser      = OperatorProvider.Provider.Current();
            string   ACCEPTID     = Request.Form["ACCEPTID"] != null ? Request.Form["ACCEPTID"].ToString() : "";         //验收ID
            string   ACCEPTSTATUS = Request.Form["ACCEPTSTATUS"] != null ? Request.Form["ACCEPTSTATUS"].ToString() : ""; //验收情况
            string   CHANGEID     = Request.Form["CHANGEID"] != null ? Request.Form["CHANGEID"].ToString() : "";         //整改ID
            string   participant  = string.Empty;                                                                        //获取流程下一节点的参与人员
            string   wfFlag       = string.Empty;                                                                        //流程标识

            string IIMajorRisks = dataitemdetailbll.GetItemValue("IIMajorRisks");                                        //II级重大隐患

            string IMajorRisks = dataitemdetailbll.GetItemValue("IMajorRisks");                                          //I级重大隐患


            var          baseEntity = htbaseinfobll.GetEntity(keyValue);
            WfControlObj wfentity   = new WfControlObj();

            wfentity.businessid = keyValue;
            wfentity.argument1  = bentity.MAJORCLASSIFY; //专业分类
            wfentity.argument3  = bentity.HIDTYPE;       //隐患类别
            wfentity.argument4  = bentity.HIDBMID;       //所属部门
            wfentity.startflow  = baseEntity.WORKSTREAM;
            wfentity.rankid     = baseEntity.HIDRANK;
            wfentity.user       = curUser;
            wfentity.organizeid = baseEntity.HIDDEPART; //对应电厂id
            //省级登记的
            if (baseEntity.ADDTYPE == "2")
            {
                wfentity.mark = "省级隐患排查";
            }
            else //厂级
            {
                wfentity.mark = "厂级隐患排查";
            }
            //验收通过
            if (ACCEPTSTATUS == "1")
            {
                wfentity.submittype = "提交";
            }
            else //验收不通过
            {
                wfentity.submittype = "退回";
            }

            //获取下一流程的操作人
            WfControlResult result = wfcontrolbll.GetWfControl(wfentity);

            //返回操作结果成功
            if (result.code == WfCode.Sucess)
            {
                participant = result.actionperson;

                wfFlag = result.wfflag;

                //如果是更改状态
                if (result.ischangestatus)
                {
                    if (!string.IsNullOrEmpty(participant))
                    {
                        //提交流程
                        int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                        if (count > 0)
                        {
                            #region 操作其他项目
                            if (!string.IsNullOrEmpty(ACCEPTID))
                            {
                                var tempEntity = htacceptinfobll.GetEntity(ACCEPTID);
                                entity.AUTOID = tempEntity.AUTOID;
                            }
                            if (null == entity.ACCEPTDATE)
                            {
                                entity.ACCEPTDATE = DateTime.Now;
                            }
                            htacceptinfobll.SaveForm(ACCEPTID, entity);

                            htworkflowbll.UpdateWorkStreamByObjectId(keyValue);  //更新业务流程状态

                            //退回则重新添加验收记录
                            if (wfentity.submittype == "退回")
                            {
                                string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);

                                if (tagName == "隐患整改")
                                {
                                    //整改记录
                                    HTChangeInfoEntity chEntity  = htchangeinfobll.GetEntity(CHANGEID);
                                    HTChangeInfoEntity newEntity = new HTChangeInfoEntity();
                                    newEntity                      = chEntity;
                                    newEntity.CREATEDATE           = DateTime.Now;
                                    newEntity.MODIFYDATE           = DateTime.Now;
                                    newEntity.ID                   = null;
                                    newEntity.AUTOID               = chEntity.AUTOID + 1;
                                    newEntity.CHANGERESUME         = null;
                                    newEntity.CHANGEFINISHDATE     = null;
                                    newEntity.REALITYMANAGECAPITAL = 0;
                                    newEntity.ATTACHMENT           = Guid.NewGuid().ToString(); //整改附件
                                    newEntity.HIDCHANGEPHOTO       = Guid.NewGuid().ToString(); //整改图片
                                    newEntity.APPSIGN              = "Web";
                                    htchangeinfobll.SaveForm("", newEntity);
                                }

                                //验收记录
                                HTAcceptInfoEntity htacceptinfoentity = htacceptinfobll.GetEntityByHidCode(bentity.HIDCODE);
                                HTAcceptInfoEntity accptEntity        = new HTAcceptInfoEntity();
                                accptEntity              = htacceptinfoentity;
                                accptEntity.ID           = null;
                                accptEntity.AUTOID       = htacceptinfoentity.AUTOID + 1;
                                accptEntity.CREATEDATE   = DateTime.Now;
                                accptEntity.MODIFYDATE   = DateTime.Now;
                                accptEntity.ACCEPTSTATUS = null;
                                accptEntity.ACCEPTIDEA   = null;
                                accptEntity.ACCEPTPHOTO  = Guid.NewGuid().ToString(); //验收图片
                                accptEntity.APPSIGN      = "Web";
                                htacceptinfobll.SaveForm("", accptEntity);
                            }
                            #endregion
                        }
                    }
                    else
                    {
                        return(Error("请联系系统管理员,确认是否配置流程所需参与人!"));
                    }
                }
                else
                {
                    //验收信息
                    if (!string.IsNullOrEmpty(ACCEPTID))
                    {
                        var tempEntity = htacceptinfobll.GetEntity(ACCEPTID);
                        entity.AUTOID = tempEntity.AUTOID;
                    }
                    if (null == entity.ACCEPTDATE)
                    {
                        entity.ACCEPTDATE = DateTime.Now;
                    }
                    htacceptinfobll.SaveForm(ACCEPTID, entity);

                    //添加下一个验收对象
                    HTAcceptInfoEntity accptEntity = new HTAcceptInfoEntity();
                    accptEntity              = entity;
                    accptEntity.ID           = string.Empty;
                    accptEntity.AUTOID       = entity.AUTOID + 1;
                    accptEntity.CREATEDATE   = DateTime.Now;
                    accptEntity.MODIFYDATE   = DateTime.Now;
                    accptEntity.ACCEPTSTATUS = string.Empty;
                    accptEntity.ACCEPTIDEA   = string.Empty;
                    accptEntity.ACCEPTDATE   = null;
                    accptEntity.DAMAGEDATE   = null;
                    accptEntity.ACCEPTPHOTO  = Guid.NewGuid().ToString(); //验收图片
                    accptEntity.APPSIGN      = "Web";
                    htacceptinfobll.SaveForm("", accptEntity);
                    //获取
                    htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);
                }
                return(Success(result.message));
            }
            else
            {
                return(Error(result.message));
            }
        }
Exemplo n.º 8
0
        public ActionResult SaveForm(string keyValue, HTExtensionEntity entity)
        {
            Operator curUser = new OperatorProvider().Current();

            string postPoneResult = Request.Form["POSTPONERESULT"].ToString(); //审批结果

            var bsentity = htbaseinfobll.GetEntity(keyValue);                  //根据id获取隐患对象

            //string postponereason = Request.Form["POSTPONEREASON"].ToString(); //审批意见

            string rankname = string.Empty;

            bool isUpdateDate = false;

            string participant = string.Empty;
            string wfFlag      = string.Empty;

            string hidcode = bsentity.HIDCODE;

            try
            {
                WfControlResult result   = new WfControlResult();
                WfControlObj    wfentity = new WfControlObj();
                wfentity.businessid = keyValue;  //
                wfentity.startflow  = "整改延期审批";
                wfentity.submittype = "提交";
                wfentity.rankid     = bsentity.HIDRANK;
                wfentity.user       = curUser;
                wfentity.mark       = "整改延期流程";
                wfentity.organizeid = bsentity.HIDDEPART;  //对应电厂id

                HTChangeInfoEntity cEntity = htchangeinfobll.GetEntityByHidCode(hidcode);
                //是否通过
                if (postPoneResult == "1")
                {
                    //获取下一流程的操作人
                    result = wfcontrolbll.GetWfControl(wfentity);
                    //处理成功
                    if (result.code == WfCode.Sucess)
                    {
                        participant = result.actionperson;
                        wfFlag      = result.wfflag;

                        cEntity.POSTPONEPERSON     = "," + participant + ","; // 用于当前人账户判断是否具有操作其权限
                        cEntity.POSTPONEDAYS       = cEntity.POSTPONEDAYS;    //申请天数
                        cEntity.POSTPONEDEPT       = result.deptcode;         //审批部门Code
                        cEntity.POSTPONEDEPTNAME   = result.deptname;         //审批部门名称
                        cEntity.POSTPONEPERSONNAME = result.username;         //审批人
                        cEntity.APPLICATIONSTATUS  = wfFlag;                  //延期通过
                    }
                    else
                    {
                        return(Error(result.message));
                    }
                }
                else
                {
                    cEntity.APPLICATIONSTATUS = "3";  //延期申请失败
                    //延期失败保存整改人相关信息到result,用于极光推送
                    UserEntity changeUser = userbll.GetEntity(cEntity.CHANGEPERSON);
                    if (null != changeUser)
                    {
                        result.actionperson = changeUser.Account;
                        result.username     = cEntity.CHANGEPERSONNAME;
                        result.deptname     = cEntity.CHANGEDUTYDEPARTNAME;
                        result.deptid       = changeUser.DepartmentId;
                        result.deptcode     = cEntity.CHANGEDUTYDEPARTCODE;
                    }
                }

                //延期成功
                if (wfFlag == "2" && postPoneResult == "1")
                {
                    isUpdateDate = true;
                }
                //如果安环部、生技部审批通过,则更改整改截至时间、验收时间,增加相应的整改天数
                if (isUpdateDate)
                {
                    //重新赋值整改截至时间
                    cEntity.CHANGEDEADINE = cEntity.CHANGEDEADINE.Value.AddDays(cEntity.POSTPONEDAYS);

                    //更新验收时间
                    HTAcceptInfoEntity aEntity = htacceptinfobll.GetEntityByHidCode(hidcode);
                    if (null != aEntity.ACCEPTDATE)
                    {
                        aEntity.ACCEPTDATE = aEntity.ACCEPTDATE.Value.AddDays(cEntity.POSTPONEDAYS);
                    }
                    htacceptinfobll.SaveForm(aEntity.ID, aEntity);

                    entity.HANDLESIGN = "1";  //成功标记
                }
                cEntity.APPSIGN = "Web";
                //更新整改信息
                htchangeinfobll.SaveForm(cEntity.ID, cEntity);

                //添加审批记录
                entity.APPSIGN = "Web";

                string nextName = string.Empty;

                //成功
                if (wfFlag == "2" && postPoneResult == "1")
                {
                    entity.HANDLETYPE = wfFlag;   //处理类型 0 申请 1 审批 2 整改结束    wfFlag状态返回 2 时表示整改延期完成
                }
                //审批中
                else if (wfFlag != "2" && postPoneResult == "1")
                {
                    entity.HANDLETYPE = "1";   //审批中

                    nextName = "整改延期审批";
                }
                else  //失败
                {
                    if (postPoneResult == "0")
                    {
                        entity.HANDLETYPE = "-1";   //失败

                        nextName = "整改延期退回";
                    }
                }

                entity.POSTPONERESULT = postPoneResult;   //申请结果
                htextensionbll.SaveForm("", entity);

                //极光推送
                htworkflowbll.PushMessageForWorkFlow("隐患处理审批", nextName, wfentity, result);
            }
            catch (Exception ex)
            {
                return(Error(ex.Message.ToString()));
            }

            return(Success("操作成功。"));
        }
Exemplo n.º 9
0
        public ActionResult SubmitForm(string keyValue, LllegalRegisterEntity entity, LllegalReformEntity rEntity, LllegalAcceptEntity acceptEntity)
        {
            Operator curUser = OperatorProvider.Provider.Current();

            string participant = string.Empty;

            string wfFlag = string.Empty;

            WfControlResult result = new WfControlResult();

            try
            {
                //保存退回操作信息
                LllegalRegisterEntity baseentity = lllegalregisterbll.GetEntity(keyValue);
                baseentity.RESEVERFOUR = entity.RESEVERFOUR;
                baseentity.RESEVERFIVE = entity.RESEVERFIVE;
                lllegalregisterbll.SaveForm(keyValue, baseentity);

                //整改信息
                LllegalReformEntity rfEntity = lllegalreformbll.GetEntityByBid(keyValue);
                rfEntity.REFORMFINISHDATE = rEntity.REFORMFINISHDATE;
                rfEntity.REFORMMEASURE    = rEntity.REFORMMEASURE;
                rfEntity.REFORMSTATUS     = rEntity.REFORMSTATUS;
                rfEntity.MODIFYDATE       = DateTime.Now;
                rfEntity.MODIFYUSERID     = curUser.UserId;
                rfEntity.MODIFYUSERNAME   = curUser.UserName;
                rfEntity.REFORMPIC        = rEntity.REFORMPIC;
                rfEntity.REFORMATTACHMENT = rEntity.REFORMATTACHMENT;

                rfEntity.REFORMPEOPLE   = rEntity.REFORMPEOPLE;
                rfEntity.REFORMPEOPLEID = rEntity.REFORMPEOPLEID;
                rfEntity.REFORMDEPTNAME = rEntity.REFORMDEPTNAME;
                rfEntity.REFORMDEPTCODE = rEntity.REFORMDEPTCODE;
                rfEntity.REFORMTEL      = rEntity.REFORMTEL;
                lllegalreformbll.SaveForm(rfEntity.ID, rfEntity);


                WfControlObj wfentity = new WfControlObj();
                wfentity.businessid = keyValue;
                wfentity.argument1  = baseentity.MAJORCLASSIFY; //专业分类
                wfentity.startflow  = baseentity.FLOWSTATE;
                wfentity.rankid     = null;
                wfentity.user       = curUser;
                wfentity.organizeid = baseentity.BELONGDEPARTID; //对应电厂id
                if (entity.ADDTYPE == "2")
                {
                    wfentity.mark = "省级违章流程";
                }
                else
                {
                    wfentity.mark = "厂级违章流程";
                }
                //退回
                if (entity.RESEVERFOUR == "是")
                {
                    //历史记录
                    var reformitem = lllegalreformbll.GetHistoryList(entity.ID).ToList();
                    //如果未整改可以退回
                    if (reformitem.Count() == 0)
                    {
                        wfentity.submittype = "退回";
                    }
                    else
                    {
                        return(Error("整改过后的违章无法再次退回!"));
                    }
                }
                else //正常提交到验收流程
                {
                    wfentity.submittype = "提交";
                }


                //获取下一流程的操作人
                result = wfcontrolbll.GetWfControl(wfentity);
                //处理成功
                if (result.code == WfCode.Sucess)
                {
                    //参与者
                    participant = result.actionperson;
                    //状态
                    wfFlag = result.wfflag;

                    //如果是更改状态
                    if (result.ischangestatus)
                    {
                        //提交流程到下一节点
                        if (!string.IsNullOrEmpty(participant))
                        {
                            int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                            if (count > 0)
                            {
                                htworkflowbll.UpdateFlowStateByObjectId("bis_lllegalregister", "flowstate", keyValue);  //更新业务流程状态
                            }
                        }
                        else
                        {
                            return(Error("请联系系统管理员,确认提交问题!"));
                        }
                    }
                    else
                    {
                        //获取
                        htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);

                        string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);

                        #region 当前还处于违章整改阶段
                        if (tagName == "违章整改")
                        {
                            UserInfoEntity userentity = userbll.GetUserInfoByAccount(participant);
                            rfEntity.REFORMPEOPLE   = userentity.RealName;
                            rfEntity.REFORMPEOPLEID = userentity.UserId;
                            rfEntity.REFORMDEPTNAME = userentity.DeptName;
                            rfEntity.REFORMDEPTCODE = userentity.DepartmentCode;
                            rfEntity.REFORMTEL      = userentity.Telephone;
                            lllegalreformbll.SaveForm(rfEntity.ID, rfEntity);
                        }
                        #endregion
                    }
                }
                //非自动处理的流程
                else if (result.code == WfCode.NoAutoHandle)
                {
                    bool isupdate = false;//是否更改流程状态
                    //退回操作  单独处理
                    if (entity.RESEVERFOUR == "是")
                    {
                        DataTable dt = htworkflowbll.GetBackFlowObjectByKey(keyValue);

                        if (dt.Rows.Count > 0)
                        {
                            wfFlag = dt.Rows[0]["wfflag"].ToString();            //流程走向

                            participant = dt.Rows[0]["participant"].ToString();  //指向人

                            isupdate = dt.Rows[0]["isupdate"].ToString() == "1"; //是否更改流程状态
                        }
                    }
                    //更改流程状态的情况下
                    if (isupdate)
                    {
                        if (!string.IsNullOrEmpty(participant) && !string.IsNullOrEmpty(wfFlag))
                        {
                            int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                            if (count > 0)
                            {
                                htworkflowbll.UpdateFlowStateByObjectId("bis_lllegalregister", "flowstate", keyValue);  //更新业务流程状态
                            }
                            result.message = "处理成功";
                            result.code    = WfCode.Sucess;
                        }
                    }
                    else
                    {
                        //不更改流程状态下
                        htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);

                        string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);
                        #region 当前还处于违章整改阶段
                        if (tagName == "违章整改")
                        {
                            UserInfoEntity userentity = userbll.GetUserInfoByAccount(participant);
                            rfEntity.REFORMPEOPLE   = userentity.RealName;
                            rfEntity.REFORMPEOPLEID = userentity.UserId;
                            rfEntity.REFORMDEPTNAME = userentity.DeptName;
                            rfEntity.REFORMDEPTCODE = userentity.DepartmentCode;
                            rfEntity.REFORMTEL      = userentity.Telephone;
                            lllegalreformbll.SaveForm(rfEntity.ID, rfEntity);
                        }
                        #endregion

                        result.message = "处理成功";
                        result.code    = WfCode.Sucess;
                    }
                }

                if (result.code == WfCode.Sucess)
                {
                    return(Success(result.message));
                }
                else //其他返回状态
                {
                    return(Error(result.message));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
Exemplo n.º 10
0
        public ActionResult SaveSettingForm(string keyValue, LllegalReformEntity entity)
        {
            Operator curUser = new OperatorProvider().Current();
            LllegalRegisterEntity bsentity = lllegalregisterbll.GetEntity(keyValue);//主键
            string rankname = string.Empty;

            bool isUpdateDate = false;                                         //是否更新时间

            var    cEntity        = lllegalreformbll.GetEntityByBid(keyValue); //获取整改对象
            string postponereason = Request.Form["POSTPONEREASON"] != null ? Request.Form["POSTPONEREASON"].ToString() : "";


            try
            {
                WfControlObj wfentity = new WfControlObj();
                wfentity.businessid = keyValue; //
                wfentity.argument1  = bsentity.MAJORCLASSIFY;
                wfentity.argument2  = bsentity.LLLEGALTYPE;
                wfentity.startflow  = "整改延期申请";
                wfentity.submittype = "提交";
                wfentity.rankid     = null;
                wfentity.user       = curUser;
                wfentity.mark       = "违章整改延期";
                wfentity.organizeid = bsentity.BELONGDEPARTID; //对应电厂id

                //获取下一流程的操作人
                WfControlResult result = wfcontrolbll.GetWfControl(wfentity);
                //保存申请记录
                LllegalExtensionEntity exentity = new LllegalExtensionEntity();
                //处理成功
                if (result.code == WfCode.Sucess)
                {
                    string participant = result.actionperson;
                    string wfFlag      = result.wfflag;

                    cEntity.POSTPONEPERSON     = "," + participant + ","; // 用于当前人账户判断是否具有操作其权限
                    cEntity.POSTPONEDAYS       = entity.POSTPONEDAYS;     //申请天数
                    cEntity.POSTPONEDEPT       = result.deptcode;         //审批部门Code
                    cEntity.POSTPONEDEPTNAME   = result.deptname;         //审批部门名称
                    cEntity.POSTPONEPERSONNAME = result.username;
                    cEntity.APPLICATIONSTATUS  = wfFlag;
                    //是否更新时间,累加天数
                    if (wfFlag == "2")
                    {
                        isUpdateDate = true;
                    }
                    //如果安环部、生技部审批通过,则更改整改截至时间、验收时间,增加相应的整改天数
                    if (isUpdateDate)
                    {
                        //重新赋值整改截至时间
                        cEntity.REFORMDEADLINE = cEntity.REFORMDEADLINE.Value.AddDays(cEntity.POSTPONEDAYS.Value);

                        //更新验收时间
                        LllegalAcceptEntity aEntity = lllegalacceptbll.GetEntityByBid(keyValue);
                        if (null != aEntity.ACCEPTTIME)
                        {
                            aEntity.ACCEPTTIME = aEntity.ACCEPTTIME.Value.AddDays(cEntity.POSTPONEDAYS.Value);
                        }
                        lllegalacceptbll.SaveForm(aEntity.ID, aEntity);

                        exentity.HANDLESIGN = "1"; //成功标记
                    }
                    cEntity.APPSIGN = "Web";
                    //更新整改信息
                    lllegalreformbll.SaveForm(cEntity.ID, cEntity); //更新延期设置

                    exentity.LLLEGALID      = keyValue;
                    exentity.HANDLEDATE     = DateTime.Now;
                    exentity.POSTPONEDAYS   = entity.POSTPONEDAYS.ToString();
                    exentity.HANDLEUSERID   = curUser.UserId;
                    exentity.HANDLEUSERNAME = curUser.UserName;
                    exentity.HANDLEDEPTCODE = curUser.DeptCode;
                    exentity.HANDLEDEPTNAME = curUser.DeptName;
                    exentity.HANDLETYPE     = "0"; //申请类型  状态返回 2 时表示整改延期完成 (申请)
                    exentity.HANDLEID       = DateTime.Now.ToString("yyyyMMddhhmmss").ToString();
                    exentity.POSTPONEREASON = postponereason;
                    exentity.APPSIGN        = "Web";
                    lllegalextensionbll.SaveForm("", exentity);

                    //极光推送
                    if (wfFlag != "2")
                    {
                        htworkflowbll.PushMessageForWorkFlow("违章管理流程", "整改延期审批", wfentity, result);
                    }


                    return(Success(result.message));
                }
                else
                {
                    return(Error(result.message));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message.ToString()));
            }
        }
Exemplo n.º 11
0
        public ActionResult SaveCForm(string keyValue, string isUpSubmit, HTBaseInfoEntity bentity, HTApprovalEntity entity, HTChangeInfoEntity chEntity, HTAcceptInfoEntity aEntity)
        {
            Operator curUser = OperatorProvider.Provider.Current();

            string wfFlag = string.Empty;  //流程标识

            IList <UserEntity> ulist = new List <UserEntity>();

            #region 保存基本信息

            //评估ID
            string APPROVALID = Request.Form["APPROVALID"] != null ? Request.Form["APPROVALID"].ToString() : "";

            string CHANGEID = Request.Form["CHANGEID"] != null ? Request.Form["CHANGEID"].ToString() : "";

            string ACCEPTID = Request.Form["ACCEPTID"] != null ? Request.Form["ACCEPTID"].ToString() : "";

            APPROVALID = APPROVALID == "&nbsp;" ? "" : APPROVALID;

            //隐患曝光
            string EXPOSURESTATE = Request.Form["EXPOSURESTATE"] != null ? Request.Form["EXPOSURESTATE"].ToString() : "";
            //保存隐患基本信息
            htbaseinfobll.SaveForm(keyValue, bentity);

            //隐患整改
            if (!string.IsNullOrEmpty(CHANGEID))
            {
                var tempEntity = htchangeinfobll.GetEntity(CHANGEID);
                chEntity.AUTOID            = tempEntity.AUTOID;
                chEntity.BACKREASON        = ""; //回退原因
                chEntity.APPLICATIONSTATUS = tempEntity.APPLICATIONSTATUS;
                chEntity.POSTPONEDAYS      = tempEntity.POSTPONEDAYS;
                chEntity.POSTPONEDEPT      = tempEntity.POSTPONEDEPT;
                chEntity.POSTPONEDEPTNAME  = tempEntity.POSTPONEDEPTNAME;
            }
            htchangeinfobll.SaveForm(CHANGEID, chEntity);

            //隐患验收
            if (!string.IsNullOrEmpty(ACCEPTID))
            {
                var tempEntity = htacceptinfobll.GetEntity(ACCEPTID);
                aEntity.AUTOID = tempEntity.AUTOID;
            }
            htacceptinfobll.SaveForm(ACCEPTID, aEntity);
            #endregion

            string participant = string.Empty;  //获取流程下一节点的参与人员

            bool isgoback = false;

            WfControlObj wfentity = new WfControlObj();
            wfentity.businessid = keyValue;
            string startflow = htbaseinfobll.GetEntity(keyValue).WORKSTREAM;
            wfentity.startflow  = startflow;
            wfentity.rankid     = bentity.HIDRANK;
            wfentity.user       = curUser;
            wfentity.mark       = "省级隐患排查";
            wfentity.organizeid = bentity.HIDDEPART; //对应电厂id
            //返回结果
            WfControlResult result = new WfControlResult();

            if (isUpSubmit == "1")  //上报,且存在上级部门
            {
                wfentity.submittype = "上报";
            }
            else  //不上报,评估通过需要提交整改,评估不通过退回到登记
            {
                /****判断当前人是否评估通过*****/
                #region 判断当前人是否评估通过
                //评估通过,则直接进行整改
                if (entity.APPROVALRESULT == "1")
                {
                    wfentity.submittype = "提交";
                }
                else  //评估不通过,退回到登记
                {
                    wfentity.submittype = "退回";
                    isgoback            = true;
                }
                #endregion
            }


            //获取下一流程的操作人
            result = wfcontrolbll.GetWfControl(wfentity);

            //返回操作结果成功
            if (result.code == WfCode.Sucess)
            {
                participant = result.actionperson;
                wfFlag      = result.wfflag;
                //更改状态
                if (result.ischangestatus)
                {
                    if (!string.IsNullOrEmpty(participant))
                    {
                        int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                        if (count > 0)
                        {
                            //保存隐患评估信息
                            htapprovebll.SaveForm(APPROVALID, entity);
                            htworkflowbll.UpdateWorkStreamByObjectId(keyValue);  //更新业务流程状态
                        }
                        else
                        {
                            return(Error("当前用户无评估权限!"));
                        }
                    }
                }
                else //不更改状态
                {
                    if (!string.IsNullOrEmpty(participant))
                    {
                        //保存隐患评估信息
                        htapprovebll.SaveForm(APPROVALID, entity);

                        htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);
                    }
                }
                return(Success(result.message));
            }
            else
            {
                return(Error(result.message));
            }
        }
Exemplo n.º 12
0
        public ActionResult SaveForm(string keyValue, string isUpSubmit, HTBaseInfoEntity bentity, HTApprovalEntity entity, HTChangeInfoEntity chEntity, HTAcceptInfoEntity aEntity)
        {
            Operator curUser = OperatorProvider.Provider.Current();

            string wfFlag = string.Empty;  //流程标识

            #region 保存基本信息

            //评估ID
            string APPROVALID = Request.Form["APPROVALID"] != null ? Request.Form["APPROVALID"].ToString() : "";

            string CHANGEID = Request.Form["CHANGEID"] != null ? Request.Form["CHANGEID"].ToString() : "";

            string ACCEPTID = Request.Form["ACCEPTID"] != null ? Request.Form["ACCEPTID"].ToString() : "";

            APPROVALID = APPROVALID == "&nbsp;" ? "" : APPROVALID;

            //隐患曝光
            string EXPOSURESTATE = Request.Form["EXPOSURESTATE"] != null ? Request.Form["EXPOSURESTATE"].ToString() : "";
            //设备
            if (string.IsNullOrEmpty(bentity.DEVICEID))
            {
                bentity.DEVICEID = string.Empty;
            }
            if (string.IsNullOrEmpty(bentity.DEVICENAME))
            {
                bentity.DEVICENAME = string.Empty;
            }
            if (string.IsNullOrEmpty(bentity.DEVICECODE))
            {
                bentity.DEVICECODE = string.Empty;
            }
            //保存隐患基本信息
            htbaseinfobll.SaveForm(keyValue, bentity);

            //隐患整改
            if (!string.IsNullOrEmpty(CHANGEID))
            {
                var tempEntity = htchangeinfobll.GetEntity(CHANGEID);
                chEntity.AUTOID            = tempEntity.AUTOID;
                chEntity.BACKREASON        = ""; //回退原因
                chEntity.APPLICATIONSTATUS = tempEntity.APPLICATIONSTATUS;
                chEntity.POSTPONEDAYS      = tempEntity.POSTPONEDAYS;
                chEntity.POSTPONEDEPT      = tempEntity.POSTPONEDEPT;
                chEntity.POSTPONEDEPTNAME  = tempEntity.POSTPONEDEPTNAME;
            }
            htchangeinfobll.SaveForm(CHANGEID, chEntity);

            //隐患验收
            if (!string.IsNullOrEmpty(ACCEPTID))
            {
                var tempEntity = htacceptinfobll.GetEntity(ACCEPTID);
                aEntity.AUTOID = tempEntity.AUTOID;
            }
            htacceptinfobll.SaveForm(ACCEPTID, aEntity);
            #endregion

            string participant = string.Empty;  //获取流程下一节点的参与人员

            HTBaseInfoEntity baseEntity = htbaseinfobll.GetEntity(keyValue);

            WfControlObj wfentity = new WfControlObj();
            wfentity.businessid = keyValue;
            wfentity.argument1  = bentity.MAJORCLASSIFY; //专业分类
            wfentity.argument2  = curUser.DeptId;        //当前部门
            wfentity.argument3  = bentity.HIDTYPE;       //隐患类别
            wfentity.argument4  = bentity.HIDBMID;       //所属部门
            string startflow = baseEntity.WORKSTREAM;
            wfentity.startflow  = startflow;
            wfentity.rankid     = baseEntity.HIDRANK;
            wfentity.user       = curUser;
            wfentity.mark       = "厂级隐患排查";
            wfentity.organizeid = baseEntity.HIDDEPART; //对应电厂id
            //返回结果
            WfControlResult result = new WfControlResult();

            if (isUpSubmit == "1")  //上报,且存在上级部门
            {
                #region  报

                wfentity.submittype = "上报";
                //获取下一流程的操作人
                result = wfcontrolbll.GetWfControl(wfentity);

                //处理成功
                if (result.code == WfCode.Sucess)
                {
                    participant = result.actionperson; //目标流程参与者

                    if (!string.IsNullOrEmpty(participant))
                    {
                        //保存隐患评估信息
                        htapprovebll.SaveForm(APPROVALID, entity);

                        htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);

                        return(Success(result.message));
                    }
                    else
                    {
                        return(Error("当前上级部门无评估人员,如需上报,请联系系统管理员进行配置!"));
                    }
                }
                else
                {
                    return(Error(result.message));
                }
                #endregion
            }
            else  //不上报,评估通过需要提交整改,评估不通过退回到登记
            {
                /****判断当前人是否评估通过*****/
                #region 判断当前人是否评估通过
                //评估通过,则直接进行整改
                if (entity.APPROVALRESULT == "1")
                {
                    wfentity.submittype = "提交";
                    //不指定整改责任人
                    if (chEntity.ISAPPOINT == "0")
                    {
                        wfentity.submittype = "制定提交";
                    }
                    //判断是否是同级提交
                    bool ismajorpush = GetCurUserWfAuth(baseEntity.HIDRANK, "隐患评估", "隐患评估", "厂级隐患排查", "同级提交", baseEntity.MAJORCLASSIFY, null, null, keyValue);
                    if (ismajorpush)
                    {
                        wfentity.submittype = "同级提交";
                    }

                    #region 国电新疆版本
                    if (baseEntity.ADDTYPE == "3")
                    {
                        //非本部门整改
                        if (baseEntity.ISSELFCHANGE == "0")
                        {
                            wfentity.submittype = "制定提交";

                            //如果已经制定了整改计划,则按照提交来进行推送
                            if (baseEntity.ISFORMULATE == "1")
                            {
                                wfentity.submittype = "提交";
                            }
                            //如果当前评估部门是整改部门,则直接提交
                            if (curUser.DeptId == chEntity.CHANGEDUTYDEPARTID)
                            {
                                wfentity.submittype = "提交";
                            }
                            //如果当前评估部门是创建部门,则直接提交至非本部门整改的安监部
                            if (curUser.DeptCode == baseEntity.CREATEUSERDEPTCODE)
                            {
                                wfentity.submittype = "制定提交";
                            }
                        }
                        else  //本部门整改情况下, 公司级用户不管如何,都不会直接到生技部
                        {
                            UserEntity userEntity = userbll.GetEntity(baseEntity.CREATEUSERID);
                            if (userEntity.RoleName.Contains("公司级用户") && curUser.RoleName.Contains("公司级用户"))
                            {
                                wfentity.submittype = "制定提交";
                            }
                        }
                    }
                    #endregion
                }
                else  //评估不通过,退回到登记
                {
                    wfentity.submittype = "退回";

                    #region 国电新疆版本
                    if (baseEntity.ADDTYPE == "3")
                    {
                        //已经制定了整改计划,则按照制定计划退回
                        if (baseEntity.ISFORMULATE == "1")
                        {
                            wfentity.submittype = "制定退回";
                        }
                    }
                    #endregion
                }
                //获取下一流程的操作人
                result = wfcontrolbll.GetWfControl(wfentity);
                //处理成功
                if (result.code == WfCode.Sucess)
                {
                    participant = result.actionperson;

                    wfFlag = result.wfflag;

                    if (!string.IsNullOrEmpty(participant))
                    {
                        //如果是更改状态
                        if (result.ischangestatus)
                        {
                            int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);
                            if (count > 0)
                            {
                                //保存隐患评估信息
                                htapprovebll.SaveForm(APPROVALID, entity);
                                htworkflowbll.UpdateWorkStreamByObjectId(keyValue);  //更新业务流程状态
                                return(Success(result.message));
                            }
                            else
                            {
                                return(Error("当前用户无评估权限!"));
                            }
                        }
                        else  //不更改状态的情况下
                        {
                            //保存隐患评估信息
                            htapprovebll.SaveForm(APPROVALID, entity);

                            htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);

                            return(Success(result.message));
                        }
                    }
                    else
                    {
                        return(Error("目标流程参与者未定义!"));
                    }
                }
                else
                {
                    return(Error(result.message));
                }
                #endregion
            }
        }
Exemplo n.º 13
0
        public ActionResult SubmitForm(string keyValue, LllegalRegisterEntity entity, LllegalApproveEntity pEntity, LllegalReformEntity rEntity, LllegalAcceptEntity aEntity)
        {
            /*
             * 注:核准分两步
             *
             *  确定为装置类情况下,如果当前核准人是安全管理部门人员, 先判断是否为装置类,如果不是 则直接到整改或退回,如果是,则转发至装置部门 或退回(不是提交)
             *  如果是非安全管理人员,则提交到安全管理部门人员会退回到登记.
             */

            string errorMsg = string.Empty;

            Operator curUser = OperatorProvider.Provider.Current();

            string wfFlag = string.Empty;      //流程标识

            string participant = string.Empty; //获取流程下一节点的参与人员

            var lllegatypename = "";

            if (!string.IsNullOrWhiteSpace(entity.LLLEGALTYPE))
            {
                lllegatypename = dataitemdetailbll.GetEntity(entity.LLLEGALTYPE).ItemName;
            }

            //保存违章基本信息
            LllegalRegisterEntity baseentity = lllegalregisterbll.GetEntity(keyValue);

            entity.AUTOID             = baseentity.AUTOID;
            entity.CREATEDATE         = baseentity.CREATEDATE;
            entity.CREATEUSERDEPTCODE = baseentity.CREATEUSERDEPTCODE;
            entity.CREATEUSERID       = baseentity.CREATEUSERID;
            entity.CREATEUSERNAME     = baseentity.CREATEUSERNAME;
            entity.CREATEUSERORGCODE  = baseentity.CREATEUSERORGCODE;
            entity.MODIFYDATE         = DateTime.Now;
            entity.MODIFYUSERID       = curUser.UserId;
            entity.MODIFYUSERNAME     = curUser.UserName;
            entity.RESEVERFOUR        = "";
            entity.RESEVERFIVE        = "";
            lllegalregisterbll.SaveForm(keyValue, entity);

            #region 考核信息

            string RELEVANCEDATA = Request.Form["RELEVANCEDATA"];
            if (!string.IsNullOrEmpty(RELEVANCEDATA))
            {
                //先删除考核信息集合
                lllegalpunishbll.DeleteLllegalPunishList(entity.ID, "");

                JArray jarray = (JArray)JsonConvert.DeserializeObject(RELEVANCEDATA);

                foreach (JObject rhInfo in jarray)
                {
                    //string relevanceId = rhInfo["ID"].ToString(); //主键id
                    string assessobject                 = rhInfo["ASSESSOBJECT"].ToString();
                    string personinchargename           = rhInfo["PERSONINCHARGENAME"].ToString(); //关联责任人姓名
                    string personinchargeid             = rhInfo["PERSONINCHARGEID"].ToString();   //关联责任人id
                    string performancepoint             = rhInfo["PERFORMANCEPOINT"].ToString();   //EHS绩效考核
                    string economicspunish              = rhInfo["ECONOMICSPUNISH"].ToString();    // 经济处罚
                    string education                    = rhInfo["EDUCATION"].ToString();          //教育培训
                    string lllegalpoint                 = rhInfo["LLLEGALPOINT"].ToString();       //违章扣分
                    string awaitjob                     = rhInfo["AWAITJOB"].ToString();           //待岗
                    LllegalPunishEntity newpunishEntity = new LllegalPunishEntity();
                    newpunishEntity.LLLEGALID          = entity.ID;
                    newpunishEntity.ASSESSOBJECT       = assessobject; //考核对象
                    newpunishEntity.PERSONINCHARGEID   = personinchargeid;
                    newpunishEntity.PERSONINCHARGENAME = personinchargename;
                    newpunishEntity.PERFORMANCEPOINT   = !string.IsNullOrEmpty(performancepoint) ? Convert.ToDecimal(performancepoint) : 0;
                    newpunishEntity.ECONOMICSPUNISH    = !string.IsNullOrEmpty(economicspunish) ? Convert.ToDecimal(economicspunish) : 0;
                    newpunishEntity.EDUCATION          = !string.IsNullOrEmpty(education) ? Convert.ToDecimal(education) : 0;
                    newpunishEntity.LLLEGALPOINT       = !string.IsNullOrEmpty(lllegalpoint) ? Convert.ToDecimal(lllegalpoint) : 0;
                    newpunishEntity.AWAITJOB           = !string.IsNullOrEmpty(awaitjob) ? Convert.ToDecimal(awaitjob) : 0;
                    newpunishEntity.MARK = assessobject.Contains("考核") ? "0" : "1"; //标记0考核,1联责
                    lllegalpunishbll.SaveForm("", newpunishEntity);
                }
            }
            #endregion

            #region 违章奖励信息
            string AWARDDATA = Request.Form["AWARDDATA"];
            if (!string.IsNullOrEmpty(AWARDDATA))
            {  //先删除关联集合
                lllegalawarddetailbll.DeleteLllegalAwardList(entity.ID);

                JArray jarray = (JArray)JsonConvert.DeserializeObject(AWARDDATA);

                foreach (JObject rhInfo in jarray)
                {
                    string userid   = rhInfo["USERID"].ToString(); //奖励用户
                    string username = rhInfo["USERNAME"].ToString();
                    string deptid   = rhInfo["DEPTID"].ToString(); //奖励用户部门
                    string deptname = rhInfo["DEPTNAME"].ToString();
                    string points   = rhInfo["POINTS"].ToString(); //奖励积分
                    string money    = rhInfo["MONEY"].ToString();  //奖励金额

                    LllegalAwardDetailEntity awardEntity = new LllegalAwardDetailEntity();
                    awardEntity.LLLEGALID = entity.ID;
                    awardEntity.USERID    = userid; //奖励对象
                    awardEntity.USERNAME  = username;
                    awardEntity.DEPTID    = deptid;
                    awardEntity.DEPTNAME  = deptname;
                    awardEntity.POINTS    = !string.IsNullOrEmpty(points) ? int.Parse(points) : 0;
                    awardEntity.MONEY     = !string.IsNullOrEmpty(money) ? Convert.ToDecimal(money) : 0;
                    lllegalawarddetailbll.SaveForm("", awardEntity);
                }
            }
            #endregion

            //违章整改记录
            LllegalReformEntity cEntity = lllegalreformbll.GetEntityByBid(keyValue);
            cEntity.REFORMDEADLINE         = rEntity.REFORMDEADLINE;
            cEntity.REFORMPEOPLE           = rEntity.REFORMPEOPLE;
            cEntity.REFORMPEOPLEID         = rEntity.REFORMPEOPLEID;
            cEntity.REFORMDEPTCODE         = rEntity.REFORMDEPTCODE;
            cEntity.REFORMDEPTNAME         = rEntity.REFORMDEPTNAME;
            cEntity.REFORMTEL              = rEntity.REFORMTEL;
            cEntity.REFORMSTATUS           = string.Empty;
            cEntity.REFORMCHARGEDEPTID     = rEntity.REFORMCHARGEDEPTID;
            cEntity.REFORMCHARGEDEPTNAME   = rEntity.REFORMCHARGEDEPTNAME;
            cEntity.REFORMCHARGEPERSON     = rEntity.REFORMCHARGEPERSON;
            cEntity.REFORMCHARGEPERSONNAME = rEntity.REFORMCHARGEPERSONNAME;
            cEntity.ISAPPOINT              = rEntity.ISAPPOINT;
            lllegalreformbll.SaveForm(cEntity.ID, cEntity);

            //违章验收
            LllegalAcceptEntity aptEntity = lllegalacceptbll.GetEntityByBid(keyValue);
            aptEntity.ACCEPTPEOPLE   = aEntity.ACCEPTPEOPLE;
            aptEntity.ACCEPTPEOPLEID = aEntity.ACCEPTPEOPLEID;
            aptEntity.ACCEPTDEPTCODE = aEntity.ACCEPTDEPTCODE;
            aptEntity.ACCEPTDEPTNAME = aEntity.ACCEPTDEPTNAME;
            aptEntity.ACCEPTTIME     = aEntity.ACCEPTTIME;
            lllegalacceptbll.SaveForm(aptEntity.ID, aptEntity);


            WfControlObj wfentity = new WfControlObj();
            wfentity.businessid = keyValue;               //
            wfentity.argument1  = entity.MAJORCLASSIFY;   //专业分类
            wfentity.argument2  = entity.LLLEGALTYPE;     //违章类型
            wfentity.argument3  = curUser.DeptId;         //当前人所属部门
            wfentity.argument4  = entity.LLLEGALTEAMCODE; //违章部门
            wfentity.argument5  = entity.LLLEGALLEVEL;    //违章级别
            wfentity.startflow  = baseentity.FLOWSTATE;
            //上报,且存在上级部门
            if (entity.ISUPSAFETY == "1")
            {
                wfentity.submittype = "上报";
            }
            else  //不上报,评估通过需要提交整改,评估不通过退回到登记
            {
                /****判断当前人是否评估通过*****/
                #region 判断当前人是否评估通过
                //评估通过,则直接进行整改
                if (pEntity.APPROVERESULT == "1")
                {
                    wfentity.submittype = "提交";
                    //不指定整改责任人
                    if (rEntity.ISAPPOINT == "0")
                    {
                        wfentity.submittype = "制定提交";
                    }
                    //判断是否是同级提交
                    bool ismajorpush = GetCurUserWfAuth(null, baseentity.FLOWSTATE, baseentity.FLOWSTATE, "厂级违章流程", "同级提交", entity.MAJORCLASSIFY, null, null, keyValue);
                    if (ismajorpush)
                    {
                        wfentity.submittype = "同级提交";
                    }
                }
                else  //评估不通过,退回到登记
                {
                    wfentity.submittype = "退回";
                }
                #endregion
            }
            wfentity.rankid     = null;
            wfentity.user       = curUser;
            wfentity.mark       = "厂级违章流程";
            wfentity.organizeid = entity.BELONGDEPARTID; //对应电厂id
            //获取下一流程的操作人
            WfControlResult result = wfcontrolbll.GetWfControl(wfentity);
            //处理成功
            if (result.code == WfCode.Sucess)
            {
                participant = result.actionperson;

                wfFlag = result.wfflag;

                if (!string.IsNullOrEmpty(participant))
                {
                    //如果是更改状态
                    if (result.ischangestatus)
                    {
                        int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);
                        if (count > 0)
                        {
                            //保存违章核准
                            pEntity.LLLEGALID = keyValue;
                            lllegalapprovebll.SaveForm("", pEntity);

                            htworkflowbll.UpdateFlowStateByObjectId("bis_lllegalregister", "flowstate", keyValue);  //更新业务流程状态

                            return(Success(result.message));
                        }
                        else
                        {
                            return(Error("当前用户无核准权限!"));
                        }
                    }
                    else  //不更改状态的情况下
                    {
                        //保存违章核准
                        pEntity.LLLEGALID = keyValue;
                        lllegalapprovebll.SaveForm("", pEntity);

                        htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);

                        return(Success(result.message));
                    }
                }
                else
                {
                    return(Error("目标流程参与者未定义!"));
                }
            }
            else
            {
                return(Error(result.message));
            }
        }
Exemplo n.º 14
0
        public ActionResult SaveForm(string keyValue, LllegalExtensionEntity entity)
        {
            Operator curUser = new OperatorProvider().Current();

            string postPoneResult = Request.Form["POSTPONERESULT"].ToString();  //审批结果

            var bsentity = lllegalregisterbll.GetEntity(keyValue); //根据id获取隐患对象

            string postponereason = Request.Form["POSTPONEREASON"].ToString(); //审批意见

            string rankname = string.Empty;

             bool isUpdateDate = false;

             string participant = string.Empty;
             string wfFlag =string.Empty;

             try
             {
                 WfControlResult result = new WfControlResult();
                 WfControlObj wfentity = new WfControlObj();
                 wfentity.businessid = keyValue; //
                 wfentity.argument1 = bsentity.MAJORCLASSIFY;
                 wfentity.argument2 = bsentity.LLLEGALTYPE;
                 wfentity.startflow = "整改延期审批";
                 wfentity.submittype = "提交";
                 wfentity.rankid = null;
                 wfentity.user = curUser;
                 wfentity.mark = "违章整改延期";
                 wfentity.organizeid = bsentity.BELONGDEPARTID; //对应电厂id

                 LllegalReformEntity cEntity = lllegalreformbll.GetEntityByBid(keyValue);
                 //是否通过
                 if (postPoneResult == "1")
                 {
                     //获取下一流程的操作人
                     result = wfcontrolbll.GetWfControl(wfentity);
                     //处理成功
                     if (result.code == WfCode.Sucess)
                     {
                         participant = result.actionperson;
                         wfFlag = result.wfflag;

                         cEntity.POSTPONEPERSON = "," + participant + ",";  // 用于当前人账户判断是否具有操作其权限
                         cEntity.POSTPONEDAYS = cEntity.POSTPONEDAYS; //申请天数
                         cEntity.POSTPONEDEPT = result.deptcode;  //审批部门Code
                         cEntity.POSTPONEDEPTNAME = result.deptname;  //审批部门名称
                         cEntity.POSTPONEPERSONNAME = result.username; //审批人
                         cEntity.APPLICATIONSTATUS = wfFlag; //延期通过
                     }
                     else 
                     {
                         return Error(result.message);
                     }
                 }
                 else
                 {
                     cEntity.APPLICATIONSTATUS = "3"; //延期申请失败
                    //延期失败保存整改人相关信息到result,用于极光推送
                    //UserEntity changeUser = userbll.GetEntity(cEntity.REFORMPEOPLEID);
                    //if(null!=changeUser)
                    //{
                    //    result.actionperson = changeUser.Account;
                    //    result.username = cEntity.REFORMPEOPLE;
                    //    result.deptname = cEntity.REFORMDEPTNAME;
                    //    result.deptid = changeUser.DepartmentId;
                    //    result.deptcode = cEntity.REFORMDEPTCODE;
                    //}
                    string[] userids = cEntity.REFORMPEOPLEID.Split(',');
                    DataTable userdt = userbll.GetUserTable(userids);
                    foreach (DataRow row in userdt.Rows)
                    {
                        result.actionperson += row["account"].ToString() + ",";
                        result.username += row["realname"].ToString() + ",";
                        if (!result.deptname.Contains(row["deptname"].ToString()))
                        {
                            result.deptname += row["deptname"].ToString() + ",";
                        }
                        if (!result.deptid.Contains(row["departmentid"].ToString()))
                        {
                            result.deptid += row["departmentid"].ToString() + ",";
                        }
                        if (!result.deptcode.Contains(row["departmentcode"].ToString()))
                        {
                            result.deptcode += row["departmentcode"].ToString() + ",";
                        }
                    }
                    if (!string.IsNullOrEmpty(result.actionperson))
                    {
                        result.actionperson = result.actionperson.Substring(0, result.actionperson.Length - 1);
                    }
                    if (!string.IsNullOrEmpty(result.username))
                    {
                        result.username = result.username.Substring(0, result.username.Length - 1);
                    }
                    if (!string.IsNullOrEmpty(result.deptname))
                    {
                        result.deptname = result.deptname.Substring(0, result.deptname.Length - 1);
                    }
                    if (!string.IsNullOrEmpty(result.deptid))
                    {
                        result.deptid = result.deptid.Substring(0, result.deptid.Length - 1);
                    }
                    if (!string.IsNullOrEmpty(result.deptcode))
                    {
                        result.deptcode = result.deptcode.Substring(0, result.deptcode.Length - 1);
                    }
                }

                 //延期成功 
                 if (wfFlag == "2" && postPoneResult == "1")
                 {
                     isUpdateDate = true;
                 }
                 //如果安环部、生技部审批通过,则更改整改截至时间、验收时间,增加相应的整改天数
                 if (isUpdateDate)
                 {
                     //重新赋值整改截至时间
                     cEntity.REFORMDEADLINE = cEntity.REFORMDEADLINE.Value.AddDays(cEntity.POSTPONEDAYS.Value);

                     //更新验收时间
                     LllegalAcceptEntity aEntity = lllegalacceptbll.GetEntityByBid(keyValue);
                     if (null != aEntity.ACCEPTTIME)
                     {
                         aEntity.ACCEPTTIME = aEntity.ACCEPTTIME.Value.AddDays(cEntity.POSTPONEDAYS.Value);
                     }
                     lllegalacceptbll.SaveForm(aEntity.ID, aEntity);

                     entity.HANDLESIGN = "1"; //成功标记
                 }
                 //cEntity.APPSIGN = "Web";
                 //更新整改信息
                 lllegalreformbll.SaveForm(cEntity.ID, cEntity); //更新延期设置

                 //添加审批记录
                 entity.APPSIGN = "Web";

                 string nextName = string.Empty;

                 //成功
                 if (wfFlag == "2" && postPoneResult == "1")
                 {
                     entity.HANDLETYPE = wfFlag;  //处理类型 0 申请 1 审批 2 整改结束    wfFlag状态返回 2 时表示整改延期完成
                 }
                 //审批中
                 else if (wfFlag != "2" && postPoneResult == "1")
                 {
                     entity.HANDLETYPE = "1";  //审批中

                     nextName = "整改延期审批";
                 }
                 else //失败
                 {
                     if (postPoneResult == "0")
                     {
                         entity.HANDLETYPE = "-1";  //失败

                         nextName = "整改延期退回";
                     }
                 }
                 entity.POSTPONERESULT = postPoneResult;  //申请结果
                 lllegalextensionbll.SaveForm("", entity);

                 //极光推送
                 htworkflowbll.PushMessageForWorkFlow("违章管理流程", nextName, wfentity, result);
             }
             catch (Exception ex)
             {
                 return Error(ex.Message.ToString());
             }

            return Success("操作成功。");
        }
Exemplo n.º 15
0
        public ActionResult SubmitForm(string keyValue, QuestionVerifyEntity qEntity)
        {
            Operator        curUser = OperatorProvider.Provider.Current();
            WfControlResult result  = new WfControlResult();

            try
            {
                string wfFlag = string.Empty;      //流程标识

                string participant = string.Empty; //获取流程下一节点的参与人员 (取验收人)

                QuestionInfoEntity   baseEntity   = questioninfobll.GetEntity(keyValue);
                QuestionReformEntity reformEntity = questionreformbll.GetEntityByBid(keyValue);

                QuestionVerifyEntity aptEntity = questionverifybll.GetEntityByBid(keyValue);
                if (null == aptEntity)
                {
                    aptEntity = new QuestionVerifyEntity();
                }
                aptEntity.QUESTIONID     = keyValue;
                aptEntity.VERIFYRESULT   = qEntity.VERIFYRESULT;
                aptEntity.VERIFYOPINION  = qEntity.VERIFYOPINION;
                aptEntity.MODIFYDATE     = DateTime.Now;
                aptEntity.MODIFYUSERID   = curUser.UserId;
                aptEntity.MODIFYUSERNAME = curUser.UserName;
                aptEntity.VERIFYSIGN     = !string.IsNullOrEmpty(qEntity.VERIFYSIGN) ? HttpUtility.UrlDecode(qEntity.VERIFYSIGN) : "";
                aptEntity.VERIFYDATE     = qEntity.VERIFYDATE;


                WfControlObj wfentity = new WfControlObj();
                wfentity.businessid = keyValue;
                wfentity.startflow  = baseEntity.FLOWSTATE;
                wfentity.rankid     = null;
                wfentity.user       = curUser;
                wfentity.argument1  = curUser.UserId;
                wfentity.organizeid = baseEntity.BELONGDEPTID; //对应电厂id
                //厂级
                wfentity.mark = "厂级问题流程";
                //验证通过
                if (qEntity.VERIFYRESULT == "1")
                {
                    wfentity.submittype = "提交";
                }
                else //验证不通过
                {
                    wfentity.submittype = "退回";
                }

                //获取下一流程的操作人
                result = wfcontrolbll.GetWfControl(wfentity);

                //返回操作结果成功(配置流程的情况下)
                if (result.code == WfCode.Sucess)
                {
                    participant = result.actionperson;

                    wfFlag = result.wfflag;

                    //如果是更改状态
                    #region 如果是更改状态
                    if (result.ischangestatus)
                    {
                        //提交流程到下一节点
                        if (!string.IsNullOrEmpty(participant))
                        {
                            int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);
                            if (count > 0)
                            {
                                //添加问题验证记录
                                aptEntity.ID               = null;
                                aptEntity.VERIFYDEPTID     = curUser.DeptId;
                                aptEntity.VERIFYDEPTCODE   = curUser.DeptCode;
                                aptEntity.VERIFYDEPTNAME   = curUser.DeptName;
                                aptEntity.VERIFYPEOPLE     = curUser.Account;
                                aptEntity.VERIFYPEOPLENAME = curUser.UserName;
                                questionverifybll.SaveForm("", aptEntity);

                                //退回则重新添加验证记录
                                if (wfFlag == "2")
                                {
                                    QuestionReformEntity newEntity = new QuestionReformEntity();
                                    newEntity                  = reformEntity;
                                    newEntity.CREATEDATE       = DateTime.Now;
                                    newEntity.MODIFYDATE       = DateTime.Now;
                                    newEntity.MODIFYUSERID     = curUser.UserId;
                                    newEntity.MODIFYUSERNAME   = curUser.UserName;
                                    newEntity.REFORMPIC        = null; //重新生成图片GUID
                                    newEntity.REFORMSTATUS     = null; //整改完成情况
                                    newEntity.REFORMDESCRIBE   = null; //整改情况描述
                                    newEntity.REFORMFINISHDATE = null; //整改完成时间
                                    newEntity.ID               = "";
                                    questionreformbll.SaveForm("", newEntity);
                                    //验证记录记录
                                    QuestionVerifyEntity cptEntity = new QuestionVerifyEntity();
                                    cptEntity               = aptEntity;
                                    cptEntity.ID            = null;
                                    cptEntity.CREATEDATE    = DateTime.Now;
                                    cptEntity.MODIFYDATE    = DateTime.Now;
                                    cptEntity.VERIFYRESULT  = null;
                                    cptEntity.VERIFYOPINION = null;
                                    cptEntity.VERIFYSIGN    = null;
                                    questionverifybll.SaveForm("", cptEntity);
                                }
                                htworkflowbll.UpdateFlowStateByObjectId("bis_questioninfo", "flowstate", keyValue);  //更新业务流程状态
                            }
                            else
                            {
                                return(Error("当前用户无评估权限!"));
                            }
                        }
                        else
                        {
                            return(Error(result.message));
                        }
                    }
                    #endregion
                    #region  更改状态的情况下
                    else  //不更改状态的情况下
                    {
                        //保存隐患评估信息
                        #region 提交流程到下一节点
                        if (!string.IsNullOrEmpty(participant))
                        {
                            //添加问题验证记录
                            aptEntity.ID               = null;
                            aptEntity.VERIFYDEPTID     = curUser.DeptId;
                            aptEntity.VERIFYDEPTCODE   = curUser.DeptCode;
                            aptEntity.VERIFYDEPTNAME   = curUser.DeptName;
                            aptEntity.VERIFYPEOPLE     = curUser.Account;
                            aptEntity.VERIFYPEOPLENAME = curUser.UserName;
                            questionverifybll.SaveForm("", aptEntity);

                            htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);
                        }
                        else
                        {
                            return(Error(result.message));
                        }
                        #endregion
                    }
                    #endregion
                }
                //不按照配置
                else if (result.code == WfCode.NoInstance || result.code == WfCode.NoEnable)
                {
                    //验证通过
                    if (qEntity.VERIFYRESULT == "1")
                    {
                        wfFlag = "1";

                        participant = curUser.Account;
                    }
                    else //验证不通过
                    {
                        wfFlag = "2";

                        participant = reformEntity.REFORMPEOPLE; //整改人
                    }

                    if (!string.IsNullOrEmpty(participant))
                    {
                        int count = htworkflowbll.SubmitWorkFlow(keyValue, participant, wfFlag, curUser.UserId);

                        if (count > 0)
                        {
                            //添加问题验证记录
                            aptEntity.VERIFYDEPTID     = curUser.DeptId;
                            aptEntity.VERIFYDEPTCODE   = curUser.DeptCode;
                            aptEntity.VERIFYDEPTNAME   = curUser.DeptName;
                            aptEntity.VERIFYPEOPLE     = curUser.Account;
                            aptEntity.VERIFYPEOPLENAME = curUser.UserName;
                            questionverifybll.SaveForm(aptEntity.ID, aptEntity);

                            //退回则重新添加验证记录
                            if (wfFlag == "2")
                            {
                                QuestionReformEntity newEntity = new QuestionReformEntity();
                                newEntity                  = reformEntity;
                                newEntity.CREATEDATE       = DateTime.Now;
                                newEntity.MODIFYDATE       = DateTime.Now;
                                newEntity.MODIFYUSERID     = curUser.UserId;
                                newEntity.MODIFYUSERNAME   = curUser.UserName;
                                newEntity.REFORMPIC        = null; //重新生成图片GUID
                                newEntity.REFORMSTATUS     = null; //整改完成情况
                                newEntity.REFORMDESCRIBE   = null; //整改情况描述
                                newEntity.REFORMFINISHDATE = null; //整改完成时间
                                newEntity.ID               = "";
                                questionreformbll.SaveForm("", newEntity);
                                //验证记录记录
                                QuestionVerifyEntity cptEntity = new QuestionVerifyEntity();
                                cptEntity               = aptEntity;
                                cptEntity.ID            = null;
                                cptEntity.CREATEDATE    = DateTime.Now;
                                cptEntity.MODIFYDATE    = DateTime.Now;
                                cptEntity.VERIFYRESULT  = null;
                                cptEntity.VERIFYOPINION = null;
                                cptEntity.VERIFYSIGN    = null;
                                questionverifybll.SaveForm("", cptEntity);
                            }

                            htworkflowbll.UpdateFlowStateByObjectId("bis_questioninfo", "flowstate", keyValue);  //更新业务流程状态
                        }
                        result.message = "操作成功!";
                    }
                    else
                    {
                        return(Error("操作失败,请联系管理员!"));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
            return(Success(result.message));
        }
Exemplo n.º 16
0
        public ActionResult SubmitForm(string keyValue, LllegalAcceptEntity acceptEntity)
        {
            Operator        curUser = OperatorProvider.Provider.Current();
            WfControlResult result  = new WfControlResult();

            try
            {
                /*
                 * 考虑两种情况
                 * 当验收不通过,则验收退回到违章整改状态,并进行重新整改 ,这里需要注意,一旦不通过,则重新生成一条整改信息,一条验收信息.
                 * 当验收通过,则整改结束
                 */
                string wfFlag = string.Empty;      //流程标识

                string participant = string.Empty; //获取流程下一节点的参与人员 (取验收人)

                LllegalRegisterEntity baseEntity = lllegalregisterbll.GetEntity(keyValue);

                LllegalAcceptEntity aptEntity = lllegalacceptbll.GetEntityByBid(keyValue);
                aptEntity.ACCEPTRESULT   = acceptEntity.ACCEPTRESULT;
                aptEntity.ACCEPTMIND     = acceptEntity.ACCEPTMIND;
                aptEntity.MODIFYDATE     = DateTime.Now;
                aptEntity.MODIFYUSERID   = curUser.UserId;
                aptEntity.MODIFYUSERNAME = curUser.UserName;
                aptEntity.ACCEPTPIC      = acceptEntity.ACCEPTPIC;
                aptEntity.ACCEPTDEPTCODE = acceptEntity.ACCEPTDEPTCODE;
                aptEntity.ACCEPTDEPTNAME = acceptEntity.ACCEPTDEPTNAME;
                aptEntity.ACCEPTPEOPLE   = acceptEntity.ACCEPTPEOPLE;
                aptEntity.ACCEPTPEOPLEID = acceptEntity.ACCEPTPEOPLEID;
                aptEntity.ACCEPTTIME     = acceptEntity.ACCEPTTIME;

                WfControlObj wfentity = new WfControlObj();
                wfentity.businessid = keyValue;
                wfentity.argument1  = baseEntity.MAJORCLASSIFY; //专业分类
                wfentity.startflow  = baseEntity.FLOWSTATE;
                wfentity.rankid     = null;
                wfentity.user       = curUser;
                wfentity.organizeid = baseEntity.BELONGDEPARTID; //对应电厂id
                //厂级
                if (baseEntity.ADDTYPE == "2")
                {
                    wfentity.mark = "省级违章流程";
                }
                else
                {
                    wfentity.mark = "厂级违章流程";
                }
                //验收通过
                if (acceptEntity.ACCEPTRESULT == "1")
                {
                    wfentity.submittype = "提交";
                }
                else //验收不通过
                {
                    wfentity.submittype = "退回";
                }

                //获取下一流程的操作人
                result = wfcontrolbll.GetWfControl(wfentity);

                //返回操作结果成功
                if (result.code == WfCode.Sucess)
                {
                    participant = result.actionperson;

                    wfFlag = result.wfflag;

                    //提交流程到下一节点
                    if (!string.IsNullOrEmpty(participant))
                    {
                        int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                        if (count > 0)
                        {
                            //添加违章验收记录
                            lllegalacceptbll.SaveForm(aptEntity.ID, aptEntity);

                            htworkflowbll.UpdateFlowStateByObjectId("bis_lllegalregister", "flowstate", keyValue);  //更新业务流程状态

                            //退回则重新添加验收记录
                            if (wfentity.submittype == "退回")
                            {
                                string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);
                                if (tagName == "违章整改")
                                {
                                    LllegalReformEntity reformEntity = lllegalreformbll.GetEntityByBid(keyValue);
                                    LllegalReformEntity newEntity    = new LllegalReformEntity();
                                    newEntity                  = reformEntity;
                                    newEntity.CREATEDATE       = DateTime.Now;
                                    newEntity.MODIFYDATE       = DateTime.Now;
                                    newEntity.MODIFYUSERID     = curUser.UserId;
                                    newEntity.MODIFYUSERNAME   = curUser.UserName;
                                    newEntity.REFORMPIC        = string.Empty; //重新生成图片GUID
                                    newEntity.REFORMATTACHMENT = string.Empty; //整改附件
                                    newEntity.REFORMSTATUS     = string.Empty; //整改完成情况
                                    newEntity.REFORMMEASURE    = string.Empty; //整改具体措施
                                    newEntity.REFORMFINISHDATE = null;         //整改完成时间
                                    newEntity.ID               = "";
                                    lllegalreformbll.SaveForm("", newEntity);
                                }

                                //验收记录
                                LllegalAcceptEntity cptEntity = new LllegalAcceptEntity();
                                cptEntity              = aptEntity;
                                cptEntity.ID           = null;
                                cptEntity.CREATEDATE   = DateTime.Now;
                                cptEntity.MODIFYDATE   = DateTime.Now;
                                cptEntity.ACCEPTRESULT = null;
                                cptEntity.ACCEPTMIND   = null;
                                cptEntity.ACCEPTPIC    = null;
                                lllegalacceptbll.SaveForm("", cptEntity);
                            }
                        }
                    }
                    else
                    {
                        return(Error(result.message));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
            return(Success((result.message)));
        }
Exemplo n.º 17
0
        public ActionResult SubmitForm(string keyValue, QuestionInfoEntity entity, QuestionReformEntity rEntity, QuestionVerifyEntity aEntity)
        {
            Operator curUser = OperatorProvider.Provider.Current();

            string participant = string.Empty;

            string wfFlag = string.Empty;

            WfControlResult result = new WfControlResult();

            try
            {
                //保存退回操作信息
                QuestionInfoEntity baseentity = questioninfobll.GetEntity(keyValue);
                questioninfobll.SaveForm(keyValue, baseentity);

                //整改信息
                QuestionReformEntity rfEntity = questionreformbll.GetEntityByBid(keyValue);
                rfEntity.REFORMDESCRIBE   = rEntity.REFORMDESCRIBE;   //整改情况描述
                rfEntity.REFORMFINISHDATE = rEntity.REFORMFINISHDATE; //整改结束时间
                rfEntity.REFORMMEASURE    = rEntity.REFORMMEASURE;    //整改措施
                rfEntity.REFORMSTATUS     = rEntity.REFORMSTATUS;     //整改完成情况
                rfEntity.REFORMSIGN       = !string.IsNullOrEmpty(rEntity.REFORMSIGN) ? HttpUtility.UrlDecode(rEntity.REFORMSIGN) : "";
                rfEntity.REFORMREASON     = rEntity.REFORMREASON;     //未完成原因
                rfEntity.MODIFYDATE       = DateTime.Now;
                rfEntity.MODIFYUSERID     = curUser.UserId;
                rfEntity.MODIFYUSERNAME   = curUser.UserName;
                rfEntity.REFORMPIC        = rEntity.REFORMPIC; //整改图片

                #region MyRegion
                WfControlObj wfentity = new WfControlObj();
                wfentity.businessid = keyValue;
                wfentity.startflow  = "问题整改";
                wfentity.rankid     = null;
                wfentity.user       = curUser;
                wfentity.argument1  = curUser.UserId;
                wfentity.organizeid = baseentity.BELONGDEPTID; //对应电厂id
                wfentity.mark       = "厂级问题流程";
                wfentity.submittype = "提交";


                //获取下一流程的操作人
                result = wfcontrolbll.GetWfControl(wfentity);
                //处理成功
                if (result.code == WfCode.Sucess)
                {
                    //参与者
                    participant = result.actionperson;
                    //状态
                    wfFlag = result.wfflag;

                    //提交流程到下一节点
                    if (!string.IsNullOrEmpty(participant))
                    {
                        int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                        if (count > 0)
                        {
                            //更新整改内容
                            //rfEntity.REFORMDEPTCODE = curUser.DeptCode; //当前人
                            //rfEntity.REFORMDEPTID = curUser.DeptId;
                            //rfEntity.REFORMDEPTNAME = curUser.DeptName;
                            rfEntity.REFORMPEOPLE     = curUser.Account;
                            rfEntity.REFORMPEOPLENAME = curUser.UserName;
                            questionreformbll.SaveForm(rfEntity.ID, rfEntity);


                            htworkflowbll.UpdateFlowStateByObjectId("bis_questioninfo", "flowstate", keyValue);  //更新业务流程状态
                        }
                    }
                    else
                    {
                        return(Error("请联系系统管理员,确认提交问题!"));
                    }
                }
                else if (result.code == WfCode.NoInstance || result.code == WfCode.NoEnable)
                {
                    wfFlag = "1";                       //到验证阶段

                    participant = aEntity.VERIFYPEOPLE; //验证人

                    if (!string.IsNullOrEmpty(participant))
                    {
                        int count = htworkflowbll.SubmitWorkFlow(keyValue, participant, wfFlag, curUser.UserId);

                        if (count > 0)
                        {
                            //更新整改内容
                            //rfEntity.REFORMDEPTCODE = curUser.DeptCode; //当前人
                            //rfEntity.REFORMDEPTID = curUser.DeptId;
                            //rfEntity.REFORMDEPTNAME = curUser.DeptName;
                            rfEntity.REFORMPEOPLE     = curUser.Account;
                            rfEntity.REFORMPEOPLENAME = curUser.UserName;
                            questionreformbll.SaveForm(rfEntity.ID, rfEntity);

                            htworkflowbll.UpdateFlowStateByObjectId("bis_questioninfo", "flowstate", keyValue);  //更新业务流程状态
                        }
                        return(Success("操作成功!"));
                    }
                    else
                    {
                        return(Success("操作失败,请联系管理员!"));
                    }
                }

                if (result.code == WfCode.Sucess)
                {
                    return(Success(result.message));
                }
                else //其他返回状态
                {
                    return(Error(result.message));
                }
                #endregion
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
Exemplo n.º 18
0
        public ActionResult SaveForm(string keyValue, HtReCheckEntity entity, HTChangeInfoEntity centity, HTBaseInfoEntity bentity)
        {
            Operator curUser     = OperatorProvider.Provider.Current();
            string   RECHECKID   = Request.Form["RECHECKID"] != null ? Request.Form["RECHECKID"].ToString() : ""; //复查验证ID
            string   CHANGEID    = Request.Form["CHANGEID"] != null ? Request.Form["CHANGEID"].ToString() : "";   //整改ID
            string   participant = string.Empty;                                                                  //获取流程下一节点的参与人员
            string   wfFlag      = string.Empty;                                                                  //流程标识

            var          baseEntity = htbaseinfobll.GetEntity(keyValue);
            WfControlObj wfentity   = new WfControlObj();

            wfentity.businessid = keyValue;
            wfentity.argument1  = bentity.MAJORCLASSIFY;
            wfentity.argument3  = bentity.HIDTYPE; //隐患类别
            wfentity.argument4  = bentity.HIDBMID; //所属部门
            wfentity.startflow  = baseEntity.WORKSTREAM;
            wfentity.rankid     = baseEntity.HIDRANK;
            wfentity.user       = curUser;
            wfentity.organizeid = baseEntity.HIDDEPART; //对应电厂id
            //省级登记的
            if (baseEntity.ADDTYPE == "2")
            {
                wfentity.mark = "省级隐患排查";
            }
            else //厂级
            {
                wfentity.mark = "厂级隐患排查";
            }
            //复查通过
            if (entity.RECHECKSTATUS == "1")
            {
                wfentity.submittype = "提交";
            }
            else //复查不通过
            {
                wfentity.submittype = "退回";
            }

            //获取下一流程的操作人
            WfControlResult result = wfcontrolbll.GetWfControl(wfentity);

            //返回操作结果成功
            if (result.code == WfCode.Sucess)
            {
                participant = result.actionperson;

                wfFlag = result.wfflag;

                //如果是更改状态
                if (result.ischangestatus)
                {
                    if (!string.IsNullOrEmpty(participant))
                    {
                        //提交流程
                        int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                        if (count > 0)
                        {
                            //保存复查验证
                            if (!string.IsNullOrEmpty(RECHECKID))
                            {
                                var tempEntity = htrecheckbll.GetEntity(RECHECKID);
                                entity.AUTOID = tempEntity.AUTOID;
                            }
                            htrecheckbll.SaveForm(RECHECKID, entity);           //保存信息

                            htworkflowbll.UpdateWorkStreamByObjectId(keyValue); //更新业务流程状态

                            #region 退回后重新新增整改记录及整改效果评估记录
                            if (wfentity.submittype == "退回")
                            {
                                string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);
                                if (tagName == "隐患整改")
                                {
                                    //整改记录
                                    HTChangeInfoEntity cEntity = htchangeinfobll.GetEntity(CHANGEID);
                                    if (null != cEntity)
                                    {
                                        HTChangeInfoEntity newEntity = new HTChangeInfoEntity();
                                        newEntity                      = cEntity;
                                        newEntity.CREATEDATE           = DateTime.Now;
                                        newEntity.MODIFYDATE           = DateTime.Now;
                                        newEntity.ID                   = null;
                                        newEntity.AUTOID               = cEntity.AUTOID + 1;
                                        newEntity.CHANGERESUME         = null;
                                        newEntity.CHANGEFINISHDATE     = null;
                                        newEntity.REALITYMANAGECAPITAL = 0;
                                        newEntity.ATTACHMENT           = Guid.NewGuid().ToString(); //整改附件
                                        newEntity.HIDCHANGEPHOTO       = Guid.NewGuid().ToString(); //整改图片
                                        newEntity.APPSIGN              = "Web";
                                        htchangeinfobll.SaveForm("", newEntity);
                                    }
                                }
                                //验收记录
                                HTAcceptInfoEntity htacceptinfoentity = htacceptinfobll.GetEntityByHidCode(baseEntity.HIDCODE);
                                if (null != htacceptinfoentity)
                                {
                                    HTAcceptInfoEntity accptEntity = new HTAcceptInfoEntity();
                                    accptEntity              = htacceptinfoentity;
                                    accptEntity.ID           = null;
                                    accptEntity.AUTOID       = htacceptinfoentity.AUTOID + 1;
                                    accptEntity.CREATEDATE   = DateTime.Now;
                                    accptEntity.MODIFYDATE   = DateTime.Now;
                                    accptEntity.ACCEPTSTATUS = null;
                                    accptEntity.ACCEPTIDEA   = null;
                                    accptEntity.ACCEPTPHOTO  = Guid.NewGuid().ToString();
                                    accptEntity.APPSIGN      = "Web";
                                    htacceptinfobll.SaveForm("", accptEntity);
                                }
                            }
                            #endregion
                        }
                        return(Success(result.message));
                    }
                    else
                    {
                        return(Error("目标流程参与者未定义"));
                    }
                }
                else
                {
                    //保存复查验证
                    if (!string.IsNullOrEmpty(RECHECKID))
                    {
                        var tempEntity = htrecheckbll.GetEntity(RECHECKID);
                        entity.AUTOID = tempEntity.AUTOID;
                    }
                    htrecheckbll.SaveForm(RECHECKID, entity); //保存信息
                    //获取
                    htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId);

                    return(Success(result.message));
                }
            }
            else
            {
                return(Error(result.message));
            }
        }
Exemplo n.º 19
0
        public ActionResult SaveForm(string keyValue, HTAcceptInfoEntity atEntity, HTChangeInfoEntity chEntity, HTEstimateEntity entity)
        {
            Operator curUser        = OperatorProvider.Provider.Current();
            string   ACCEPTID       = Request.Form["ACCEPTID"] != null ? Request.Form["ACCEPTID"].ToString() : "";             //验收ID
            string   ESTIMATEID     = Request.Form["ESTIMATEID"] != null ? Request.Form["ESTIMATEID"].ToString() : "";         //整改效果评估ID
            string   ESTIMATERESULT = Request.Form["ESTIMATERESULT"] != null ? Request.Form["ESTIMATERESULT"].ToString() : ""; //评估情况
            string   CHANGEID       = Request.Form["CHANGEID"] != null ? Request.Form["CHANGEID"].ToString() : "";             //整改ID
            string   participant    = string.Empty;                                                                            //获取流程下一节点的参与人员
            string   wfFlag         = string.Empty;                                                                            //流程标识


            var          baseEntity = htbaseinfobll.GetEntity(keyValue);
            WfControlObj wfentity   = new WfControlObj();

            wfentity.businessid = keyValue;
            wfentity.startflow  = baseEntity.WORKSTREAM;
            wfentity.rankid     = baseEntity.HIDRANK;
            wfentity.user       = curUser;
            wfentity.organizeid = baseEntity.HIDDEPART; //对应电厂id
            //省级登记的
            if (baseEntity.ADDTYPE == "2")
            {
                wfentity.mark = "省级隐患排查";
            }
            else //厂级
            {
                wfentity.mark = "厂级隐患排查";
            }
            //评估合格
            if (ESTIMATERESULT == "1")
            {
                wfentity.submittype = "提交";
            }
            else //评估不通过
            {
                wfentity.submittype = "退回";
            }

            //获取下一流程的操作人
            WfControlResult result = wfcontrolbll.GetWfControl(wfentity);

            //返回操作结果成功
            if (result.code == WfCode.Sucess)
            {
                participant = result.actionperson;

                wfFlag = result.wfflag;

                if (!string.IsNullOrEmpty(participant))
                {
                    //提交流程
                    int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId);

                    if (count > 0)
                    {
                        htworkflowbll.UpdateWorkStreamByObjectId(keyValue);  //更新业务流程状态

                        //保存整改效果评估
                        if (!string.IsNullOrEmpty(ESTIMATEID))
                        {
                            var tempEntity = htestimatebll.GetEntity(ESTIMATEID);
                            entity.AUTOID = tempEntity.AUTOID;
                        }
                        htestimatebll.SaveForm(ESTIMATEID, entity);

                        //退回后重新新增整改记录及整改效果评估记录
                        if (wfentity.submittype == "退回")
                        {
                            string tagName = htworkflowbll.QueryTagNameByCurrentWF(keyValue);

                            if (tagName == "隐患整改")
                            {
                                //整改记录
                                HTChangeInfoEntity cEntity   = htchangeinfobll.GetEntity(CHANGEID);
                                HTChangeInfoEntity newEntity = new HTChangeInfoEntity();
                                newEntity                      = cEntity;
                                newEntity.CREATEDATE           = DateTime.Now;
                                newEntity.MODIFYDATE           = DateTime.Now;
                                newEntity.ID                   = null;
                                newEntity.AUTOID               = cEntity.AUTOID + 1;
                                newEntity.CHANGERESUME         = null;
                                newEntity.CHANGEFINISHDATE     = null;
                                newEntity.REALITYMANAGECAPITAL = 0;
                                newEntity.ATTACHMENT           = Guid.NewGuid().ToString(); //整改附件
                                newEntity.HIDCHANGEPHOTO       = Guid.NewGuid().ToString(); //整改图片
                                newEntity.APPSIGN              = "Web";
                                htchangeinfobll.SaveForm("", newEntity);
                            }

                            HTAcceptInfoEntity htacceptinfoentity = htacceptinfobll.GetEntityByHidCode(baseEntity.HIDCODE);
                            //验收记录
                            HTAcceptInfoEntity accptEntity = new HTAcceptInfoEntity();
                            accptEntity              = htacceptinfoentity;
                            accptEntity.ID           = null;
                            accptEntity.AUTOID       = htacceptinfoentity.AUTOID + 1;
                            accptEntity.CREATEDATE   = DateTime.Now;
                            accptEntity.MODIFYDATE   = DateTime.Now;
                            accptEntity.ACCEPTSTATUS = null;
                            accptEntity.ACCEPTIDEA   = null;
                            accptEntity.ACCEPTPHOTO  = Guid.NewGuid().ToString(); //验收图片
                            accptEntity.APPSIGN      = "Web";
                            htacceptinfobll.SaveForm("", accptEntity);
                        }
                    }
                }
                else
                {
                    return(Error("目标流程参与者未定义"));
                }
                return(Success(result.message));
            }
            else
            {
                return(Error(result.message));
            }
        }