The following defines the structure of the tables and the data required for the basic, intermediate and advanced examples.

1 Load data

The first step is to create new test tables for the different examples with consistent data in your own database.

Copy
-- CREATION TABLE OF ARTICLE MASTER
CREATE TABLE devtest_garticul (
    codigo  char(16)        primary key,
    nomart  varchar(100)    not null
);
ALTER TABLE devtest_garticul LOCK MODE (ROW);
INSERT INTO devtest_garticul VALUES ('1', 'Mechanical keyboards');
INSERT INTO devtest_garticul VALUES ('2', 'Ergonomic mouse');
INSERT INTO devtest_garticul VALUES ('3', 'Panoramic monitors');
-- CREATION TABLE OF WAREHOUSE MASTER
CREATE TABLE devtest_galmacen (
    codigo  char(5)         primary key,
    nomalm  varchar(100)    not null
);
ALTER TABLE devtest_galmacen LOCK MODE (ROW);
INSERT INTO devtest_galmacen VALUES ('D1', 'Central warehouse');
INSERT INTO devtest_galmacen VALUES ('D2', 'Auxiliary warehouse');
-- CREATION TABLE OF LOCATION MASTER
CREATE TABLE devtest_galmubic (
    codigo  char(5)         primary key,
    codalm  char(5)         not null,
    nomubi  varchar(100)    not null
);
ALTER TABLE devtest_galmubic LOCK MODE (ROW);
INSERT INTO devtest_galmubic VALUES ('1', 'D1', 'D1 - 01');
INSERT INTO devtest_galmubic VALUES ('2', 'D1', 'D1 - 02');
INSERT INTO devtest_galmubic VALUES ('3', 'D2', 'D2 - 01');
INSERT INTO devtest_galmubic VALUES ('4', 'D2', 'D2 - 02');
INSERT INTO devtest_galmubic VALUES ('5', 'D1', 'D1 - 03');
-- CREATION TABLE OF STOCK BY LOCATION
CREATE TABLE devtest_galmstku (
    codart  char(16)    not null,
    codubi  char(5)     not null,
    stkact  integer     not null	default 0
);
ALTER TABLE devtest_galmstku LOCK MODE (ROW);
INSERT INTO devtest_galmstku VALUES ('1', '1', 10);
INSERT INTO devtest_galmstku VALUES ('2', '1', 15);
INSERT INTO devtest_galmstku VALUES ('2', '2', 20);
INSERT INTO devtest_galmstku VALUES ('2', '3', 15);
INSERT INTO devtest_galmstku VALUES ('3', '3',  5);
INSERT INTO devtest_galmstku VALUES ('3', '2', 30);
-- CREATION TABLE OF TASKS PER USER
CREATE TABLE devtest_gtasku (
    seqno   serial      primary key,
    coduser char(16)    not null,
    codart  char(16)    not null,
    fecha   date        not null,
    estado  char(1)     not null,
    nomtask char(20)    not null
);
ALTER TABLE devtest_gtasku LOCK MODE (ROW);
INSERT INTO devtest_gtasku VALUES (0, 'USER1', '1', '01-01-2020', 'A', 'Move location');
INSERT INTO devtest_gtasku VALUES (0, 'USER1', '2', '02-01-2020', 'A', 'Move location');
INSERT INTO devtest_gtasku VALUES (0, 'USER2', '3', '01-01-2020', 'A', 'Move location');
-- CREATION TABLE OF MOVEMENT HEADER
CREATE TABLE devtest_galmmovh (
    cabid   integer     primary key,
    fecha   date        not null,
    coduser char(16)    not null,
    codalm  char(5)     not null,
    estado  char(1)     not null
);
ALTER TABLE devtest_galmmovh LOCK MODE (ROW);
INSERT INTO devtest_galmmovh VALUES (1, '01-01-2020', 'USER1', 'D1', 'V');
INSERT INTO devtest_galmmovh VALUES (2, '01-01-2020', 'USER1', 'D2', 'V');
INSERT INTO devtest_galmmovh VALUES (3, '01-01-2020', 'USER2', 'D2', 'P');
-- CREATION TABLE OF MOVEMENT LINE
CREATE TABLE devtest_galmmovl (
    seqno   serial      primary key,
    cabid   integer     not null,
    codart  char(16)    not null,
    codubi  char(5)     not null,
    canmov  integer     not null	default 0,
    estmov  smallint    not null	default 0
);
ALTER TABLE devtest_galmmovl LOCK MODE (ROW);
INSERT INTO devtest_galmmovl VALUES (0, 1, '1', '1',  5, 0);
INSERT INTO devtest_galmmovl VALUES (0, 1, '2', '2', 10, 0);
INSERT INTO devtest_galmmovl VALUES (0, 1, '3', '2',  8, 0);
INSERT INTO devtest_galmmovl VALUES (0, 2, '3', '3',  2, 0);

Important

Following the definition of the Program execution ,the tables of the example must be compiled in the database corresponding to " -dbdata

Remember

If you use the test tables listed here, or other similar ones, do not forget to delete it at the end of the tests.

Copy
-- DROP THE TEST EXISTING TABLES
DROP TABLE IF EXISTS devtest_garticul;
DROP TABLE IF EXISTS devtest_galmacen;
DROP TABLE IF EXISTS devtest_galmubic;
DROP TABLE IF EXISTS devtest_galmstku;
DROP TABLE IF EXISTS devtest_gtasku;
DROP TABLE IF EXISTS devtest_galmmovh;
DROP TABLE IF EXISTS devtest_galmmovl;