Beispiel #1
0
        public static SQLStmt Get(EStatement sqlStmtName)
        {
            switch (sqlStmtName)
            {
            case EStatement.COMPLETED_WORK:
                return(new SQLStmt(_LoadSQLStmt("completed_work.sql"), "completed_work"));

            case EStatement.COMPLETED_WORK_OTHER:
                return(new SQLStmt(_LoadSQLStmt("completed_work_other.sql"), "completed_work_other"));

            case EStatement.CURRENT_TRANSFERS:
                return(new SQLStmt(_LoadSQLStmt("current_transfers.sql"), "current_transfers"));

            case EStatement.ASSIGNED_OUTBOUND_TRANSFERS:
                return(new SQLStmt(_LoadSQLStmt("assigned_outbound_transfers_movements.sql"), "assigned_outbound_transfers"));

            case EStatement.COMPLETED_OUTBOUND_TRANSFERS:
                return(new SQLStmt(_LoadSQLStmt("completed_outbound_transfer_movements.sql"), "completed_outbound_transfers"));

            case EStatement.CURRENT_MOVEMENTS:
                return(new SQLStmt(_LoadSQLStmt("current_movements.sql"), "current_movements"));

            case EStatement.COMPLETED_MOVEMENTS:
                return(new SQLStmt(_LoadSQLStmt("completed_movements.sql"), "completed_movements"));

            case EStatement.MOVEMENT_BREAKOUT:
                return(new SQLStmt(_LoadSQLStmt("movement_breakout.sql"), "movement_breakout"));

            case EStatement.TRACKED_KITS:
                return(new SQLStmt(_LoadSQLStmt("tracked_kits.sql"), "tracked_kits"));

            default:
                return(null);
            }
        }
Beispiel #2
0
        private Variable _handleStatement(EStatement statement, string scope)
        {
            // evaluate
            var evaluation = _expandParameter(statement.Evaluable);

            if (!Enum.TryParse <Types>(evaluation.Type, out Types type))
            {
                throw new EngineException($"Statement of type {statement.Type} in {scope} has unparsable variable type: {evaluation.Type}");
            }
            if (type != Types.Boolean)
            {
                throw new EngineException($"Variable for {statement.Type} statement in {scope} is of type {type}, but a {Types.Boolean} was expected");
            }
            if (evaluation.Value == null)
            {
                throw new EngineException($"Variable for {statement.Type} statement in {scope} is unassigned");
            }

            if ((bool)evaluation.Value != true)
            {
                return(Variable.Empty);
            }

            // call _runBlock, as if running a function, but empty set of parameters
            // the return value will be empty, if the statement completed, signaling we can continue,
            // or has a value, signaling we encountered a return inside the statement.
            var result = _runBlock(statement, new List <Variable>());

            // only continue the while if result is empty (meaning a return was not encountered)
            if (statement.Type == EStatementType.WHILE && result.IsEmpty)
            {
                _handleStatement(statement, scope);
            }

            return(result);
        }
Beispiel #3
0
 /// <summary>
 /// Ritorna conteggio per statement
 /// </summary>
 /// <param name="statement"></param>
 /// <returns></returns>
 public long GetCounter(EStatement statement)
 {
     return(this._Data[statement].Counter);
 }
Beispiel #4
0
 internal void Increment(EStatement statement)
 {
     this._Data[statement].Counter++;
 }