--- ABS-10561
-------------------------------   STOCKROOM------------------------------------------
ALTER TABLE STOCKROOMOOSACTIONS
  DROP CONSTRAINT STOCKROOMOOS_OOSA_ID;
ALTER TABLE STOCKROOMOOSACTIONS
  ADD CONSTRAINT STOCKROOMOOS_OOSA_ID FOREIGN KEY (OOSACTION_ID)
  REFERENCES OOSACTION (OOSACTION_ID) ON DELETE CASCADE;

-------------------------------   OOSACTIONRESTRICTION------------------------------------------
DELETE FROM OOSACTIONRESTRICTION O WHERE O.OOSACTIONRESTRICTION_ID = 8;
COMMIT;

DELETE FROM OOSACTIONRESTRICTION O WHERE O.OOSACTIONRESTRICTION_ID = 9;
COMMIT;


DELETE FROM OOSACTIONRESTRICTION O WHERE O.OOSACTIONRESTRICTION_ID = 10;
COMMIT;

DELETE FROM OOSACTIONRESTRICTION OAR WHERE OAR.OOSACTION_ID=3;
COMMIT;

-------------------------------   OOSACTION------------------------------------------
DELETE FROM OOSACTION O WHERE O.OOSACTION_ID = 3;
COMMIT;

UPDATE OOSACTION O
SET O.FACTORYDESCRIPTION = 'Purchasing'
WHERE O.OOSACTION_ID = 1;
COMMIT;

UPDATE OOSACTION O
SET O.FACTORYDESCRIPTION = 'Receive items on Stock'
WHERE O.OOSACTION_ID = 2;
COMMIT;

-------------------------------   OOSACTIONRESTRICTION------------------------------------------
INSERT INTO OOSACTION O
  (O.OOSACTION_ID, 
   O.FACTORYDESCRIPTION, 
   O.SYSTEMUSER_ID, 
   O.TIMESTAMP)
  VALUES (5,
         'MaintainUI- Change stock location',
         GETMINSYSTEMUSER(),
         SYSDATE);
COMMIT;

INSERT INTO OOSACTION O
  (O.OOSACTION_ID, 
   O.FACTORYDESCRIPTION, 
   O.SYSTEMUSER_ID, 
   O.TIMESTAMP)
  VALUES (6,
         'MaintainUI – Change product/Size/Grade',
         GETMINSYSTEMUSER(),
         SYSDATE);
COMMIT;	

INSERT INTO OOSACTIONRESTRICTION
  (OOSACTIONRESTRICTION_ID,
   OOSACTION_ID,
   OOSRESTRICTION_ID,
   SYSTEMUSER_ID,
   TIMESTAMP)
VALUES
  (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 5, 1, GETMINSYSTEMUSER(), SYSDATE);  
COMMIT;

INSERT INTO OOSACTIONRESTRICTION
  (OOSACTIONRESTRICTION_ID,
   OOSACTION_ID,
   OOSRESTRICTION_ID,
   SYSTEMUSER_ID,
   TIMESTAMP)
VALUES
  (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 5, 2, GETMINSYSTEMUSER(), SYSDATE);  
COMMIT;

INSERT INTO OOSACTIONRESTRICTION
  (OOSACTIONRESTRICTION_ID,
   OOSACTION_ID,
   OOSRESTRICTION_ID,
   SYSTEMUSER_ID,
   TIMESTAMP)
VALUES
  (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 5, 3, GETMINSYSTEMUSER(), SYSDATE);  
COMMIT;

INSERT INTO OOSACTIONRESTRICTION
  (OOSACTIONRESTRICTION_ID,
   OOSACTION_ID,
   OOSRESTRICTION_ID,
   SYSTEMUSER_ID,
   TIMESTAMP)
VALUES
  (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 5, 4, GETMINSYSTEMUSER(), SYSDATE);  
COMMIT;

INSERT INTO OOSACTIONRESTRICTION
  (OOSACTIONRESTRICTION_ID,
   OOSACTION_ID,
   OOSRESTRICTION_ID,
   SYSTEMUSER_ID,
   TIMESTAMP)
VALUES
  (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 6, 1, GETMINSYSTEMUSER(), SYSDATE);  
COMMIT;

INSERT INTO OOSACTIONRESTRICTION
  (OOSACTIONRESTRICTION_ID,
   OOSACTION_ID,
   OOSRESTRICTION_ID,
   SYSTEMUSER_ID,
   TIMESTAMP)
VALUES
  (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 6, 2, GETMINSYSTEMUSER(), SYSDATE);  
COMMIT;

-------------------------------   STOCKROOM------------------------------------------
DELETE FROM STOCKROOMOOSACTIONS O WHERE O.OOSACTION_ID = 3;
COMMIT;

INSERT INTO STOCKROOMOOSACTIONS
(SELECT SEQ_STOCKROOMOOSACTIONS.NEXTVAL,
       S.STOCKROOM_ID,
       5,
       1,
       GETMINSYSTEMUSER(),
       TIMESTAMP
FROM STOCKROOM S);
COMMIT;

INSERT INTO STOCKROOMOOSACTIONS
(SELECT SEQ_STOCKROOMOOSACTIONS.NEXTVAL,
       S.STOCKROOM_ID,
       6,
       1,
       GETMINSYSTEMUSER(),
       TIMESTAMP
FROM STOCKROOM S);
COMMIT;

