--Order 20015191.60

insert into MULTIREADEXCEPTIONREASON (MULTIREADEXCEPTIONREASON_ID, FACTORYDESCRIPTION, STORELOGYN, SYSTEMUSER_ID, TIMESTAMP)
values (15, 'Scanned somewhere else in the meantime', 'Y', 1, sysdate);
commit;

insert into STAY  (stay_id, staytype, staynr, systemuser_id, timestamp, factorydescription, includedraginbatch)
values (seq_stay.nextval, 1, 27, 1, sysdate, 'On-site at Customer', 'Y');
commit;

insert into transactiontype (transactiontype_id, factorydescription, systemuser_id, timestamp, legacytransactioncode)
values (76, 'On-site Inventory Scan', 1, sysdate, null);
commit;


---MULTIREADSCANBATCHCONTENTS table--

ALTER TABLE MULTIREADSCANBATCHCONTENTS
	ADD (BUSINESSUNIT_ID NUMBER NULL);

ALTER TABLE MULTIREADSCANBATCHCONTENTS
	ADD (PRODUCTLISTPERDISTRIBPOINT_ID NUMBER NULL);

---LACUSTOMERPRODUCT table---

CREATE SEQUENCE SEQ_LACUSTOMERPRODUCT
START WITH 1
INCREMENT BY 1;

CREATE TABLE LACUSTOMERPRODUCT
(
	LACUSTOMERPRODUCT_ID NUMBER NOT NULL ,
	CUSTOMER_ID          NUMBER NOT NULL ,
	PRODUCT_ID           NUMBER NOT NULL ,
	SIZEDEFINITION_ID    NUMBER NOT NULL ,
	FINISHINGMETHOD_ID   NUMBER NULL ,
	PRODUCTCODE          VARCHAR2(12) NOT NULL ,
	PRODUCTCUSTOMDESC    VARCHAR2(30) NULL ,
	SIZECODE             VARCHAR2(12) NOT NULL ,
	FINMETHODCODE        VARCHAR2(6) NOT NULL ,
	TYPEOFMERCHANDISE    NUMBER NOT NULL ,
	SIZESEQUENCE         NUMBER NOT NULL ,
	CODEUNIQUELY         VARCHAR2(1) NOT NULL ,
	ONSITEINVENTORYCOUNT VARCHAR2(1) NOT NULL 
);

COMMENT ON COLUMN LACUSTOMERPRODUCT.CODEUNIQUELY IS 'Y/N';

COMMENT ON COLUMN LACUSTOMERPRODUCT.ONSITEINVENTORYCOUNT IS 'Y/N';

CREATE UNIQUE INDEX XAK1LACUSTOMERPRODUCT ON LACUSTOMERPRODUCT
(CUSTOMER_ID   ASC,PRODUCT_ID   ASC,SIZEDEFINITION_ID   ASC,FINISHINGMETHOD_ID   ASC);

ALTER TABLE LACUSTOMERPRODUCT
ADD CONSTRAINT  XPKLACUSTOMERPRODUCT PRIMARY KEY (LACUSTOMERPRODUCT_ID);

