/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, HTExtensionEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public ActionResult SaveForm(string keyValue, HTExtensionEntity entity) { Operator curUser = new OperatorProvider().Current(); string postPoneResult = Request.Form["POSTPONERESULT"].ToString(); //审批结果 var bsentity = htbaseinfobll.GetEntity(keyValue); //根据id获取隐患对象 //string postponereason = Request.Form["POSTPONEREASON"].ToString(); //审批意见 string rankname = string.Empty; bool isUpdateDate = false; string participant = string.Empty; string wfFlag = string.Empty; string hidcode = bsentity.HIDCODE; try { WfControlResult result = new WfControlResult(); WfControlObj wfentity = new WfControlObj(); wfentity.businessid = keyValue; // wfentity.startflow = "整改延期审批"; wfentity.submittype = "提交"; wfentity.rankid = bsentity.HIDRANK; wfentity.user = curUser; wfentity.mark = "整改延期流程"; wfentity.organizeid = bsentity.HIDDEPART; //对应电厂id HTChangeInfoEntity cEntity = htchangeinfobll.GetEntityByHidCode(hidcode); //是否通过 if (postPoneResult == "1") { //获取下一流程的操作人 result = wfcontrolbll.GetWfControl(wfentity); //处理成功 if (result.code == WfCode.Sucess) { participant = result.actionperson; wfFlag = result.wfflag; cEntity.POSTPONEPERSON = "," + participant + ","; // 用于当前人账户判断是否具有操作其权限 cEntity.POSTPONEDAYS = cEntity.POSTPONEDAYS; //申请天数 cEntity.POSTPONEDEPT = result.deptcode; //审批部门Code cEntity.POSTPONEDEPTNAME = result.deptname; //审批部门名称 cEntity.POSTPONEPERSONNAME = result.username; //审批人 cEntity.APPLICATIONSTATUS = wfFlag; //延期通过 } else { return(Error(result.message)); } } else { cEntity.APPLICATIONSTATUS = "3"; //延期申请失败 //延期失败保存整改人相关信息到result,用于极光推送 UserEntity changeUser = userbll.GetEntity(cEntity.CHANGEPERSON); if (null != changeUser) { result.actionperson = changeUser.Account; result.username = cEntity.CHANGEPERSONNAME; result.deptname = cEntity.CHANGEDUTYDEPARTNAME; result.deptid = changeUser.DepartmentId; result.deptcode = cEntity.CHANGEDUTYDEPARTCODE; } } //延期成功 if (wfFlag == "2" && postPoneResult == "1") { isUpdateDate = true; } //如果安环部、生技部审批通过,则更改整改截至时间、验收时间,增加相应的整改天数 if (isUpdateDate) { //重新赋值整改截至时间 cEntity.CHANGEDEADINE = cEntity.CHANGEDEADINE.Value.AddDays(cEntity.POSTPONEDAYS); //更新验收时间 HTAcceptInfoEntity aEntity = htacceptinfobll.GetEntityByHidCode(hidcode); if (null != aEntity.ACCEPTDATE) { aEntity.ACCEPTDATE = aEntity.ACCEPTDATE.Value.AddDays(cEntity.POSTPONEDAYS); } htacceptinfobll.SaveForm(aEntity.ID, aEntity); entity.HANDLESIGN = "1"; //成功标记 } cEntity.APPSIGN = "Web"; //更新整改信息 htchangeinfobll.SaveForm(cEntity.ID, cEntity); //添加审批记录 entity.APPSIGN = "Web"; string nextName = string.Empty; //成功 if (wfFlag == "2" && postPoneResult == "1") { entity.HANDLETYPE = wfFlag; //处理类型 0 申请 1 审批 2 整改结束 wfFlag状态返回 2 时表示整改延期完成 } //审批中 else if (wfFlag != "2" && postPoneResult == "1") { entity.HANDLETYPE = "1"; //审批中 nextName = "整改延期审批"; } else //失败 { if (postPoneResult == "0") { entity.HANDLETYPE = "-1"; //失败 nextName = "整改延期退回"; } } entity.POSTPONERESULT = postPoneResult; //申请结果 htextensionbll.SaveForm("", entity); //极光推送 htworkflowbll.PushMessageForWorkFlow("隐患处理审批", nextName, wfentity, result); } catch (Exception ex) { return(Error(ex.Message.ToString())); } return(Success("操作成功。")); }
public ActionResult SaveSettingForm(string keyCode, HTChangeInfoEntity entity) { Operator curUser = new OperatorProvider().Current(); string hidid = Request.Form["HIDID"] != null ? Request.Form["HIDID"].ToString() : ""; //隐患主键 HTBaseInfoEntity bsentity = new HTBaseInfoBLL().GetEntity(hidid); //主键 string rankname = string.Empty; bool isUpdateDate = false; //是否更新时间 var cEntity = htchangeinfobll.GetEntityByCode(keyCode); //根据HidCode获取整改对象 string postponereason = Request.Form["POSTPONEREASON"] != null ? Request.Form["POSTPONEREASON"].ToString() : ""; string controlmeasure = Request.Form["CONTROLMEASURE"] != null ? Request.Form["CONTROLMEASURE"].ToString() : ""; //管控措施 try { WfControlObj wfentity = new WfControlObj(); wfentity.businessid = hidid; // wfentity.argument1 = bsentity.MAJORCLASSIFY; wfentity.argument3 = bsentity.HIDTYPE; //隐患类别 wfentity.startflow = "整改延期申请"; wfentity.submittype = "提交"; wfentity.rankid = bsentity.HIDRANK; wfentity.user = curUser; wfentity.mark = "整改延期流程"; wfentity.organizeid = bsentity.HIDDEPART; //对应电厂id //获取下一流程的操作人 WfControlResult result = wfcontrolbll.GetWfControl(wfentity); //保存申请记录 HTExtensionEntity exentity = new HTExtensionEntity(); //处理成功 if (result.code == WfCode.Sucess) { string participant = result.actionperson; string wfFlag = result.wfflag; cEntity.POSTPONEPERSON = "," + participant + ","; // 用于当前人账户判断是否具有操作其权限 cEntity.POSTPONEDAYS = entity.POSTPONEDAYS; //申请天数 cEntity.POSTPONEDEPT = result.deptcode; //审批部门Code cEntity.POSTPONEDEPTNAME = result.deptname; //审批部门名称 cEntity.POSTPONEPERSONNAME = result.username; cEntity.APPLICATIONSTATUS = wfFlag; //是否更新时间,累加天数 if (wfFlag == "2") { isUpdateDate = true; } //如果安环部、生技部审批通过,则更改整改截至时间、验收时间,增加相应的整改天数 if (isUpdateDate) { //重新赋值整改截至时间 cEntity.CHANGEDEADINE = cEntity.CHANGEDEADINE.Value.AddDays(cEntity.POSTPONEDAYS); //更新验收时间 HTAcceptInfoEntity aEntity = htacceptinfobll.GetEntityByHidCode(keyCode); if (null != aEntity.ACCEPTDATE) { aEntity.ACCEPTDATE = aEntity.ACCEPTDATE.Value.AddDays(cEntity.POSTPONEDAYS); } htacceptinfobll.SaveForm(aEntity.ID, aEntity); exentity.HANDLESIGN = "1"; //成功标记 } cEntity.APPSIGN = "Web"; //更新整改信息 htchangeinfobll.SaveForm(cEntity.ID, cEntity); //更新延期设置 exentity.HIDCODE = cEntity.HIDCODE; exentity.HIDID = hidid; exentity.HANDLEDATE = DateTime.Now; exentity.POSTPONEDAYS = entity.POSTPONEDAYS.ToString(); exentity.HANDLEUSERID = curUser.UserId; exentity.HANDLEUSERNAME = curUser.UserName; exentity.HANDLEDEPTCODE = curUser.DeptCode; exentity.HANDLEDEPTNAME = curUser.DeptName; exentity.HANDLETYPE = "0"; //申请类型 状态返回 2 时表示整改延期完成 (申请) exentity.HANDLEID = DateTime.Now.ToString("yyyyMMddhhmmss").ToString(); exentity.POSTPONEREASON = postponereason; //延期理由 exentity.CONTROLMEASURE = controlmeasure; //临时管控措施 exentity.APPSIGN = "Web"; htextensionbll.SaveForm("", exentity); //极光推送 htworkflowbll.PushMessageForWorkFlow("隐患处理审批", "整改延期审批", wfentity, result); return(Success(result.message)); } else { return(Error(result.message)); } } catch (Exception ex) { return(Error(ex.Message.ToString())); } }