src-db/database/model/functions/M_RESERVATION_POST.xml
changeset 18745 7dfe05aa19c5
parent 18705 5966a12e0b3c
child 19073 79002a24b20a
equal deleted inserted replaced
18744:229839951ded 18745:7dfe05aa19c5
   158           RAISE_APPLICATION_ERROR(-20000, '@SOLineWithMoreThanOneOpenReservation@');
   158           RAISE_APPLICATION_ERROR(-20000, '@SOLineWithMoreThanOneOpenReservation@');
   159         END IF;
   159         END IF;
   160   
   160   
   161         UPDATE c_orderline
   161         UPDATE c_orderline
   162         SET so_res_status = CASE WHEN v_quantity = v_reservedqty THEN 'CR'
   162         SET so_res_status = CASE WHEN v_quantity = v_reservedqty THEN 'CR'
   163                                  ELSE 'PR'
   163                                  WHEN v_reservedqty > 0 THEN 'PR'
       
   164                                  ELSE 'NR'
   164                             END
   165                             END
   165         WHERE c_orderline_id = v_orderline_id;
   166         WHERE c_orderline_id = v_orderline_id;
   166   
   167   
   167         SELECT c_order_id INTO v_sales_order_id
   168         SELECT c_order_id INTO v_sales_order_id
   168         FROM c_orderline
   169         FROM c_orderline
   177                                  WHEN v_creservedcount + v_preservedcount > 0 THEN 'PR'
   178                                  WHEN v_creservedcount + v_preservedcount > 0 THEN 'PR'
   178                                  ELSE 'NR'
   179                                  ELSE 'NR'
   179                             END
   180                             END
   180         WHERE c_order_id = v_sales_order_id;
   181         WHERE c_order_id = v_sales_order_id;
   181       END IF;
   182       END IF;
   182   
   183       -- ADD RESERVED STOCK
       
   184       M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message);
       
   185 
   183       v_newstatus := 'CO';
   186       v_newstatus := 'CO';
   184       v_newaction := 'HO';
   187       v_newaction := 'HO';
   185       -- ADD RESERVED STOCK
       
   186       M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message);
       
   187     END;
   188     END;
   188 
   189 
   189   ELSIF (v_resaction = 'HO') THEN
   190   ELSIF (v_resaction = 'HO') THEN
   190   /*
   191   /*
   191     Reservation Hold Process
   192     Reservation Hold Process