/// <summary>
        /// 获取事故事件处理信息审核流程图
        /// </summary>
        /// <param name="keyValue"></param>
        /// <returns></returns>
        public List <CheckFlowData> GetAppFlowList(string keyValue)
        {
            List <CheckFlowData>   nodelist = new List <CheckFlowData>();
            Operator               user     = ERCHTMS.Code.OperatorProvider.Provider.Current();
            PowerplanthandleEntity entity   = GetEntity(keyValue);
            string    deptname = DepartmentService.GetEntityByCode(entity.CreateUserDeptCode).FullName;
            string    deptid   = DepartmentService.GetEntityByCode(entity.CreateUserDeptCode).DepartmentId;
            DataTable dt       = GetAuditInfo(keyValue, "(事故事件处理记录)审核");

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    //审核记录
                    if (dr["auditdept"] != null && !string.IsNullOrEmpty(dr["auditdept"].ToString()))
                    {
                        CheckFlowData checkdata = new CheckFlowData();
                        DateTime      auditdate;
                        DateTime.TryParse(dr["audittime"].ToString(), out auditdate);
                        checkdata.auditdate     = auditdate.ToString("yyyy-MM-dd HH:mm");
                        checkdata.auditdeptname = dr["auditdept"].ToString();
                        checkdata.auditusername = dr["auditpeople"].ToString();
                        checkdata.auditstate    = dr["auditresult"].ToString() == "0" ? "同意" : "不同意";
                        checkdata.isapprove     = "1";
                        checkdata.isoperate     = "0";
                        nodelist.Add(checkdata);
                    }
                    else
                    {
                        CheckFlowData checkdata = new CheckFlowData();
                        checkdata.auditdate = "";
                        //部门,人员
                        var    checkDeptId = dr["checkdeptid"].ToString();
                        var    checkremark = dr["remark"].ToString();
                        string type        = checkremark != "1" ? "0" : "1";
                        if (checkDeptId == "-3" || checkDeptId == "-1")
                        {
                            checkDeptId             = deptid;
                            checkdata.auditdeptname = deptname;
                        }
                        else
                        {
                            checkdata.auditdeptname = dr["checkdeptname"].ToString();
                        }
                        string userNames = GetUserName(checkDeptId, dr["checkrolename"].ToString()).Split('|')[0];

                        checkdata.auditusername = !string.IsNullOrEmpty(userNames) ? userNames : "无";
                        checkdata.auditremark   = "";
                        checkdata.isapprove     = "0";
                        checkdata.isoperate     = entity.FlowId == dr["id"].ToString() ? "1" : "0";
                        checkdata.auditstate    = "审核(批)中";
                        nodelist.Add(checkdata);
                    }
                }
            }
            return(nodelist);
        }
        /// <summary>
        /// 获取单条事故事件处理信息完整流程图
        /// </summary>
        /// <param name="keyValue"></param>
        /// <returns></returns>
        public List <CheckFlowData> GetAppFullFlowList(string keyValue)
        {
            List <CheckFlowData>         nodelist = new List <CheckFlowData>();
            Operator                     user     = ERCHTMS.Code.OperatorProvider.Provider.Current();
            PowerplanthandledetailEntity entity   = powerplanthandledetailservice.GetEntity(keyValue);
            string    deptname = DepartmentService.GetEntityByCode(entity.CreateUserDeptCode).FullName;
            string    deptid   = DepartmentService.GetEntityByCode(entity.CreateUserDeptCode).DepartmentId;
            DataTable dt       = GetAuditInfo(entity.PowerPlantHandleId, "(事故事件处理记录)审核");

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    //审核记录
                    if (dr["auditdept"] != null && !string.IsNullOrEmpty(dr["auditdept"].ToString()))
                    {
                        CheckFlowData checkdata = new CheckFlowData();
                        DateTime      auditdate;
                        DateTime.TryParse(dr["audittime"].ToString(), out auditdate);
                        checkdata.auditdate     = auditdate.ToString("yyyy-MM-dd HH:mm");
                        checkdata.auditdeptname = dr["auditdept"].ToString();
                        checkdata.auditusername = dr["auditpeople"].ToString();
                        checkdata.auditstate    = dr["auditresult"].ToString() == "0" ? "同意" : "不同意";
                        checkdata.isapprove     = "1";
                        checkdata.isoperate     = "0";
                        nodelist.Add(checkdata);
                    }
                    else
                    {
                        CheckFlowData checkdata = new CheckFlowData();
                        checkdata.auditdate = "";
                        //部门,人员
                        var    checkDeptId = dr["checkdeptid"].ToString();
                        var    checkremark = dr["remark"].ToString();
                        string type        = checkremark != "1" ? "0" : "1";
                        if (checkDeptId == "-3" || checkDeptId == "-1")
                        {
                            checkDeptId             = deptid;
                            checkdata.auditdeptname = deptname;
                        }
                        else
                        {
                            checkdata.auditdeptname = dr["checkdeptname"].ToString();
                        }
                        string userNames = GetUserName(checkDeptId, dr["checkrolename"].ToString()).Split('|')[0];

                        checkdata.auditusername = !string.IsNullOrEmpty(userNames) ? userNames : "无";
                        checkdata.auditremark   = "";
                        checkdata.isapprove     = "0";
                        checkdata.isoperate     = entity.FlowId == dr["id"].ToString() ? "1" : "0";
                        checkdata.auditstate    = "审核(批)中";
                        nodelist.Add(checkdata);
                    }
                }
            }

            #region 签收节点
            Boolean HaveSignNode = entity.IsAssignPerson == "1" ? true : false;
            if (entity.IsAssignPerson == "1")
            {
                //审核记录
                if (!string.IsNullOrEmpty(entity.RealSignPersonName))
                {
                    CheckFlowData checkdata = new CheckFlowData();
                    DateTime      auditdate;
                    DateTime.TryParse(entity.RealSignDate.ToString(), out auditdate);
                    checkdata.auditdate     = auditdate.ToString("yyyy-MM-dd HH:mm");
                    checkdata.auditdeptname = entity.RealSignPersonDept;
                    checkdata.auditusername = entity.RealSignPersonName;
                    checkdata.auditstate    = "已签收";
                    checkdata.isapprove     = "1";
                    checkdata.isoperate     = "0";
                    nodelist.Add(checkdata);
                }
                else
                {
                    CheckFlowData checkdata = new CheckFlowData();
                    checkdata.auditdate     = "";
                    checkdata.auditdeptname = entity.SignDeptName;
                    checkdata.auditusername = entity.SignPersonName;
                    checkdata.auditremark   = "";
                    checkdata.isapprove     = "0";
                    checkdata.isoperate     = "1";
                    checkdata.auditstate    = "签收中";
                    nodelist.Add(checkdata);
                }
            }
            #endregion
            #region 整改节点
            if (!string.IsNullOrEmpty(entity.RectificationDutyPerson))
            {
                PowerplantreformEntity reformentity = PowerplantreformService.GetList("").Where(t => t.PowerPlantHandleDetailId == keyValue && t.Disable == 0).FirstOrDefault();
                if (reformentity != null)
                {
                    CheckFlowData checkdata = new CheckFlowData();
                    DateTime      auditdate;
                    DateTime.TryParse(reformentity.CreateDate.ToString(), out auditdate);
                    checkdata.auditdate     = auditdate.ToString("yyyy-MM-dd HH:mm");
                    checkdata.auditdeptname = DepartmentService.GetEntityByCode(reformentity.CreateUserDeptCode).FullName;
                    checkdata.auditusername = reformentity.RectificationPerson;
                    checkdata.auditstate    = "已整改";
                    checkdata.isapprove     = "1";
                    checkdata.isoperate     = "0";
                    nodelist.Add(checkdata);
                }
                else
                {
                    CheckFlowData checkdata = new CheckFlowData();
                    checkdata.auditdate = "";

                    string               approveuserid              = entity.RectificationDutyPersonId;
                    string[]             accounts                   = UserService.GetUserTable(approveuserid.Split(',')).AsEnumerable().Select(e => e.Field <string>("ACCOUNT")).ToArray();
                    string               accountstr                 = accounts.Length > 0 ? string.Join(",", accounts) + "," : "";
                    TransferrecordEntity transfer                   = TransferrecordService.GetList(t => t.RecId == entity.Id && t.Disable == 0).FirstOrDefault();
                    string               outtransferuseraccount     = transfer == null ? "" : transfer.OutTransferUserAccount; //转交申请人
                    string               intransferuseraccount      = transfer == null ? "" : transfer.InTransferUserAccount;  //转交接收人
                    string[]             outtransferuseraccountlist = outtransferuseraccount.Split(',');
                    string[]             intransferuseraccountlist  = intransferuseraccount.Split(',');
                    foreach (var item in intransferuseraccountlist)
                    {
                        if (!item.IsEmpty() && !accountstr.Contains(item + ","))
                        {
                            accountstr += (item + ",");//将转交接收人加入审核账号中
                        }
                    }
                    foreach (var item in outtransferuseraccountlist)
                    {
                        if (!item.IsEmpty() && accountstr.Contains(item + ","))
                        {
                            accountstr = accountstr.Replace(item + ",", "");//将转交申请人从审核账号中移除
                        }
                    }

                    DataTable dtuser    = UserService.GetUserTable(accountstr.Split(','));
                    string[]  usernames = dtuser.AsEnumerable().Select(d => d.Field <string>("realname")).ToArray();
                    string[]  deptnames = dtuser.AsEnumerable().Select(d => d.Field <string>("deptname")).ToArray().GroupBy(t => t).Select(p => p.Key).ToArray();
                    checkdata.auditusername = usernames.Length > 0 ? string.Join(",", usernames) : "无";
                    checkdata.auditdeptname = deptnames.Length > 0 ? string.Join(",", deptnames) : "无";
                    checkdata.auditremark   = "";
                    checkdata.isapprove     = "0";
                    checkdata.isoperate     = "1";
                    checkdata.auditstate    = "整改中";
                    nodelist.Add(checkdata);
                }
                #region  事故事件验收节点

                if (reformentity != null)
                {
                    DataTable dtCheckNodes = GetCheckInfo(keyValue, "事故事件处理记录-验收");
                    if (dtCheckNodes != null && dtCheckNodes.Rows.Count > 0)
                    {
                        for (int j = 0; j < dtCheckNodes.Rows.Count; j++)
                        {
                            DataRow drtemp = dtCheckNodes.Rows[j];
                            //审核记录
                            if (drtemp["auditdept"] != null && !string.IsNullOrEmpty(drtemp["auditdept"].ToString()))
                            {
                                CheckFlowData checkdata = new CheckFlowData();
                                DateTime      auditdate;
                                DateTime.TryParse(drtemp["audittime"].ToString(), out auditdate);
                                checkdata.auditdate     = auditdate.ToString("yyyy-MM-dd HH:mm");
                                checkdata.auditdeptname = drtemp["auditdept"].ToString();
                                checkdata.auditusername = drtemp["auditpeople"].ToString();
                                checkdata.auditstate    = drtemp["auditresult"].ToString() == "0" ? "通过" : "不通过";
                                checkdata.auditremark   = "";
                                checkdata.isapprove     = "1";
                                checkdata.isoperate     = "0";
                                nodelist.Add(checkdata);
                            }
                            else
                            {
                                CheckFlowData checkdata = new CheckFlowData();
                                checkdata.auditdate = "";
                                //部门,人员
                                var    checkDeptId = drtemp["checkdeptid"].ToString();
                                var    checkremark = drtemp["remark"].ToString();
                                string type        = checkremark != "1" ? "0" : "1";
                                if (checkDeptId == "-3" || checkDeptId == "-1")
                                {
                                    checkDeptId             = entity.RealReformDeptId;
                                    checkdata.auditdeptname = entity.RealReformDept;
                                }
                                else
                                {
                                    checkdata.auditdeptname = drtemp["checkdeptname"].ToString();
                                }
                                string userNames = GetUserName(checkDeptId, drtemp["checkrolename"].ToString()).Split('|')[0];

                                checkdata.auditusername = !string.IsNullOrEmpty(userNames) ? userNames : "无";
                                checkdata.auditremark   = "";
                                checkdata.isapprove     = "0";
                                checkdata.isoperate     = entity.FlowId == drtemp["flowid"].ToString() ? "1" : "0";
                                checkdata.auditstate    = "验收中";
                                nodelist.Add(checkdata);
                            }
                        }
                    }
                }
                #endregion
            }
            #endregion
            return(nodelist);
        }
Example #3
0
        public List <CheckFlowData> GetAppFlowList(string keyValue, string modulename)
        {
            List <CheckFlowData> nodelist = new List <CheckFlowData>();
            Operator             user     = ERCHTMS.Code.OperatorProvider.Provider.Current();
            LifthoistjobEntity   entity   = GetEntity(keyValue);
            DataTable            dt       = GetCheckInfo(keyValue, modulename, user);

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    //审核记录
                    if (dr["auditdeptname"] != null && !string.IsNullOrEmpty(dr["auditdeptname"].ToString()))
                    {
                        CheckFlowData checkdata = new CheckFlowData();
                        DateTime      auditdate;
                        DateTime.TryParse(dr["auditdate"].ToString(), out auditdate);
                        checkdata.auditdate     = auditdate.ToString("yyyy-MM-dd HH:mm");
                        checkdata.auditdeptname = dr["auditdeptname"].ToString();
                        checkdata.auditusername = dr["auditusername"].ToString();
                        checkdata.auditstate    = dr["auditstate"].ToString() == "1" ? "同意" : "不同意";
                        checkdata.auditremark   = dr["auditremark"].ToString() != "确认step" ? dr["auditremark"].ToString() : "";
                        checkdata.isapprove     = "1";
                        checkdata.isoperate     = "0";
                        nodelist.Add(checkdata);
                    }
                    else
                    {
                        CheckFlowData checkdata = new CheckFlowData();
                        checkdata.auditdate = "";
                        string executedept = string.Empty;
                        highriskcommonapplyservice.GetExecutedept(entity.WORKDEPTTYPE.ToString(), entity.CONSTRUCTIONUNITID, entity.ENGINEERINGID, out executedept);                                             //获取执行部门
                        string createdetpid           = departmentservice.GetEntityByCode(entity.CREATEUSERDEPTCODE).IsEmpty() ? "" : departmentservice.GetEntityByCode(entity.CREATEUSERDEPTCODE).DepartmentId; //获取创建部门ID
                        string outsouringengineerdept = string.Empty;
                        highriskcommonapplyservice.GetOutsouringengineerDept(entity.CONSTRUCTIONUNITID, out outsouringengineerdept);
                        string   accountstr                 = manypowercheckservice.GetApproveUserAccount(dr["id"].ToString(), entity.ID, "", entity.SPECIALTYTYPE, executedept, outsouringengineerdept, createdetpid, "", ""); //获取审核人账号
                        string   outtransferuseraccount     = dr["outtransferuseraccount"].IsEmpty() ? "" : dr["outtransferuseraccount"].ToString();                                                                            //转交申请人
                        string   intransferuseraccount      = dr["intransferuseraccount"].IsEmpty() ? "" : dr["intransferuseraccount"].ToString();                                                                              //转交接收人
                        string[] outtransferuseraccountlist = outtransferuseraccount.Split(',');
                        string[] intransferuseraccountlist  = intransferuseraccount.Split(',');
                        foreach (var item in intransferuseraccountlist)
                        {
                            if (!item.IsEmpty() && !accountstr.Contains(item + ","))
                            {
                                accountstr += (item + ",");//将转交接收人加入审核账号中
                            }
                        }
                        foreach (var item in outtransferuseraccountlist)
                        {
                            if (!item.IsEmpty() && accountstr.Contains(item + ","))
                            {
                                accountstr = accountstr.Replace(item + ",", "");//将转交申请人从审核账号中移除
                            }
                        }

                        DataTable dtuser    = userservice.GetUserTable(accountstr.Split(','));
                        string[]  usernames = dtuser.AsEnumerable().Select(d => d.Field <string>("realname")).ToArray();
                        string[]  deptnames = dtuser.AsEnumerable().Select(d => d.Field <string>("deptname")).ToArray().GroupBy(t => t).Select(p => p.Key).ToArray();
                        checkdata.auditdeptname = deptnames.Length > 0 ? string.Join(",", deptnames) : "无";
                        checkdata.auditusername = usernames.Length > 0 ? string.Join(",", usernames) : "无";
                        checkdata.auditremark   = "";
                        checkdata.isapprove     = "0";
                        if (entity.AUDITSTATE == 2)
                        {
                            checkdata.isoperate = "0";
                        }
                        else
                        {
                            checkdata.isoperate = dr["id"].ToString() == entity.FLOWID ? "1" : "0";
                        }
                        if (checkdata.isoperate == "1")
                        {
                            if (dr["flowname"].ToString().Contains("确认"))
                            {
                                checkdata.auditstate = "确认中";
                            }
                            else
                            {
                                checkdata.auditstate = "审核(批)中";
                            }
                        }
                        else
                        {
                            checkdata.auditstate = "";
                        }
                        nodelist.Add(checkdata);
                    }
                }
            }
            return(nodelist);
        }