/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, LllegalApproveEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
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 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)); } }