Exemplo n.º 1
0
        public object ApproveForm()
        {
            try
            {
                string   res      = HttpContext.Current.Request["json"];
                dynamic  dy       = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string   userid   = dy.userid;
                string   keyValue = dy.data.keyvalue;
                Operator curUser  = ERCHTMS.Code.OperatorProvider.Provider.Current();

                AptitudeinvestigateauditEntity aentity = new AptitudeinvestigateauditEntity
                {
                    AUDITRESULT   = dy.data.auditresult,
                    AUDITTIME     = Convert.ToDateTime(dy.data.audittime),
                    AUDITPEOPLE   = dy.data.auditpeople,
                    AUDITPEOPLEID = dy.data.auditpeopleid,
                    AUDITDEPTID   = dy.data.auditdeptid,
                    AUDITDEPT     = dy.data.auditdept,
                    AUDITOPINION  = dy.data.auditopinion,
                    AUDITSIGNIMG  = dy.data.auditsignimg
                };
                string state = string.Empty;

                string moduleName = "日常考核";

                DailyexamineEntity entity = dailyexaminebll.GetEntity(keyValue);
                /// <param name="currUser">当前登录人</param>
                /// <param name="state">是否有权限审核 1:能审核 0 :不能审核</param>
                /// <param name="moduleName">模块名称</param>
                /// <param name="createdeptid">创建人部门ID</param>
                ManyPowerCheckEntity mpcEntity = dailyexaminebll.CheckAuditPower(curUser, out state, moduleName, entity.CreateUserDeptId);


                #region                                                                                                                                 //审核信息表
                AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity();
                aidEntity.AUDITRESULT   = aentity.AUDITRESULT;                                                                                          //通过
                aidEntity.AUDITTIME     = Convert.ToDateTime(aentity.AUDITTIME.Value.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss")); //审核时间
                aidEntity.AUDITPEOPLE   = aentity.AUDITPEOPLE;                                                                                          //审核人员姓名
                aidEntity.AUDITPEOPLEID = aentity.AUDITPEOPLEID;                                                                                        //审核人员id
                aidEntity.APTITUDEID    = keyValue;                                                                                                     //关联的业务ID
                aidEntity.AUDITDEPTID   = aentity.AUDITDEPTID;                                                                                          //审核部门id
                aidEntity.AUDITDEPT     = aentity.AUDITDEPT;                                                                                            //审核部门
                aidEntity.AUDITOPINION  = aentity.AUDITOPINION;                                                                                         //审核意见
                aidEntity.FlowId        = entity.FlowID;
                aidEntity.AUDITSIGNIMG  = string.IsNullOrWhiteSpace(aentity.AUDITSIGNIMG) ? "" : aentity.AUDITSIGNIMG.ToString().Replace(new DataItemDetailBLL().GetItemValue("imgUrl"), "");

                HttpFileCollection files = HttpContext.Current.Request.Files;
                if (files.Count > 0)
                {
                    for (int i = 0; i < files.AllKeys.Length; i++)
                    {
                        HttpPostedFile file           = files[i];
                        string         fileOverName   = System.IO.Path.GetFileName(file.FileName);
                        string         fileName       = System.IO.Path.GetFileNameWithoutExtension(file.FileName);
                        string         FileEextension = Path.GetExtension(file.FileName);
                        //if (fileName == aidEntity.ID)
                        //{
                        string dir         = new DataItemDetailBLL().GetItemValue("imgPath") + "\\Resource\\sign";
                        string newFileName = fileName + FileEextension;
                        string newFilePath = dir + "\\" + newFileName;
                        file.SaveAs(newFilePath);
                        aidEntity.AUDITSIGNIMG = "/Resource/sign/" + fileOverName;
                        break;
                        //}
                    }
                }
                aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity);
                #endregion

                #region  //保存日常考核
                //审核通过
                if (aentity.AUDITRESULT == "0")
                {
                    //0表示流程未完成,1表示流程结束
                    if (null != mpcEntity)
                    {
                        entity.FlowDept     = mpcEntity.CHECKDEPTID;
                        entity.FlowDeptName = mpcEntity.CHECKDEPTNAME;
                        entity.FlowRole     = mpcEntity.CHECKROLEID;
                        entity.FlowRoleName = mpcEntity.CHECKROLENAME;
                        entity.IsSaved      = 1;
                        entity.FlowID       = mpcEntity.ID;
                        entity.IsOver       = 0;
                        entity.FlowName     = mpcEntity.CHECKDEPTNAME + "审核中";
                    }
                    else
                    {
                        entity.FlowDept     = "";
                        entity.FlowDeptName = "";
                        entity.FlowRole     = "";
                        entity.FlowRoleName = "";
                        entity.IsSaved      = 1;
                        entity.IsOver       = 1;
                        entity.FlowName     = "";
                    }
                }
                else //审核不通过
                {
                    entity.FlowDept     = "";
                    entity.FlowDeptName = "";
                    entity.FlowRole     = "";
                    entity.FlowRoleName = "";
                    entity.FlowID       = "";
                    entity.IsOver       = 0; //处于登记阶段
                    entity.IsSaved      = 0; //是否完成状态赋值为未完成
                    entity.FlowName     = "";
                }
                //更新日常考核基本状态信息
                dailyexaminebll.SaveForm(keyValue, entity);
                #endregion

                #region    //审核不通过
                if (aentity.AUDITRESULT == "1")
                {
                    //添加历史记录
                    HistorydailyexamineEntity hsentity = new HistorydailyexamineEntity();
                    hsentity.CreateUserId       = entity.CreateUserId;
                    hsentity.CreateUserDeptCode = entity.CreateUserDeptCode;
                    hsentity.CreateUserOrgCode  = entity.CreateUserOrgCode;
                    hsentity.CreateDate         = entity.CreateDate;
                    hsentity.CreateUserName     = entity.CreateUserName;
                    hsentity.CreateUserDeptId   = entity.CreateUserDeptId;
                    hsentity.ModifyDate         = entity.ModifyDate;
                    hsentity.ModifyUserId       = entity.ModifyUserId;
                    hsentity.ModifyUserName     = entity.ModifyUserName;
                    hsentity.ExamineCode        = entity.ExamineCode;
                    hsentity.ExamineDept        = entity.ExamineDept;
                    hsentity.ExamineDeptId      = entity.ExamineDeptId;
                    hsentity.ExamineToDeptId    = entity.ExamineToDeptId;
                    hsentity.ExamineToDept      = entity.ExamineToDept;
                    hsentity.ExamineType        = entity.ExamineType; //关联ID
                    hsentity.ExamineMoney       = Convert.ToDouble(entity.ExamineMoney);
                    hsentity.ExaminePerson      = entity.ExaminePerson;
                    hsentity.ExaminePersonId    = entity.ExaminePersonId; //关联ID
                    hsentity.ExamineTime        = entity.ExamineTime;
                    hsentity.ExamineContent     = entity.ExamineContent;
                    hsentity.ExamineBasis       = entity.ExamineBasis;
                    hsentity.Remark             = entity.Remark;
                    hsentity.ContractId         = entity.Id;//关联ID
                    hsentity.IsSaved            = 2;
                    hsentity.IsOver             = entity.IsOver;
                    hsentity.FlowDeptName       = entity.FlowDeptName;
                    hsentity.FlowDept           = entity.FlowDept;
                    hsentity.FlowRoleName       = entity.FlowRoleName;
                    hsentity.FlowRole           = entity.FlowRole;
                    hsentity.FlowName           = entity.FlowName;
                    hsentity.Id = "";

                    historydailyexaminebll.SaveForm(hsentity.Id, hsentity);

                    //获取当前业务对象的所有审核记录
                    var shlist = aptitudeinvestigateauditbll.GetAuditList(keyValue);
                    //批量更新审核记录关联ID
                    foreach (AptitudeinvestigateauditEntity mode in shlist)
                    {
                        mode.APTITUDEID = hsentity.Id; //对应新的ID
                        aptitudeinvestigateauditbll.SaveForm(mode.ID, mode);
                    }
                    //批量更新附件记录关联ID
                    var flist = fileinfobll.GetImageListByObject(keyValue);
                    foreach (FileInfoEntity fmode in flist)
                    {
                        fmode.RecId = hsentity.Id; //对应新的ID
                        fileinfobll.SaveForm("", fmode);
                    }
                }
                #endregion

                return(new { Code = 0, Count = 0, Info = "保存成功" });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Count = 0, Info = ex.Message });
            }
        }
Exemplo n.º 2
0
        public ActionResult ApporveForm(string keyValue, AptitudeinvestigateauditEntity aentity)
        {
            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

            string state = string.Empty;

            string moduleName = "日常考核";

            DailyexamineEntity entity = dailyexaminebll.GetEntity(keyValue);
            /// <param name="currUser">当前登录人</param>
            /// <param name="state">是否有权限审核 1:能审核 0 :不能审核</param>
            /// <param name="moduleName">模块名称</param>
            /// <param name="createdeptid">创建人部门ID</param>
            ManyPowerCheckEntity mpcEntity = dailyexaminebll.CheckAuditPower(curUser, out state, moduleName, entity.CreateUserDeptId);


            #region                                                                                                                                 //审核信息表
            AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity();
            aidEntity.AUDITRESULT   = aentity.AUDITRESULT;                                                                                          //通过
            aidEntity.AUDITTIME     = Convert.ToDateTime(aentity.AUDITTIME.Value.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss")); //审核时间
            aidEntity.AUDITPEOPLE   = aentity.AUDITPEOPLE;                                                                                          //审核人员姓名
            aidEntity.AUDITPEOPLEID = aentity.AUDITPEOPLEID;                                                                                        //审核人员id
            aidEntity.APTITUDEID    = keyValue;                                                                                                     //关联的业务ID
            aidEntity.AUDITDEPTID   = aentity.AUDITDEPTID;                                                                                          //审核部门id
            aidEntity.AUDITDEPT     = aentity.AUDITDEPT;                                                                                            //审核部门
            aidEntity.AUDITOPINION  = aentity.AUDITOPINION;                                                                                         //审核意见
            aidEntity.FlowId        = entity.FlowID;
            aidEntity.AUDITSIGNIMG  = HttpUtility.UrlDecode(aidEntity.AUDITSIGNIMG);
            aidEntity.AUDITSIGNIMG  = string.IsNullOrWhiteSpace(aentity.AUDITSIGNIMG) ? "" : aentity.AUDITSIGNIMG.ToString().Replace("../..", "");
            if (null != mpcEntity)
            {
                aidEntity.REMARK = (mpcEntity.AUTOID.Value - 1).ToString(); //备注 存流程的顺序号
            }
            else
            {
                aidEntity.REMARK = "7";
            }
            aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity);
            #endregion

            #region  //保存日常考核
            //审核通过
            if (aentity.AUDITRESULT == "0")
            {
                //0表示流程未完成,1表示流程结束
                if (null != mpcEntity)
                {
                    entity.FlowDept     = mpcEntity.CHECKDEPTID;
                    entity.FlowDeptName = mpcEntity.CHECKDEPTNAME;
                    entity.FlowRole     = mpcEntity.CHECKROLEID;
                    entity.FlowRoleName = mpcEntity.CHECKROLENAME;
                    entity.IsSaved      = 1;
                    entity.IsOver       = 0;
                    entity.FlowID       = mpcEntity.ID;
                    entity.FlowName     = mpcEntity.CHECKDEPTNAME + "审核中";
                }
                else
                {
                    entity.FlowDept     = "";
                    entity.FlowDeptName = "";
                    entity.FlowRole     = "";
                    entity.FlowRoleName = "";
                    entity.IsSaved      = 1;
                    entity.IsOver       = 1;
                    entity.FlowName     = "";
                }
            }
            else //审核不通过
            {
                entity.FlowDept     = "";
                entity.FlowDeptName = "";
                entity.FlowRole     = "";
                entity.FlowRoleName = "";
                entity.IsOver       = 0; //处于登记阶段
                entity.IsSaved      = 0; //是否完成状态赋值为未完成
                entity.FlowName     = "";
                entity.FlowID       = "";
            }
            //更新日常考核基本状态信息
            dailyexaminebll.SaveForm(keyValue, entity);
            #endregion

            #region    //审核不通过
            if (aentity.AUDITRESULT == "1")
            {
                //添加历史记录
                HistorydailyexamineEntity hsentity = new HistorydailyexamineEntity();
                hsentity.CreateUserId       = entity.CreateUserId;
                hsentity.CreateUserDeptCode = entity.CreateUserDeptCode;
                hsentity.CreateUserOrgCode  = entity.CreateUserOrgCode;
                hsentity.CreateDate         = entity.CreateDate;
                hsentity.CreateUserName     = entity.CreateUserName;
                hsentity.CreateUserDeptId   = entity.CreateUserDeptId;
                hsentity.ModifyDate         = entity.ModifyDate;
                hsentity.ModifyUserId       = entity.ModifyUserId;
                hsentity.ModifyUserName     = entity.ModifyUserName;
                hsentity.ExamineCode        = entity.ExamineCode;
                hsentity.ExamineDept        = entity.ExamineDept;
                hsentity.ExamineDeptId      = entity.ExamineDeptId;
                hsentity.ExamineToDeptId    = entity.ExamineToDeptId;
                hsentity.ExamineToDept      = entity.ExamineToDept;
                hsentity.ExamineType        = entity.ExamineType; //关联ID
                hsentity.ExamineMoney       = entity.ExamineMoney;
                hsentity.ExaminePerson      = entity.ExaminePerson;
                hsentity.ExaminePersonId    = entity.ExaminePersonId; //关联ID
                hsentity.ExamineTime        = entity.ExamineTime;
                hsentity.ExamineContent     = entity.ExamineContent;
                hsentity.ExamineBasis       = entity.ExamineBasis;
                hsentity.Remark             = entity.Remark;
                hsentity.ContractId         = entity.Id;//关联ID
                hsentity.IsSaved            = 2;
                hsentity.IsOver             = entity.IsOver;
                hsentity.FlowDeptName       = entity.FlowDeptName;
                hsentity.FlowDept           = entity.FlowDept;
                hsentity.FlowRoleName       = entity.FlowRoleName;
                hsentity.FlowRole           = entity.FlowRole;
                hsentity.FlowName           = entity.FlowName;
                hsentity.Project            = entity.Project;
                hsentity.ProjectId          = entity.ProjectId;
                hsentity.Id = "";

                historydailyexaminebll.SaveForm(hsentity.Id, hsentity);

                //获取当前业务对象的所有审核记录
                var shlist = aptitudeinvestigateauditbll.GetAuditList(keyValue);
                //批量更新审核记录关联ID
                foreach (AptitudeinvestigateauditEntity mode in shlist)
                {
                    mode.APTITUDEID = hsentity.Id; //对应新的ID
                    aptitudeinvestigateauditbll.SaveForm(mode.ID, mode);
                }
                //批量更新附件记录关联ID
                var flist = fileinfobll.GetImageListByObject(keyValue);
                foreach (FileInfoEntity fmode in flist)
                {
                    fmode.RecId = hsentity.Id; //对应新的ID
                    fileinfobll.SaveForm("", fmode);
                }
            }
            #endregion

            return(Success("操作成功!"));
        }
Exemplo n.º 3
0
        public ActionResult GetImageListJsonByFolder(string folderId)
        {
            var data = fileInfoBLL.GetImageListByObject(folderId);

            return(ToJsonResult(data));
        }
Exemplo n.º 4
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));
            }
        }