Usuwanie lokalizacji magazynowych

<< Kliknij, aby wyświetlić spis treści >>

Nawigacja:  »brak tematów«

Usuwanie lokalizacji magazynowych

Usuwanie przypisanych do produktów lokalizacji magazynowych

Warunek: stan magazynu ID_STORE dla produktu którego stan magazynowy = 0/null

 

execute block (

   id_store trec_id = :id_store)

returns (

   id_product trec_id,

   id_storage_location trec_id,

   qnt tquantity)

as

begin

 for select psl.id_product,

            psl.id_storage_location

       from product_storage_location psl

         left join storage_location sl on sl.id_storage_location = psl.id_storage_location and sl.id_store = :id_store

       order by psl.id_product

       into :id_product, :id_storage_location

 do

 begin

   qnt = 0;

   select pq.qnt

     from product_qnt pq

     where pq.id_store = :id_store

       and pq.id_product = :id_product

     into :qnt;

   if ((:qnt = 0) or (:qnt is null)) then

   begin

     suspend;

     delete from product_storage_location

     where (id_product = :id_product)

       and (id_storage_location = :id_storage_location);

   end

 end

end