src-db/database/model/functions/M_RESERVATION_POST.xml
changeset 18689 a17b382229ce
parent 18663 157c92ecd0e2
child 18693 7b17189c848b
equal deleted inserted replaced
18688:9181cfa32cd7 18689:a17b382229ce
    36   v_Result NUMBER:=1; --  Success
    36   v_Result NUMBER:=1; --  Success
    37   v_resaction       VARCHAR2(60);
    37   v_resaction       VARCHAR2(60);
    38   v_resstatus       VARCHAR2(60);
    38   v_resstatus       VARCHAR2(60);
    39   v_newstatus       VARCHAR2(60);
    39   v_newstatus       VARCHAR2(60);
    40   v_newaction       VARCHAR2(60);
    40   v_newaction       VARCHAR2(60);
       
    41   v_orderline_id    VARCHAR2(32);
       
    42   v_count           NUMBER;
    41 
    43 
    42 TYPE RECORD IS REF CURSOR;
    44 TYPE RECORD IS REF CURSOR;
    43   Cur_Parameter RECORD;
    45   Cur_Parameter RECORD;
    44 
    46 
    45 BEGIN
    47 BEGIN
    69     v_resaction := p_resaction;
    71     v_resaction := p_resaction;
    70     v_user_id := p_user_id;
    72     v_user_id := p_user_id;
    71   END IF;
    73   END IF;
    72 
    74 
    73 BEGIN
    75 BEGIN
    74   SELECT res_status
    76   SELECT res_status, c_orderline_id
    75     INTO v_resstatus
    77     INTO v_resstatus, v_orderline_id
    76   FROM m_reservation
    78   FROM m_reservation
    77   WHERE m_reservation_id = v_reservation_id;
    79   WHERE m_reservation_id = v_reservation_id;
    78   
    80   
    79   IF (v_resaction = 'PR') THEN
    81   IF (v_resaction = 'PR') THEN
    80   /*
    82   /*
    81     Reservation Complete Process
    83     Reservation Complete Process
    82   */
    84   */
    83     IF (v_resstatus != 'DR') THEN
    85     IF (v_resstatus != 'DR') THEN
    84       RAISE_APPLICATION_ERROR(-20000, '@ActionNotSupported@');
    86       RAISE_APPLICATION_ERROR(-20000, '@ActionNotSupported@');
    85     END IF;
    87     END IF;
       
    88     IF (v_orderline_id IS NOT NULL) THEN
       
    89       SELECT count(*) INTO v_count
       
    90       FROM m_reservation
       
    91       WHERE c_orderline_id = v_orderline_id
       
    92         AND res_status != 'CL'
       
    93         AND m_reservation_id != v_reservation_id;
       
    94       IF (v_count > 0) THEN
       
    95         RAISE_APPLICATION_ERROR(-20000, '@SOLineWithMoreThanOneOpenReservation@');
       
    96       END IF;
       
    97     END IF;
       
    98 
    86     v_newstatus := 'CO';
    99     v_newstatus := 'CO';
    87     v_newaction := 'HO';
   100     v_newaction := 'HO';
    88     
       
    89     -- ADD RESERVED STOCK
   101     -- ADD RESERVED STOCK
    90     M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message);
   102     M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message);
    91 
   103 
    92   ELSIF (v_resaction = 'HO') THEN
   104   ELSIF (v_resaction = 'HO') THEN
    93   /*
   105   /*