alter table ASN add sourceId VARCHAR2(255 CHAR);
alter table ASN add sourceType VARCHAR2(255 CHAR);
alter table PICK_TICKET add sourceId VARCHAR2(255 CHAR);
alter table PICK_TICKET add sourceType VARCHAR2(255 CHAR);
alter table ITEM add sourceId VARCHAR2(255 CHAR);
alter table ITEM add sourceType VARCHAR2(255 CHAR);


-----------------------2018-11-12
alter table PICK_TICKET add equated_Quantity VARCHAR2(255 CHAR);
alter table PLAN_PICK_TICKET_DETAIL add equated_Quantity VARCHAR2(255 CHAR);
-------------------------------2018-12-26
 alter table STORE add sequenceNo1  NUMBER(4);
 alter table STORE add sequenceNo2  NUMBER(4);
alter table STORE add LINE_THURSDAY_ID  NUMBER(19);
 alter table STORE add LINE_SUNDAY_ID  NUMBER(19);
 update STORE s set s.sequenceno1=0 where s.sequenceno1 is null;
  update STORE s set s.sequenceno2=0 where s.sequenceno2 is null;
alter table STORE
  add constraint FK_STORE_LINE_THURSDAY foreign key (LINE_THURSDAY_ID)
  references LINE (ID);
 
alter table STORE
  add constraint FK_STORE_LINE_SUNDAY foreign key (LINE_SUNDAY_ID)
  references LINE (ID);
  
   alter table PICK_TICKET add sequenceNo1  NUMBER(19);
    update PICK_TICKET s set s.sequenceNo1=0 where s.sequenceNo1 is null;
    
    alter table PICK_TICKET rename column sequenceNo1 to sequenceNo;
       
    alter table FEE add order_CODE  VARCHAR2(50 CHAR);
    alter table Label add damage_Quantity  float;
    alter table Label add lack_Quantity  float;
   update Label set lack_Quantity=0 where lack_Quantity is null;
    update Label set damage_Quantity=0 where damage_Quantity is null;
    
    
    ---------------20191222
    alter table STRUCTURE add contract_Date_Start  date;
    alter table STRUCTURE add contract_Date_End  date;
    
    
    -- Create table
create table MOVE_OBJECT_DETAIL
(
  ID                NUMBER(19) not null,
  DISCRIMINATOR     VARCHAR2(255 CHAR) not null,
  MOVE_OBJECT_ID    NUMBER(19) not null,
  ITEM_KEY_ID       NUMBER(19) not null,
  SRC_LOC_ID        NUMBER(19),
  SRC_LP            NUMBER(19),
  SRC_LP_CODE       VARCHAR2(50 CHAR),
  DST_LOC_ID        NUMBER(19),
  DST_LP            NUMBER(19),
  DST_LP_CODE       VARCHAR2(50 CHAR),
  STORAGE_DATE      DATE,
  SOI               VARCHAR2(255 CHAR),
  INVENTORY_STATUS  VARCHAR2(20 CHAR),
  PLAN_QUANTITY     FLOAT not null,
  PLAN_QUANTITY_MU  FLOAT not null,
  ALLOCATE_QUANTITY FLOAT not null,
  MOVE_QUANTITY     FLOAT not null,
  PACKAGE_UNIT_ID   NUMBER(19) not null,
  LINE_NO           NUMBER(10),
  PROP_C1           VARCHAR2(100 CHAR),
  PROP_C2           VARCHAR2(100 CHAR),
  PROP_C3           VARCHAR2(100 CHAR),
  PROP_C4           VARCHAR2(100 CHAR),
  PROP_C5           VARCHAR2(100 CHAR),
  PROP_C6           VARCHAR2(100 CHAR),
  PROP_C7           VARCHAR2(100 CHAR),
  PROP_C8           VARCHAR2(100 CHAR),
  PROP_C9           VARCHAR2(100 CHAR),
  PROP_N1           VARCHAR2(100 CHAR),
  PROP_N2           VARCHAR2(100 CHAR),
  PROP_N3           VARCHAR2(100 CHAR),
  PROP_D1           VARCHAR2(100 CHAR),
  PROP_D2           VARCHAR2(100 CHAR),
  PROP_D3           VARCHAR2(100 CHAR),
  PROP_L1           VARCHAR2(100 CHAR),
  PROP_L2           VARCHAR2(100 CHAR),
  PROP_L3           VARCHAR2(100 CHAR),
  MOVE_DOC_ID       NUMBER(19),
  INV_ID            NUMBER(19)
);
-- Create/Recreate primary, unique and foreign key constraints 
alter table MOVE_OBJECT_DETAIL
  add primary key (ID)
  using index ;
alter table MOVE_OBJECT_DETAIL
  add constraint FKEAC6C54321298FF5 foreign key (SRC_LOC_ID)
  references LOCATION (ID);
alter table MOVE_OBJECT_DETAIL
  add constraint FKEAC6C5432D287710 foreign key (DST_LP)
  references STOCK (ID);
alter table MOVE_OBJECT_DETAIL
  add constraint FKEAC6C54346AB5691 foreign key (SRC_LP)
  references STOCK (ID);
alter table MOVE_OBJECT_DETAIL
  add constraint FKEAC6C5434B1458F4 foreign key (DST_LOC_ID)
  references LOCATION (ID);
alter table MOVE_OBJECT_DETAIL
  add constraint FKEAC6C5439E10C788 foreign key (ITEM_KEY_ID)
  references ITEM_KEY (ID);
alter table MOVE_OBJECT_DETAIL
  add constraint FKEAC6C543BE48EABC foreign key (PACKAGE_UNIT_ID)
  references PACKAGE_UNIT (ID);
alter table MOVE_OBJECT_DETAIL
  add constraint FKEAC6C543C3609BE0 foreign key (MOVE_DOC_ID)
  references MOVE_OBJECT (ID);
alter table MOVE_OBJECT_DETAIL
  add constraint FKEAC6C543FB3A4D5D foreign key (MOVE_OBJECT_ID)
  references MOVE_OBJECT (ID);

  
  -- Create table
create table MOVE_OBJECT
(
  ID                NUMBER(19) not null,
  DISCRIMINATOR     VARCHAR2(255 CHAR) not null,
  WAREHOUSE_ID      NUMBER(19) not null,
  COMPANYA_ID       NUMBER(19) not null,
  COMPANYB_ID       NUMBER(19),
  BILL_TYPE_ID      NUMBER(19),
  MOVE_TYPE         VARCHAR2(20 CHAR),
  CODE              VARCHAR2(20 CHAR) not null,
  CREATE_DATE       DATE,
  STATUS            VARCHAR2(20 CHAR),
  RELATEBILLCODE    VARCHAR2(20 CHAR),
  USER_ID           NUMBER(19),
  USER_NAME         VARCHAR2(20 CHAR),
  UPDATE_TIME       TIMESTAMP(6),
  PLAN_QUANTITY     FLOAT not null,
  ALLOCATE_QUANTITY FLOAT not null,
  MOVE_QUANTITY     FLOAT not null,
  WORKER1_ID        NUMBER(19),
  WORKER2_ID        NUMBER(19),
  WORKER3_ID        NUMBER(19),
  WORKER4_ID        NUMBER(19),
  PRINT_COUNT       NUMBER(10)
);
-- Create/Recreate primary, unique and foreign key constraints 
alter table MOVE_OBJECT
  add primary key (ID)
  using index ;
alter table MOVE_OBJECT
  add unique (WAREHOUSE_ID, COMPANYA_ID, BILL_TYPE_ID, CODE)
  using index;
alter table MOVE_OBJECT
  add constraint FK2625A36D6919E52F foreign key (WAREHOUSE_ID)
  references WAREHOUSE (ID);
alter table MOVE_OBJECT
  add constraint FK2625A36D8EAED2F4 foreign key (BILL_TYPE_ID)
  references BILL_TYPE (ID);
alter table MOVE_OBJECT
  add constraint FK2625A36D93177B7E foreign key (COMPANYA_ID)
  references STRUCTURE (ID);
alter table MOVE_OBJECT
  add constraint FK2625A36D9317EFDD foreign key (COMPANYB_ID)
  references STRUCTURE (ID);
alter table MOVE_OBJECT
  add constraint FK2625A36DEE3209B0 foreign key (WORKER1_ID)
  references WORKER (ID);
alter table MOVE_OBJECT
  add constraint FK2625A36DEE327E0F foreign key (WORKER2_ID)
  references WORKER (ID);
alter table MOVE_OBJECT
  add constraint FK2625A36DEE32F26E foreign key (WORKER3_ID)
  references WORKER (ID);
alter table MOVE_OBJECT
  add constraint FK2625A36DEE3366CD foreign key (WORKER4_ID)
  references WORKER (ID);

  ----------20200611
  -- Create table
create table WMS_COMMON_CODE
(
  id           NUMBER(19) not null,
  code         VARCHAR2(20 CHAR) not null,
  name         VARCHAR2(100 CHAR),
  code_type    VARCHAR2(100 CHAR),
  operator     VARCHAR2(20 CHAR) not null,
  operate_date DATE,
  remark       VARCHAR2(250 CHAR),
  disabled     NUMBER(1)
);
-- Create/Recreate primary, unique and foreign key constraints 
alter table WMS_COMMON_CODE
  add primary key (ID)
  using index ;
alter table WMS_COMMON_CODE
  add unique (CODE, CODE_TYPE)
  using index ;
  ------------20200611
   INSERT INTO ENUMERATE (ID,ENUM_TYPE, ENUM_VALUE) VALUES (1111,'FeeUnit', 'QUANTITY');

  
   
   -- Create table
create table CONTRACT
(
  id                  NUMBER(19) not null,
  wms_balance_id      NUMBER(19),
  warehouse_id        NUMBER(19),
  contract_date_start DATE,
  contract_date_end   DATE,
  operator_date       TIMESTAMP(6),
  check_time          TIMESTAMP(6),
  be_company          NUMBER(1),
  be_contract         NUMBER(1),
  disabled            NUMBER(1),
  description         VARCHAR2(100 CHAR),
  back_des            VARCHAR2(100 CHAR),
  code                VARCHAR2(100 CHAR),
  name                VARCHAR2(100 CHAR),
  operator            VARCHAR2(100 CHAR),
  check_person        VARCHAR2(100 CHAR),
  check_ctime         TIMESTAMP(6),
  check_cperson       VARCHAR2(100 CHAR),
  status              VARCHAR2(100 CHAR),
  contract_type       VARCHAR2(100 CHAR),
  customer_code       VARCHAR2(100 CHAR)
);
-- Create/Recreate primary, unique and foreign key constraints 
alter table CONTRACT
  add primary key (ID)
  using index ;
alter table CONTRACT
  add unique ( WMS_BALANCE_ID, WAREHOUSE_ID, CODE)
  using index ;
alter table CONTRACT
  add constraint FKAA64609448B9E48 foreign key (WMS_BALANCE_ID)
  references STRUCTURE (ID);
alter table CONTRACT
  add constraint FKAA646096919E52F foreign key (WAREHOUSE_ID)
  references WAREHOUSE (ID);

  -- Create sequence 
create sequence SEQ_CONTRACT
minvalue 1
maxvalue 999999999999999999999999999
start with 1500
increment by 1
cache 20;

   
   create sequence wms_commoncode
minvalue 1
maxvalue 999999999999999999999999999
start with 1500
increment by 1
cache 20;
-------------20200612
alter table PICK_TICKET add Pack_Type1 VARCHAR2(50 CHAR);
alter table PICK_TICKET add quantity1 float;
alter table PICK_TICKET add Pack_Type2 VARCHAR2(50 CHAR);
alter table PICK_TICKET add quantity2 float;
alter table PICK_TICKET add Pack_Type3 VARCHAR2(50 CHAR);
alter table PICK_TICKET add quantity3 float;
update PICK_TICKET set quantity1=0 where quantity1 is null;
update PICK_TICKET set quantity2=0 where quantity2 is null;
update PICK_TICKET set quantity3=0 where quantity3 is null;

alter table FEE_Rate add node VARCHAR2(50 CHAR);
alter table FEE_Rate add pack_Type VARCHAR2(50 CHAR);
alter table FEE_Rate add shipment_Method VARCHAR2(50 CHAR);

-- Create table
create table WMS_CONSUMABLES
(
  id            NUMBER(19) not null,
  pack_type     VARCHAR2(120 CHAR),
  task_method   VARCHAR2(100 CHAR),
  quantity      FLOAT,
  volume        FLOAT,
  weight        FLOAT,
  register_date DATE,
  operator      VARCHAR2(50 CHAR),
  operate_date  DATE
);

-- Create sequence 
create sequence SQE_WMS_CONSUMABLES
minvalue 1
maxvalue 9999999999999999999999999999
start with 1000
increment by 1
cache 20;
    