public ActionResult GetFormJson(string keyValue) { DataItemDetailBLL itemBll = new DataItemDetailBLL(); ERCHTMS.Entity.SystemManage.DataItemDetailEntity entity = itemBll.GetEntity(keyValue); return(ToJsonResult(entity)); }
public ActionResult SaveForm(string keyValue, string score) { Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current(); DataItemDetailBLL itemBll = new DataItemDetailBLL(); ERCHTMS.Entity.SystemManage.DataItemDetailEntity entity = itemBll.GetEntity(keyValue); if (entity != null) { entity.ItemCode = user.OrganizeCode; entity.ItemName = user.OrganizeName; entity.ItemId = "1234567890"; entity.ItemValue = score; itemBll.SaveForm(keyValue, entity); } else { entity = new Entity.SystemManage.DataItemDetailEntity(); entity.ItemDetailId = user.OrganizeId; entity.ParentId = "0"; entity.ItemName = user.OrganizeName; entity.ItemCode = user.OrganizeCode; entity.ItemId = "1234567890"; entity.ItemValue = score; itemBll.SaveForm(keyValue, entity); } return(Success("操作成功。")); }
/// <summary> /// 设置风险预控规则 /// </summary> /// <returns></returns> public ActionResult SetRole() { var bll = new DataItemDetailBLL(); DataItemDetailEntity entity = bll.GetEntity("szfxykgz"); return(View(entity)); }
public ActionResult SaveWarningForm() { string keyValue = Request.Form["keyValue"].ToString(); string s1 = Request.Form["s1"].ToString(); string s2 = Request.Form["s2"].ToString(); string s3 = Request.Form["s3"].ToString(); string s4 = Request.Form["s4"].ToString(); string description = s4 + "|" + s3 + "|" + s2 + "|" + s1; DataItemDetailEntity entity = dataitemdetailbll.GetEntity(keyValue); entity.ItemValue = description; dataitemdetailbll.SaveForm(keyValue, entity); return(Success("保存成功!")); }
public ActionResult GetRankListJson(Pagination pagination, string queryJson, string year) { var watch = CommonHelper.TimerStart(); pagination.p_kid = "u.USERID"; pagination.p_fields = "u.account,senddeptid,REALNAME,MOBILE,OrganizeName,DEPTNAME,DUTYNAME,POSTNAME,usertype,GENDER,u.OrganizeCode,u.CreateDate,isblack,identifyid,nvl(score,0) score,BIRTHDAY"; pagination.p_tablename = "v_userinfo u left join (select a.userid,nvl(sum(score),0) as score from base_user a left join bis_userscore b on a.userid=b.userid where year='" + year + "' group by a.userid) t on u.userid=t.userid"; pagination.conditionJson = "1=1"; Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current(); if (user.IsSystem) { pagination.conditionJson = "1=1"; } else { string where = new AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value, "departmentcode", "organizecode"); if (!string.IsNullOrEmpty(where)) { pagination.conditionJson += " and " + where; } } DataItemDetailBLL itemBll = new DataItemDetailBLL(); ERCHTMS.Entity.SystemManage.DataItemDetailEntity entity = itemBll.GetEntity(user.OrganizeId); var data = userscorebll.GetPageJsonList(pagination, queryJson); var JsonData = new { rows = data, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch), userdata = new { score = entity == null ? "100" : entity.ItemValue } }; return(Content(JsonData.ToJson())); }
public object IntegralInfo([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; string uId = dy.data.uid; //人员Id OperatorProvider.AppUserId = userId; //设置当前用户 UserEntity user = new UserBLL().GetEntity(uId); DataTable dt = new UserScoreBLL().GetList(uId); DataItemDetailBLL itemBll = new DataItemDetailBLL(); ERCHTMS.Entity.SystemManage.DataItemDetailEntity entity = itemBll.GetEntity("csjf"); decimal score = new UserScoreBLL().GetUserScore(uId, DateTime.Now.Year.ToString()); score = entity == null ? score : int.Parse(entity.ItemValue) + score; return(new { Code = 0, Count = 0, Info = "操作成功", data = new { score = score, Details = dt } }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
public ActionResult GetFormJson(string keyValue) { var data = dataItemDetailBLL.GetEntity(keyValue); return(Content(data.ToJson())); }
public ActionResult SubmitForm(string keyValue, LllegalRegisterEntity entity, LllegalApproveEntity pEntity, LllegalPunishEntity pbEntity, LllegalReformEntity rEntity, LllegalAcceptEntity aEntity) { /* * 注:核准分两步 * * 确定为装置类情况下,如果当前核准人是安全管理部门人员, 先判断是否为装置类,如果不是 则直接到整改或退回,如果是,则转发至装置部门 或退回(不是提交) * 如果是非安全管理人员,则提交到安全管理部门人员会退回到登记. */ string errorMsg = string.Empty; Operator curUser = OperatorProvider.Provider.Current(); string wfFlag = string.Empty; //流程标识 string participant = string.Empty; //获取流程下一节点的参与人员 bool isSubmit = true; //是否要执行提交步骤,安全管理部门用于控制装置类违章转发至装置部门 bool isAddScore = false; //是否添加到用户积分 var lllegatypename = dataitemdetailbll.GetEntity(entity.LLLEGALTYPE).ItemName; //不通过,退回到违章登记,不管是I级核准还是II级核准 if (pEntity.APPROVERESULT == "0") { wfFlag = "2"; string createuserid = lllegalregisterbll.GetEntity(keyValue).CREATEUSERID; UserEntity userEntity = userbll.GetEntity(createuserid); participant = userEntity.Account; //登记用户 errorMsg = "登记用户"; } else //核准通过 { // 安全管理部门人员 if (userbll.GetSafetyAndDeviceDept(curUser).Contains("1")) { //当前人有且是装置部门,直接到整改 if (userbll.GetSafetyAndDeviceDept(curUser).Contains("2")) { //取整改人 wfFlag = "1"; // II级核准=>整改 //如果非装置类 则提交到整改 UserEntity reformUser = userbll.GetEntity(rEntity.REFORMPEOPLEID); //整改用户对象 //取整改人 participant = reformUser.Account; errorMsg = "整改责任人"; isAddScore = true; } else { //判断是否装置类违章 if (lllegatypename == dataitemdetailbll.GetItemValue("ApplianceClass")) { //更改核准人账号,变更为装置部门用户 此步步需要更改状态 isSubmit = false; //取装置部门用户 participant = userbll.GetSafetyDeviceDeptUser("1", curUser); errorMsg = "装置部门用户"; } else { //如果是非装置类违章,通过则进行整改 //取整改人 wfFlag = "1"; // II级核准=>整改 //如果非装置类 则提交到整改 UserEntity reformUser = userbll.GetEntity(rEntity.REFORMPEOPLEID); //整改用户对象 //取整改人 participant = reformUser.Account; errorMsg = "整改责任人"; isAddScore = true; } } } //装置用户 else if (userbll.GetSafetyAndDeviceDept(curUser).Contains("2")) { wfFlag = "1"; // II级核准=>整改 //如果非装置类 则提交到整改 UserEntity reformUser = userbll.GetEntity(rEntity.REFORMPEOPLEID); //整改用户对象 //取整改人 participant = reformUser.Account; errorMsg = "整改责任人"; isAddScore = true; } else //其他部门人员 { //上报情况下 if (entity.ISUPSAFETY == "1") { wfFlag = "3"; //取安全管理部门 ,推送至II级核准 //取安全管理部门用户 participant = userbll.GetSafetyDeviceDeptUser("0", curUser); errorMsg = "安全管理部门用户"; } else //不上报情况下,提交到整改 { wfFlag = "1"; //I级核准=>整改 //如果非装置类 则提交到整改 UserEntity reformUser = userbll.GetEntity(rEntity.REFORMPEOPLEID); //整改用户对象 //取整改人 participant = reformUser.Account; errorMsg = "整改责任人"; isAddScore = true; } } } //保存违章基本信息 LllegalRegisterEntity baseentity = lllegalregisterbll.GetEntity(keyValue); entity.AUTOID = baseentity.AUTOID; entity.CREATEDATE = baseentity.CREATEDATE; entity.CREATEUSERDEPTCODE = baseentity.CREATEUSERDEPTCODE; entity.CREATEUSERID = baseentity.CREATEUSERID; entity.CREATEUSERNAME = baseentity.CREATEUSERNAME; entity.CREATEUSERORGCODE = baseentity.CREATEUSERORGCODE; entity.MODIFYDATE = DateTime.Now; entity.MODIFYUSERID = curUser.UserId; entity.MODIFYUSERNAME = curUser.UserName; entity.RESEVERFOUR = ""; entity.RESEVERFIVE = ""; lllegalregisterbll.SaveForm(keyValue, entity); //保存核准基本信息 (不执行真正意义上的提交,则无法进行核准) if (isSubmit) { pEntity.LLLEGALID = keyValue; lllegalapprovebll.SaveForm("", pEntity); //新增考核内容信息(特别针对核准过程) pbEntity.MARK = "1"; //表示考核记录下的 pbEntity.LLLEGALID = keyValue; pbEntity.APPROVEID = pEntity.ID; pbEntity.CREATEDATE = DateTime.Now; pbEntity.CREATEUSERDEPTCODE = curUser.DeptCode; pbEntity.CREATEUSERID = curUser.UserId; pbEntity.CREATEUSERNAME = curUser.UserName; pbEntity.CREATEUSERORGCODE = curUser.OrganizeCode; pbEntity.MODIFYDATE = DateTime.Now; pbEntity.MODIFYUSERID = curUser.UserId; pbEntity.MODIFYUSERNAME = curUser.UserName; lllegalpunishbll.SaveForm("", pbEntity); } //同时对基础的考核内容进行更改相应的惩罚值 LllegalPunishEntity punishEntity = lllegalpunishbll.GetEntityByBid(keyValue); if (null != punishEntity) { //punishEntity.APPROVEID = pEntity.ID; punishEntity.PERSONINCHARGEID = pbEntity.PERSONINCHARGEID; punishEntity.PERSONINCHARGENAME = pbEntity.PERSONINCHARGENAME; punishEntity.ECONOMICSPUNISH = pbEntity.ECONOMICSPUNISH; punishEntity.LLLEGALPOINT = pbEntity.LLLEGALPOINT; punishEntity.AWAITJOB = pbEntity.AWAITJOB; punishEntity.LLLEGAOTHER = pbEntity.LLLEGAOTHER; punishEntity.FIRSTINCHARGEID = pbEntity.FIRSTINCHARGEID; punishEntity.FIRSTINCHARGENAME = pbEntity.FIRSTINCHARGENAME; punishEntity.FIRSTECONOMICSPUNISH = pbEntity.FIRSTECONOMICSPUNISH; punishEntity.FIRSTLLLEGALPOINT = pbEntity.FIRSTLLLEGALPOINT; punishEntity.FIRSTAWAITJOB = pbEntity.FIRSTAWAITJOB; punishEntity.FIRSTOTHER = pbEntity.FIRSTOTHER; punishEntity.SECONDINCHARGEID = pbEntity.SECONDINCHARGEID; punishEntity.SECONDINCHARGENAME = pbEntity.SECONDINCHARGENAME; punishEntity.SECONDECONOMICSPUNISH = pbEntity.SECONDECONOMICSPUNISH; punishEntity.SECONDLLLEGALPOINT = pbEntity.SECONDLLLEGALPOINT; punishEntity.SECONDAWAITJOB = pbEntity.SECONDAWAITJOB; punishEntity.SECONDOTHER = pbEntity.SECONDOTHER; lllegalpunishbll.SaveForm(punishEntity.ID, punishEntity); } // string ReformID = Request.Form["REFORMID"] != null ? Request.Form["REFORMID"].ToString() : ""; //整改ID //违章整改记录 LllegalReformEntity cEntity = lllegalreformbll.GetEntityByBid(keyValue); cEntity.REFORMDEADLINE = rEntity.REFORMDEADLINE; cEntity.REFORMPEOPLE = rEntity.REFORMPEOPLE; cEntity.REFORMPEOPLEID = rEntity.REFORMPEOPLEID; cEntity.REFORMDEPTCODE = rEntity.REFORMDEPTCODE; cEntity.REFORMDEPTNAME = rEntity.REFORMDEPTNAME; cEntity.REFORMTEL = rEntity.REFORMTEL; lllegalreformbll.SaveForm(cEntity.ID, cEntity); // string AcceptID = Request.Form["ACCEPTID"] != null ? Request.Form["ACCEPTID"].ToString() : ""; // 验收ID //隐患验收 LllegalAcceptEntity aptEntity = lllegalacceptbll.GetEntityByBid(keyValue); aptEntity.ACCEPTPEOPLE = aEntity.ACCEPTPEOPLE; aptEntity.ACCEPTPEOPLEID = aEntity.ACCEPTPEOPLEID; aptEntity.ACCEPTDEPTCODE = aEntity.ACCEPTDEPTCODE; aptEntity.ACCEPTDEPTNAME = aEntity.ACCEPTDEPTNAME; aptEntity.ACCEPTTIME = aEntity.ACCEPTTIME; lllegalacceptbll.SaveForm(aptEntity.ID, aptEntity); //添加用户积分关联 if (isAddScore) { lllegalpunishbll.SaveUserScore(pbEntity.PERSONINCHARGEID, entity.LLLEGALLEVEL); lllegalpunishbll.SaveUserScore(pbEntity.FIRSTINCHARGEID, entity.LLLEGALLEVEL); lllegalpunishbll.SaveUserScore(pbEntity.SECONDINCHARGEID, entity.LLLEGALLEVEL); } //确定要提交 if (isSubmit) { //提交流程到下一节点 if (!string.IsNullOrEmpty(participant)) { int count = htworkflowbll.SubmitWorkFlow(keyValue, participant, wfFlag, curUser.UserId); if (count > 0) { htworkflowbll.UpdateFlowStateByObjectId("bis_lllegalregister", "flowstate", keyValue); //更新业务流程状态 } } else { return(Error("请联系系统管理员,确认" + errorMsg + "!")); } } else //安全管理部门对装置类违章进行转发,转发至装置部门单位下,无需更改流程状态 { bool isSuccess = htworkflowbll.SubmitWorkFlowNoChangeStatus(keyValue, participant, curUser.UserId); if (isSuccess) { return(Success("操作成功!")); } else { return(Error("请联系系统管理员,确认" + errorMsg + "!")); } } return(Success("操作成功!")); }
public ActionResult ExportScoreRank(string condition, string queryJson) { Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current(); DataItemDetailBLL itemBll = new DataItemDetailBLL(); var item = itemBll.GetEntity(user.OrganizeId); string val = item == null ? "100" : item.ItemValue; Pagination pagination = new Pagination(); pagination.page = 1; pagination.rows = 100000000; pagination.p_kid = "u.userid"; pagination.p_fields = "REALNAME,GENDER,identifyid,DEPTNAME,(nvl(score,0)+" + val + ") score"; pagination.p_tablename = "v_userinfo u left join (select a.userid,nvl(sum(score),0) as score from base_user a left join bis_userscore b on a.userid=b.userid where year='" + DateTime.Now.Year + "' group by a.userid) t on u.userid=t.userid"; pagination.conditionJson = "1=1 "; pagination.sidx = "score"; pagination.sord = "desc"; string title = "人员安全积分排名"; if (user.IsSystem) { pagination.conditionJson = "1=1"; } else { string where = new AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value, "departmentcode", "organizecode"); if (!string.IsNullOrEmpty(where)) { pagination.conditionJson += " and " + where; } } var data = userscorebll.GetPageJsonList(pagination, queryJson); //设置导出格式 ExcelConfig excelconfig = new ExcelConfig(); excelconfig.Title = title; excelconfig.TitleFont = "微软雅黑"; excelconfig.TitlePoint = 25; excelconfig.FileName = title + ".xls"; excelconfig.IsAllSizeColumn = true; //每一列的设置,没有设置的列信息,系统将按datatable中的列名导出 List <ColumnEntity> listColumnEntity = new List <ColumnEntity>(); excelconfig.ColumnEntity = listColumnEntity; ColumnEntity columnentity = new ColumnEntity(); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "realname", ExcelColumn = "姓名", Alignment = "center" }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "gender", ExcelColumn = "性别", Alignment = "center" }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "identifyid", ExcelColumn = "身份证号", Alignment = "center" }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "deptname", ExcelColumn = "单位/部门", Alignment = "center" }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "score", ExcelColumn = "积分", Alignment = "center" }); //调用导出方法 ExcelHelper.ExcelDownload(data, excelconfig); return(Success("导出成功。")); }
public object GetInfo([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; string id = dy.data.uid; bool IsPermission = false; //是否有权限 OperatorProvider.AppUserId = userId; //设置当前用户 var user = userBll.GetUserInfoEntity(id); //获取用户基本信息 DataItemDetailBLL itemBll = new DataItemDetailBLL(); string path = itemBll.GetItemValue("imgUrl"); var cert = new ERCHTMS.Busines.PersonManage.CertificateBLL().GetList(id).Select(t => new { t.CertName, t.CertNum, SendDate = t.SendDate.Value.ToString("yyyy-MM-dd"), t.Years, t.SendOrgan, FilePath = path + t.FilePath }).ToList(); //获取人员证书信息 var wzInfo = new DesktopBLL().GetWZInfoByUserId(id); //违章信息 var health = new ERCHTMS.Busines.OccupationalHealthManage.OccupationalstaffdetailBLL().GetUserTable(id); //职业病信息 //20190326 fwz 新增查询个人接触职业危害因素 string Hazardfactor = ""; //判断是否是本人\厂领导\EHS部与人力资源部的人 if (userId == id) { IsPermission = true; } //获取当前操作用户 var Appuser = userBll.GetUserInfoEntity(userId); //获取用户基本信息 //EHS部与人力资源部配置在字典中 通过字典查找 var Perdeptname = Appuser.DepartmentCode; DataItemDetailBLL dataItemDetailBLL = new DataItemDetailBLL(); var data = dataItemDetailBLL.GetDataItemListByItemCode("'SelectDept'").ToList(); if (data != null) { foreach (var Peritem in data) { string value = Peritem.ItemValue; string[] values = value.Split('|'); for (int i = 0; i < values.Length; i++) { if (values[i] == Perdeptname) //如果部门编码对应则是有权限的人 { IsPermission = true; break; } } } } //如果是厂领导也有权限 if (Appuser.RoleName.Contains("厂级部门用户") && Appuser.RoleName.Contains("公司领导")) { IsPermission = true; } if (IsPermission) { Hazardfactor = new HazardfactoruserBLL().GetUserHazardfactor(user.Account); } var work = new WorkRecordBLL().GetList(id).Select(t => new { EnterDate = t.EnterDate.ToString().Contains("0001") ? "" : t.EnterDate.ToString("yyyy-MM-dd"), LeaveTime = t.LeaveTime.ToString().Contains("0001") ? "" : t.LeaveTime.ToString("yyyy-MM-dd"), t.DeptName, t.PostName, t.OrganizeName, t.JobName }).ToList();//工作记录 string deptname = new TransferBLL().GetDeptName(user.DepartmentId); string projectName = ""; if (!string.IsNullOrEmpty(user.ProjectId)) { OutsouringengineerEntity entity = new OutsouringengineerBLL().GetEntity(user.ProjectId); if (entity != null) { projectName = entity.ENGINEERNAME; } } string photo = ""; if (!string.IsNullOrEmpty(user.HeadIcon)) { if (!string.IsNullOrEmpty(path)) { photo = path + user.HeadIcon; } } int score = 100; var item = itemBll.GetEntity("csjf"); if (item != null) { score = int.Parse(item.ItemValue); } int point = 0; string argValue = new DataItemDetailBLL().GetItemValue("Point"); if (!string.IsNullOrEmpty(argValue) && argValue == "point") { dynamic pointdata = UpdatePoint(user.Account); if (pointdata != null && pointdata.Qualitydata.Count > 0) { point = pointdata.Qualitydata[0].point; } } //2019-03-08 Fwz修改 加入职务字段 部门显示改为层级显示 return(new { Code = 0, Count = 1, Info = "获取数据成功", data = new { realname = user.RealName, point = point, sex = user.Gender, identifyid = user.IdentifyID, deptname = deptname, postname = user.DutyName, dutyname = user.PostName, organizename = user.OrganizeName, native = user.Native, nation = user.Nation, isSpecial = user.IsSpecial, isSpecialEqu = user.IsSpecialEqu, isBlack = user.IsBlack, mobile = user.Mobile, usertype = user.UserType, isEpiboly = user.isEpiboly, enterDate = user.EnterTime == null ? "" : user.EnterTime.Value.ToString("yyyy-MM-dd"), leaveTime = user.DepartureTime == null ? "" : user.DepartureTime.Value.ToString("yyyy-MM-dd"), isPresence = user.isPresence, score = new UserScoreBLL().GetUserScore(user.UserId, DateTime.Now.Year.ToString()) + score, projectName = projectName, faceUrl = photo, CertInfo = cert, IllInfo = health, Hazardfactor = Hazardfactor, IsPermission = IsPermission, WorkInfo = work, IllegalInfo = wzInfo, isfourperson = user.IsFourPerson, fourpersontype = user.FourPersonType } }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
public ActionResult SubmitForm(string keyValue, LllegalRegisterEntity entity, LllegalApproveEntity pEntity, LllegalReformEntity rEntity, LllegalAcceptEntity aEntity) { /* * 注:核准分两步 * * 确定为装置类情况下,如果当前核准人是安全管理部门人员, 先判断是否为装置类,如果不是 则直接到整改或退回,如果是,则转发至装置部门 或退回(不是提交) * 如果是非安全管理人员,则提交到安全管理部门人员会退回到登记. */ string errorMsg = string.Empty; Operator curUser = OperatorProvider.Provider.Current(); string wfFlag = string.Empty; //流程标识 string participant = string.Empty; //获取流程下一节点的参与人员 var lllegatypename = ""; if (!string.IsNullOrWhiteSpace(entity.LLLEGALTYPE)) { lllegatypename = dataitemdetailbll.GetEntity(entity.LLLEGALTYPE).ItemName; } //保存违章基本信息 LllegalRegisterEntity baseentity = lllegalregisterbll.GetEntity(keyValue); entity.AUTOID = baseentity.AUTOID; entity.CREATEDATE = baseentity.CREATEDATE; entity.CREATEUSERDEPTCODE = baseentity.CREATEUSERDEPTCODE; entity.CREATEUSERID = baseentity.CREATEUSERID; entity.CREATEUSERNAME = baseentity.CREATEUSERNAME; entity.CREATEUSERORGCODE = baseentity.CREATEUSERORGCODE; entity.MODIFYDATE = DateTime.Now; entity.MODIFYUSERID = curUser.UserId; entity.MODIFYUSERNAME = curUser.UserName; entity.RESEVERFOUR = ""; entity.RESEVERFIVE = ""; lllegalregisterbll.SaveForm(keyValue, entity); #region 考核信息 string RELEVANCEDATA = Request.Form["RELEVANCEDATA"]; if (!string.IsNullOrEmpty(RELEVANCEDATA)) { //先删除考核信息集合 lllegalpunishbll.DeleteLllegalPunishList(entity.ID, ""); JArray jarray = (JArray)JsonConvert.DeserializeObject(RELEVANCEDATA); foreach (JObject rhInfo in jarray) { //string relevanceId = rhInfo["ID"].ToString(); //主键id string assessobject = rhInfo["ASSESSOBJECT"].ToString(); string personinchargename = rhInfo["PERSONINCHARGENAME"].ToString(); //关联责任人姓名 string personinchargeid = rhInfo["PERSONINCHARGEID"].ToString(); //关联责任人id string performancepoint = rhInfo["PERFORMANCEPOINT"].ToString(); //EHS绩效考核 string economicspunish = rhInfo["ECONOMICSPUNISH"].ToString(); // 经济处罚 string education = rhInfo["EDUCATION"].ToString(); //教育培训 string lllegalpoint = rhInfo["LLLEGALPOINT"].ToString(); //违章扣分 string awaitjob = rhInfo["AWAITJOB"].ToString(); //待岗 LllegalPunishEntity newpunishEntity = new LllegalPunishEntity(); newpunishEntity.LLLEGALID = entity.ID; newpunishEntity.ASSESSOBJECT = assessobject; //考核对象 newpunishEntity.PERSONINCHARGEID = personinchargeid; newpunishEntity.PERSONINCHARGENAME = personinchargename; newpunishEntity.PERFORMANCEPOINT = !string.IsNullOrEmpty(performancepoint) ? Convert.ToDecimal(performancepoint) : 0; newpunishEntity.ECONOMICSPUNISH = !string.IsNullOrEmpty(economicspunish) ? Convert.ToDecimal(economicspunish) : 0; newpunishEntity.EDUCATION = !string.IsNullOrEmpty(education) ? Convert.ToDecimal(education) : 0; newpunishEntity.LLLEGALPOINT = !string.IsNullOrEmpty(lllegalpoint) ? Convert.ToDecimal(lllegalpoint) : 0; newpunishEntity.AWAITJOB = !string.IsNullOrEmpty(awaitjob) ? Convert.ToDecimal(awaitjob) : 0; newpunishEntity.MARK = assessobject.Contains("考核") ? "0" : "1"; //标记0考核,1联责 lllegalpunishbll.SaveForm("", newpunishEntity); } } #endregion #region 违章奖励信息 string AWARDDATA = Request.Form["AWARDDATA"]; if (!string.IsNullOrEmpty(AWARDDATA)) { //先删除关联集合 lllegalawarddetailbll.DeleteLllegalAwardList(entity.ID); JArray jarray = (JArray)JsonConvert.DeserializeObject(AWARDDATA); foreach (JObject rhInfo in jarray) { string userid = rhInfo["USERID"].ToString(); //奖励用户 string username = rhInfo["USERNAME"].ToString(); string deptid = rhInfo["DEPTID"].ToString(); //奖励用户部门 string deptname = rhInfo["DEPTNAME"].ToString(); string points = rhInfo["POINTS"].ToString(); //奖励积分 string money = rhInfo["MONEY"].ToString(); //奖励金额 LllegalAwardDetailEntity awardEntity = new LllegalAwardDetailEntity(); awardEntity.LLLEGALID = entity.ID; awardEntity.USERID = userid; //奖励对象 awardEntity.USERNAME = username; awardEntity.DEPTID = deptid; awardEntity.DEPTNAME = deptname; awardEntity.POINTS = !string.IsNullOrEmpty(points) ? int.Parse(points) : 0; awardEntity.MONEY = !string.IsNullOrEmpty(money) ? Convert.ToDecimal(money) : 0; lllegalawarddetailbll.SaveForm("", awardEntity); } } #endregion //违章整改记录 LllegalReformEntity cEntity = lllegalreformbll.GetEntityByBid(keyValue); cEntity.REFORMDEADLINE = rEntity.REFORMDEADLINE; cEntity.REFORMPEOPLE = rEntity.REFORMPEOPLE; cEntity.REFORMPEOPLEID = rEntity.REFORMPEOPLEID; cEntity.REFORMDEPTCODE = rEntity.REFORMDEPTCODE; cEntity.REFORMDEPTNAME = rEntity.REFORMDEPTNAME; cEntity.REFORMTEL = rEntity.REFORMTEL; cEntity.REFORMSTATUS = string.Empty; cEntity.REFORMCHARGEDEPTID = rEntity.REFORMCHARGEDEPTID; cEntity.REFORMCHARGEDEPTNAME = rEntity.REFORMCHARGEDEPTNAME; cEntity.REFORMCHARGEPERSON = rEntity.REFORMCHARGEPERSON; cEntity.REFORMCHARGEPERSONNAME = rEntity.REFORMCHARGEPERSONNAME; cEntity.ISAPPOINT = rEntity.ISAPPOINT; lllegalreformbll.SaveForm(cEntity.ID, cEntity); //违章验收 LllegalAcceptEntity aptEntity = lllegalacceptbll.GetEntityByBid(keyValue); aptEntity.ACCEPTPEOPLE = aEntity.ACCEPTPEOPLE; aptEntity.ACCEPTPEOPLEID = aEntity.ACCEPTPEOPLEID; aptEntity.ACCEPTDEPTCODE = aEntity.ACCEPTDEPTCODE; aptEntity.ACCEPTDEPTNAME = aEntity.ACCEPTDEPTNAME; aptEntity.ACCEPTTIME = aEntity.ACCEPTTIME; lllegalacceptbll.SaveForm(aptEntity.ID, aptEntity); WfControlObj wfentity = new WfControlObj(); wfentity.businessid = keyValue; // wfentity.argument1 = entity.MAJORCLASSIFY; //专业分类 wfentity.argument2 = entity.LLLEGALTYPE; //违章类型 wfentity.argument3 = curUser.DeptId; //当前人所属部门 wfentity.argument4 = entity.LLLEGALTEAMCODE; //违章部门 wfentity.argument5 = entity.LLLEGALLEVEL; //违章级别 wfentity.startflow = baseentity.FLOWSTATE; //上报,且存在上级部门 if (entity.ISUPSAFETY == "1") { wfentity.submittype = "上报"; } else //不上报,评估通过需要提交整改,评估不通过退回到登记 { /****判断当前人是否评估通过*****/ #region 判断当前人是否评估通过 //评估通过,则直接进行整改 if (pEntity.APPROVERESULT == "1") { wfentity.submittype = "提交"; //不指定整改责任人 if (rEntity.ISAPPOINT == "0") { wfentity.submittype = "制定提交"; } //判断是否是同级提交 bool ismajorpush = GetCurUserWfAuth(null, baseentity.FLOWSTATE, baseentity.FLOWSTATE, "厂级违章流程", "同级提交", entity.MAJORCLASSIFY, null, null, keyValue); if (ismajorpush) { wfentity.submittype = "同级提交"; } } else //评估不通过,退回到登记 { wfentity.submittype = "退回"; } #endregion } wfentity.rankid = null; wfentity.user = curUser; wfentity.mark = "厂级违章流程"; wfentity.organizeid = entity.BELONGDEPARTID; //对应电厂id //获取下一流程的操作人 WfControlResult result = wfcontrolbll.GetWfControl(wfentity); //处理成功 if (result.code == WfCode.Sucess) { participant = result.actionperson; wfFlag = result.wfflag; if (!string.IsNullOrEmpty(participant)) { //如果是更改状态 if (result.ischangestatus) { int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId); if (count > 0) { //保存违章核准 pEntity.LLLEGALID = keyValue; lllegalapprovebll.SaveForm("", pEntity); htworkflowbll.UpdateFlowStateByObjectId("bis_lllegalregister", "flowstate", keyValue); //更新业务流程状态 return(Success(result.message)); } else { return(Error("当前用户无核准权限!")); } } else //不更改状态的情况下 { //保存违章核准 pEntity.LLLEGALID = keyValue; lllegalapprovebll.SaveForm("", pEntity); htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId); return(Success(result.message)); } } else { return(Error("目标流程参与者未定义!")); } } else { return(Error(result.message)); } }
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 }