/*==============================================================*/
/* Table: WAVE_TASK                                        */
/*==============================================================*/
CREATE TABLE WAVE_TASK (
WAVE_ID			VARCHAR2(12) NOT NULL,
TRAN_DATE	DATE,
SALE_ORDER__FROM		CHAR(10),
SALE_ORDER__TO	CHAR(10),
CUST_CODE__FROM	CHAR(10),
CUST_CODE__TO	CHAR(10),
DUE_DATE__FROM	DATE,
DUE_DATE__TO		DATE,
CHG_USER			CHAR(10),
CHG_TERM			VARCHAR2(15),
CHG_DATE			DATE
) 
tablespace itm_dis_d2;
alter table WAVE_TASK add constraint PK_WAVE_TASK primary key (WAVE_ID)
using index tablespace itm_dis_i1;

/*==============================================================*/
/* Table: WAVE_TASK_DET                                          */
/*==============================================================*/
create table WAVE_TASK_DET  (
   WAVE_ID             VARCHAR2(12) not null,
   LINE_NO              NUMBER(3) not null,
   REF_SER		CHAR(6),
   REF_ID		CHAR(10),
   REF_TYPE		CHAR(1),
   STATUS		CHAR(1)
 ) 
tablespace itm_dis_d2;
alter table WAVE_TASK_DET add constraint PK_WAVE_TASK_DET primary key (WAVE_ID,
LINE_NO)  using index tablespace itm_dis_i1;
alter table WAVE_TASK_DET add constraint FK_WAVE_TASK_DET foreign key (WAVE_ID)
references WAVE_TASK (WAVE_ID) on delete cascade;


/*==============================================================*/
/* Table: REPL_ORD_HDR                                          */
/*==============================================================*/
create table REPL_ORD_HDR  (
   REPL_ORDER           CHAR(10) not null,
   ORDER_DATE           DATE,
   SITE_CODE            CHAR(5),
   SALE_ORDER           CHAR(10),
   WAVE_ID              VARCHAR2(12),
   CHG_USER             CHAR(10),
   CHG_TERM             VARCHAR2(15),
   CHG_DATE             DATE)
tablespace itm_dis_d2;

alter table REPL_ORD_HDR add constraint PK_REPL_ORD_HDR primary key (REPL_ORDER)
using index tablespace itm_dis_i1;

/*==============================================================*/
/* Table: REPL_ORD_DET                                          */
/*==============================================================*/
create table REPL_ORD_DET  (
   REPL_ORDER           char(10) not null,
   LINE_NO              number(3) not null,
   SALE_ORDER           CHAR(10),
   LINE_NO__SORD              number(3),
   SITE_CODE            char(5),
   ITEM_CODE            char(10),
   LOC_CODE             char(8),
   LOT_NO               char(15),
   LOT_SL               char(15),
   NO_ART               number(6),
   QUANTITY             number(14,3)) tablespace itm_dis_d2;
alter table REPL_ORD_DET add constraint PK_REPL_ORD_DET primary key (REPL_ORDER,
LINE_NO)  using index tablespace itm_dis_i1;
alter table REPL_ORD_DET add constraint FK_REPL_ORD_DET foreign key (REPL_ORDER)
references REPL_ORD_HDR (REPL_ORDER) on delete cascade;
/*==============================================================*/
/* Table: REPL_ISS_HDR                                          */
/*==============================================================*/
create table REPL_ISS_HDR  (
   TRAN_ID              char(10) not null,
   TRAN_DATE            DATE,
   SITE_CODE            char(5),
   REPL_ORDER           char(10),
   CONFIRMED            char(1),
   CONF_DATE            DATE,
   EMP_CODE__APRV       char(10),
   CHG_USER             char(10),
   CHG_DATE             date,
   CHG_TERM             varchar2(15)) tablespace itm_dis_d2;
alter table REPL_ISS_HDR add constraint PK_REPL_ISS_HDR primary key (TRAN_ID) using
index tablespace itm_dis_i1;


/*==============================================================*/
/* Table: REPL_ISS_DET                                          */
/*==============================================================*/
create table REPL_ISS_DET  (
   TRAN_ID              char(10) not null,
   LINE_NO              number(3) not null,
   REPL_ORDER           char(10),
   LINE_NO__ORD         number(3),
   SITE_CODE            char(5),
   ITEM_CODE            char(10),
   LOC_CODE             char(8),
   LOT_NO               char(15),
   LOT_SL               char(15),
   QUANTITY             number(14,3),
   NO_ART               number(6),
   LOC_CODE__TO         char(8)) tablespace itm_dis_d2;
  alter table REPL_ISS_DET add constraint PK_REPL_ISS_DET primary key (TRAN_ID,
LINE_NO) using index tablespace itm_dis_i1;
alter table REPL_ISS_DET add constraint FK_REPL_ISS_DET foreign key (TRAN_ID)
references REPL_ISS_HDR (TRAN_ID) on delete cascade;

/*==============================================================*/
/* Table: PICK_ORD_HDR                                          */
/*==============================================================*/
create table PICK_ORD_HDR  (
   PICK_ORDER           char(10) not null,
   ORDER_DATE           date,
   SITE_CODE            char(5),
   SALE_ORDER           char(10),
   WAVE_ID              VARCHAR2(12),
   PICK_TYPE CHAR(1),
   CHG_USER             char(10),
   CHG_DATE             date,
   CHG_TERM             varchar2(15)) tablespace itm_dis_d2;
alter table  PICK_ORD_HDR add  constraint PK_PICK_ORD_HDR primary key (PICK_ORDER)
using index tablespace itm_dis_i1;


/*==============================================================*/
/* Table: PICK_ORD_DET                                          */
/*==============================================================*/
create table PICK_ORD_DET  (
   PICK_ORDER           char(10) not null,
   LINE_NO              number(3) not null,
   SALE_ORDER           CHAR(10),
   LINE_NO__SORD              number(3),
   SITE_CODE            char(5),
   ITEM_CODE            char(10),
   LOC_CODE             char(8),
   LOT_NO               char(15),
   LOT_SL               char(15),
   NO_ART               number(6),
   QUANTITY             number(14,3))  tablespace itm_dis_d2;
   alter table  PICK_ORD_DET add constraint PK_PICK_ORD_DET primary key (PICK_ORDER,
LINE_NO) using index tablespace itm_dis_i1;
alter table PICK_ORD_DET add constraint FK_PICK_ORD_DET foreign key (PICK_ORDER)
references PICK_ORD_HDR (PICK_ORDER) on delete cascade;
/*==============================================================*/
/* Table: PICK_ISS_HDR                                          */
/*==============================================================*/
create table PICK_ISS_HDR  (
   TRAN_ID             char(10) not null,
   TRAN_DATE           date,
   PICK_ORDER          char(10) not null,
   SITE_CODE           char(5),
   CONFIRMED           char(1),
   CONF_DATE           DATE,
   EMP_CODE__APRV      char(10),
   CHG_USER            char(10),
   CHG_DATE            date,
   CHG_TERM            varchar2(15))  tablespace itm_dis_d2;
alter table PICK_ISS_HDR add   constraint PK_PICK_ISS_HDR primary key (TRAN_ID)
using index tablespace itm_dis_i1;


/*==============================================================*/
/* Table: PICK_ISS_DET                                          */
/*==============================================================*/
create table PICK_ISS_DET  (
   TRAN_ID              char(10) not null,
   LINE_NO              number(3) not null,
   PICK_ORDER          char(10) not null,
   LINE_NO__ORD         number(3),
   SITE_CODE            char(5),
   ITEM_CODE            char(10),
   LOC_CODE             char(8),
   LOT_NO               char(15),
   LOT_SL               char(15),
   NO_ART               number(6),
   QUANTITY             number(14,3),
   LOC_CODE__TO         char(8))  tablespace itm_dis_d2;
alter table  PICK_ISS_DET add  constraint PK_PICK_ISS_DET primary key (TRAN_ID,
LINE_NO) using index tablespace itm_dis_i1;
alter table PICK_ISS_DET add constraint FK_PICK_ISS_DET foreign key (TRAN_ID)
references PICK_ISS_HDR (TRAN_ID) on delete cascade;



/*==============================================================*/
/* Table: PACK_HDR                                              */
/*==============================================================*/
create table PACK_HDR  (
   TRAN_ID              char(10) not null,
   TRAN_DATE            date,
   SITE_CODE            char(5),
   SALE_ORDER           char(10),
   WAVE_ID              varchar2(12),
   CONFIRMED            char(1),
   CONF_DATE            date,
   EMP_CODE__APRV       char(10),
   CHG_USER             char(10),
   CHG_DATE             date,
   CHG_TERM             varchar2(15))  tablespace itm_dis_d2;
 alter table  PACK_HDR add  constraint PK_PACK_HDR primary key (TRAN_ID) using index
tablespace itm_dis_i1;

/*==============================================================*/
/* Table: PACK_DET                                              */
/*==============================================================*/
create table PACK_DET  (
   TRAN_ID              char(10) not null,
   LINE_NO              number(3) not null,
   SALE_ORDER           CHAR(10),
   LINE_NO__SORD              number(3),
   SITE_CODE            char(5),
   ITEM_CODE            char(10),
   LOC_CODE             char(8),
   LOT_NO               char(15),
   LOT_SL               char(15),
   QUANTITY             number(14,3),
   LOC_CODE__TO         char(8),
   OUTER_CARTON_NO      varchar2(15),
   NO_ART               number(6))  tablespace itm_dis_d2;
 alter table  PACK_DET add  constraint PK_PACK_DET primary key (TRAN_ID, LINE_NO)
using index tablespace itm_dis_i1;
alter table PACK_DET add constraint FK_PACK_DET foreign key (TRAN_ID) references
PACK_HDR (TRAN_ID) on delete cascade;

/*==============================================================*/
/* Table: DESP_PACK_DET												 */
/*==============================================================*/

CREATE TABLE DESP_PACK_DET(
  TRAN_ID                                  CHAR(10),
  LINE_NO                                  NUMBER(3),
  OUTER_CARTON_NO                          VARCHAR2(15) )
 TABLESPACE ITM_DIS_D2;

 ALTER TABLE DESP_PACK_DET ADD CONSTRAINT PK_DESP_PACK_DET_X PRIMARY KEY
 (TRAN_ID)
 USING INDEX TABLESPACE ITM_DIS_I1;

/*==============================================================*/
/* Table: PHY_CNT												 */
/*==============================================================*/
CREATE TABLE PHY_CNT ( TRAN_ID CHAR(10) NOT NULL, 
TRAN_DATE DATE NOT NULL,
SITE_CODE   
CHAR(5), ITEM_CODE  CHAR(10),
LOC_CODE  CHAR(8),
LOT_NO  CHAR(15), 
LOT_SL   CHAR(15), 
PHY_CNT_DT  DATE CHG_DATE DATE,
CHG_TERM CHAR(15), 
CHG_USER CHAR(15)); 
TABLESPACE ITM_DIS_D2;
ALTER TABLE PHY_CNT ADD  CONSTRAINT PK_PHY_CNT PRIMARY KEY (TRAN_ID) 
USING INDEX TABLESPACE ITM_DIS_I1;
/*==============================================================*/
/* Transaction Entries														*/
/*==============================================================*/
