/// <summary> /// 更新任务完成状态 /// </summary> /// <param name="processId">流程实例主键</param> /// <param name="nodeId">节点主键</param> /// <param name="taskId">任务节点Id</param> /// <param name="userId">用户主键</param> /// <param name="userName">用户名称</param> public void UpdateStateByNodeId(string processId, string nodeId, string taskId, string userId, string userName) { try { var list = this.BaseRepository().FindList <WfTaskEntity>(t => t.F_ProcessId == processId && t.F_IsFinished == 0 && t.F_NodeId == nodeId); foreach (var item in list) { WfTaskEntity wfTaskEntity = new WfTaskEntity(); wfTaskEntity.Modify(item.F_Id); wfTaskEntity.F_IsFinished = 1; if (taskId == item.F_Id) { wfTaskEntity.F_ModifyUserId = userId; } wfTaskEntity.F_ModifyUserName = userName; this.BaseRepository().Update(wfTaskEntity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 保存或更新流程实例任务 /// </summary> /// <param name="entity">实体</param> /// <param name="companyId">公司主键</param> /// <param name="departmentId">部门主键</param> public void SaveEntitys(WfTaskEntity entity, string companyId, string departmentId) { try { if (entity.auditors.Count > 0) { foreach (var auditor in entity.auditors) { WfTaskEntity wfTaskEntity = new WfTaskEntity(); wfTaskEntity.F_ProcessId = entity.F_ProcessId; wfTaskEntity.F_NodeId = entity.F_NodeId; wfTaskEntity.F_NodeName = entity.F_NodeName; wfTaskEntity.F_TaskType = entity.F_TaskType; wfTaskEntity.F_TimeoutAction = entity.F_TimeoutAction; wfTaskEntity.F_TimeoutNotice = entity.F_TimeoutNotice; wfTaskEntity.F_PreviousId = entity.F_PreviousId; wfTaskEntity.F_PreviousName = entity.F_PreviousName; wfTaskEntity.F_CreateUserId = entity.F_CreateUserId; wfTaskEntity.F_CreateUserName = entity.F_CreateUserName; wfTaskEntity.F_AuditorId = auditor.auditorId; wfTaskEntity.F_AuditorName = auditor.auditorName; wfTaskEntity.F_CompanyId = "1"; wfTaskEntity.F_DepartmentId = "1"; if (auditor.condition == 1)//1.同一个部门2.同一个公司 { wfTaskEntity.F_DepartmentId = departmentId; } else if (auditor.condition == 2) { wfTaskEntity.F_CompanyId = companyId; } wfTaskEntity.Create(); this.BaseRepository().Insert(wfTaskEntity); } } else { entity.F_AuditorId = "1"; entity.Create(); this.BaseRepository().Insert(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 保存或更新流程实例任务 /// </summary> /// <param name="entity">实体</param> /// <param name="companyId">公司主键</param> /// <param name="departmentId">部门主键</param> public void SaveEntitys(WfTaskEntity entity, string companyId, string departmentId) { try { wfTaskService.SaveEntitys(entity, companyId, departmentId); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }
/// <summary> /// 保存或更新流程实例任务 /// </summary> /// <param name="keyValue">主键</param> /// <param name="entity">实体</param> public void SaveEntity(WfTaskEntity entity) { try { wfTaskService.SaveEntity(entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }
/// <summary> /// 保存或更新流程实例任务 /// </summary> /// <param name="entity">实体</param> public void SaveEntity(WfTaskEntity entity) { try { entity.Create(); this.BaseRepository().Insert(entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 更新任务状态 /// </summary> /// <param name="keyValue">主键</param> /// <param name="state">状态 1 完成 2 关闭(会签 </param> public void UpdateState(string keyValue, int state) { try { WfTaskEntity wfTaskEntity = new WfTaskEntity(); wfTaskEntity.Modify(keyValue); wfTaskEntity.F_IsFinished = state; this.BaseRepository().Update(wfTaskEntity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }