DBA Data[Home] [Help]

TRIGGER: APPS.WIP_DISCRETE_JOBS_BRU

Source

Description
wip_discrete_jobs_bru
/* $Header: wipt002.sql 120.1 2006/03/22 18:10:07 vjambhek noship $ */
BEFORE UPDATE of
  demand_class,
  net_quantity,
  scheduled_completion_date,
  date_completed,
  status_type,
  alternate_bom_designator,
  bom_reference_id,
  bom_revision,
  bom_revision_date,
  project_id,
  task_id,
  start_quantity /*Bug 4259501- Change of start_quantity should also be notified to planning manager*/
ON wip_discrete_jobs
FOR EACH ROW
Type
BEFORE EACH ROW
Event
UPDATE
Column
When
    new.job_type = 1
      AND (new.status_type < 7 OR old.status_type < 7)
     
Referencing
REFERENCING NEW AS NEW OLD AS OLD
Body
BEGIN
  WIP_MRP_RELIEF.wip_discrete_jobs_proc(:new.primary_item_id,
                         :new.organization_id,
                         :new.last_update_date,
                         :new.last_updated_by,
                         :new.creation_date,
                         :new.created_by,
                         :new.net_quantity,
                         :old.net_quantity,
                         :new.scheduled_completion_date,
                         :old.scheduled_completion_date,
                         :new.wip_entity_id,
                         :new.source_code,
                         :new.source_line_id,
                         :new.alternate_bom_designator,
                         :old.alternate_bom_designator,
                         :new.bom_revision_date,
                         :old.bom_revision_date,
                         :new.demand_class,
                         :old.demand_class,
                         :new.status_type,
                         :old.status_type,
                         :new.quantity_completed +
			  :new.quantity_scrapped,
                         :old.quantity_completed +
			  :old.quantity_scrapped,
                         :new.date_completed,
                         :old.date_completed,
			 :new.project_id,
			 :old.project_id,
			 :new.task_id,
			 :old.task_id
                         );

       /* Bug#2777229 - Added below code to delete records from
          wip_scheduling_exceptions when the job status is changed
          to complete/cancelled/closed */

   if ( :new.status_type in
       (WIP_CONSTANTS.COMP_CHRG,WIP_CONSTANTS.CANCELLED,WIP_CONSTANTS.CLOSED)
       and :old.status_type not in
       (WIP_CONSTANTS.COMP_CHRG,WIP_CONSTANTS.CANCELLED,WIP_CONSTANTS.CLOSED))
   then
              delete from wip_scheduling_exceptions
               where wip_entity_id = :new.wip_entity_id
                 and organization_id = :new.organization_id;
   end if;

END;