/// <summary>
        /// 废弃单据
        /// (废弃单据时)当废弃审批流时需要做的事情
        /// </summary>
        /// <param name="workFlowCurrentEntity">当前审批流</param>
        /// <returns>影响行数</returns>
        public override bool OnAuditQuash(BaseWorkFlowCurrentEntity workFlowCurrentEntity)
        {
            // 审核通过后,需要把有效状态修改过来
            BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo);
            string objectId = workFlowCurrentManager.GetEntity(workFlowCurrentEntity.Id).ObjectId;

            if (!string.IsNullOrEmpty(objectId))
            {
                // 这里写自己的方法(审核 过程中的回调),废弃审核时
                IDbHelper dbHelper = new DotNet.Utilities.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.SetDBNow("审核日期");
                    sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code);
                    sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditQuash.ToString());
                    sqlBuilder.SetWhere("申请单号", objectId);
                    sqlBuilder.EndUpdate();
                    break;

                case "YuanFuCaiLiaoShenQingDan":
                    sqlBuilder.BeginUpdate("WL部门物品申购");
                    sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditQuash.ToString());
                    sqlBuilder.SetWhere("申购单号", objectId);
                    sqlBuilder.EndUpdate();
                    break;

                case "MoJuCaiGouHeTongP":
                case "MoJuCaiGouHeTongGM":
                    sqlBuilder.BeginUpdate("GCMJ模具申请");
                    sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditQuash.ToString());
                    sqlBuilder.SetWhere("申请单号", objectId);
                    sqlBuilder.EndUpdate();
                    break;
                }
                dbHelper.Close();
            }
            // 若还需要有其他处理,就这后面继续处理
            return(true);
        }
Exemplo n.º 2
0
        /// <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));
        }
Exemplo n.º 3
0
        /// <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);
        }