示例#1
0
        public override State GetState(StepState state)
        {
            switch (state)
            {
            case StepState.NotReceive:
                return(MergeNRState.Instance);

            case StepState.ReceiveNotOpen:
                return(MergeRNOState.Instance);

            case StepState.OpenNotProcess:
                return(MergeONPState.Instance);

            case StepState.ProcessNotSend:
                return(MergePNSState.Instance);

            default:
                AtawDebug.ThrowImpossibleCode(this);
                return(null);
            }
        }
示例#2
0
        public bool ProcessManualWorkflow(WF_WORKFLOW_INST workflowRow, string userId)
        {
            WorkflowDbContext dbContext = Source as WorkflowDbContext;
            StepState         state     = (StepState)workflowRow.WI_STATUS;

            switch (state)
            {
            case StepState.NotReceive:
                // NR:
                // 检查userId是否在接受人列表中,是接收并打开,返回true,否则返回false
                //如果接受人有多个,你只是其中的一个,并且你是上个流程的处理者,不能接收 这一点可以根据配置来.....
                string      receiveIds = workflowRow.WI_RECEIVE_LIST;
                QuoteIdList ulReceive  = QuoteIdList.LoadFromString(receiveIds);
                if (ulReceive.Contains(userId))
                {
                    bool   _isAppAutoStep = "WrokflowAutoStep".AppKv <bool>(false);
                    string _ManualAskUser = AtawAppContext.Current.GetItem("ManualAskUser").Value <string>();
                    if (ulReceive.Count > 0 && (_ManualAskUser == userId) && !_isAppAutoStep)
                    {
                        //.............
                        return(false);
                    }
                    else
                    {
                        workflowRow.WI_RECEIVE_ID   = userId;
                        workflowRow.WI_STATUS       = (int)StepState.OpenNotProcess;
                        workflowRow.WI_RECEIVE_DATE = dbContext.Now;
                        Source.Submit();
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }

            case StepState.ReceiveNotOpen:
                // RNO:
                // 检查接收人是否是userId,是打开,返回true,否则返回false
                if (userId == workflowRow.WI_RECEIVE_ID)
                {
                    workflowRow.WI_STATUS = (int)StepState.OpenNotProcess;
                    Source.Submit();
                    return(true);
                }
                else
                {
                    return(false);
                }

            case StepState.OpenNotProcess:
                // ONP:
                // 检查接收人是否是userId,是返回true,否则返回false
                return(userId == workflowRow.WI_RECEIVE_ID);

            default:
                AtawDebug.ThrowImpossibleCode(this);
                break;
            }

            return(false);
        }