Пример #1
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));
            }
        }
Пример #2
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("操作成功。"));
        }
Пример #3
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));
            }
        }
Пример #4
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 == " " ? "" : 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
            }
        }
Пример #5
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));
            }
        }
Пример #6
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));
            }
        }