示例#1
0
        /// <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);
        }
        /// <summary>
        /// 废弃单据
        /// (废弃单据时)当废弃审批流时需要做的事情
        /// </summary>
        /// <param name="workFlowCurrentEntity">当前审批流</param>
        /// <returns>影响行数</returns>
        public override bool OnAuditQuash(BaseWorkFlowCurrentEntity workFlowCurrentEntity)
        {
            // 审核通过后,需要把有效状态修改过来
            BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo);
            string objectId = workFlowCurrentManager.GetObject(workFlowCurrentEntity.Id).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.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);
        }
示例#3
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.GetObject(id);

            // 工作流里会进行撤销的工作
            return(workFlowCurrentManager.Reset(workFlowCurrentEntity));
        }