ALTER TABLE PEDIDO DROP CONSTRAINT CKC_7545294
/ 
ALTER TABLE PEDIDO ADD CONSTRAINT CKC_7545294  CHECK (IDPRIOPED IN ('0','1','2','3','4'))
/

ALTER TABLE PARAMGERAL ADD HTTPNEOLOG VARCHAR2(200) NULL
/

CREATE TABLE USR_IMPORTA_PEDNEOLOG
(
    CDFILIAL            VARCHAR2(4)            NOT NULL,
    NRPEDIDO            VARCHAR2(10)           NOT NULL,
	DTINCLUSAOPED       DATE                   NULL    ,
    CONSTRAINT PK_IMPORTA PRIMARY KEY (CDFILIAL, NRPEDIDO),
	NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_USR_IMP_PEDNEOLOG CHECK (IDATIVO IN ('S','N')),
    DTINCLUSAO        DATE                  			NULL,
    DTULTATU          DATE                  			NULL,
    NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 		NULL,
    NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERULTATU      VARCHAR2(12)    DEFAULT '1'
)
/

CREATE TABLE USR_PEDNEOLOG
(
    CDFILIAL            VARCHAR2(4)            NOT NULL,
    NRPEDIDO            VARCHAR2(10)           NOT NULL,
    DTPEDIDO            DATE                   NULL    ,
    DTENTPED            DATE                   NULL    ,
    CDFILIALPED        VARCHAR2(04)    NULL    ,
    DSENDEFILI          VARCHAR2(50)           NULL    ,
    SGPAIS              VARCHAR2(5)            NULL    ,
    SGESTADO            VARCHAR2(2)            NULL    ,
    NMMUNICIPIO         VARCHAR2(30)           NULL    ,
    NMBAIRFILI          VARCHAR2(30)           NULL    ,
    NRENDEFILISEP       VARCHAR2(5)            NULL    ,
    DSCOMPENDFIL        VARCHAR2(200)          NULL    ,
    NRCEPFILI           VARCHAR2(15)           NULL    ,
    OBSPEDIDO           VARCHAR2(500)          NULL    ,
    IDPRIOPED           VARCHAR2(1)            NULL    ,
	DTINCLUSAOPED       DATE                   NULL    ,
    DTIMPORTACAO        DATE                   NULL    ,
    DSERRO              VARCHAR2(500)          NULL    ,
    CONSTRAINT PK_PEDNEOLOG PRIMARY KEY (CDFILIAL, NRPEDIDO),
	NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_USR_PEDNEOLOG CHECK (IDATIVO IN ('S','N')),
    DTINCLUSAO        DATE                  			NULL,
    DTULTATU          DATE                  			NULL,
    NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 		NULL,
    NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERULTATU      VARCHAR2(12)    DEFAULT '1'
)
/

CREATE TABLE USR_ITEMPEDNEOLOG
(
    CDFILIAL            VARCHAR2(4)            NOT NULL,
    NRPEDIDO            VARCHAR2(10)           NOT NULL,
    NRITEMPED           VARCHAR2(10)           NOT NULL,
    CDARVPROD           VARCHAR2(20)           NULL    ,
    DSENDEFILI          VARCHAR2(50)           NULL    ,
    SGPAIS              VARCHAR2(5)            NULL    ,
    SGESTADO            VARCHAR2(2)            NULL    ,
    NMMUNICIPIO         VARCHAR2(30)           NULL    ,
    NMBAIRFILI          VARCHAR2(30)           NULL    ,
    NRENDEFILISEP       VARCHAR2(5)            NULL    ,
    DSCOMPENDFIL        VARCHAR2(200)          NULL    ,
    NRCEPFILI           VARCHAR2(15)           NULL    ,
    QTITEMPED           FLOAT                  NULL    ,
    VRPREUNITPED        FLOAT                  NULL    ,
	DTINCLUSAOPED       DATE                   NULL    ,
    DTIMPORTACAO        DATE                   NULL    ,
    DSERRO              VARCHAR2(500)          NULL    ,
    CONSTRAINT PK_ITEMPEDNEOLOG PRIMARY KEY (CDFILIAL, NRPEDIDO, NRITEMPED),
	NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_USR_ITPEDNEOLOG CHECK (IDATIVO IN ('S','N')),
    DTINCLUSAO        DATE                  			NULL,
    DTULTATU          DATE                  			NULL,
    NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 		NULL,
    NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERULTATU      VARCHAR2(12)    DEFAULT '1'
)
/

CREATE TABLE USR_FILIALNEOLOG
(
	CDFILIAL VARCHAR2(4) NOT NULL,
	NMFILIAL VARCHAR(30) NOT NULL,
	DSENDEFILI VARCHAR2(50) NULL ,
	SGPAIS VARCHAR2(5) NULL ,
	SGESTADO VARCHAR2(2) NULL ,
	NMMUNICIPIO VARCHAR2(30) NULL ,
	NMBAIRFILI VARCHAR2(30) NULL ,
	NRENDEFILISEP VARCHAR2(5) NULL ,
	DSCOMPENDFIL VARCHAR2(200) NULL ,
	NRCEPFILI VARCHAR2(15) NULL ,
	DTINCLUSAOPED       DATE NULL,
	DTIMPORTACAO DATE NULL ,
	DSERRO VARCHAR2(500) NULL ,
		CONSTRAINT PK_FILIALNEOLOG PRIMARY KEY (CDFILIAL),
	NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
		CONSTRAINT CKC_IDATIVO_USR_FILIALNEOLOG CHECK (IDATIVO IN ('S','N')),
    DTINCLUSAO        DATE                  			NULL,
    DTULTATU          DATE                  			NULL,
    NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 		NULL,
    NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERULTATU      VARCHAR2(12)    DEFAULT '1'
)
/

CREATE TABLE USR_PRODNEOLOG (
	CDPRODUTO VARCHAR2(10) NOT NULL,
	NMPRODUTO VARCHAR2(50) NULL,
	CDARVPROD VARCHAR2(20) NULL,
	VRALTURA FLOAT(126) NULL,
	VRPROFUNDIDADE FLOAT(126) NULL,
	VRPESO FLOAT(126) NULL,
	VRLARGURA FLOAT(126) NULL,
	CDCATEGORIA VARCHAR2(10) NULL,
	DTINCLUSAOPED  DATE  NULL    ,
	DTIMPORTACAO DATE NULL,
	DSERRO VARCHAR2(500) NULL,
		CONSTRAINT PK_PRONEOLOG PRIMARY KEY ( CDPRODUTO ),
	NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
		CONSTRAINT CKC_IDATIVO_USR_PRODNEOLOG CHECK (IDATIVO IN ('S','N')),
    DTINCLUSAO        DATE                  			NULL,
    DTULTATU          DATE                  			NULL,
    NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 		NULL,
    NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERULTATU      VARCHAR2(12)    DEFAULT '1'
)
/