/// <summary> /// 流程完成时 /// 结束审核时,需要回调写入到表里,调用相应的事件 /// 若成功可以执行完成的处理 /// </summary> /// <param name="workFlowCurrentEntity">当前审批流程</param> /// <returns>成功失败</returns> public override bool OnAuditComplete(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { // 审核通过后,需要把有效状态修改过来 BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo); //string objectId = workFlowCurrentManager.GetEntity(workFlowCurrentEntity.Id).ObjectId; string objectId = workFlowCurrentEntity.ObjectId; if (!string.IsNullOrEmpty(objectId)) { // 这里写自己的方法(审核 过程中的回调),完成审核时 IDbHelper dbHelper = new SqlHelper(BaseSystemInfo.BusinessDbConnection); dbHelper.Open(); SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); switch (workFlowCurrentEntity.CategoryCode) { case "PuTongCaiGouDan": case "GuoNeiCaiGouHeTong": case "PutongCaiGouDanDGM": case "PutongCaiGouDanManager": sqlBuilder.BeginUpdate("WL物品申购"); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditComplete.ToString()); sqlBuilder.SetValue("审核", 1); sqlBuilder.SetDBNow("审核日期"); sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code); sqlBuilder.SetWhere("申请单号", objectId); sqlBuilder.EndUpdate(); break; case "YuanFuCaiLiaoShenQingDan": sqlBuilder.BeginUpdate("WL部门物品申购"); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditComplete.ToString()); sqlBuilder.SetValue("审核", 1); sqlBuilder.SetValue("总审核", 1); sqlBuilder.SetDBNow("审核日期"); sqlBuilder.SetDBNow("总审核日期"); sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code); sqlBuilder.SetWhere("申购单号", objectId); sqlBuilder.EndUpdate(); break; case "MoJuCaiGouHeTongP": case "MoJuCaiGouHeTongGM": sqlBuilder.BeginUpdate("GCMJ模具申请"); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditComplete.ToString()); sqlBuilder.SetValue("审核", 1); sqlBuilder.SetWhere("申请单号", objectId); sqlBuilder.EndUpdate(); break; } dbHelper.Close(); } // 若还需要有其他处理,就这后面继续处理 return(true); }
/// <summary> /// 流程完成时 /// 结束审核时,需要回调写入到表里,调用相应的事件 /// 若成功可以执行完成的处理 /// </summary> /// <param name="workFlowCurrentEntity">当前审批流程</param> /// <returns>成功失败</returns> public override bool OnAuditComplete(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { // 审核通过后,需要把有效状态修改过来 BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo); //string objectId = workFlowCurrentManager.GetEntity(workFlowCurrentEntity.Id).ObjectId; string objectId = workFlowCurrentEntity.ObjectId; if (!string.IsNullOrEmpty(objectId)) { // 这里写自己的方法(审核 过程中的回调),完成审核时 IDbHelper dbHelper = new SqlHelper(BaseSystemInfo.BusinessDbConnection); dbHelper.Open(); SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); switch (workFlowCurrentEntity.CategoryCode) { case "PuTongCaiGouDan": case "GuoNeiCaiGouHeTong": case "PutongCaiGouDanDGM": case "PutongCaiGouDanManager": sqlBuilder.BeginUpdate("WL物品申购"); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditComplete.ToString()); sqlBuilder.SetValue("审核", 1); sqlBuilder.SetDBNow("审核日期"); sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code); sqlBuilder.SetWhere("申请单号", objectId); sqlBuilder.EndUpdate(); break; case "YuanFuCaiLiaoShenQingDan": sqlBuilder.BeginUpdate("WL部门物品申购"); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditComplete.ToString()); sqlBuilder.SetValue("审核", 1); sqlBuilder.SetValue("总审核", 1); sqlBuilder.SetDBNow("审核日期"); sqlBuilder.SetDBNow("总审核日期"); sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code); sqlBuilder.SetWhere("申购单号", objectId); sqlBuilder.EndUpdate(); break; case "MoJuCaiGouHeTongP": case "MoJuCaiGouHeTongGM": sqlBuilder.BeginUpdate("GCMJ模具申请"); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditComplete.ToString()); sqlBuilder.SetValue("审核", 1); sqlBuilder.SetWhere("申请单号", objectId); sqlBuilder.EndUpdate(); break; } dbHelper.Close(); } // 若还需要有其他处理,就这后面继续处理 return true; }
public override int SetDeleted(object id, bool enabled = false, bool modifiedUser = false) { List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowCurrentEntity.FieldCategoryCode, id)); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowCurrentEntity.FieldDeletionStateCode, 0)); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowCurrentEntity.FieldEnabled, 0)); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo); // 若现在还有流程在用这个模板,就不可以被删除 if (!workFlowCurrentManager.Exists(parameters)) { return(base.SetDeleted(id, enabled, modifiedUser)); } return(0); }
/// <summary> /// 废弃单据 /// (发出单据时)当废弃审批流时需要做的事情 /// </summary> /// <param name="id">主键</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> public int AuditQuash(string id, string auditIdea) { int returnValeu = 0; // 只有还在审核中的才可以废弃 string auditStatus = this.GetProperty(id, BaseBusinessLogic.FieldAuditStatus); if (!string.IsNullOrEmpty(auditStatus)) { if (!(auditStatus.Equals(AuditStatus.StartAudit.ToString()) || auditStatus.Equals(AuditStatus.WaitForAudit.ToString()))) { return returnValeu; } } // 若能撤销流程中的单据,才可以撤销本地的单据 BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo); // 工作流里会进行撤销的工作 return workFlowCurrentManager.AuditQuash(this, this.CurrentTableName, id, auditIdea); }
/// <summary> /// 废弃单据 /// (发出单据时)当废弃审批流时需要做的事情 /// </summary> /// <param name="id">主键</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> public int AuditQuash(string id, string auditIdea) { int returnValeu = 0; // 只有还在审核中的才可以废弃 string auditStatus = this.GetProperty(id, BaseBusinessLogic.FieldAuditStatus); if (!string.IsNullOrEmpty(auditStatus)) { if (!(auditStatus.Equals(AuditStatus.StartAudit.ToString()) || auditStatus.Equals(AuditStatus.WaitForAudit.ToString()))) { return(returnValeu); } } // 若能撤销流程中的单据,才可以撤销本地的单据 BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo); // 工作流里会进行撤销的工作 return(workFlowCurrentManager.AuditQuash(this, this.CurrentTableName, id, auditIdea)); }
/// <summary> /// 删除用户的审核步骤 /// </summary> /// <param name="userId">用户主键</param> /// <returns>影响行数</returns> public int DeleteAuditStepByUser(string userId) { int returnValue = 0; // 1: 若还有当前审核中的记录,不能被删除掉 BaseWorkFlowCurrentManager manager = new BaseWorkFlowCurrentManager(this.DbHelper, this.UserInfo); List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>(3); parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldAuditUserId, userId)); parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldEnabled, 1)); parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldDeletionStateCode, 0)); if (!manager.Exists(parameters)) { // 2: 删除用户的审核步骤。 returnValue = this.SetProperty(new KeyValuePair<string, object>(BaseWorkFlowStepEntity.FieldAuditUserId, userId), new KeyValuePair<string, object>(BaseWorkFlowStepEntity.FieldDeletionStateCode, 1)); // 3: 同时把用户设置为无效。 if (returnValue > 0) { BaseUserManager userManager = new BaseUserManager(this.UserInfo); userManager.SetProperty(new KeyValuePair<string, object>(BaseUserEntity.FieldId, userId), new KeyValuePair<string, object>(BaseUserEntity.FieldEnabled, 0)); } } return returnValue; }
/// <summary> /// 重置单据 /// (发出单据时)当废弃审批流时需要做的事情 /// </summary> /// <param name="id">主键</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> public virtual int Reset(string id, string auditIdea) { int returnValeu = 0; // 只有还在审核中的才可以废弃 string auditStatus = this.GetProperty(id, BaseBusinessLogic.FieldAuditStatus); if (!string.IsNullOrEmpty(auditStatus)) { if (!(auditStatus.Equals(AuditStatus.StartAudit.ToString()) || auditStatus.Equals(AuditStatus.WaitForAudit.ToString()))) { return(returnValeu); } } // 若能撤销流程中的单据,才可以撤销本地的单据 BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo); BaseWorkFlowCurrentEntity workFlowCurrentEntity = workFlowCurrentManager.GetEntity(id); // 工作流里会进行撤销的工作 return(workFlowCurrentManager.Reset(workFlowCurrentEntity)); }
/// <summary> /// 删除用户的审核步骤 /// </summary> /// <param name="userId">用户主键</param> /// <returns>影响行数</returns> public int DeleteAuditStepByUser(string userId) { int returnValue = 0; // 1: 若还有当前审核中的记录,不能被删除掉 BaseWorkFlowCurrentManager manager = new BaseWorkFlowCurrentManager(this.DbHelper, this.UserInfo); List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(3); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowCurrentEntity.FieldAuditUserId, userId)); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowCurrentEntity.FieldEnabled, 1)); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowCurrentEntity.FieldDeletionStateCode, 0)); if (!manager.Exists(parameters)) { // 2: 删除用户的审核步骤。 returnValue = this.SetProperty(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldAuditUserId, userId), new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldDeletionStateCode, 1)); // 3: 同时把用户设置为无效。 if (returnValue > 0) { BaseUserManager userManager = new BaseUserManager(this.UserInfo); userManager.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldId, userId), new KeyValuePair <string, object>(BaseUserEntity.FieldEnabled, 0)); } } return(returnValue); }
public override int SetDeleted(object id, bool enabled = false, bool modifiedUser = false) { List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>(); parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldCategoryCode, id)); parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldDeletionStateCode, 0)); parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldEnabled, 0)); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo); // 若现在还有流程在用这个模板,就不可以被删除 if (!workFlowCurrentManager.Exists(parameters)) { return base.SetDeleted(id, enabled, modifiedUser); } return 0; }
/// <summary> /// 最终审核通过 /// </summary> /// <param name="userInfo">当前用户</param> /// <param name="id">主键</param> /// <param name="auditIdea">审核意见</param> /// <returns>影响行数</returns> public int AuditComplete(BaseUserInfo userInfo, string[] ids, string auditIdea) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); //IWorkFlowManager userReportManager = new UserReportManager(userInfo); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); dbHelper.BeginTransaction(); returnValue += workFlowCurrentManager.AuditComplete(ids, auditIdea); dbHelper.CommitTransaction(); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { dbHelper.RollbackTransaction(); BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return returnValue; }
/// <summary> /// 检查是否是步骤流 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="currentFlowIds">主键组</param> /// <param name="returnStatusCode">返回代码</param> /// <param name="returnStatusMessage">返回信息</param> /// <returns></returns> public bool CheckIsAutoWorkFlow(BaseUserInfo userInfo, string[] currentFlowIds, out string returnStatusCode,out string returnStatusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif returnStatusCode = string.Empty; returnStatusMessage = string.Empty; bool returnValue = false ; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { // 打开数据库 dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); string processId = string.Empty; for (int i = 0; i < currentFlowIds.Length; i++) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = workFlowCurrentManager.GetEntity(currentFlowIds[i]); if ((workFlowCurrentEntity != null) && (!string.IsNullOrEmpty(workFlowCurrentEntity.Id))) { if (workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.StartAudit.ToString()) || workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditPass.ToString()) || workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.WaitForAudit.ToString()) || workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditReject.ToString())) { // 不为空的话是步骤流 if (workFlowCurrentEntity.WorkFlowId != null) { returnValue = true; } else { // 判断是否是批量审核,只有自由流才限制批量审批 if (i > 0) { returnStatusMessage = "你选中的记录里包含自由审批流程所以不能批量审批。"; } return false; } } else { returnStatusMessage = "你选中的记录里包含状态不明确的记录。"; return false; } } else { returnStatusMessage = "你选中的记录里可能已被删除。"; return false; } } BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return returnValue; }
/// <summary> /// 提交审批(步骤流) /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="categoryCode">单据类型代码</param> /// <param name="categoryFullName">单据类型名称</param> /// <param name="objectIds">单据主键组</param> /// <param name="objectFullName">单据名称</param> /// <param name="workFlowCode">工作流编号</param> /// <param name="auditIdea">审批意见</param> /// <param name="returnStatusCode">返回码</param> /// <param name="dtWorkFlowActivity">步骤列表</param> /// <returns></returns> public string AuditStatr(BaseUserInfo userInfo, string categoryCode, string categoryFullName, string[] objectIds, string objectFullName, string workFlowCode, string auditIdea, out string returnStatusCode, DataTable dtWorkFlowActivity = null) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string returnValue = string.Empty; returnStatusCode = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); // 默认的都按报表来处理,特殊的直接调用,明确指定 IWorkFlowManager userReportManager = new UserReportManager(userInfo); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); // 事物开始 dbHelper.BeginTransaction(); for (int i = 0; i < objectIds.Length; i++) { returnValue = workFlowCurrentManager.AutoStatr(userReportManager, objectIds[i], objectFullName, categoryCode, categoryFullName, workFlowCode, auditIdea, dtWorkFlowActivity); } BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); // 提交事务 dbHelper.CommitTransaction(); if (!string.IsNullOrEmpty(returnValue)) { returnStatusCode = StatusCode.OK.ToString(); } } catch (Exception ex) { // 回滚事务 dbHelper.RollbackTransaction(); BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return returnValue; }
/// <summary> /// 按分页获取监控列表 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="pageSize">每页记录数</param> /// <param name="pageIndex">第几页</param> /// <param name="recordCount">总记录数</param> /// <param name="categoryCode">类型</param> /// <param name="searchValue">查找内容</param> /// <returns></returns> public DataTable GetMonitorPagedDT(BaseUserInfo userInfo, int pageSize, int pageIndex, out int recordCount, string categoryCode = null, string searchValue = null) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = null; recordCount = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); if (userInfo.IsAdministrator) { // 不分页 dataTable = workFlowCurrentManager.GetDataTable(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldDeletionStateCode, 0), BaseWorkFlowCurrentEntity.FieldSendDate); // 分页 // dataTable = workFlowCurrentManager.GetPagedDT(pageSize, pageIndex, out recordCount, categoryCode, searchValue); } else { //dataTable = workFlowCurrentManager.GetMonitorDT(); dataTable = workFlowCurrentManager.GetMonitorPagedDT(pageSize,pageIndex,out recordCount,categoryCode,searchValue); } dataTable.TableName = BaseWorkFlowCurrentEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return dataTable; }
/// <summary> /// 检查是否是步骤流 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="categoryCode">单据类型代码</param> /// <param name="objectIds">单据主键组</param> /// <param name="returnStatusCode">返回代码</param> /// <param name="returnStatusMessage">返回信息</param> /// <returns></returns> public bool CheckIsAutoWorkFlow(BaseUserInfo userInfo, string categoryCode, string[] objectIds, out string returnStatusCode,out string returnStatusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif returnStatusCode = string.Empty; returnStatusMessage = string.Empty; bool returnValue = true; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { // 打开数据库 dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); string processId = string.Empty; for (int i = 0; i < objectIds.Length; i++) { processId = workFlowCurrentManager.GetCurrentId(categoryCode, objectIds[i]); if (string.IsNullOrEmpty(processId)) { // 批量审批时需要返回false 含有自由流是不能批量审批的。 if (i > 0) { returnStatusMessage = "你选中的记录里包含自由审批流程所以不能批量审批。"; } return false; } } BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return returnValue; }
/// <summary> /// 获取流程当前步骤列表 /// </summary> /// <param name="userInfo">用户</param> /// <returns>数据表</returns> public DataTable GetDataTable(BaseUserInfo userInfo) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = new DataTable(BaseWorkFlowCurrentEntity.TableName); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>(); parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldEnabled, 1)); parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldDeletionStateCode, 0)); dataTable = workFlowCurrentManager.GetDataTable(parameters, BaseWorkFlowCurrentEntity.FieldSendDate); dataTable.TableName = BaseWorkFlowCurrentEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return dataTable; }
/// <summary> /// 获取工作流主键 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="categoryId">类型主键</param> /// <param name="objectId">单据主键</param> /// <returns></returns> public string GetCurrentId(BaseUserInfo userInfo, string categoryId, string objectId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { // 打开数据库 dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); returnValue = workFlowCurrentManager.GetCurrentId(categoryId, objectId); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return returnValue; }
/// <summary> /// 获取已审核流程列表 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="categoryCode">单据类型</param> /// <param name="categorybillFullName">流程</param> /// <param name="searchValue">关键字</param> /// <returns></returns> public DataTable GetAuditRecord(BaseUserInfo userInfo, string categoryCode, string categorybillFullName = null, string searchValue = null) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = null; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); dataTable = workFlowCurrentManager.GetAuditRecord(categoryCode, categorybillFullName, searchValue); dataTable.TableName = BaseWorkFlowCurrentEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return dataTable; }
/// <summary> /// 重置单据 /// (发出单据时)当废弃审批流时需要做的事情 /// </summary> /// <param name="id">主键</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> public virtual int Reset(string id, string auditIdea) { int returnValeu = 0; // 只有还在审核中的才可以废弃 string auditStatus = this.GetProperty(id, BaseBusinessLogic.FieldAuditStatus); if (!string.IsNullOrEmpty(auditStatus)) { if (!(auditStatus.Equals(AuditStatus.StartAudit.ToString()) || auditStatus.Equals(AuditStatus.WaitForAudit.ToString()))) { return returnValeu; } } // 若能撤销流程中的单据,才可以撤销本地的单据 BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo); BaseWorkFlowCurrentEntity workFlowCurrentEntity = workFlowCurrentManager.GetEntity(id); // 工作流里会进行撤销的工作 return workFlowCurrentManager.Reset(workFlowCurrentEntity); }
/// <summary> /// 获取审核历史明细 /// </summary> /// <param name="userInfo">用户</param> /// <param name="categoryId">单据分类主键</param> /// <param name="objectId">单据主键</param> /// <returns>数据权限</returns> public DataTable GetAuditDetailDT(BaseUserInfo userInfo, string categoryId, string objectId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = null; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); string[] ids = workFlowCurrentManager.GetIds(new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldCategoryCode, categoryId), new KeyValuePair<string, object>(BaseWorkFlowCurrentEntity.FieldObjectId, objectId)); BaseWorkFlowHistoryManager workFlowHistoryManager = new BaseWorkFlowHistoryManager(dbHelper, userInfo); dataTable = workFlowHistoryManager.GetDataTable(BaseWorkFlowHistoryEntity.FieldCurrentFlowId, ids, BaseWorkFlowHistoryEntity.FieldCreateOn); dataTable.TableName = BaseWorkFlowCurrentEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return dataTable; }