/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, FivesafetycheckEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public ActionResult SaveForm(string keyValue, FivesafetycheckEntity entity) { Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current(); string state = string.Empty; string moduleName = "五定安全检查"; string flowid = string.Empty; ManyPowerCheckEntity mpcEntity = peoplereviewbll.CheckAuditPower(curUser, out state, moduleName, "", false); entity.CHECKEDDEPARTIDALL = entity.CHECKEDDEPARTID; if (mpcEntity == null) { // 没有扣成就直接进入整改中 entity.ISSAVED = 1; entity.ISOVER = 1; } else { //直接进入申请中(没有保存) entity.ISSAVED = 1; entity.ISOVER = 0; entity.FLOWDEPT = mpcEntity.CHECKDEPTID; entity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME; entity.FLOWROLE = mpcEntity.CHECKROLEID; entity.FLOWROLENAME = mpcEntity.CHECKROLENAME; entity.FLOWNAME = mpcEntity.FLOWNAME; entity.FLOWID = mpcEntity.ID; } fivesafetycheckbll.SaveForm(keyValue, entity); return(Success("操作成功。")); }
public ActionResult ApporveForm(string keyValue, AptitudeinvestigateauditEntity aentity) { Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current(); FivesafetycheckEntity entity = fivesafetycheckbll.GetEntity(keyValue); string state = string.Empty; string moduleName = "五定安全检查"; ManyPowerCheckEntity mpcEntity = peoplereviewbll.CheckAuditPower(curUser, out state, moduleName, "", false, entity.FLOWID); #region //审核信息表 AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity(); aidEntity.AUDITRESULT = aentity.AUDITRESULT; //通过 aidEntity.AUDITTIME = Convert.ToDateTime(aentity.AUDITTIME.Value.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss")); //审核时间 aidEntity.AUDITPEOPLE = aentity.AUDITPEOPLE; //审核人员姓名 aidEntity.AUDITPEOPLEID = aentity.AUDITPEOPLEID; //审核人员id aidEntity.APTITUDEID = keyValue; //关联的业务ID aidEntity.AUDITDEPTID = aentity.AUDITDEPTID; //审核部门id aidEntity.AUDITDEPT = aentity.AUDITDEPT; //审核部门 aidEntity.AUDITOPINION = aentity.AUDITOPINION; //审核意见 aidEntity.FlowId = entity.FLOWID; //流程步骤 if (null != mpcEntity) { aidEntity.REMARK = (mpcEntity.AUTOID.Value - 1).ToString(); //备注 存流程的顺序号 } else { aidEntity.REMARK = "7"; } aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity); #endregion #region 保存 //审核通过 if (aentity.AUDITRESULT == "0") { //判断是否走的会签,走会签就要判断是不是所有的部门都有签到,未完成的会签只添加审核记录 var checkstep = powerCheckbll.GetEntity(entity.FLOWID); int hqresult = 0; // 0:会签完成,走后续流程 1:会签未完成 if (checkstep.SERIALNUM == 1) // 脚本会签 { var deptauditlist = fivesafetycheckbll.GetStepDept(checkstep, keyValue); //获取未会签的部门 foreach (UserEntity userinfp in deptauditlist) { if (userinfp.DepartmentId != curUser.DeptId) { hqresult = 1; } else //更新当前人会签记录 { if (entity.CHECKDEPTALL == "" || entity.CHECKDEPTALL == null) { entity.CHECKDEPTALL = curUser.DeptId; entity.CHECKUSERALL = curUser.UserId; } else { entity.CHECKDEPTALL += "," + curUser.DeptId; entity.CHECKUSERALL += "," + curUser.UserId; } } } } if (hqresult == 0) // 会签完成,走后续流程 { //0表示流程未完成,1表示流程结束 会签走完了才执行后面的代码 if (null != mpcEntity) { entity.ISOVER = 0; entity.FLOWID = mpcEntity.ID; entity.FLOWDEPT = mpcEntity.CHECKDEPTID; entity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME; entity.FLOWROLE = mpcEntity.CHECKROLEID; entity.FLOWROLENAME = mpcEntity.CHECKROLENAME; entity.FLOWNAME = mpcEntity.FLOWNAME; } else { entity.ISOVER = 1; entity.FLOWID = ""; entity.FLOWDEPT = ""; entity.FLOWDEPTNAME = ""; entity.FLOWROLE = ""; entity.FLOWROLENAME = ""; entity.FLOWNAME = ""; } } } else //审核不通过 { entity.ISSAVED = 0; entity.ISOVER = 0; entity.CHECKDEPTALL = ""; entity.CHECKUSERALL = ""; entity.FLOWID = ""; // 审批不通过,将历史审批记录打标(为流程图) //获取当前业务对象的所有审核记录 var shlist = aptitudeinvestigateauditbll.GetAuditList(keyValue); //批量更新审核记录关联ID foreach (AptitudeinvestigateauditEntity mode in shlist) { mode.REMARK = "-1"; //历史审批记录改成-1 aptitudeinvestigateauditbll.SaveForm(mode.ID, mode); } } fivesafetycheckbll.SaveForm(keyValue, entity); #endregion return(Success("操作成功!")); }