/// <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; } }
/// <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; //} }
/// <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="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; } }
/// <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; } }
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("提醒失败,确认人员是否存在")); } }
/// <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; } }
/// <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; } }
/// <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; } }
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; } }
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; } }
/// <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 + " 作业时间:" + high.WorkStartTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 到 " + high.WorkEndTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 作业地点:" + 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 + " 作业时间:" + high.WorkStartTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 到 " + high.WorkEndTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 作业地点:" + high.WorkPlace; JPushApi.PushMessage(userEntity.Account, userEntity.RealName, "ZY019", "消防水使用许可申请未通过,请及时处理", Content, fireWaterEntity.Id); } } } this.service.UpdateForm(fireWaterEntity, auditEntity); }
/// <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 + " 作业时间:" + model.WorkStartTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 到 " + model.WorkEndTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 作业地点:" + 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; } }
/// <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("操作成功。")); }
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)); } }
/// <summary> /// 开始作业 /// </summary> /// <param name="keyValue"></param> /// <param name="ledgerType"></param> /// <param name="type"></param> /// <param name="worktime"></param> /// <param name="issendmessage"></param> /// <param name="conditioncontent"></param> /// <param name="conditionid"></param> /// <param name="iscomplete"></param> public void LedgerOp(string keyValue, string ledgerType, string type, string worktime, string issendmessage, string conditioncontent, string conditionid = "", string iscomplete = "") { string title = string.Empty; string message = string.Empty; var time = Convert.ToDateTime(worktime); Operator curUser = OperatorProvider.Provider.Current(); JobApprovalFormEntity entity = service.GetEntity(keyValue); string sql = ""; if (type == "HeightWorking" || type == "Lifting" || type == "Digging" || type == "OpenCircuit" || type == "WhenHot" || type == "BlindPlateWall" || type == "LimitedSpace" || type == "EquOverhaulClean") { if (ledgerType == "0") { sql = string.Format(@"update bis_jobsafetycardapply set realityjobstarttime=to_date('{1}','yyyy-mm-dd hh24:mi:ss')," + "jobstate=10,RealityJobEndTime='' where id='{0}'", keyValue, time.ToString("yyyy-MM-dd HH:mm:ss")); } else if (ledgerType == "1") { int jobstate = 9; if (iscomplete == "0") { jobstate = 9;//状态为作业暂停 } else { UserBLL userbll = new UserBLL(); JobSafetyCardApplyBLL JobSafetyCardApplyBLL = new JobSafetyCardApplyBLL(); JobSafetyCardApplyEntity data = JobSafetyCardApplyBLL.GetEntity(keyValue); if (type == "OpenCircuit") { jobstate = 6; //断路作业 结束作业后下一步流程为验收 状态值改为验收中:6 DataTable dt = userbll.GetUserTable(data.CheckPersonId.Split(',')); JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), data.CheckPerson, "ZYAQZ004", data.JobTypeName + "安全证待您进行作业后验收,请您及时处理。", data.CreateUserName + "于" + data.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + data.JobTypeName + "安全证需要您进行作业后验收,请您及时处理。", data.Id); } else if (type == "EquOverhaulClean") { jobstate = 7; //设备检修清理作业 结束作业后下一步流程为送电 状态值改为送电中:7 DataTable dt = userbll.GetUserTable(data.PowerGivePersonId.Split(',')); JPushApi.PushMessage(string.Join(",", dt.AsEnumerable().Select(t => t.Field <string>("account")).ToArray()), data.PowerGivePerson, "ZYAQZ010", data.JobTypeName + "已结束,待您进行送电,请您及时处理。", data.CreateUserName + "于" + data.CreateDate.Value.ToString("yyyy年MM月dd日") + "申请的" + data.JobTypeName + "已结束,需要您进行送电操作,请您及时处理。", data.Id); } else { jobstate = 11; //其他作业 作业结束即为整个流程结束 状态值为11 } } sql = string.Format("update bis_jobsafetycardapply set jobstate={2},realityjobendtime=to_date('{1}','yyyy-mm-dd hh24:mi:ss') where id='{0}'", keyValue, time.ToString("yyyy-MM-dd HH:mm:ss"), jobstate); } } else { if (ledgerType == "0") { entity.RealityJobStartTime = time; sql = string.Format(@"update BIS_JobApprovalForm set RealityJobStartTime=to_date('{1}','yyyy-mm-dd hh24:mi:ss')," + "WorkOperate='0',RealityJobEndTime='' where id='{0}'", keyValue, time.ToString("yyyy-MM-dd HH:mm:ss")); entity.WorkOperate = "0"; entity.RealityJobEndTime = null; } if (ledgerType == "1") { entity.RealityJobEndTime = time; if (iscomplete == "0") { entity.WorkOperate = "1"; } sql = string.Format("update BIS_JobApprovalForm set WorkOperate='{2}',RealityJobEndTime=to_date('{1}','yyyy-mm-dd hh24:mi:ss') where id='{0}'", keyValue, time.ToString("yyyy-MM-dd HH:mm:ss"), entity.WorkOperate); } //更新作业安全证状态 UpdateGerOp(keyValue, ledgerType, type, worktime, issendmessage, conditioncontent, conditionid, iscomplete); } service.UpdateData(sql); #region 添加执行情况信息 FireWaterCondition Conditionentity = new FireWaterCondition(); Conditionentity.Id = !string.IsNullOrEmpty(conditionid) ? conditionid : ""; Conditionentity.LedgerType = ledgerType; Conditionentity.ConditionTime = time; Conditionentity.ConditionContent = conditioncontent; Conditionentity.ConditionDept = curUser.DeptName; Conditionentity.ConditionDeptCode = curUser.DeptCode; Conditionentity.ConditionDeptId = curUser.DeptId; Conditionentity.ConditionPerson = curUser.UserName; Conditionentity.ConditionPersonId = curUser.UserId; Conditionentity.FireWaterId = keyValue; firewaterbll.SubmitCondition(conditionid, Conditionentity); #endregion }
/// <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); } } }
/// <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 + " 作业时间:" + high.WorkStartTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 到 " + high.WorkEndTime.Value.ToString("yyyy年MM月dd日 HH时mm分") + " 作业地点:" + 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; } }
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("操作成功。")); }
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("操作成功。")); }
public void AddLllegalScore(LllegalRegisterEntity entity) { //当前用户 Operator curUser = OperatorProvider.Provider.Current(); #region 违章评分对象 try { string fileName = "推送违章对接培训平台接口" + DateTime.Now.ToString("yyyyMMdd") + ".log"; LllegalPunishBLL lllegalpunishbll = new LllegalPunishBLL(); #region 添加用户积分 string lllegaluserids = string.Empty; string lllegaldeptcode = string.Empty; //考核人 var relevanceList = lllegalpunishbll.GetListByLllegalId(entity.ID, ""); foreach (LllegalPunishEntity lpEntity in relevanceList) { if (lpEntity.ASSESSOBJECT.Contains("人员") && !string.IsNullOrEmpty(lpEntity.PERSONINCHARGEID)) { //违章责任人 lllegalpunishbll.SaveUserScore(lpEntity.PERSONINCHARGEID, entity.LLLEGALLEVEL); lllegaluserids += lpEntity.PERSONINCHARGEID + ","; } else if (lpEntity.ASSESSOBJECT.Contains("单位")) { lllegaldeptcode += lpEntity.PERSONINCHARGEID + ","; //记录单位编码 } } #endregion //考核用户id if (!string.IsNullOrEmpty(lllegaluserids)) { lllegaluserids = lllegaluserids.Substring(0, lllegaluserids.Length - 1); } //考核部门 if (!string.IsNullOrEmpty(lllegaldeptcode)) { lllegaldeptcode = lllegaldeptcode.Substring(0, lllegaldeptcode.Length - 1); } #region 消息提醒考核的人员、考核的单位 //消息通知的用户 string pushaccount = string.Empty; string pushusernames = string.Empty; string pushcode = "WZ012"; //违章考核消息通知 //考核人员 if (!string.IsNullOrEmpty(lllegaluserids)) { DataTable dt = userbll.GetUserByDeptCodeAndRoleName(lllegaluserids, null, null); if (dt.Rows.Count == 1) { pushaccount += dt.Rows[0]["account"].ToString() + ","; //账户 pushusernames += dt.Rows[0]["realname"].ToString() + ","; //姓名 } } //考核单位(获取单位负责人) if (!string.IsNullOrEmpty(lllegaldeptcode)) { DataTable dt = userbll.GetUserByDeptCodeAndRoleName(null, lllegaldeptcode, "负责人"); if (dt.Rows.Count == 1) { pushaccount += dt.Rows[0]["account"].ToString() + ","; //账户 pushusernames += dt.Rows[0]["realname"].ToString() + ","; //姓名 } } if (!string.IsNullOrEmpty(pushaccount)) { pushaccount = pushaccount.Substring(0, pushaccount.Length - 1); pushusernames = pushusernames.Substring(0, pushusernames.Length - 1); //极光消息推送 JPushApi.PushMessage(pushaccount, pushusernames, pushcode, entity.ID); } #endregion #region 违章评分对象 List <FwzTrainUserInfo> fwzlist = new List <FwzTrainUserInfo>(); var lllegalPoint = dataitemdetailbll.GetDataItemListByItemCode("'LllegalTrainPointSetting'"); if (lllegalPoint.Count() > 0) { var LllegalTrainingPointValue = lllegalPoint.Where(p => p.ItemName == "LllegalTrainingPointValue").FirstOrDefault(); //违章培训积分值 var LllegalTrainingPointStandard = lllegalPoint.Where(p => p.ItemName == "LllegalTrainingPointStandard").FirstOrDefault(); //违章培训积分标准 string basePoint = string.Empty; //基础分数值 string pointStandard = string.Empty; //评分标准 string lllegaltypetraineeprojectid = string.Empty; //违章类型培训项目 string safetyruletraineeprojectid = string.Empty; //安规培训项目 if (null != LllegalTrainingPointValue) { basePoint = LllegalTrainingPointValue.ItemValue; } if (null != LllegalTrainingPointStandard) { pointStandard = LllegalTrainingPointStandard.ItemValue; } ////违章类型培训项目 string wzKey = "LllegalTypeTraineeProjectId_" + curUser.OrganizeCode; if (lllegalPoint.Where(p => p.ItemName == wzKey).Count() > 0) { var LllegalTypeTraineeProjectId = lllegalPoint.Where(p => p.ItemName == wzKey).FirstOrDefault(); if (null != LllegalTypeTraineeProjectId) { if (LllegalTypeTraineeProjectId.EnabledMark == 1) { lllegaltypetraineeprojectid = LllegalTypeTraineeProjectId.ItemValue; } } } //安规培训项目 string agKey = "SafetyRuleTraineeProjectId_" + curUser.OrganizeCode; var SafetyRuleTraineeProjectId = lllegalPoint.Where(p => p.ItemName == agKey).FirstOrDefault(); if (null != SafetyRuleTraineeProjectId) { if (SafetyRuleTraineeProjectId.EnabledMark == 1) { safetyruletraineeprojectid = SafetyRuleTraineeProjectId.ItemValue; } } //评分标准 #region 评分标准 if (!string.IsNullOrEmpty(pointStandard)) { DataTable resultDt = new DataTable(); resultDt.Columns.Add("username"); resultDt.Columns.Add("account"); resultDt.Columns.Add("score"); resultDt.Columns.Add("lllegalpoint"); string[] standardarr = pointStandard.Split(','); //0分人员 foreach (string standard in standardarr) { DataTable upointdt = new DataTable(); upointdt = GetLllegalPointData(basePoint, DateTime.Now.Year.ToString(), lllegaluserids, standard); foreach (DataRow row in upointdt.Rows) { decimal score = !string.IsNullOrEmpty(row["score"].ToString()) ? Convert.ToDecimal(row["score"].ToString()) : 0; //剩余分数 decimal lllegalpoint = !string.IsNullOrEmpty(row["lllegalpoint"].ToString()) ? Convert.ToDecimal(row["lllegalpoint"].ToString()) : 0; //扣除分数 DataRow rrow = resultDt.NewRow(); rrow["username"] = row["realname"].ToString(); //人员姓名 rrow["account"] = row["account"].ToString(); //人员账号 rrow["score"] = score.ToString(); //剩余分数 rrow["lllegalpoint"] = lllegalpoint.ToString(); //扣除分数 resultDt.Rows.Add(rrow); FwzTrainUserInfo fwzuser = new FwzTrainUserInfo(); fwzuser.Useraccount = row["account"].ToString(); fwzuser.TrainStartTime = null != entity.LLLEGALTIME ? entity.LLLEGALTIME.Value.ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); fwzuser.TrainEndTime = null != entity.LLLEGALTIME ? entity.LLLEGALTIME.Value.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss"); //安规培训 if (standard.Trim() == "score=0") { fwzuser.StationName = "所有人员"; fwzuser.TrainProjectid = safetyruletraineeprojectid; //安规 } else { fwzuser.StationName = dataitemdetailbll.GetEntity(entity.LLLEGALTYPE).ItemName; if (!string.IsNullOrEmpty(lllegaltypetraineeprojectid)) { fwzuser.TrainProjectid = lllegaltypetraineeprojectid; } else { var lllegalPointObj = lllegalPoint.Where(P => P.ItemName == fwzuser.StationName); if (lllegalPointObj.Count() > 0) { fwzuser.TrainProjectid = lllegalPointObj.FirstOrDefault().ItemValue; } } } fwzlist.Add(fwzuser); } } if (fwzlist.Count() > 0) { dynamic lllegaldy = PushUserToTrainee(fwzlist); if (null != lllegaldy) { //返回成功状态下 if (lllegaldy.Code.ToString() == "0") { string curcode = "WZ013"; string content = string.Empty; foreach (DataRow rrow in resultDt.Rows) { string score = rrow["score"].ToString(); //剩余分数 string lllegalpoint = rrow["lllegalpoint"].ToString(); //扣除分数 string curaccount = rrow["account"].ToString(); //账户 string curname = rrow["username"].ToString(); //姓名 content = "您于" + DateTime.Now.ToString("yyyy-MM-dd") + "因违章被考核了" + lllegalpoint + "分,现反违章积分为" + score + "分,需进行反违章培训,请前去参加培训."; JPushApi.PushMessage(curaccount, curname, curcode, "违章考核信息", content, entity.ID); } } string resultInfo = JsonConvert.SerializeObject(lllegaldy); LogEntity logEntity = new LogEntity(); logEntity.Browser = System.Web.HttpContext.Current.Request.Browser.Browser; logEntity.CategoryId = 5; logEntity.OperateTypeId = ((int)OperationType.Submit).ToString(); logEntity.OperateType = EnumAttribute.GetDescription(OperationType.Submit); logEntity.OperateAccount = curUser.UserName; logEntity.OperateUserId = curUser.UserId; logEntity.ExecuteResult = 1; logEntity.Module = SystemInfo.CurrentModuleName; logEntity.ModuleId = SystemInfo.CurrentModuleId; logEntity.ExecuteResultJson = resultInfo; LogBLL.WriteLog(logEntity); } } } #endregion } #endregion } catch (Exception ex) { LogEntity logEntity = new LogEntity(); logEntity.CategoryId = 4; logEntity.OperateTypeId = ((int)OperationType.Exception).ToString(); logEntity.OperateType = EnumAttribute.GetDescription(OperationType.Exception); logEntity.OperateAccount = curUser.UserName; logEntity.OperateUserId = curUser.UserId; logEntity.ExecuteResult = -1; logEntity.ExecuteResultJson = ex.Message; logEntity.Module = SystemInfo.CurrentModuleName; logEntity.ModuleId = SystemInfo.CurrentModuleId; logEntity.ExecuteResultJson = ex.ToJson(); logEntity.WriteLog(); string fileName = "推送当前用户到培训平台,建立相关培训及考试任务_" + DateTime.Now.ToString("yyyyMMdd") + ".log"; System.IO.File.AppendAllText(HttpContext.Current.Server.MapPath("~/logs/" + fileName), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "推送当前用户到培训平台,建立相关培训及考试任务:" + ex.ToJson() + "\r\n"); } #endregion }
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("操作成功。")); }