/// <summary> /// 发送即时通讯提醒 /// </summary> /// <param name="workFlowCurrentEntity">当前审核流实体信息</param> /// <param name="auditStatus">审核状态</param> /// <param name="auditIdea">审核意见</param> /// <param name="userIds">发送给用户主键</param> /// <param name="roleIds">发送给角色主键</param> /// <returns>影响行数</returns> public virtual int SendRemindMessage(BaseWorkFlowCurrentEntity workFlowCurrentEntity, AuditStatus auditStatus, string[] userIds, string organizeId, string roleId) { // 发送邮件提醒 // SendMail(workFlowCurrentEntity, auditStatus, userIds, organizeId, roleId); // 发送即时通讯提醒 return(SendMessage(workFlowCurrentEntity, auditStatus, userIds, organizeId, roleId)); }
/// <summary> /// 获取反射调用的类 /// 回写状态时用 /// </summary> /// <param name="currentId">当前工作流主键</param> /// <returns></returns> public IWorkFlowManager GetWorkFlowManager(string currentId) { IWorkFlowManager workFlowManager = new BaseUserBillManager(); BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId); workFlowManager.SetUserInfo(this.UserInfo); workFlowManager.CurrentTableName = workFlowCurrentEntity.CategoryCode; string workFlowId = this.GetEntity(currentId).WorkFlowId.ToString(); if (!workFlowId.Equals("0")) { BaseWorkFlowProcessManager workFlowProcessManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo); BaseWorkFlowProcessEntity workFlowProcessEntity = new BaseWorkFlowProcessEntity(); if (!string.IsNullOrEmpty(workFlowId)) { workFlowProcessEntity = workFlowProcessManager.GetEntity(workFlowId); } if (!string.IsNullOrEmpty(workFlowProcessEntity.CallBackClass)) { // 这里本来是想动态创建类库 编码外包[100] Type objType = Type.GetType(workFlowProcessEntity.CallBackClass, true); workFlowManager = (IWorkFlowManager)Activator.CreateInstance(objType); workFlowManager.SetUserInfo(this.UserInfo); } if (!string.IsNullOrEmpty(workFlowProcessEntity.CallBackTable)) { // 这里本来是想动态创建类库 编码外包[100] workFlowManager.CurrentTableName = workFlowProcessEntity.CallBackTable; } } // workFlowManager = new BaseUserBillManager(this.DbHelper, this.UserInfo); return(workFlowManager); }
/// <summary> /// 审核退回(不需要再发给别人了) /// </summary> /// <param name="currentId">当前主键</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> private int StepAuditReject(string currentId, string auditIdea, BaseWorkFlowStepEntity workFlowStepEntity) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetObject(currentId); // 1.记录当前的审核时间、审核人信息 workFlowCurrentEntity.AuditDate = DateTime.Now; workFlowCurrentEntity.AuditIdea = auditIdea; workFlowCurrentEntity.AuditUserId = this.UserInfo.Id; workFlowCurrentEntity.AuditUserRealName = this.UserInfo.RealName; workFlowCurrentEntity.AuditStatus = AuditStatus.AuditReject.ToString(); workFlowCurrentEntity.AuditStatusName = AuditStatus.AuditReject.ToDescription(); if (!string.IsNullOrEmpty(workFlowCurrentEntity.ActivityFullName)) { workFlowCurrentEntity.Description = string.Format("从{0}退回到{1}{2}", workFlowCurrentEntity.ActivityFullName, workFlowStepEntity.ActivityFullName, !string.IsNullOrEmpty(workFlowStepEntity.Description) ? "," + workFlowStepEntity.Description : string.Empty); } // 2.记录审核日志 this.AddHistory(workFlowCurrentEntity); // 3.上一个审核结束了,新的审核又开始了,更新待审核情况 workFlowCurrentEntity.ActivityId = workFlowStepEntity.ActivityId; workFlowCurrentEntity.ActivityCode = workFlowStepEntity.ActivityCode; workFlowCurrentEntity.ActivityFullName = workFlowStepEntity.ActivityFullName; workFlowCurrentEntity.ActivityType = workFlowStepEntity.ActivityType; workFlowCurrentEntity.ToRoleId = workFlowStepEntity.AuditRoleId; workFlowCurrentEntity.ToRoleRealName = workFlowStepEntity.AuditRoleRealName; workFlowCurrentEntity.ToDepartmentId = workFlowStepEntity.AuditDepartmentId; workFlowCurrentEntity.ToDepartmentName = workFlowStepEntity.AuditDepartmentName; workFlowCurrentEntity.ToUserId = workFlowStepEntity.AuditUserId; workFlowCurrentEntity.ToUserRealName = workFlowStepEntity.AuditUserRealName; workFlowCurrentEntity.SortCode = workFlowStepEntity.SortCode; return(this.UpdateObject(workFlowCurrentEntity)); }
/// <summary> /// 最终审核通过(完成) /// </summary> /// <param name="currentId">当前主键</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> private BaseWorkFlowCurrentEntity StepAuditComplete(string currentId, string auditIdea) { BaseWorkFlowCurrentEntity currentEntity = this.GetEntity(currentId); // 1.记录审核时间、审核人、审核意见 currentEntity.AuditUserId = this.UserInfo.Id; currentEntity.AuditUserRealName = this.UserInfo.RealName; currentEntity.AuditIdea = auditIdea; currentEntity.AuditStatus = AuditStatus.AuditComplete.ToString(); currentEntity.AuditStatusName = AuditStatus.AuditComplete.ToDescription(); currentEntity.AuditDate = DateTime.Now; currentEntity.ToUserId = null; currentEntity.ToUserRealName = null; currentEntity.ToDepartmentId = null; currentEntity.ToDepartmentName = null; currentEntity.ToRoleId = null; currentEntity.ToRoleRealName = null; // 审批好了,数据就生效了 currentEntity.Enabled = 1; // 2.记录审核日志记录日志 this.AddHistory(currentEntity); // 3.更新当前表 this.UpdateEntity(currentEntity); return(currentEntity); }
/// <summary> /// 审核通过 /// </summary> /// <param name="id">当前主键</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> public int AuditPass(IWorkFlowManager workFlowManager, string currentId, string auditIdea, BaseWorkFlowActivityEntity workFlowActivityEntity) { int returnValue = 0; // 进行更新操作 returnValue = this.StepAuditPass(currentId, auditIdea, workFlowActivityEntity); if (returnValue == 0) { // 数据可能被删除 this.ReturnStatusCode = StatusCode.ErrorDeleted.ToString(); } BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId); // 发送提醒信息 if (workFlowManager != null) { if (!string.IsNullOrEmpty(workFlowActivityEntity.AuditUserId)) { workFlowActivityEntity.AuditDepartmentId = null; workFlowActivityEntity.AuditRoleId = null; } workFlowManager.OnAutoAuditPass(workFlowCurrentEntity); workFlowManager.SendRemindMessage(workFlowCurrentEntity, AuditStatus.AuditPass, new string[] { workFlowCurrentEntity.CreateUserId, workFlowActivityEntity.AuditUserId }, workFlowActivityEntity.AuditDepartmentId, workFlowActivityEntity.AuditRoleId); } this.ReturnStatusMessage = this.GetStateMessage(this.ReturnStatusCode); return(returnValue); }
/// <summary> /// 设置实体 /// </summary> /// <param name="workFlowCurrentEntity">实体</param> private void SetObject(SQLBuilder sqlBuilder, BaseWorkFlowCurrentEntity workFlowCurrentEntity) { SetObjectExpand(sqlBuilder, workFlowCurrentEntity); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldCategoryCode, workFlowCurrentEntity.CategoryCode); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldCategoryFullName, workFlowCurrentEntity.CategoryFullName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldObjectId, workFlowCurrentEntity.ObjectId); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldObjectFullName, workFlowCurrentEntity.ObjectFullName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldProcessId, workFlowCurrentEntity.ProcessId); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldActivityId, workFlowCurrentEntity.ActivityId); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldActivityCode, workFlowCurrentEntity.ActivityCode); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldActivityFullName, workFlowCurrentEntity.ActivityFullName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldActivityType, workFlowCurrentEntity.ActivityType); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToDepartmentId, workFlowCurrentEntity.ToDepartmentId); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToDepartmentName, workFlowCurrentEntity.ToDepartmentName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToUserId, workFlowCurrentEntity.ToUserId); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToUserRealName, workFlowCurrentEntity.ToUserRealName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToRoleId, workFlowCurrentEntity.ToRoleId); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToRoleRealName, workFlowCurrentEntity.ToRoleRealName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldAuditUserId, workFlowCurrentEntity.AuditUserId); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldAuditUserCode, workFlowCurrentEntity.AuditUserCode); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldAuditUserRealName, workFlowCurrentEntity.AuditUserRealName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldSendDate, workFlowCurrentEntity.SendDate); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldAuditDate, workFlowCurrentEntity.AuditDate); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldAuditIdea, workFlowCurrentEntity.AuditIdea); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldAuditStatus, workFlowCurrentEntity.AuditStatus); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldAuditStatusName, workFlowCurrentEntity.AuditStatusName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldSortCode, workFlowCurrentEntity.SortCode); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldEnabled, workFlowCurrentEntity.Enabled); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldDeletionStateCode, workFlowCurrentEntity.DeletionStateCode); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldDescription, workFlowCurrentEntity.Description); }
/// <summary> /// 添加到工作流审批流程历史 /// </summary> /// <param name="currentId">当前工作流主键</param> /// <returns>主键</returns> private string AddHistory(string currentId) { // 读取一下,然后添加到历史记录表里 BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetObject(currentId); return(this.AddHistory(workFlowCurrentEntity)); }
/// <summary> /// 重置审批流程中的单据(撤销的没必要发送提醒信息) /// </summary> /// <param name="categoryCode">分类编号</param> /// <param name="objectId">实体主键</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> public int Reset(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { IWorkFlowManager workFlowManager = this.GetWorkFlowManager(workFlowCurrentEntity.Id); // 退回时,应该给创建者一个提醒消息 return(workFlowManager.OnReset(workFlowCurrentEntity) ? 1 : 0); }
/// <summary> /// 获取反射调用的类 /// 回写状态时用 /// </summary> /// <param name="currentId">当前工作流主键</param> /// <returns></returns> public IWorkFlowManager GetWorkFlowManager(string currentId) { IWorkFlowManager workFlowManager = null; BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetObject(currentId); string processId = this.GetObject(currentId).ProcessId.ToString(); if (!string.IsNullOrEmpty(processId)) { BaseWorkFlowProcessManager workFlowProcessManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo); BaseWorkFlowProcessEntity workFlowProcessEntity = new BaseWorkFlowProcessEntity(); if (!string.IsNullOrEmpty(processId)) { workFlowProcessEntity = workFlowProcessManager.GetObject(processId); } // 这里本来是想动态创建类库 编码外包[100] // System.Reflection.Assembly assembly = Assembly.Load("__code"); // System.Reflection.Assembly assembly = Assembly.Load("app_code"); string assemblyString = workFlowProcessEntity.CallBackAssembly; workFlowManager = (IWorkFlowManager)Assembly.Load(assemblyString).CreateInstance(workFlowProcessEntity.CallBackClass, true); // Type objType = assembly.GetType(workFlowProcessEntity.CallBackClass, true); // workFlowManager = (IWorkFlowManager)Activator.CreateInstance(objType); workFlowManager.SetUserInfo(this.UserInfo); workFlowManager.CurrentTableName = workFlowCurrentEntity.CategoryCode; if (!string.IsNullOrEmpty(workFlowProcessEntity.CallBackTable)) { // 这里本来是想动态创建类库 编码外包[100] workFlowManager.CurrentTableName = workFlowProcessEntity.CallBackTable; } } // workFlowManager = new BaseUserBillManager(this.DbHelper, this.UserInfo); return(workFlowManager); }
/// <summary> /// 撤消审批流程中的单据(撤销的没必要发送提醒信息) /// </summary> /// <param name="currentId">当前主键</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> public int AuditQuash(IWorkFlowManager workFlowManager, string currentId, string auditIdea) { int returnValue = 0; if (!string.IsNullOrEmpty(currentId)) { // using (TransactionScope transactionScope = new TransactionScope()) // { try { BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId); // 只有待审核状态的,才可以撤销,被退回的也可以废弃 if (workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditComplete.ToString()) || workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditQuash.ToString())) { return(returnValue); } // 是超级管理员,或者创建者自己才可以撤销 if (!UserInfo.IsAdministrator && !workFlowCurrentEntity.CreateUserId.Equals(UserInfo.Id)) { return(returnValue); } // 是自己的的单子需要被审核 // 最后修改人是自己,表明是自己发出的 // if ((baseWorkFlowCurrentEntity.ModifiedUserId == UserInfo.Id) || (baseWorkFlowCurrentEntity.CreateUserId == UserInfo.Id)) //{ // 进行更新操作 workFlowCurrentEntity = this.StepAuditQuash(currentId, auditIdea); if (!string.IsNullOrEmpty(workFlowCurrentEntity.Id)) { // 发送提醒信息 if (workFlowManager != null) { workFlowManager.OnAuditQuash(workFlowCurrentEntity); returnValue = workFlowManager.SendRemindMessage(workFlowCurrentEntity, AuditStatus.AuditQuash, new string[] { workFlowCurrentEntity.CreateUserId }, null, null); } } else { // 数据可能被删除 this.ReturnStatusCode = StatusCode.ErrorDeleted.ToString(); } // } this.ReturnStatusMessage = this.GetStateMessage(this.ReturnStatusCode); } catch (System.Exception ex) { // 在本地记录异常 FileUtil.WriteException(UserInfo, ex); } finally { } // transactionScope.Complete(); // } } return(returnValue); }
/// <summary> /// 流程完成时 /// 结束审核时,需要回调写入到表里,调用相应的事件 /// 若成功可以执行完成的处理 /// </summary> /// <param name="workFlowCurrentEntity">当前审批流程</param> /// <returns>成功失败</returns> public override bool OnAuditComplete(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { // 审核通过后,需要把有效状态修改过来 BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo); //string objectId = workFlowCurrentManager.GetObject(workFlowCurrentEntity.Id).ObjectId; string objectId = workFlowCurrentEntity.ObjectId; if (!string.IsNullOrEmpty(objectId)) { // 这里写自己的方法(审核 过程中的回调),完成审核时 using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.BusinessDbType, 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="currentId">当前主键</param> /// <param name="auditIdea">批示</param> /// <param name="toStepEntity">审核到第几步</param> /// <param name="workFlowAuditInfo">当前审核人信息</param> /// <returns>影响行数</returns> private int StepAuditPass(string currentId, string auditIdea, BaseWorkFlowStepEntity toStepEntity, BaseWorkFlowAuditInfo workFlowAuditInfo = null) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetObject(currentId); // 初始化审核信息,这里是显示当前审核人,可以不是当前操作员的功能 if (workFlowAuditInfo == null) { workFlowAuditInfo = new BaseWorkFlowAuditInfo(this.UserInfo); workFlowAuditInfo.AuditIdea = auditIdea; workFlowAuditInfo.AuditDate = DateTime.Now; workFlowAuditInfo.AuditUserId = this.UserInfo.Id; workFlowAuditInfo.AuditUserRealName = this.UserInfo.RealName; workFlowAuditInfo.AuditStatus = AuditStatus.AuditPass.ToString(); workFlowAuditInfo.AuditStatusName = AuditStatus.AuditPass.ToDescription(); } else { workFlowAuditInfo.AuditIdea = auditIdea; } // 审核意见是什么? workFlowCurrentEntity.AuditIdea = workFlowAuditInfo.AuditIdea; // 1.记录当前的审核时间、审核人信息 // 什么时间审核的? workFlowCurrentEntity.AuditDate = workFlowAuditInfo.AuditDate; // 审核的用户是谁? workFlowCurrentEntity.AuditUserId = workFlowAuditInfo.AuditUserId; // 审核人的姓名是谁? workFlowCurrentEntity.AuditUserRealName = workFlowAuditInfo.AuditUserRealName; // 审核状态是什么? workFlowCurrentEntity.AuditStatus = workFlowAuditInfo.AuditStatus; // 审核状态备注是什么? workFlowCurrentEntity.AuditStatusName = workFlowAuditInfo.AuditStatusName; if (!string.IsNullOrEmpty(workFlowCurrentEntity.ActivityFullName)) { workFlowCurrentEntity.Description = string.Format("从{0}提交到{1}{2}", workFlowCurrentEntity.ActivityFullName, toStepEntity.FullName, !string.IsNullOrEmpty(toStepEntity.Description) ? "," + toStepEntity.Description : string.Empty); } workFlowCurrentEntity.ToUserId = toStepEntity.AuditUserId; workFlowCurrentEntity.ToUserRealName = toStepEntity.AuditUserRealName; workFlowCurrentEntity.ToRoleId = toStepEntity.AuditRoleId; workFlowCurrentEntity.ToRoleRealName = toStepEntity.AuditRoleRealName; workFlowCurrentEntity.ToDepartmentId = toStepEntity.AuditDepartmentId; workFlowCurrentEntity.ToDepartmentName = toStepEntity.AuditDepartmentName; // 2.记录审核日志 this.AddHistory(workFlowCurrentEntity); // 3.上一个审核结束了,新的审核又开始了,更新待审核情况 workFlowCurrentEntity.ActivityId = toStepEntity.ActivityId; workFlowCurrentEntity.ActivityCode = toStepEntity.Code; workFlowCurrentEntity.ActivityFullName = toStepEntity.FullName; workFlowCurrentEntity.ActivityType = toStepEntity.ActivityType; workFlowCurrentEntity.SortCode = toStepEntity.SortCode; return(this.UpdateObject(workFlowCurrentEntity)); }
/// <summary> /// 自由审批 /// </summary> /// <param name="workFlowManager"></param> /// <param name="currentId"></param> /// <param name="toUserId"></param> /// <param name="toDepartmentId"></param> /// <param name="toRoleId"></param> /// <param name="auditIdea"></param> /// <returns></returns> public int FreeAuditPass(IWorkFlowManager workFlowManager, string currentId, string toUserId, string toDepartmentId = null, string toRoleId = null, string auditIdea = null) { // 返回值 int returnValue = 0; // 这里用锁的机制,提高并发控制能力 lock (WorkFlowCurrentLock) { BaseWorkFlowActivityEntity workFlowActivityEntity = new BaseWorkFlowActivityEntity(); // FreeWorkFlow 自由工作流 workFlowActivityEntity.WorkFlowId = 0; // 获取排序码 workFlowActivityEntity.SortCode = int.Parse(new BaseSequenceManager().GetSequence("FreeWorkFlow", 10000000)); // 是否提交给用户审批 if (!string.IsNullOrEmpty(toUserId)) { workFlowActivityEntity.AuditUserId = toUserId; workFlowActivityEntity.AuditUserRealName = new BaseUserManager().GetEntity(toUserId).RealName; } // 是否提交给部门审批 if (!string.IsNullOrEmpty(toDepartmentId)) { workFlowActivityEntity.AuditDepartmentId = toDepartmentId; workFlowActivityEntity.AuditDepartmentName = new BaseOrganizeManager().GetEntity(toDepartmentId).FullName; } // 是否提交给角色审批 if (!string.IsNullOrEmpty(toRoleId)) { workFlowActivityEntity.AuditRoleId = toRoleId; workFlowActivityEntity.AuditRoleRealName = new BaseRoleManager().GetEntity(toRoleId).RealName; } // 进行更新操作 returnValue = this.StepAuditPass(currentId, auditIdea, workFlowActivityEntity); if (returnValue == 0) { // 数据可能被删除 this.ReturnStatusCode = StatusCode.ErrorDeleted.ToString(); } BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId); // 发送提醒信息 if (workFlowManager != null) { if (!string.IsNullOrEmpty(workFlowActivityEntity.AuditUserId)) { workFlowActivityEntity.AuditDepartmentId = null; workFlowActivityEntity.AuditRoleId = null; } workFlowManager.OnAutoAuditPass(workFlowCurrentEntity); workFlowManager.SendRemindMessage(workFlowCurrentEntity, AuditStatus.AuditPass, new string[] { workFlowCurrentEntity.CreateUserId, workFlowActivityEntity.AuditUserId }, workFlowActivityEntity.AuditDepartmentId, workFlowActivityEntity.AuditRoleId); } this.ReturnStatusMessage = this.GetStateMessage(this.ReturnStatusCode); return(returnValue); } }
public string GetBackToUserId(BaseWorkFlowCurrentEntity entity) { string userId = string.Empty; var dt = GetBackToDT(entity); if (dt.Rows.Count > 0) { userId = dt.Rows[0][BaseWorkFlowHistoryEntity.FieldAuditUserId].ToString(); } return(userId); }
/// <summary> /// 获取实体 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="id">主键</param> /// <returns>实体</returns> public BaseWorkFlowCurrentEntity GetObject(BaseUserInfo userInfo, string id) { BaseWorkFlowCurrentEntity result = null; var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessWorkFlowDb(userInfo, parameter, (dbHelper) => { var workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); result = workFlowCurrentManager.GetObject(id); }); return(result); }
private int UpdataAuditStatr(string id, string categoryCode, string categoryFullName, string objectId, string objectFullName, string auditIdea, BaseWorkFlowStepEntity workFlowStepEntity) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetObject(id); workFlowCurrentEntity.CategoryCode = categoryCode; workFlowCurrentEntity.CategoryFullName = categoryFullName; workFlowCurrentEntity.ObjectId = objectId; workFlowCurrentEntity.ObjectFullName = objectFullName; workFlowCurrentEntity.ProcessId = workFlowStepEntity.ProcessId; workFlowCurrentEntity.ActivityId = workFlowStepEntity.Id; workFlowCurrentEntity.ActivityType = workFlowStepEntity.ActivityType; workFlowCurrentEntity.SendDate = DateTime.Now; workFlowCurrentEntity.AuditDate = DateTime.Now; workFlowCurrentEntity.AuditStatus = AuditStatus.StartAudit.ToString(); workFlowCurrentEntity.AuditStatusName = AuditStatus.StartAudit.ToDescription(); // 是否提交给组织机构审批 workFlowCurrentEntity.ToDepartmentId = workFlowStepEntity.AuditDepartmentId; workFlowCurrentEntity.ToDepartmentName = workFlowStepEntity.AuditDepartmentName; // 是否提交给角色审批 workFlowCurrentEntity.ToRoleId = workFlowStepEntity.AuditRoleId; workFlowCurrentEntity.ToRoleRealName = workFlowStepEntity.AuditRoleRealName; // 是否提交给用户审批 workFlowCurrentEntity.ToUserId = workFlowStepEntity.AuditUserId; workFlowCurrentEntity.ToUserRealName = workFlowStepEntity.AuditUserRealName; if (!string.IsNullOrEmpty(workFlowStepEntity.AuditUserId)) { BaseUserManager userManager = new BaseUserManager(UserInfo); BaseUserEntity userEntity = userManager.GetObject(workFlowStepEntity.AuditUserId); workFlowCurrentEntity.ToUserRealName = userEntity.RealName; // 用户的部门信息需要处理 if (!string.IsNullOrEmpty(userEntity.DepartmentId)) { BaseOrganizeManager organizeManager = new BaseOrganizeManager(UserInfo); BaseOrganizeEntity entity = organizeManager.GetObject(userEntity.DepartmentId); workFlowCurrentEntity.ToDepartmentName = entity.FullName; } } // 当前审核人的信息写入当前工作流 workFlowCurrentEntity.AuditUserId = string.Empty; workFlowCurrentEntity.AuditUserCode = string.Empty; workFlowCurrentEntity.AuditUserRealName = string.Empty; workFlowCurrentEntity.AuditIdea = auditIdea; workFlowCurrentEntity.AuditDate = DateTime.Now; int result = this.UpdateObject(workFlowCurrentEntity); this.AddHistory(workFlowCurrentEntity); return(result); }
private int UpdataAuditStatr(string id, string categoryCode, string categoryFullName, string objectId, string objectFullName, string auditIdea, BaseWorkFlowStepEntity workFlowStepEntity) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(id); workFlowCurrentEntity.CategoryCode = categoryCode; workFlowCurrentEntity.CategoryFullName = categoryFullName; workFlowCurrentEntity.ObjectId = objectId; workFlowCurrentEntity.ObjectFullName = objectFullName; workFlowCurrentEntity.WorkFlowId = workFlowStepEntity.WorkFlowId; workFlowCurrentEntity.ActivityId = workFlowStepEntity.Id; workFlowCurrentEntity.SendDate = DateTime.Now; workFlowCurrentEntity.AuditDate = DateTime.Now; workFlowCurrentEntity.AuditStatus = AuditStatus.StartAudit.ToString(); workFlowCurrentEntity.AuditStatusName = AuditStatus.StartAudit.ToDescription(); // 是否提交给组织机构审批 if (!string.IsNullOrEmpty(workFlowStepEntity.AuditDepartmentId)) { workFlowCurrentEntity.ToDepartmentId = workFlowStepEntity.AuditDepartmentId; workFlowCurrentEntity.ToDepartmentName = workFlowStepEntity.AuditDepartmentName; } // 是否提交给角色审批 if (!string.IsNullOrEmpty(workFlowStepEntity.AuditRoleId)) { workFlowCurrentEntity.ToDepartmentId = workFlowStepEntity.AuditRoleId; workFlowCurrentEntity.ToDepartmentName = workFlowStepEntity.AuditRoleRealName; } // 是否提交给用户审批 if (!string.IsNullOrEmpty(workFlowStepEntity.AuditUserId)) { BaseUserManager userManager = new BaseUserManager(UserInfo); BaseUserEntity userEntity = userManager.GetEntity(workFlowStepEntity.AuditUserId); workFlowCurrentEntity.ToUserId = workFlowStepEntity.AuditUserId; workFlowCurrentEntity.ToUserRealName = userEntity.RealName; // TODO 用户的部门信息需要处理 if (!string.IsNullOrEmpty(userEntity.DepartmentId)) { BaseOrganizeManager organizeManager = new BaseOrganizeManager(UserInfo); BaseOrganizeEntity organizeEntity = organizeManager.GetEntity(userEntity.DepartmentId); workFlowCurrentEntity.ToDepartmentId = userEntity.DepartmentId; workFlowCurrentEntity.ToDepartmentName = organizeEntity.FullName; } } // 当前审核人的信息写入当前工作流 // workFlowCurrentEntity.AuditUserId = this.UserInfo.Id; // workFlowCurrentEntity.AuditUserCode = this.UserInfo.Code; // workFlowCurrentEntity.AuditUserRealName = this.UserInfo.RealName; workFlowCurrentEntity.AuditIdea = auditIdea; workFlowCurrentEntity.AuditDate = DateTime.Now; return(this.UpdateEntity(workFlowCurrentEntity)); }
public BaseWorkFlowCurrentEntity GetObjectBy(string categoryCode, string objectId) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = null; List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); if (!string.IsNullOrEmpty(categoryCode)) { parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowCurrentEntity.FieldCategoryCode, categoryCode)); } parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowCurrentEntity.FieldObjectId, objectId)); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowCurrentEntity.FieldDeletionStateCode, 0)); workFlowCurrentEntity = BaseEntity.Create <BaseWorkFlowCurrentEntity>(this.GetDataTable(parameters)); return(workFlowCurrentEntity); }
/// <summary> /// 审核退回详细步骤 /// </summary> /// <param name="currentId">当前主键</param> /// <param name="auditIdea">批示</param> /// <param name="toUserId">发送给</param> /// <param name="activityId">退回到指定步骤</param> /// <returns>影响行数</returns> private BaseWorkFlowCurrentEntity StepAuditReject(string currentId, string auditIdea, string toUserId = null, string activityId = null) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId); // 1.记录审核时间、审核人 workFlowCurrentEntity.AuditUserId = this.UserInfo.Id; workFlowCurrentEntity.AuditUserCode = this.UserInfo.Code; workFlowCurrentEntity.AuditUserRealName = this.UserInfo.RealName; workFlowCurrentEntity.AuditStatus = AuditStatus.AuditReject.ToString(); workFlowCurrentEntity.AuditStatusName = AuditStatus.AuditReject.ToDescription(); workFlowCurrentEntity.AuditDate = DateTime.Now; workFlowCurrentEntity.AuditIdea = auditIdea; // 2.记录日志 this.AddHistory(workFlowCurrentEntity); // 3.更新待审核情况,流程已经结束了 workFlowCurrentEntity.ActivityId = null; if (!string.IsNullOrEmpty(activityId)) { workFlowCurrentEntity.ActivityId = int.Parse(activityId); BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(this.DbHelper, this.UserInfo); BaseWorkFlowActivityEntity workFlowActivityEntity = workFlowActivityManager.GetEntity(activityId); workFlowCurrentEntity.SortCode = workFlowActivityEntity.SortCode; workFlowCurrentEntity.ToUserId = workFlowActivityEntity.AuditUserId; workFlowCurrentEntity.ToUserRealName = workFlowActivityEntity.AuditUserRealName; workFlowCurrentEntity.ToDepartmentId = workFlowActivityEntity.AuditDepartmentId; workFlowCurrentEntity.ToDepartmentName = workFlowActivityEntity.AuditDepartmentName; workFlowCurrentEntity.ToRoleId = workFlowActivityEntity.AuditRoleId; workFlowCurrentEntity.ToRoleRealName = workFlowActivityEntity.AuditRoleRealName; } else { if (!string.IsNullOrEmpty(toUserId)) { BaseUserManager userManager = new BaseUserManager(UserInfo); BaseUserEntity userEntity = userManager.GetEntity(toUserId); workFlowCurrentEntity.ToUserId = userEntity.Id; workFlowCurrentEntity.ToUserRealName = userEntity.RealName; workFlowCurrentEntity.ToDepartmentId = userEntity.DepartmentId; workFlowCurrentEntity.ToDepartmentName = userEntity.DepartmentName; } //workFlowCurrentEntity.SortCode = null; } workFlowCurrentEntity.SendDate = DateTime.Now; workFlowCurrentEntity.Enabled = 0; // 4.生成审核结束的记录 this.UpdateEntity(workFlowCurrentEntity); return(workFlowCurrentEntity); }
/// <summary> /// (点退回时)当审核退回时 /// </summary> /// <param name="workFlowCurrentEntity">当前审批流</param> /// <returns>成功失败</returns> public override bool OnAuditReject(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { string objectId = workFlowCurrentEntity.ObjectId; if (!string.IsNullOrEmpty(objectId)) { // 这里写自己的方法(审核 过程中的回调),退回审核时 IDbHelper dbHelper = new DotNet.Utilities.SqlHelper(BaseSystemInfo.BusinessDbConnection); dbHelper.Open(); SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); //sqlBuilder.BeginUpdate("WL物品申购"); //sqlBuilder.SetDBNow("审核日期"); //sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code); //sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditReject.ToString()); //sqlBuilder.SetWhere("申请单号", objectId); //sqlBuilder.EndUpdate(); switch (workFlowCurrentEntity.CategoryCode) { case "PuTongCaiGouDan": case "GuoNeiCaiGouHeTong": case "PutongCaiGouDanDGM": case "PutongCaiGouDanManager": sqlBuilder.BeginUpdate("WL物品申购"); sqlBuilder.SetDBNow("审核日期"); sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditReject.ToString()); sqlBuilder.SetWhere("申请单号", objectId); sqlBuilder.EndUpdate(); break; case "YuanFuCaiLiaoShenQingDan": sqlBuilder.BeginUpdate("WL部门物品申购"); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditReject.ToString()); sqlBuilder.SetWhere("申购单号", objectId); sqlBuilder.EndUpdate(); break; case "MoJuCaiGouHeTongP": case "MoJuCaiGouHeTongGM": sqlBuilder.BeginUpdate("GCMJ模具申请"); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditReject.ToString()); sqlBuilder.SetWhere("申请单号", objectId); sqlBuilder.EndUpdate(); break; } dbHelper.Close(); } return(true); }
/// <summary> /// 更新实体 /// </summary> /// <param name="workFlowCurrentEntity">实体</param> public int UpdateObject(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetObject(sqlBuilder, workFlowCurrentEntity); if (UserInfo != null) { sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldModifiedBy, UserInfo.RealName); } sqlBuilder.SetDBNow(BaseWorkFlowCurrentEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseWorkFlowCurrentEntity.FieldId, workFlowCurrentEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// (点通过时)当审核通过时 /// </summary> /// <param name="workFlowCurrentEntity">当前审批流</param> /// <returns>成功失败</returns> public virtual bool OnAutoAuditPass(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { if (!string.IsNullOrEmpty(workFlowCurrentEntity.ObjectId)) { SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetValue(BaseBusinessLogic.FieldAuditStatus, AuditStatus.AuditPass.ToString()); sqlBuilder.SetDBNow(BaseBusinessLogic.FieldModifiedOn); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedUserId, this.UserInfo.Id); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedBy, this.UserInfo.RealName); sqlBuilder.SetWhere(BaseBusinessLogic.FieldId, workFlowCurrentEntity.ObjectId); sqlBuilder.EndUpdate(); } return(true); }
private string StepAuditStatr(BaseWorkFlowAuditInfo workFlowAuditInfo) { string result = string.Empty; BaseWorkFlowCurrentEntity workFlowCurrentEntity = new BaseWorkFlowCurrentEntity(); // 1.这个是工作流的第一个发出日期,需要全局保留,其实也是创建日期了,但是有重新审核的这个说法,若有2次重新审核的事项,的确需要保留这个字段 // workFlowCurrentEntity.CallBack = workFlowManager.GetType().ToString(); workFlowCurrentEntity.ProcessId = workFlowAuditInfo.ProcessId; workFlowCurrentEntity.ActivityId = int.Parse(workFlowAuditInfo.ActivityId); workFlowCurrentEntity.ActivityCode = workFlowAuditInfo.ActivityCode; workFlowCurrentEntity.ActivityFullName = workFlowAuditInfo.ActivityFullName; workFlowCurrentEntity.ActivityType = workFlowAuditInfo.ActivityType; // 这里是为了优化越级审核用的,按排序嘛进行先后顺序排序 workFlowCurrentEntity.CategoryCode = workFlowAuditInfo.CategoryCode; workFlowCurrentEntity.CategoryFullName = workFlowAuditInfo.CategoryFullName; workFlowCurrentEntity.ObjectId = workFlowAuditInfo.ObjectId; workFlowCurrentEntity.ObjectFullName = workFlowAuditInfo.ObjectFullName; // 2.当前审核人的信息写入当前工作流 // workFlowCurrentEntity.AuditUserId = this.UserInfo.Id; // workFlowCurrentEntity.AuditUserCode = this.UserInfo.Code; // workFlowCurrentEntity.AuditUserRealName = this.UserInfo.RealName; workFlowCurrentEntity.AuditIdea = workFlowAuditInfo.AuditIdea; workFlowCurrentEntity.AuditStatus = workFlowAuditInfo.AuditStatus; workFlowCurrentEntity.AuditStatusName = workFlowAuditInfo.AuditStatusName; workFlowCurrentEntity.SendDate = DateTime.Now; // 3.接下来需要待审核的对象的信息 workFlowCurrentEntity.ToUserId = workFlowAuditInfo.ToUserId; workFlowCurrentEntity.ToUserRealName = workFlowAuditInfo.ToUserRealName; workFlowCurrentEntity.ToDepartmentId = workFlowAuditInfo.ToDepartmentId; workFlowCurrentEntity.ToDepartmentName = workFlowAuditInfo.ToDepartmentName; workFlowCurrentEntity.ToRoleId = workFlowAuditInfo.ToRoleId; workFlowCurrentEntity.ToRoleRealName = workFlowAuditInfo.ToRoleRealName; workFlowCurrentEntity.Description = workFlowAuditInfo.Description; // 4.这些标志信息需要处理好,这里表示工作流还没完成生效,还在审批中的意思。 workFlowCurrentEntity.SortCode = int.Parse(new BaseSequenceManager(this.DbHelper).Increment("WorkFlow", 10000000)); workFlowCurrentEntity.Enabled = 0; workFlowCurrentEntity.DeletionStateCode = 0; // 添加当前待审核流程表 result = this.AddObject(workFlowCurrentEntity); // 4.记录审核日志 workFlowCurrentEntity.Id = result; this.AddHistory(workFlowCurrentEntity); return(result); }
private string AddHistory(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { BaseWorkFlowHistoryEntity entity = new BaseWorkFlowHistoryEntity(); // 这些是待审核信息 entity.CurrentFlowId = workFlowCurrentEntity.Id; entity.ProcessId = workFlowCurrentEntity.ProcessId; entity.ActivityId = workFlowCurrentEntity.ActivityId; entity.ActivityCode = workFlowCurrentEntity.ActivityCode; entity.ActivityFullName = workFlowCurrentEntity.ActivityFullName; entity.ToUserId = workFlowCurrentEntity.ToUserId; entity.ToUserRealName = workFlowCurrentEntity.ToUserRealName; entity.ToRoleId = workFlowCurrentEntity.ToRoleId; entity.ToRoleRealName = workFlowCurrentEntity.ToRoleRealName; if (string.IsNullOrEmpty(workFlowCurrentEntity.ToDepartmentId)) { entity.ToDepartmentId = this.UserInfo.DepartmentId; entity.ToDepartmentName = this.UserInfo.DepartmentName; } else { entity.ToDepartmentId = workFlowCurrentEntity.ToDepartmentId; entity.ToDepartmentName = workFlowCurrentEntity.ToDepartmentName; } entity.AuditUserId = workFlowCurrentEntity.AuditUserId; entity.AuditUserRealName = workFlowCurrentEntity.AuditUserRealName; entity.AuditIdea = workFlowCurrentEntity.AuditIdea; entity.AuditStatus = workFlowCurrentEntity.AuditStatus; entity.AuditStatusName = workFlowCurrentEntity.AuditStatusName; // 这里需要模拟产生的功能 // entity.SendDate = workFlowCurrentEntity.AuditDate; // entity.AuditDate = DateTime.Now; entity.SendDate = workFlowCurrentEntity.CreateOn; entity.AuditDate = workFlowCurrentEntity.AuditDate; entity.Description = workFlowCurrentEntity.Description; entity.SortCode = workFlowCurrentEntity.SortCode; entity.DeletionStateCode = workFlowCurrentEntity.DeletionStateCode; entity.Enabled = workFlowCurrentEntity.Enabled; BaseWorkFlowHistoryManager workFlowHistoryManager = new BaseWorkFlowHistoryManager(DbHelper, UserInfo); return(workFlowHistoryManager.AddObject(entity)); }
/// <summary> /// 重置单据 /// (单据发生错误时)紧急情况下实用 /// </summary> /// <param name="currentId">审批流当前主键</param> /// <param name="categoryCode">单据分类</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> public virtual bool OnReset(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { // 审核通过后,需要把有效状态修改过来 if (!string.IsNullOrEmpty(workFlowCurrentEntity.ObjectId)) { SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetValue(BaseBusinessLogic.FieldAuditStatus, AuditStatus.Draft.ToString()); sqlBuilder.SetValue(BaseBusinessLogic.FieldEnabled, 1); sqlBuilder.SetDBNow(BaseBusinessLogic.FieldModifiedOn); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedUserId, this.UserInfo.Id); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedBy, this.UserInfo.RealName); sqlBuilder.SetWhere(BaseBusinessLogic.FieldId, workFlowCurrentEntity.ObjectId); sqlBuilder.EndUpdate(); } // 若还需要有其他处理,就这后面继续处理 return(true); }
/// <summary> /// 下个流程发送给谁 /// </summary> /// <param name="workFlowId">当前主键</param> /// <returns>影响行数</returns> public int AuditTransmit(string currentId, string workFlowCategory, string sendToUserId, string auditIdea) { int returnValue = 0; // 进行更新操作 returnValue = this.StepAuditTransmit(currentId, workFlowCategory, sendToUserId, auditIdea); if (returnValue == 0) { // 数据可能被删除 this.ReturnStatusCode = StatusCode.ErrorDeleted.ToString(); } BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId); // 发送提醒信息 // this.SendRemindMessage(workFlowCurrentEntity.ObjectId, AuditStatus.Transmit, auditIdea, sendToUserId, null); this.ReturnStatusMessage = this.GetStateMessage(this.ReturnStatusCode); return(returnValue); }
/// <summary> /// 当自由工作流(点通过时)当审核通过时 /// </summary> /// <param name="workFlowCurrentEntity">当前审批流</param> /// <returns>成功失败</returns> public virtual bool OnAutoAuditPass(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { if (!string.IsNullOrEmpty(workFlowCurrentEntity.ObjectId)) { // 这里是回写表的功能实现 SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); // 审核流程主键,走哪个审核流程的 // workFlowCurrentEntity.ProcessId; // 分类编号 // workFlowCurrentEntity.CategoryCode; // 分类名称 // workFlowCurrentEntity.CategoryFullName; // 单据主键 // workFlowCurrentEntity.ObjectId; // 单据名称 // workFlowCurrentEntity.ObjectFullName; // 当前审核步骤主键 // workFlowCurrentEntity.ActivityId; // 当前流程编号 // workFlowCurrentEntity.ActivityCode; // 当前审核步骤名称 // workFlowCurrentEntity.ActivityFullName; // 当前审核人主键 // workFlowCurrentEntity.AuditUserId; // 当前审核人姓名 // workFlowCurrentEntity.AuditUserRealName; // 审核意见 // workFlowCurrentEntity.AuditIdea; // 送给谁审核主键 // workFlowCurrentEntity.ToUserId; // 送给谁审核的姓名 // workFlowCurrentEntity.ToUserRealName; sqlBuilder.SetValue(BaseBusinessLogic.FieldAuditStatus, AuditStatus.AuditPass.ToString()); sqlBuilder.SetDBNow(BaseBusinessLogic.FieldModifiedOn); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedUserId, this.UserInfo.Id); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedBy, this.UserInfo.RealName); sqlBuilder.SetWhere(BaseBusinessLogic.FieldId, workFlowCurrentEntity.ObjectId); sqlBuilder.EndUpdate(); } return(true); }
/// <summary> /// 发送即时通讯提醒 /// </summary> /// <param name="workFlowCurrentEntity">当前审核流实体信息</param> /// <param name="auditStatus">审核状态</param> /// <param name="auditIdea">审核意见</param> /// <param name="userIds">发送给用户主键</param> /// <param name="roleIds">发送给角色主键</param> /// <returns>影响行数</returns> public virtual int SendRemindMessage(BaseWorkFlowCurrentEntity workFlowCurrentEntity, AuditStatus auditStatus, string[] userIds, string organizeId, string roleId) { // string currentId, string objectId, string objectFullName int returnValue = 0; // 不用给自己发消息了,消息多了也烦恼 userIds = StringUtil.Remove(userIds, this.UserInfo.Id); // BaseUserEntity userEntity = userManager.GetEntity(userId); // 发送请求审核的信息 BaseMessageEntity messageEntity = new BaseMessageEntity(); messageEntity.Id = BaseBusinessLogic.NewGuid(); // 这里是回调的类,用反射要回调的 messageEntity.FunctionCode = MessageFunction.Remind.ToString(); // messageEntity.FunctionCode = this.GetType().ToString(); messageEntity.ObjectId = workFlowCurrentEntity.ObjectId; // 这里是网页上的显示地址 // messageEntity.Title = this.GetUrl(id); string auditIdea = string.Empty; if (!string.IsNullOrEmpty(workFlowCurrentEntity.AuditIdea)) { auditIdea = " 批示: " + workFlowCurrentEntity.AuditIdea; } // messageEntity.Contents = userEntity.DepartmentName + " " + userEntity.RealName messageEntity.Contents = workFlowCurrentEntity.CreateBy + " 发出审批申请: " + "<a title='点击这里,直接查看单据' target='_blank' href='" + this.GetUrl(workFlowCurrentEntity.Id) + "'>" + workFlowCurrentEntity.ObjectFullName + "</a> " + Environment.NewLine + this.UserInfo.RealName + " " + BaseBusinessLogic.GetAuditStatus(auditStatus) + " " + Environment.NewLine + auditIdea; messageEntity.Contents = "有单据" + BaseBusinessLogic.GetAuditStatus(auditStatus); messageEntity.IsNew = 1; messageEntity.ReadCount = 0; messageEntity.Enabled = 1; messageEntity.DeletionStateCode = 0; BaseMessageManager messageManager = new BaseMessageManager(this.UserInfo); returnValue = messageManager.BatchSend(userIds, organizeId, roleId, messageEntity, false); return(returnValue); }
/// <summary> /// (点通过时)当审核通过时 /// </summary> /// <param name="workFlowCurrentEntity">当前审批流</param> /// <returns>成功失败</returns> public override bool OnAutoAuditPass(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { string objectId = workFlowCurrentEntity.ObjectId; if (!string.IsNullOrEmpty(objectId)) { // 这里写自己的方法(审核 过程中的回调),通过审核时 IDbHelper dbHelper = new DotNet.Utilities.SqlHelper(BaseSystemInfo.BusinessDbConnection); dbHelper.Open(); SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); sqlBuilder.BeginUpdate("WL物品申购"); sqlBuilder.SetDBNow("审核日期"); sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditPass.ToString()); sqlBuilder.SetWhere("申请单号", objectId); sqlBuilder.EndUpdate(); dbHelper.Close(); } return(true); }
/// <summary> /// 撤消审批流程中的单据 /// </summary> /// <param name="id">当前主键</param> /// <returns>影响行数</returns> private BaseWorkFlowCurrentEntity StepAuditQuash(string currentId, string auditIdea) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId); // 1.记录审核时间、审核人 workFlowCurrentEntity.ToUserId = this.UserInfo.Id; workFlowCurrentEntity.ToUserRealName = this.UserInfo.RealName; workFlowCurrentEntity.AuditDate = DateTime.Now; workFlowCurrentEntity.AuditIdea = auditIdea; workFlowCurrentEntity.AuditStatus = AuditStatus.AuditQuash.ToString(); workFlowCurrentEntity.AuditStatusName = AuditStatus.AuditQuash.ToDescription(); workFlowCurrentEntity.ActivityId = null; workFlowCurrentEntity.Enabled = 1; workFlowCurrentEntity.DeletionStateCode = 0; // 4.生成审核结束的记录 this.AddHistory(workFlowCurrentEntity); // 废弃的,就变成删除状态了 this.UpdateEntity(workFlowCurrentEntity); // 5.把历史都设置为删除标志 return(workFlowCurrentEntity); }