Example #1
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, JobApprovalFormEntity entity, List <ManyPowerCheckEntity> data, string arr)
        {
            try
            {
                service.SaveForm(keyValue, entity, data, arr);
                if (entity.IsSubmit == 1)
                {
                    UserBLL userbll = new UserBLL();
                    DangerousJobFlowDetailEntity flow = DangerousJobFlowDetailIService.GetList().Where(t => t.BusinessId == entity.Id && t.Status == 0).FirstOrDefault();
                    string    userids = DangerousJobFlowDetailIService.GetCurrentStepUser(entity.Id, flow.Id);
                    DataTable dt      = userbll.GetUserTable(userids.Split(','));
                    entity = service.GetEntity(entity.Id);
                    entity.JobLevelName = dataitemdetailbll.GetItemName("DangerousJobCheck", entity.JobLevel);

                    JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("realname")).ToArray()), "WXZY001", entity.JobLevelName + "审批单(" + entity.JobTypeName + ")申请待您审批,请您及时处理。", entity.CreateUserName + "于" + entity.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + entity.JobLevelName + "审批单(" + entity.JobTypeName + ")需要您进行审批,请您及时处理。", entity.Id);
                }
                //if (entity.FlowState == "1")
                //{
                //    UserBLL userbll = new UserBLL();
                //    UserEntity userEntity = userbll.GetEntity(entity.DutyPersonId);//获取责任人用户信息
                //    JPushApi.PushMessage(userEntity.Account, entity.DutyPerson, "GZDB001", "例行安全工作", entity.Id);
                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        private void SendMessage(NosaworksEntity entity)
        {
            var dList = entity.DutyUserId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            var sList = new string[] {};

            if (!entity.SubmitUserId.IsNullOrWhiteSpace())
            {
                sList = entity.SubmitUserId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (dList.Length > sList.Length)
            {
                var           user  = ERCHTMS.Code.OperatorProvider.Provider.Current();
                var           eList = dList.Except(sList);
                var           aList = new UserBLL().GetListForCon(x => eList.Contains(x.UserId));
                MessageEntity msg   = new MessageEntity()
                {
                    Id           = Guid.NewGuid().ToString(),
                    UserId       = string.Join(",", aList.Select(x => x.Account)),
                    UserName     = string.Join(",", aList.Select(x => x.RealName)),
                    SendTime     = DateTime.Now,
                    SendUser     = user.Account,
                    SendUserName = entity.CREATEUSERNAME,
                    Title        = "NOSA工作成果上传提醒",
                    Content      = string.Format("您有一项“{0}”的NOSA工作成果未上传,请即时上传。", entity.Name),
                    Category     = "其它"
                };
                if (new MessageBLL().SaveForm("", msg))
                {
                    JPushApi.PublicMessage(msg);
                }
            }
        }
 /// <summary>
 /// 安全风险审批单审核保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主表主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void ApprovalFormCheckSaveForm(string keyValue, DangerousJobFlowDetailEntity entity)
 {
     try
     {
         service.ApprovalFormCheckSaveForm(keyValue, entity);
         JobApprovalFormBLL bll     = new JobApprovalFormBLL();
         UserBLL            userbll = new UserBLL();
         var data = bll.GetEntity(keyValue);
         data.JobLevelName = dataitemdetailbll.GetItemName("DangerousJobCheck", data.JobLevel);
         if (data.JobState == 4)//审核不通过
         {
             JPushApi.PushMessage(userbll.GetEntity(data.CreateUserId).Account, data.CreateUserName, "WXZY002", data.JobLevelName + "审批单(" + data.JobTypeName + ")申请审批未通过,请您知晓。", "您于" + data.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + data.JobLevelName + "审批单(" + data.JobTypeName + ")安全证审批未通过,如您还需进行作业,请重新进行申请。", data.Id);
         }
         else if (data.JobState == 1)//下一步审批人
         {
             DangerousJobFlowDetailEntity flow = service.GetList().Where(t => t.BusinessId == keyValue && t.Status == 0).FirstOrDefault();
             string    userids = service.GetCurrentStepUser(keyValue, flow.Id);
             DataTable dt      = userbll.GetUserTable(userids.Split(','));
             JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("realname")).ToArray()), "WXZY001", data.JobLevelName + "审批单(" + data.JobTypeName + ")申请待您审批,请您及时处理。", data.CreateUserName + "于" + data.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + data.JobLevelName + "审批单(" + data.JobTypeName + ")需要您进行审批,请您及时处理。", data.Id);
         }
         else
         {
             //审批通过
             DataTable dt = userbll.GetUserTable((data.CreateUserId + "," + data.JobPersonId).Split(','));
             JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("realname")).ToArray()), "WXZY003", data.JobLevelName + "审批单(" + data.JobTypeName + ")申请已审批通过,请您查收。", "您于" + data.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + data.JobLevelName + "审批单(" + data.JobTypeName + ")已审批通过,请您合理安排作业时间。", data.Id);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        /// <summary>
        /// 变更操作人
        /// </summary>
        /// <param name="keyValue"></param>
        /// <param name="TransferUserName"></param>
        /// <param name="TransferUserAccount"></param>
        /// <param name="TransferUserId"></param>
        public void ExchangeForm(string keyValue, string TransferUserName, string TransferUserAccount, string TransferUserId, Operator user)
        {
            service.ExchangeForm(keyValue, TransferUserName, TransferUserAccount, TransferUserId);

            var entity = service.GetEntity(keyValue);

            JPushApi.PushMessage(TransferUserAccount, TransferUserName, "ZYAQZ003", entity.JobTypeName + "安全证的流程处理人已转交给您,请您及时处理。", entity.JobTypeName + "安全证的流程处理人已由" + user.UserName + "转交给您,请您及时处理。", entity.Id);
            //switch (entity.JobState)
            //{
            //    case 1: //审核中状态更改流程基础表跟流程流转表的审核人信息
            //        JPushApi.PushMessage(TransferUserAccount, TransferUserName, "ZYAQZ003", entity.JobTypeName + "安全证申请待您审批,请您及时处理。", entity.CreateUserName + "于" + entity.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + entity.JobTypeName + "安全证需要您进行审批,请您及时处理。", entity.Id);
            //        break;
            //    case 3: //措施确认中状态
            //        JPushApi.PushMessage(TransferUserAccount, TransferUserName, "ZYAQZ007", entity.JobTypeName + "安全证待您进行安全措施确认,请您及时处理。", entity.CreateUserName + "于" + entity.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + entity.JobTypeName + "安全证需要您进行本部门的安全措施确认,请您及时处理。", entity.Id);
            //        break;
            //    case 4: //停电中状态
            //        JPushApi.PushMessage(TransferUserAccount, TransferUserName, "ZYAQZ008", entity.JobTypeName + "安全证待您进行停电,请您及时处理。", entity.CreateUserName + "于" + entity.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + entity.JobTypeName + "安全证需要您进行停电操作,请您及时处理。", entity.Id);
            //        break;
            //    case 5: //备案中状态
            //        JPushApi.PushMessage(TransferUserAccount, TransferUserName, "ZYAQZ005", entity.JobTypeName + "安全证申请待您备案,请您及时处理。", entity.CreateUserName + "于" + entity.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + entity.JobTypeName + "安全证需要您进行备案,请您及时处理。", entity.Id);
            //        break;
            //    case 6: //验收中状态
            //        JPushApi.PushMessage(TransferUserAccount, TransferUserName, "ZYAQZ004", entity.JobTypeName + "安全证待您进行作业后验收,请您及时处理。", entity.CreateUserName + "于" + entity.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + entity.JobTypeName + "安全证需要您进行作业后验收,请您及时处理。", entity.Id);
            //        break;
            //    case 7: //送电中
            //        JPushApi.PushMessage(TransferUserAccount, TransferUserName, "ZYAQZ010", entity.JobTypeName + "已结束,待您进行送电,请您及时处理。", entity.CreateUserName + "于" + entity.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + entity.JobTypeName + "已结束,需要您进行送电操作,请您及时处理。", entity.Id);
            //        break;
            //    default:
            //        break;
            //}
        }
Example #5
0
        /// <summary>
        /// 发送短消息提醒EHS部门用户上报EHS信息
        /// </summary>
        /// <param name="now">当前时间</param>
        public void SendMessage(DateTime now)
        {
            var deptBll = new DepartmentBLL();
            var listEHS = new DataItemDetailBLL().GetDataItemListByItemCode("'EHSDepartment'").ToList();
            //枚举今日应提醒的上报类型,如:月报、季报、半年报、年报。
            var list = EnumWarTypeOfDay(now);

            foreach (var wType in list)
            {
                foreach (var ehsDepart in listEHS)
                {                                                                 //各电厂的EHS部门,统一发送短消息。
                    var ehsdeptcode = ehsDepart.ItemValue;                        //EHS部门编码
                    var dept        = deptBll.GetDeptOrgInfo(ehsDepart.ItemName); //EHS部门所属机构
                    if (dept != null)
                    {                                                             //ESH所属机构
                        var orgCode = dept.EnCode;
                        var orgName = dept.FullName;
                        var msgBody = GenMessageBody(wType, now, orgName);
                        if (!HasInfo(orgCode, wType, msgBody.Item4) && !ExistMsg(msgBody.Item3))
                        {//未上报,且未发短消息。
                            var msg = GenEntity(msgBody, ehsdeptcode);
                            if (msg != null)
                            {//发送短消息
                                if (new MessageBLL().SaveForm("", msg))
                                {
                                    JPushApi.PublicMessage(msg);
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 发送短消息提醒办公室人员发布新标准体系内容。
        /// </summary>
        /// <param name="entity"></param>
        private void SendMessage(StandardApplyEntity entity)
        {
            //当前用户
            Operator curUser = OperatorProvider.Provider.Current();
            //标准化办公室审核用户
            DataItemModel checkuser = dataitemdetailbll.GetDataItemListByItemCode("'CheckUserAccount'").Where(p => p.ItemName == curUser.OrganizeId).ToList().FirstOrDefault();

            if (checkuser != null)
            {
                var           chkStr      = checkuser.ItemValue.Split(new char[] { '|' });
                var           userAccount = chkStr[0];
                var           officeuser  = new UserBLL().GetUserInfoByAccount(userAccount);
                MessageEntity msg         = new MessageEntity()
                {
                    Id           = Guid.NewGuid().ToString(),
                    UserId       = userAccount,
                    UserName     = officeuser.RealName,
                    SendTime     = DateTime.Now,
                    SendUser     = curUser.Account,
                    SendUserName = curUser.UserName,
                    Title        = "标准文件发布提醒",
                    Content      = string.Format("“{0}”标准修(订)审批流程已完成,请即时发布。", entity.FileName),
                    Category     = "其它"
                };
                if (new MessageBLL().SaveForm("", msg))
                {
                    JPushApi.PublicMessage(msg);
                }
            }
        }
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, JobSafetyCardApplyEntity entity, List <ManyPowerCheckEntity> data, string arr, string arrData)
 {
     try
     {
         service.SaveForm(keyValue, entity, data, arr, arrData);
         entity = GetEntity(keyValue);
         if (entity.IsSubmit == 1)
         {
             UserBLL userbll = new UserBLL();
             if (entity.JobType == "LimitedSpace" || entity.JobType == "EquOverhaulClean")
             {
                 DataTable dt = userbll.GetUserTable(entity.MeasurePersonId.Split(','));
                 JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), entity.MeasurePerson, "ZYAQZ007", entity.JobTypeName + "安全证待您进行安全措施确认,请您及时处理。", entity.CreateUserName + "于" + entity.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + entity.JobTypeName + "安全证需要您进行本部门的安全措施确认,请您及时处理。", entity.Id);
             }
             else
             {
                 DangerousJobFlowDetailEntity flow = DangerousJobFlowDetailIService.GetList().Where(t => t.BusinessId == entity.Id && t.Status == 0).FirstOrDefault();
                 string    userids = DangerousJobFlowDetailIService.GetCurrentStepUser(entity.Id, flow.Id);
                 DataTable dt      = userbll.GetUserTable(userids.Split(','));
                 JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("realname")).ToArray()), "ZYAQZ003", entity.JobTypeName + "安全证申请待您审批,请您及时处理。", entity.CreateUserName + "于" + entity.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + entity.JobTypeName + "安全证需要您进行审批,请您及时处理。", entity.Id);
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #8
0
 /// <summary>
 /// 离场审批
 /// </summary>
 /// <param name="keyValue"></param>
 /// <param name="aentity"></param>
 public void LeaveApprove(string keyValue, LeaveApproveEntity entity, AptitudeinvestigateauditEntity aentity)
 {
     try
     {
         PushMessageData pushdata   = service.LeaveApprove(keyValue, entity, aentity);
         UserEntity      userEntity = userservice.GetEntity(entity.CreateUserId);
         JPushApi.PushMessage(userEntity.Account, userEntity.RealName, pushdata.SendCode, "", "", pushdata.EntityId);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #9
0
        public ActionResult SaveForm(string keyValue, MessageEntity entity)
        {
            Operator currUser = OperatorProvider.Provider.Current();

            entity.SendTime = DateTime.Now;
            //entity.Status += currUser.Account + ",";
            if (messagebll.SaveForm(keyValue, entity))
            {
                JPushApi.PublicMessage(entity);
            }

            return(Success("操作成功。"));
        }
Example #10
0
        public ActionResult sendMess(string objid, string superuserid)
        {
            var getUser = new UserBLL().GetEntity(superuserid);

            if (getUser != null)
            {
                JPushApi.PushMessage(getUser.Account, getUser.RealName, "NosaW001", objid);
                return(Success("提醒成功"));;
            }
            else
            {
                return(Success("提醒失败,确认人员是否存在"));
            }
        }
Example #11
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, SafetyworkfeedbackEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
         SafetyworksuperviseBLL announRes = new SafetyworksuperviseBLL();
         var        sl         = announRes.GetEntity(entity.SuperviseId);
         UserBLL    userbll    = new UserBLL();
         UserEntity userEntity = userbll.GetEntity(sl.SupervisePersonId);//获取督办人用户信息
         JPushApi.PushMessage(userEntity.Account, sl.SupervisePerson, "GZDB002", "例行安全工作", sl.Id);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #12
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, SafetyworksuperviseEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
         if (entity.FlowState == "1")
         {
             UserBLL    userbll    = new UserBLL();
             UserEntity userEntity = userbll.GetEntity(entity.DutyPersonId);//获取责任人用户信息
             JPushApi.PushMessage(userEntity.Account, entity.DutyPerson, "GZDB001", "例行安全工作", entity.Id);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, SuperviseconfirmationEntity entity)
        {
            try
            {
                service.SaveForm(keyValue, entity);

                SafetyworksuperviseBLL announRes = new SafetyworksuperviseBLL();
                var     sl      = announRes.GetEntity(entity.SuperviseId);
                UserBLL userbll = new UserBLL();
                //判断是督办完成还是退回
                if (entity.SuperviseResult == "1")                              //退回
                {
                    UserEntity userEntity = userbll.GetEntity(sl.DutyPersonId); //获取责任人用户信息
                    JPushApi.PushMessage(userEntity.Account, sl.DutyPerson, "GZDB003", "例行安全工作", sl.Id);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #14
0
        public void ExchangeForm(string keyValue, string TransferUserName, string TransferUserAccount, string TransferUserId)
        {
            try
            {
                var entity = service.GetEntity(keyValue);
                service.ExchangeForm(keyValue, TransferUserName, TransferUserAccount, TransferUserId);

                UserBLL userbll = new UserBLL();
                DangerousJobFlowDetailEntity flow = DangerousJobFlowDetailIService.GetList().Where(t => t.BusinessId == entity.Id && t.Status == 0).FirstOrDefault();
                string    userids = DangerousJobFlowDetailIService.GetCurrentStepUser(entity.Id, flow.Id);
                DataTable dt      = userbll.GetUserTable(userids.Split(','));

                entity.JobLevelName = dataitemdetailbll.GetItemName("DangerousJobCheck", entity.JobLevel);

                JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()),
                                     string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("realname")).ToArray()), "WXZY004", "【" + entity.JobLevelName + "】审批单(" + entity.JobTypeName + ")的审批已转交给您,请您及时处理。", "【" + entity.JobLevelName + "】审批单(" + entity.JobTypeName + ")的审批已由【" + entity.CreateUserName + "】转交给您,请您及时处理。", entity.Id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #15
0
        /// <summary>
        /// 保存整改计划对象
        /// </summary>
        /// <param name="keyValue"></param>
        /// <param name="entity"></param>
        public void SaveChangePlan(string keyValue, ChangePlanDetailEntity entity)
        {
            try
            {
                cpservice.SaveForm(keyValue, entity);
                //仅推送一次
                if (string.IsNullOrEmpty(keyValue))
                {
                    HTBaseInfoEntity   bentity  = service.GetEntity(entity.HIDDENID);
                    HTChangeInfoEntity centity  = chservice.GetEntityByHidCode(bentity.HIDCODE);
                    string             pushcode = "YH017"; //整改计划

                    string sql = string.Format(@"select  f.createuser  account, d.realname username,c.encode deptcode ,c.fullname deptname   from bis_htbaseinfo  a   
                                                left join sys_wftbinstance  g on a.id = g.objectid    
                                                left join sys_wftbinstancedetail f on g.currentdetailid = f.id 
                                                left  join base_department c on f.createuserdeptcode= c.encode  
                                                left  join base_user  d on f.createuser =d.account   where a.id='{0}' ", entity.HIDDENID);

                    var dt = service.GetGeneralQueryBySql(sql);


                    string pushaccount = string.Empty; //推送人员账户
                    string pushname    = string.Empty; //推送人员名称
                    string message     = string.Format(@"您好,{0} {1}于{2}针对《{3}》的隐患已提交了整改计划,请您前往隐患台账查看该条隐患的整改计划。",
                                                       centity.CHANGEDUTYDEPARTNAME, centity.CHANGEPERSONNAME, DateTime.Now.ToString("yyyy-MM-dd HH:mm"), bentity.HIDDESCRIBE);

                    if (dt.Rows.Count > 0)
                    {
                        pushaccount = dt.Rows[0]["account"].ToString();
                        pushname    = dt.Rows[0]["username"].ToString();
                    }
                    JPushApi.PushMessage(pushaccount, pushname, pushcode, "整改计划消息", message, entity.HIDDENID);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #16
0
        public ActionResult KeyRemind(string type)
        {
            try
            {
                string personSql = string.Empty;
                switch (type)
                {
                case "1":
                    personSql = string.Format(@"select u.account,u.realname,m.id
                                                                          from base_user u
                                                                         inner join (select distinct m.elementsuperid,m.id from hrs_nosaworkmanager m where to_char(m.month,'yyyy-MM')='{0}' and iscommit='0') m
                                                                            on m.elementsuperid = u.userid ", DateTime.Now.ToString("yyyy-MM"));

                    break;

                case "2":
                    personSql = string.Format(@"select u.account,u.realname,m.id
                                                                          from base_user u
                                                                         inner join (select distinct m.areasuperid,m.id from hrs_nosaareaworksummary m where to_char(m.month,'yyyy-MM')='{0}' and iscommit='0') m
                                                                            on m.areasuperid = u.userid ", DateTime.Now.ToString("yyyy-MM"));
                    break;

                default:
                    break;
                }
                DataTable dt = worksummary.GetTable(personSql);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    JPushApi.PushMessage(dt.Rows[i]["account"].ToString(), dt.Rows[i]["realname"].ToString(), "NosaW001", dt.Rows[i]["id"].ToString());
                }
                return(Success("提醒成功"));
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
 /// <summary>
 /// 审核保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主表主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void CheckSaveForm(string keyValue, DangerousJobFlowDetailEntity entity)
 {
     try
     {
         service.CheckSaveForm(keyValue, entity);
         JobSafetyCardApplyBLL bll = new JobSafetyCardApplyBLL();
         UserBLL userbll           = new UserBLL();
         var     data = bll.GetEntity(keyValue);
         if (data.JobState == 2)//审核不通过
         {
             JPushApi.PushMessage(userbll.GetEntity(data.CreateUserId).Account, data.CreateUserName, "ZYAQZ002", data.JobTypeName + "安全证申请审批未通过,请您知晓。", "您于" + data.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + data.JobTypeName + "安全证审批未通过,如您还需进行作业,请重新进行申请。", data.Id);
         }
         else if (data.JobState == 1)//下一步审批人
         {
             DangerousJobFlowDetailEntity flow = service.GetList().Where(t => t.BusinessId == keyValue && t.Status == 0).FirstOrDefault();
             string    userids = service.GetCurrentStepUser(keyValue, flow.Id);
             DataTable dt      = userbll.GetUserTable(userids.Split(','));
             JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("realname")).ToArray()), "ZYAQZ003", data.JobTypeName + "安全证申请待您审批,请您及时处理。", data.CreateUserName + "于" + data.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + data.JobTypeName + "安全证需要您进行审批,请您及时处理。", data.Id);
         }
         else
         {
             //审批通过
             DataTable dt = userbll.GetUserTable((data.CreateUserId + "," + data.JobPersonId).Split(','));
             JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("realname")).ToArray()), "ZYAQZ001", data.JobTypeName + "安全证申请已审批通过,请您查收。", "您于" + data.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + data.JobTypeName + "安全证已审批通过,请您合理安排作业时间。", data.Id);
             if (data.JobType == "Digging") //动土作业审批通过进行到备案状态 需要发送待备案消息
             {
                 DataTable dt1 = userbll.GetUserTable(data.RecordsPersonId.Split(','));
                 JPushApi.PushMessage(string.Join(",", dt1.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), data.RecordsPerson, "ZYAQZ005", data.JobTypeName + "安全证申请待您备案,请您及时处理。", data.CreateUserName + "于" + data.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + data.JobTypeName + "安全证需要您进行备案,请您及时处理。", data.Id);
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 private void SendMessage(NosatrafilesEntity entity)
 {
     if (!entity.MsgUserId.IsNullOrWhiteSpace())
     {
         var           user  = ERCHTMS.Code.OperatorProvider.Provider.Current();
         var           aList = new UserBLL().GetListForCon(x => entity.MsgUserId.Contains(x.UserId)).Select(x => x.Account);
         MessageEntity msg   = new MessageEntity()
         {
             Id           = Guid.NewGuid().ToString(),
             UserId       = string.Join(",", aList),
             UserName     = entity.MsgUserName,
             SendTime     = DateTime.Now,
             SendUser     = user.Account,
             SendUserName = entity.CREATEUSERNAME,
             Title        = "新的NOSA培训文件提醒",
             Content      = string.Format("您有新的NOSA培训文件“{0}”,请即时查阅。", entity.FileName),
             Category     = "其它"
         };
         if (new MessageBLL().SaveForm("", msg))
         {
             JPushApi.PublicMessage(msg);
         }
     }
 }
Example #19
0
        public object SaveOrCommitData()
        {
            try
            {
                string  res       = HttpContext.Current.Request["json"];
                dynamic dy        = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  userId    = dy.userid;
                string  deleteids = dy.data.deleteids; //删除附件id集合
                OperatorProvider.AppUserId = userId;   //设置当前用户
                var user = ERCHTMS.Code.OperatorProvider.Provider.Current();
                //消息实体
                string messageentity = JsonConvert.SerializeObject(dy.data.messageentity);
                var    entity        = JsonConvert.DeserializeObject <MessageEntity>(messageentity);

                //保存成功之后推送消息
                if (messagebll.SaveForm(entity.Id, entity))
                {
                    JPushApi.PublicMessage(entity);
                }
                string webUrl = new DataItemDetailBLL().GetItemValue("imgUrl");
                //处理附件
                if (!string.IsNullOrEmpty(deleteids))
                {
                    DeleteFile(deleteids);
                }
                HttpFileCollection files = HttpContext.Current.Request.Files;
                if (files.Count > 0)
                {
                    for (int i = 0; i < files.AllKeys.Length; i++)
                    {
                        HttpPostedFile file = files[i];
                        //原始文件名
                        string fileName       = System.IO.Path.GetFileName(file.FileName);
                        long   filesize       = file.ContentLength;
                        string FileEextension = Path.GetExtension(fileName);
                        string fileGuid       = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + Guid.NewGuid().ToString();
                        string dir            = new DataItemDetailBLL().GetItemValue("imgPath") + "\\Resource\\Upfile";
                        string newFileName    = fileGuid + FileEextension;
                        string newFilePath    = dir + "\\" + newFileName;
                        if (!Directory.Exists(dir))
                        {
                            Directory.CreateDirectory(dir);
                        }

                        FileInfoEntity fileInfoEntity = new FileInfoEntity();
                        if (!System.IO.File.Exists(newFilePath))
                        {
                            //保存文件
                            file.SaveAs(newFilePath);
                            //文件信息写入数据库
                            fileInfoEntity.Create();
                            fileInfoEntity.FileId         = fileGuid;
                            fileInfoEntity.RecId          = entity.Id;
                            fileInfoEntity.FileName       = fileName;
                            fileInfoEntity.FilePath       = "~/Resource/Upfile/" + newFileName;
                            fileInfoEntity.FileSize       = (Math.Round(decimal.Parse(filesize.ToString()) / decimal.Parse("1024"), 2)).ToString();//文件大小(kb)
                            fileInfoEntity.FileExtensions = FileEextension;
                            fileInfoEntity.FileType       = FileEextension.TrimStart('.');
                            FileInfoBLL fileInfoBLL = new FileInfoBLL();
                            fileInfoBLL.SaveForm("", fileInfoEntity);
                        }
                    }
                }
                return(new { code = 0, count = 0, info = "操作成功" });
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = ex.Message });
            }
        }
Example #20
0
        public ActionResult SubmitAppForm(string keyValue, string state, string recordData, IntromissionEntity entity, AptitudeinvestigateauditEntity aentity)
        {
            int noDoneCount = 0; //未完成个数

            bool isUseSetting = true;

            int isBack = 0;

            string newKeyValue = string.Empty;

            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

            string status = "";
            //更改申请信息状态
            ManyPowerCheckEntity mpcEntity = peoplereviewbll.CheckAuditPower(curUser, out status, "入厂许可审查", entity.OUTENGINEERID, false, entity.FLOWID);


            JArray arr = new JArray();

            if (!recordData.IsEmpty())
            {
                arr = (JArray)JsonConvert.DeserializeObject(recordData);
            }

            //审查状态下更新审查内容
            if (state == "1")
            {
                //只更新审查内容
                for (int i = 0; i < arr.Count(); i++)
                {
                    string id       = arr[i]["id"].ToString();       //主键
                    string result   = arr[i]["result"].ToString();   //结果
                    string people   = arr[i]["people"].ToString();   //选择的人员
                    string peopleid = arr[i]["peopleid"].ToString(); //选择的人员
                    string signpic  = string.IsNullOrWhiteSpace(arr[i]["signpic"].ToString()) ? "" : HttpUtility.UrlDecode(arr[i]["signpic"].ToString()).Replace("../..", "");
                    if (!string.IsNullOrEmpty(id))
                    {
                        var scEntity = investigatedtrecordbll.GetEntity(id); //审查内容项
                        scEntity.INVESTIGATERESULT = result;
                        if (result == "未完成")
                        {
                            noDoneCount += 1;
                        }                                          //存在未完成的则累加
                        scEntity.INVESTIGATEPEOPLE   = people;
                        scEntity.INVESTIGATEPEOPLEID = peopleid;
                        scEntity.SIGNPIC             = HttpUtility.UrlDecode(signpic);
                        //更新当前流程进行中的审查内容
                        investigatedtrecordbll.SaveForm(id, scEntity);
                    }
                }
                //退回操作(审查退回)
                if (noDoneCount > 0)
                {
                    entity.FLOWDEPT         = " ";
                    entity.FLOWDEPTNAME     = " ";
                    entity.FLOWROLE         = " ";
                    entity.FLOWROLENAME     = " ";
                    entity.FLOWID           = " ";
                    entity.INVESTIGATESTATE = "0"; //更改状态为登记状态
                    entity.FLOWNAME         = "";

                    isBack = 1; //审查退回
                    var applyUser = new UserBLL().GetEntity(entity.APPLYPEOPLEID);
                    if (applyUser != null)
                    {
                        JPushApi.PushMessage(applyUser.Account, entity.CREATEUSERNAME, "WB012", entity.ID);
                    }
                    //  AddBackData(keyValue, out newKeyValue);
                }
                else
                {
                    if (null != mpcEntity)
                    {
                        entity.FLOWDEPT     = mpcEntity.CHECKDEPTID;
                        entity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME;
                        entity.FLOWROLE     = mpcEntity.CHECKROLEID;
                        entity.FLOWROLENAME = mpcEntity.CHECKROLENAME;
                        entity.FLOWID       = mpcEntity.ID;
                        DataTable dt          = new UserBLL().GetUserAccountByRoleAndDept(curUser.OrganizeId, mpcEntity.CHECKDEPTID, mpcEntity.CHECKROLENAME);
                        var       userAccount = dt.Rows[0]["account"].ToString();
                        var       userName    = dt.Rows[0]["realname"].ToString();
                        JPushApi.PushMessage(userAccount, userName, "WB013", entity.ID);
                    }
                    entity.FLOWNAME         = "审核中";
                    entity.INVESTIGATESTATE = "2"; //更改状态为审核
                }
            }
            else
            {
                //同意进行下一步
                if (aentity.AUDITRESULT == "0")
                {
                    //下一步流程不为空
                    if (null != mpcEntity)
                    {
                        entity.FLOWDEPT     = mpcEntity.CHECKDEPTID;
                        entity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME;
                        entity.FLOWROLE     = mpcEntity.CHECKROLEID;
                        entity.FLOWROLENAME = mpcEntity.CHECKROLENAME;
                        entity.FLOWID       = mpcEntity.ID;
                        DataTable dt          = new UserBLL().GetUserAccountByRoleAndDept(curUser.OrganizeId, mpcEntity.CHECKDEPTID, mpcEntity.CHECKROLENAME);
                        var       userAccount = dt.Rows[0]["account"].ToString();
                        var       userName    = dt.Rows[0]["realname"].ToString();
                        JPushApi.PushMessage(userAccount, userName, "WB013", entity.ID);
                    }
                    else
                    {
                        entity.FLOWDEPT         = " ";
                        entity.FLOWDEPTNAME     = " ";
                        entity.FLOWROLE         = " ";
                        entity.FLOWROLENAME     = " ";
                        entity.FLOWID           = " ";
                        entity.FLOWNAME         = "已完结";
                        entity.INVESTIGATESTATE = "3"; //更改状态为完结状态
                    }

                    //添加审核记录
                    aentity.APTITUDEID   = keyValue; //关联id
                    aentity.AUDITSIGNIMG = HttpUtility.UrlDecode(aentity.AUDITSIGNIMG);
                    aentity.AUDITSIGNIMG = string.IsNullOrWhiteSpace(aentity.AUDITSIGNIMG) ? "" : aentity.AUDITSIGNIMG.ToString().Replace("../..", "");
                    aptitudeinvestigateauditbll.SaveForm("", aentity);
                }
                else  //退回到申请人 (审核退回)
                {
                    entity.FLOWDEPT         = " ";
                    entity.FLOWDEPTNAME     = " ";
                    entity.FLOWROLE         = " ";
                    entity.FLOWROLENAME     = " ";
                    entity.FLOWID           = " ";
                    entity.INVESTIGATESTATE = "0"; //更改状态为登记状态
                    entity.FLOWNAME         = "";
                    isBack = 2;                    //审核退回
                    var applyUser = new UserBLL().GetEntity(entity.APPLYPEOPLEID);
                    if (applyUser != null)
                    {
                        JPushApi.PushMessage(applyUser.Account, entity.CREATEUSERNAME, "WB012", entity.ID);
                    }
                    //  AddBackData(keyValue, out newKeyValue);  //添加历史记录
                }
            }
            //更改入厂许可申请单
            intromissionbll.SaveForm(keyValue, entity);

            //退回操作
            if (isBack > 0)
            {
                //添加历史记录
                AddBackData(keyValue, out newKeyValue);

                //审核退回
                if (isBack > 1)
                {
                    //获取当前业务对象的所有历史审核记录
                    var shlist = aptitudeinvestigateauditbll.GetAuditList(keyValue);
                    //批量更新审核记录关联ID
                    foreach (AptitudeinvestigateauditEntity mode in shlist)
                    {
                        mode.APTITUDEID = newKeyValue; //对应新的关联ID
                        aptitudeinvestigateauditbll.SaveForm(mode.ID, mode);
                    }
                    //添加审核记录
                    aentity.APTITUDEID   = newKeyValue; //关联id
                    aentity.AUDITSIGNIMG = HttpUtility.UrlDecode(aentity.AUDITSIGNIMG);
                    aentity.AUDITSIGNIMG = string.IsNullOrWhiteSpace(aentity.AUDITSIGNIMG) ? "" : aentity.AUDITSIGNIMG.ToString().Replace("../..", "");
                    aptitudeinvestigateauditbll.SaveForm("", aentity);
                }
            }

            return(Success("操作成功。"));
        }
Example #21
0
        public ActionResult SubmitForm(string keyValue, IntromissionEntity entity)
        {
            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

            string deptid   = string.Empty;
            string deptname = string.Empty;
            string roleid   = string.Empty;
            string rolename = string.Empty;

            bool isMulti = false;

            //保存信息
            entity.INVESTIGATESTATE = "0";
            if (string.IsNullOrEmpty(keyValue))
            {
                entity.APPLYTIME = DateTime.Now;
            }
            intromissionbll.SaveForm(keyValue, entity);

            string moduleName    = "入厂许可审查";
            string outengineerid = entity.OUTENGINEERID;

            //判断是否需要审查(审查配置表)
            var list = investigatebll.GetList(curUser.OrganizeId).Where(p => p.SETTINGTYPE == "入厂许可").ToList();

            ManyPowerCheckEntity mpcEntity = null;

            InvestigateEntity investigateEntity = null;

            bool isUseSetting = true;

            if (list.Count() > 0)
            {
                investigateEntity = list.FirstOrDefault();
            }
            //审查配置不为空
            if (null != investigateEntity)
            {
                //启用审查
                if (investigateEntity.ISUSE == "是")
                {
                    entity.FLOWNAME         = "审查中";
                    entity.INVESTIGATESTATE = "1"; //审查状态

                    //新增审查记录
                    InvestigateRecordEntity rcEntity = new InvestigateRecordEntity();
                    rcEntity.INTOFACTORYID   = entity.ID;
                    rcEntity.INVESTIGATETYPE = "0";//当前记录标识
                    investigaterecordbll.SaveForm("", rcEntity);

                    //获取审查内容
                    var contentList = investigatecontentbll.GetList(investigateEntity.ID).ToList();

                    //批量增加审查内容到审查记录中
                    foreach (InvestigateContentEntity icEntity in contentList)
                    {
                        InvestigateDtRecordEntity dtEntity = new InvestigateDtRecordEntity();
                        dtEntity.INVESTIGATERECORDID  = rcEntity.ID;
                        dtEntity.INVESTIGATECONTENT   = icEntity.INVESTIGATECONTENT;
                        dtEntity.INVESTIGATECONTENTID = icEntity.ID;
                        investigatedtrecordbll.SaveForm("", dtEntity);
                    }
                }
                else  //未启用审查,直接跳转到审核
                {
                    entity.FLOWNAME         = "审核中";
                    entity.INVESTIGATESTATE = "2"; //审核状态
                }
            }
            else
            {
                //如果没有审查配置,直接到审核
                isUseSetting            = false;
                entity.FLOWNAME         = "审核中";
                entity.INVESTIGATESTATE = "2"; //审核状态
            }
            string status = "";

            //更改申请信息状态
            mpcEntity = peoplereviewbll.CheckAuditPower(curUser, out status, moduleName, outengineerid, false, entity.FLOWID);

            if (null != mpcEntity)
            {
                entity.FLOWDEPT     = mpcEntity.CHECKDEPTID;
                entity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME;
                entity.FLOWROLE     = mpcEntity.CHECKROLEID;
                entity.FLOWROLENAME = mpcEntity.CHECKROLENAME;
                entity.FLOWID       = mpcEntity.ID;
                DataTable dt          = new UserBLL().GetUserAccountByRoleAndDept(curUser.OrganizeId, mpcEntity.CHECKDEPTID, mpcEntity.CHECKROLENAME);
                var       userAccount = dt.Rows[0]["account"].ToString();
                var       userName    = dt.Rows[0]["realname"].ToString();
                JPushApi.PushMessage(userAccount, userName, "WB013", entity.ID);
            }
            else
            {
                entity.FLOWNAME         = "已完结";
                entity.INVESTIGATESTATE = "3"; //完结状态
            }
            intromissionbll.SaveForm(entity.ID, entity);

            //推送到下一个流程
            return(Success("操作成功。"));
        }
Example #22
0
        /// <summary>
        /// 申请审核
        /// 适用于审核时,修改业务状态信息
        /// </summary>
        /// <param name="key">申请信息主键ID</param>
        /// <param name="auditEntity">审核记录</param>
        public void ApplyCheck(string keyValue, ScaffoldauditrecordEntity auditEntity)
        {
            FireWaterEntity      fireWaterEntity = service.GetEntity(keyValue);
            Operator             currUser        = ERCHTMS.Code.OperatorProvider.Provider.Current();
            ManyPowerCheckEntity mpcEntity       = null;

            //把当前业务流程节点赋值到审核记录中
            auditEntity.FlowId = fireWaterEntity.FlowId;
            if (fireWaterEntity.WorkDeptType == "0")
            {
                mpcEntity = peopleReviwservice.CheckAuditForNextByWorkUnit(currUser, "消防水使用-内部审核", fireWaterEntity.WorkDeptId, fireWaterEntity.FlowId, false);
            }
            else
            {
                mpcEntity = peopleReviwservice.CheckAuditForNextByOutsourcing(currUser, "消防水使用-外部审核", fireWaterEntity.WorkDeptId, fireWaterEntity.FlowId, false, true, fireWaterEntity.EngineeringId);
            }
            //如果审核记录不为空,且为不同意,流程结束
            if (auditEntity.AuditState == 1)
            {
                //下一步流程不为空
                if (null != mpcEntity)
                {
                    fireWaterEntity.FlowDept         = mpcEntity.CHECKDEPTID;
                    fireWaterEntity.FlowDeptName     = mpcEntity.CHECKDEPTNAME;
                    fireWaterEntity.FlowRole         = mpcEntity.CHECKROLEID;
                    fireWaterEntity.FlowRoleName     = mpcEntity.CHECKROLENAME;
                    fireWaterEntity.FlowId           = mpcEntity.ID;
                    fireWaterEntity.FlowName         = mpcEntity.FLOWNAME;
                    fireWaterEntity.ApplyState       = "1";
                    fireWaterEntity.InvestigateState = "2";
                    fireWaterEntity.FlowRemark       = !string.IsNullOrEmpty(mpcEntity.REMARK) ? mpcEntity.REMARK : "";

                    //推送消息到有审批权限的人
                    string type = fireWaterEntity.FlowRemark != "1" ? "0" : "1";
                    new ScaffoldBLL().SendMessage(fireWaterEntity.FlowDept, fireWaterEntity.FlowRole, "ZY100", fireWaterEntity.Id, "", "", type, !string.IsNullOrEmpty(fireWaterEntity.SpecialtyType) ? fireWaterEntity.SpecialtyType : "");
                }
                else
                {
                    fireWaterEntity.FlowRemark       = "";
                    fireWaterEntity.FlowDept         = " ";
                    fireWaterEntity.FlowDeptName     = " ";
                    fireWaterEntity.FlowRole         = " ";
                    fireWaterEntity.FlowRoleName     = " ";
                    fireWaterEntity.ApplyState       = "3";
                    fireWaterEntity.FlowName         = "已完结";
                    fireWaterEntity.InvestigateState = "3";
                    fireWaterEntity.FlowId           = "";


                    var high = GetEntity(fireWaterEntity.Id);
                    if (high != null)
                    {
                        string     Content      = "作业内容:" + high.WorkContent + "&#10;作业时间:" + high.WorkStartTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 到 " + high.WorkEndTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + "&#10;作业地点:" + high.WorkPlace;
                        UserEntity userEntity   = userservice.GetEntity(high.CreateUserId);
                        string[]   workuserlist = high.WorkUserIds.Split(',');
                        string[]   copyuserlist = high.CopyUserIds.Split(',');
                        DataTable  dutyuserDt   = new DataTable();
                        dutyuserDt = userservice.GetUserTable(workuserlist);
                        //推送给作业申请人
                        if (userEntity != null)
                        {
                            JPushApi.PushMessage(userEntity.Account, userEntity.RealName, "ZY020", "消防水使用许可申请已通过,请及时处理", Content, fireWaterEntity.Id);
                        }
                        DataTable copyuserdt = new DataTable();
                        copyuserdt = userservice.GetUserTable(copyuserlist);


                        //推送给作业负责人/作业人
                        if (dutyuserDt.Rows.Count > 0)
                        {
                            string Account  = "";
                            string RealName = "";
                            foreach (DataRow item in dutyuserDt.Rows)
                            {
                                Account  += item["account"].ToString() + ",";
                                RealName += item["realname"].ToString() + ",";
                            }
                            if (!string.IsNullOrEmpty(Account))
                            {
                                Account  = Account.Substring(0, Account.Length - 1);
                                RealName = RealName.Substring(0, RealName.Length - 1);
                            }
                            JPushApi.PushMessage(Account, RealName, "ZY020", "您有一条新的消防水使用作业任务,请及时处理", Content, fireWaterEntity.Id);
                        }
                        //推送给抄送人
                        if (copyuserdt.Rows.Count > 0)
                        {
                            string Account  = "";
                            string RealName = "";
                            foreach (DataRow item in copyuserdt.Rows)
                            {
                                Account  += item["account"].ToString() + ",";
                                RealName += item["realname"].ToString() + ",";
                            }
                            if (!string.IsNullOrEmpty(Account))
                            {
                                Account  = Account.Substring(0, Account.Length - 1);
                                RealName = RealName.Substring(0, RealName.Length - 1);
                            }
                            JPushApi.PushMessage(Account, RealName, "ZY020", "消防水使用许可申请审核已经通过,请知晓", Content, fireWaterEntity.Id);
                        }
                    }
                }
            }
            else
            {
                fireWaterEntity.FlowRemark       = "";
                fireWaterEntity.FlowDept         = " ";
                fireWaterEntity.FlowDeptName     = " ";
                fireWaterEntity.FlowRole         = " ";
                fireWaterEntity.FlowRoleName     = " ";
                fireWaterEntity.ApplyState       = "2";
                fireWaterEntity.FlowName         = "已完结";
                fireWaterEntity.InvestigateState = "3";
                fireWaterEntity.FlowId           = "";
                //审批不通过,推消息到申请人
                UserEntity userEntity = new UserService().GetEntity(fireWaterEntity.CreateUserId);
                if (userEntity != null)
                {
                    var high = GetEntity(fireWaterEntity.Id);
                    if (high != null)
                    {
                        string Content = "作业内容:" + high.WorkContent + "&#10;作业时间:" + high.WorkStartTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 到 " + high.WorkEndTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + "&#10;作业地点:" + high.WorkPlace;
                        JPushApi.PushMessage(userEntity.Account, userEntity.RealName, "ZY019", "消防水使用许可申请未通过,请及时处理", Content, fireWaterEntity.Id);
                    }
                }
            }
            this.service.UpdateForm(fireWaterEntity, auditEntity);
        }
Example #23
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// 适用于保存及修改时,处理业务数据及初始状态
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="model">实体对象</param>
        /// <param name="auditEntity">审核实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, FireWaterModel model)
        {
            try
            {
                Operator             currUser  = ERCHTMS.Code.OperatorProvider.Provider.Current();
                ManyPowerCheckEntity mpcEntity = null;
                if (model.WorkDeptType == "0")
                {
                    mpcEntity = peopleReviwservice.CheckAuditForNextByWorkUnit(currUser, "消防水使用-内部审核", model.WorkDeptId, model.FlowId, false);
                }
                else
                {
                    mpcEntity = peopleReviwservice.CheckAuditForNextByOutsourcing(currUser, "消防水使用-外部审核", model.WorkDeptId, model.FlowId, false, true, model.EngineeringId);
                }
                if (model.ApplyState == "0")
                {
                    model.FlowName         = "申请中";
                    model.InvestigateState = "0";
                }
                if (model.ApplyState == "1")
                {
                    //如果审核步骤不为空,处理流程信息及状态
                    if (mpcEntity != null)
                    {
                        model.FlowDept         = mpcEntity.CHECKDEPTID;
                        model.FlowDeptName     = mpcEntity.CHECKDEPTNAME;
                        model.FlowRole         = mpcEntity.CHECKROLEID;
                        model.FlowRoleName     = mpcEntity.CHECKROLENAME;
                        model.FlowId           = mpcEntity.ID;
                        model.FlowName         = mpcEntity.FLOWNAME;
                        model.ApplyState       = "1";
                        model.InvestigateState = "2";
                        model.FlowRemark       = !string.IsNullOrEmpty(mpcEntity.REMARK) ? mpcEntity.REMARK : "";

                        //推送消息到有审批权限的人
                        string type = model.FlowRemark != "1" ? "0" : "1";
                        new ScaffoldBLL().SendMessage(model.FlowDept, model.FlowRole, "ZY100", model.Id, "", "", type, !string.IsNullOrEmpty(model.SpecialtyType) ? model.SpecialtyType : "");
                    }
                    else
                    {
                        model.FlowRemark       = "";
                        model.FlowDept         = " ";
                        model.FlowDeptName     = " ";
                        model.FlowRole         = " ";
                        model.FlowRoleName     = " ";
                        model.ApplyState       = "3";
                        model.FlowName         = "已完结";
                        model.InvestigateState = "3";

                        string     Content      = "作业内容:" + model.WorkContent + "&#10;作业时间:" + model.WorkStartTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 到 " + model.WorkEndTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + "&#10;作业地点:" + model.WorkPlace;
                        UserEntity userEntity   = userservice.GetEntity(model.CreateUserId);
                        string[]   workuserlist = model.WorkUserIds.Split(',');
                        DataTable  dutyuserDt   = new DataTable();
                        dutyuserDt = userservice.GetUserTable(workuserlist);
                        //推送给作业申请人
                        if (userEntity != null)
                        {
                            JPushApi.PushMessage(userEntity.Account, userEntity.RealName, "ZY020", "消防水使用许可申请已通过,请及时处理", Content, keyValue);
                        }
                        //推送给作业负责人/作业人
                        if (dutyuserDt.Rows.Count > 0)
                        {
                            string Account  = "";
                            string RealName = "";
                            foreach (DataRow item in dutyuserDt.Rows)
                            {
                                Account  += item["account"].ToString() + ",";
                                RealName += item["realname"].ToString() + ",";
                            }
                            if (!string.IsNullOrEmpty(Account))
                            {
                                Account  = Account.Substring(0, Account.Length - 1);
                                RealName = RealName.Substring(0, RealName.Length - 1);
                            }
                            JPushApi.PushMessage(Account, RealName, "ZY020", "您有一条新的消防水使用作业任务,请及时处理", Content, keyValue);
                        }
                    }
                }

                service.SaveForm(keyValue, model);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #24
0
 /// <summary>
 /// 推送
 /// </summary>
 /// <param name="list"></param>
 public void PushSideMessage(List <PushMessageData> list)
 {
     if (list != null)
     {
         foreach (var pushdata in list)
         {
             if (pushdata.Success == 1 && !string.IsNullOrEmpty(pushdata.SendCode))
             {
                 //if (pushdata.SendCode == "ZY015")//待监管
                 //{
                 //    //安全主管部门
                 //    Operator currUser = ERCHTMS.Code.OperatorProvider.Provider.Current();
                 //    IEnumerable<DepartmentEntity> departs = departmentservice.GetDepts(currUser.OrganizeId, 1);
                 //    string deptids = string.Empty;
                 //    //配置的角色
                 //    string rolenames = dataitemdetailservice.GetItemValue(currUser.OrganizeId, "urgerole");
                 //    IList<UserEntity> users2 = null;
                 //    if (departs != null && departs.Count() > 0 && !string.IsNullOrEmpty(rolenames))
                 //    {
                 //        rolenames = "'" + rolenames.Replace(",", "','") + "'";
                 //        deptids = string.Join(",", departs.Select(x => x.DepartmentId).ToArray());
                 //        deptids = "'" + deptids.Replace(",", "','") + "'";
                 //        //安全主管部门,角色的用户
                 //        users2 = userservice.GetUserListByRoleName(deptids, rolenames, true, string.Empty);
                 //    }
                 //    List<UserEntity> users = new List<UserEntity>();
                 //    if (users2 != null && users2.Count > 0)
                 //    {
                 //        users.AddRange(users2);
                 //        users = users.Union(users2).ToList();
                 //    }
                 //    if (users != null && users.Count > 0)
                 //    {
                 //        string names = string.Join(",", users.Select(x => x.RealName).ToArray());
                 //        string accounts = string.Join(",", users.Select(x => x.Account).ToArray());
                 //        JPushApi.PushMessage(accounts, names, pushdata.SendCode, pushdata.EntityId);
                 //    }
                 //}
                 //else
                 if (pushdata.SendCode == "ZY016")//待执行的
                 {
                     if (pushdata.UserId != null)
                     {
                         string[] userid   = pushdata.UserId.Split(',');
                         string   names    = "";
                         string   accounts = "";
                         foreach (var item in userid)
                         {
                             UserEntity userEntity = userservice.GetEntity(pushdata.UserId);
                             if (userEntity != null)
                             {
                                 names    += userEntity.RealName + ",";
                                 accounts += userEntity.Account + ",";
                             }
                         }
                         if (!string.IsNullOrEmpty(names))
                         {
                             JPushApi.PushMessage(accounts.TrimEnd(','), names.TrimEnd(','), pushdata.SendCode, pushdata.EntityId);
                         }
                     }
                 }
                 else if (pushdata.SendCode == "ZY017")//待分配的
                 {
                     string             flowdeptids   = "'" + pushdata.UserDept.Replace(",", "','") + "'";
                     string             flowrolenames = "'" + pushdata.UserRole.Replace(",", "','") + "'";
                     IList <UserEntity> users         = new UserService().GetUserListByRoleName(flowdeptids, flowrolenames, true, string.Empty);
                     if (users != null && users.Count > 0)
                     {
                         string names    = string.Join(",", users.Select(x => x.RealName).ToArray());
                         string accounts = string.Join(",", users.Select(x => x.Account).ToArray());
                         JPushApi.PushMessage(accounts, names, pushdata.SendCode, pushdata.EntityId);
                     }
                 }
             }
         }
     }
 }
        public ActionResult SubmitAccpAudit(string keyValue, SafetychangeEntity change, ScaffoldauditrecordEntity entity)
        {
            Operator currUser   = ERCHTMS.Code.OperatorProvider.Provider.Current();
            string   moduleName = string.Empty;

            if (change.WORKUNITTYPE == "0")
            {
                moduleName = "(内部)设施变动验收审核";
            }
            else
            {
                moduleName = "(外包)设施变动验收审核";
            }
            entity.FlowId = change.NodeId;
            ManyPowerCheckEntity mpcEntity = peoplereviewbll.CheckAuditForNextByWorkUnit(currUser, moduleName, change.WORKUNITID, change.NodeId, false);

            //同意进行下一步
            if (entity.AuditState == 0)
            {
                //下一步流程不为空
                if (null != mpcEntity)
                {
                    change.FLOWDEPT     = mpcEntity.CHECKDEPTID;
                    change.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME;
                    change.FLOWROLE     = mpcEntity.CHECKROLEID;
                    change.FLOWROLENAME = mpcEntity.CHECKROLENAME;
                    change.NodeId       = mpcEntity.ID;
                    change.NodeName     = mpcEntity.FLOWNAME;
                    change.ISCOMMIT     = 1;
                    change.ISACCPCOMMIT = 1;

                    change.FLOWREMARK = !string.IsNullOrEmpty(mpcEntity.REMARK) ? mpcEntity.REMARK : "";

                    string type = change.FLOWREMARK != "1" ? "0" : "1";
                    new ScaffoldBLL().SendMessage(change.FLOWDEPT, change.FLOWROLE, "ZY012", keyValue, "", "", type, !string.IsNullOrEmpty(change.ACCSPECIALTYTYPE) ? change.ACCSPECIALTYTYPE : "");
                }
                else
                {
                    change.FLOWREMARK   = "";
                    change.FLOWDEPT     = " ";
                    change.FLOWDEPTNAME = " ";
                    change.FLOWROLE     = " ";
                    change.FLOWROLENAME = " ";
                    //change.NodeId = " ";
                    change.NodeName     = "已完结";
                    change.ISAPPLYOVER  = 1;
                    change.ISCOMMIT     = 1;
                    change.ISACCPCOMMIT = 1;
                    change.ISACCEPOVER  = 1;
                }
            }
            else
            {
                change.FLOWREMARK   = "";
                change.FLOWDEPT     = " ";
                change.FLOWDEPTNAME = " ";
                change.FLOWROLE     = " ";
                change.FLOWROLENAME = " ";
                //change.NodeId = " ";
                change.NodeName     = "已完结";
                change.ISAPPLYOVER  = 1;
                change.ISCOMMIT     = 1;
                change.ISACCPCOMMIT = 1;
                change.ISACCEPOVER  = 2;

                //审批不通过,推消息到申请人
                var high = safetychangebll.GetEntity(keyValue);
                if (high != null)
                {
                    UserEntity userEntity = new UserBLL().GetEntity(high.CREATEUSERID);
                    if (userEntity != null)
                    {
                        JPushApi.PushMessage(userEntity.Account, userEntity.RealName, "ZY014", keyValue);
                    }
                }
            }
            safetychangebll.SaveForm(keyValue, change);
            entity.AuditSignImg = string.IsNullOrWhiteSpace(entity.AuditSignImg) ? "" : entity.AuditSignImg.ToString().Replace("../..", "");
            entity.ScaffoldId   = keyValue;
            scaffoldauditrecordbll.SaveForm(entity.Id, entity);
            return(Success("操作成功。"));
        }
Example #26
0
 /// <summary>
 /// 确认,审核
 /// </summary>
 /// <param name="keyValue"></param>
 /// <param name="state"></param>
 /// <param name="recordData"></param>
 /// <param name="entity"></param>
 /// <param name="aentity"></param>
 public void SubmitCheckForm(string keyValue, string state, string recordData, HighRiskCommonApplyEntity entity, ScaffoldauditrecordEntity aentity)
 {
     try
     {
         PushMessageData pushdata = service.SubmitCheckForm(keyValue, state, recordData, entity, aentity);
         if (pushdata != null)
         {
             if (pushdata.Success == 1 && !string.IsNullOrEmpty(pushdata.SendCode))
             {
                 pushdata.Content = getName(entity.WorkType, "CommonType");
                 if (pushdata.SendCode == "ZY003")
                 {
                     pushdata.Content = "您提交的" + pushdata.Content + "申请未通过,请及时处理。";
                     var high = GetEntity(entity.Id);
                     if (high != null)
                     {
                         UserEntity userEntity = userservice.GetEntity(high.CreateUserId);
                         if (userEntity != null)
                         {
                             JPushApi.PushMessage(userEntity.Account, userEntity.RealName, pushdata.SendCode, "", pushdata.Content, pushdata.EntityId);
                         }
                     }
                 }
                 else if (pushdata.SendCode == "ZY018")
                 {
                     var high = GetEntity(entity.Id);
                     if (high != null)
                     {
                         String CommonType = pushdata.Content;
                         pushdata.Content = "作业内容:" + high.WorkContent + "&#10;作业时间:" + high.WorkStartTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 到 " + high.WorkEndTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + "&#10;作业地点:" + high.WorkPlace;
                         UserEntity userEntity         = userservice.GetEntity(high.CreateUserId);
                         UserEntity tutelageuserEntity = userservice.GetEntity(high.WorkTutelageUserId);
                         string[]   workuserlist       = (high.WorkDutyUserId + "," + high.WorkUserIds).Split(',');
                         //List<string> b = workuserlist.ToList();
                         //b.Add(high.WorkDutyUserId);
                         //workuserlist = b.ToArray();
                         DataTable dutyuserDt = new DataTable();
                         dutyuserDt = userservice.GetUserTable(workuserlist);
                         //推送给作业申请人
                         if (userEntity != null)
                         {
                             JPushApi.PushMessage(userEntity.Account, userEntity.RealName, pushdata.SendCode, "高风险作业(" + CommonType + ")申请已通过,请及时处理。", pushdata.Content, pushdata.EntityId);
                         }
                         //推送给作业负责人/作业人
                         if (dutyuserDt.Rows.Count > 0)
                         {
                             string Account  = "";
                             string RealName = "";
                             foreach (DataRow item in dutyuserDt.Rows)
                             {
                                 Account  += item["account"].ToString() + ",";
                                 RealName += item["realname"].ToString() + ",";
                             }
                             if (!string.IsNullOrEmpty(Account))
                             {
                                 Account  = Account.Substring(0, Account.Length - 1);
                                 RealName = RealName.Substring(0, RealName.Length - 1);
                             }
                             JPushApi.PushMessage(Account, RealName, pushdata.SendCode, "您有一条新的高风险作业(" + CommonType + ")任务,请及时处理。", pushdata.Content, pushdata.EntityId);
                         }
                         //推送给作业监护人
                         if (tutelageuserEntity != null)
                         {
                             JPushApi.PushMessage(tutelageuserEntity.Account, tutelageuserEntity.RealName, pushdata.SendCode, "您有一条新的高风险作业(" + CommonType + ")监护任务,请及时处理。", pushdata.Content, pushdata.EntityId);
                         }
                     }
                 }
                 else
                 {
                     //极光推送
                     PushMessageForCommon(pushdata);
                 }
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #27
0
 /// <summary>
 /// 极光推送
 /// </summary>
 /// <param name="processName"></param>
 /// <param name="nextActivityName"></param>
 /// <param name="control"></param>
 /// <param name="result"></param>
 /// <returns></returns>
 public void PushMessageForCommon(PushMessageData pushdata)
 {
     if (!string.IsNullOrEmpty(pushdata.UserAccount))
     {
         DataTable dtuser    = userservice.GetUserTable(pushdata.UserAccount.Split(','));
         string[]  usernames = dtuser.AsEnumerable().Select(d => d.Field <string>("realname")).ToArray();
         if (pushdata.SendCode == "ZY001")
         {
             pushdata.Content = "您有一条" + pushdata.Content + "申请待安全措施确认,请及时处理。";
         }
         else if (pushdata.SendCode == "ZY002")
         {
             pushdata.Content = "您有一条" + pushdata.Content + "申请待审批,请及时处理。";
         }
         else
         {
             pushdata.Content = "";
         }
         JPushApi.PushMessage(pushdata.UserAccount, string.Join(",", usernames), pushdata.SendCode, "", pushdata.Content, pushdata.EntityId);
     }
     else
     {
         string             flowdeptids = "'" + pushdata.UserDept.Replace(",", "','") + "'";
         string             flowroleids = "'" + pushdata.UserRole.Replace(",", "','") + "'";
         IList <UserEntity> users       = new UserService().GetUserListByDeptId(flowdeptids, flowroleids, true, string.Empty);
         if (users != null && users.Count > 0)
         {
             string names    = "";
             string accounts = "";
             if (!string.IsNullOrEmpty(pushdata.SpecialtyType) && !string.IsNullOrEmpty(pushdata.IsSpecial) && pushdata.IsSpecial == "1")
             {
                 foreach (var item in users)
                 {
                     if (item.RoleName.Contains("专工"))
                     {
                         if (!string.IsNullOrEmpty(item.SpecialtyType) && item.SpecialtyType != "null")
                         {
                             string[] str = item.SpecialtyType.Split(',');
                             for (int i = 0; i < str.Length; i++)
                             {
                                 if (str[i] == pushdata.SpecialtyType)
                                 {
                                     names    += item.RealName + ",";
                                     accounts += item.Account + ",";
                                 }
                             }
                         }
                     }
                     else
                     {
                         names    += item.RealName + ",";
                         accounts += item.Account + ",";
                     }
                 }
                 if (!string.IsNullOrEmpty(names))
                 {
                     names = names.TrimEnd(',');
                 }
                 if (!string.IsNullOrEmpty(accounts))
                 {
                     accounts = accounts.TrimEnd(',');
                 }
             }
             else
             {
                 names    = string.Join(",", users.Select(x => x.RealName).ToArray());
                 accounts = string.Join(",", users.Select(x => x.Account).ToArray());
             }
             if (pushdata.SendCode == "ZY001")
             {
                 pushdata.Content = "您有一条" + pushdata.Content + "申请待安全措施确认,请及时处理。";
             }
             else if (pushdata.SendCode == "ZY002")
             {
                 pushdata.Content = "您有一条" + pushdata.Content + "申请待审批,请及时处理。";
             }
             else
             {
                 pushdata.Content = "";
             }
             JPushApi.PushMessage(accounts, names, pushdata.SendCode, "", pushdata.Content, pushdata.EntityId);
         }
     }
 }
Example #28
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));
            }
        }
        public object AppSubmitAccpAudit()
        {
            try
            {
                string             res         = HttpContext.Current.Request["json"];
                dynamic            dy          = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string             userId      = dy.userid;
                string             applyentity = JsonConvert.SerializeObject(dy.data.applyentity);
                SafetychangeEntity change      = JsonConvert.DeserializeObject <SafetychangeEntity>(applyentity);

                string auditstr = JsonConvert.SerializeObject(dy.data.aiditentity);
                ScaffoldauditrecordEntity auditentity = JsonConvert.DeserializeObject <ScaffoldauditrecordEntity>(auditstr);
                string webUrl = new DataItemDetailBLL().GetItemValue("imgUrl");

                //获取用户基本信息
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Operator currUser   = OperatorProvider.Provider.Current();
                string   moduleName = string.Empty;
                if (change.WORKUNITTYPE == "0")
                {
                    moduleName = "(内部)设施变动验收审核";
                }
                else
                {
                    moduleName = "(外包)设施变动验收审核";
                }
                auditentity.FlowId = change.NodeId;
                ManyPowerCheckEntity mpcEntity = peoplereviewbll.CheckAuditForNextByWorkUnit(currUser, moduleName, change.WORKUNITID, change.NodeId, false);
                //同意进行下一步
                if (auditentity.AuditState == 0)
                {
                    //下一步流程不为空
                    if (null != mpcEntity)
                    {
                        change.FLOWDEPT     = mpcEntity.CHECKDEPTID;
                        change.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME;
                        change.FLOWROLE     = mpcEntity.CHECKROLEID;
                        change.FLOWROLENAME = mpcEntity.CHECKROLENAME;
                        change.NodeId       = mpcEntity.ID;
                        change.NodeName     = mpcEntity.FLOWNAME;
                        change.ISCOMMIT     = 1;
                        change.ISACCPCOMMIT = 1;

                        new ScaffoldBLL().SendMessage(change.FLOWDEPT, change.FLOWROLE, "ZY012", change.ID);
                    }
                    else
                    {
                        change.FLOWDEPT     = " ";
                        change.FLOWDEPTNAME = " ";
                        change.FLOWROLE     = " ";
                        change.FLOWROLENAME = " ";
                        //change.NodeId = " ";
                        change.NodeName     = "已完结";
                        change.ISAPPLYOVER  = 1;
                        change.ISCOMMIT     = 1;
                        change.ISACCPCOMMIT = 1;
                        change.ISACCEPOVER  = 1;
                    }
                }
                else
                {
                    change.FLOWDEPT     = " ";
                    change.FLOWDEPTNAME = " ";
                    change.FLOWROLE     = " ";
                    change.FLOWROLENAME = " ";
                    //change.NodeId = " ";
                    change.NodeName     = "已完结";
                    change.ISAPPLYOVER  = 1;
                    change.ISCOMMIT     = 1;
                    change.ISACCPCOMMIT = 1;
                    change.ISACCEPOVER  = 2;

                    //审批不通过,推消息到申请人
                    var high = safetychangebll.GetEntity(change.ID);
                    if (high != null)
                    {
                        UserEntity userEntity = new UserBLL().GetEntity(high.CREATEUSERID);
                        if (userEntity != null)
                        {
                            JPushApi.PushMessage(userEntity.Account, userEntity.RealName, "ZY014", change.ID);
                        }
                    }
                }
                safetychangebll.SaveForm(change.ID, change);
                auditentity.ScaffoldId   = change.ID;
                auditentity.AuditDate    = DateTime.Now;
                auditentity.AuditSignImg = string.IsNullOrWhiteSpace(auditentity.AuditSignImg) ? "" : auditentity.AuditSignImg.Replace(webUrl, "").ToString();
                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 == auditentity.Id)
                        {
                            string dir         = new DataItemDetailBLL().GetItemValue("imgPath") + "\\Resource\\sign";
                            string newFileName = fileName + FileEextension;
                            string newFilePath = dir + "\\" + newFileName;
                            file.SaveAs(newFilePath);
                            auditentity.AuditSignImg = "/Resource/sign/" + fileOverName;
                            break;
                        }
                    }
                }
                auditentity.Id = null;
                scaffoldauditrecordbll.SaveForm("", auditentity);
                return(new { code = 0, count = 1, info = "提交成功" });
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = ex.Message });
            }
        }
        public ActionResult ApplyForm(string keyValue, string istype, FivesafetycheckauditEntity entity)
        {
            FivesafetycheckauditEntity applyentity = fivesafetycheckauditbll.GetEntity(keyValue);

            if (istype == "0") // 0:整改 1:验收
            {
                applyentity.BEIZHU       = entity.BEIZHU;
                applyentity.ACTUALDATE   = entity.ACTUALDATE;
                applyentity.ACTIONRESULT = entity.ACTIONRESULT;
                if (entity.ACTIONRESULT == "0")
                {
                    applyentity.ACCEPTREUSLT  = "";
                    applyentity.ACCEPTCONTENT = "";
                }
            }
            else
            {
                applyentity.ACCEPTCONTENT = entity.ACCEPTCONTENT;
                applyentity.ACCEPTREUSLT  = entity.ACCEPTREUSLT;
                if (entity.ACCEPTREUSLT == "1") //不同意
                {
                    applyentity.ACTIONRESULT = "1";
                    applyentity.ACTUALDATE   = null;

                    JPushApi.PushMessage(new UserBLL().GetEntity(applyentity.DUTYUSERID).Account, applyentity.DUTYUSERNAME, "WDJC001", applyentity.ID);
                }
            }

            fivesafetycheckauditbll.SaveForm(keyValue, applyentity);

            #region 更新主表信息
            string checkid     = applyentity.CHECKID;
            var    checkentity = fivesafetycheckbll.GetEntity(checkid);

            if (istype == "0") // 0:整改 1:验收
            {
                //整改同意,需要判断是否全部整改完
                if (entity.ACTIONRESULT == "0")
                {
                    DataTable dt = fivesafetycheckauditbll.GetDataTable("select id from BIS_FIVESAFETYCHECKAUDIT where checkpass  = '******' and (ACTIONRESULT is null or  ACTIONRESULT = '1') and checkid = '" + checkid + "' ");
                    // 所有的整改已完成,更新主表信息为验收中
                    if (dt.Rows.Count == 0)
                    {
                        checkentity.ISOVER = 2;
                    }
                }
            }
            else
            {
                if (entity.ACCEPTREUSLT == "0") //同意
                {
                    DataTable dt = fivesafetycheckauditbll.GetDataTable("select id from BIS_FIVESAFETYCHECKAUDIT where checkpass  = '******' and (ACCEPTREUSLT is null or  ACCEPTREUSLT = '1') and checkid = '" + checkid + "' ");
                    // 所有的验收已完成,更新主表信息为已完成
                    if (dt.Rows.Count == 0)
                    {
                        checkentity.ISOVER = 3;
                    }
                }
                else // 不同意将直接改成整改中
                {
                    checkentity.ISOVER = 1;
                }
            }
            fivesafetycheckbll.SaveForm(checkid, checkentity);

            #endregion


            return(Success("操作成功。"));
        }