-- liquibase formatted sql

-- changeset zsh:20241107001
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'edg_storage_device_one_task' and table_schema = 'hangzhoumes';
CREATE TABLE edg_storage_device_one_task
(
    task_running int                DEFAULT NULL COMMENT '任务请求 0无任务 1进片 2出片 3直通',
    glass_id_in  varchar(20)        DEFAULT NULL COMMENT '进片玻璃id',
    glass_id_out varchar(20)        DEFAULT NULL COMMENT '出片玻璃id',
    glass_id     varchar(20)        DEFAULT NULL COMMENT '磨边前玻璃id',
    in_place     int                DEFAULT 0 COMMENT '就位信号',
    current_cell int                DEFAULT '0' COMMENT '当前层号',
    start_cell   int                DEFAULT '0' COMMENT '层号',
    end_cell     int                DEFAULT NULL COMMENT '预留层号',
    task_state   int                DEFAULT NULL COMMENT '任务状态 0默认空任务 1执行中 2结束任务',
    task_type    int                DEFAULT NULL COMMENT '任务类型',
    create_time  timestamp NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
);
-- rollback DROP TABLE edg_storage_device_one_task;


-- changeset zsh:20241107002
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM edg_storage_device_one_task;
INSERT INTO edg_storage_device_one_task (task_running, glass_id, in_place, glass_id_in, glass_id_out, current_cell,
                                         start_cell,
                                         end_cell, task_state, task_type)
VALUES (0, NULL, 0, NULL, NULL, 1, 0, NULL, 0, NULL, 0, 0, 0, 0);


-- changeset zsh:20241107003
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'edg_storage_device_two_task' and table_schema = 'hangzhoumes';
CREATE TABLE edg_storage_device_two_task
(
    task_running int                DEFAULT NULL COMMENT '任务请求 0无任务 1进片 2出片 3直通',
    glass_id_in  varchar(20)        DEFAULT NULL COMMENT '进片玻璃id',
    glass_id_out varchar(20)        DEFAULT NULL COMMENT '出片玻璃id',
    glass_id     varchar(20)        DEFAULT NULL COMMENT '磨边前玻璃id',
    in_place     int                DEFAULT 0 COMMENT '就位信号',
    current_cell int                DEFAULT '0' COMMENT '当前层号',
    start_cell   int                DEFAULT '0' COMMENT '层号',
    end_cell     int                DEFAULT NULL COMMENT '预留层号',
    task_state   int                DEFAULT NULL COMMENT '任务状态 0默认空任务 1执行中 2结束任务',
    task_type    int                DEFAULT NULL COMMENT '任务类型',
    create_time  timestamp NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
);
-- rollback DROP TABLE edg_storage_device_two_task;

-- changeset zsh:20241107004
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM edg_storage_device_two_task;
INSERT INTO edg_storage_device_two_task (task_running, glass_id, in_place, glass_id_in, glass_id_out, current_cell,
                                         start_cell,
                                         end_cell, task_state, task_type)
VALUES (0, NULL, 0, NULL, NULL, 1, 0, NULL, 0, NULL, 0, 0, 0, 0);



-- changeset zsh:20241107005
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'edg_storage_device_task_history' and table_schema = 'hangzhoumes';
CREATE TABLE edg_storage_device_task_history
(
    id           bigint    NOT NULL AUTO_INCREMENT COMMENT '工程表id',
    glass_id_in  varchar(20)        DEFAULT NULL COMMENT '进片玻璃id',
    glass_id_out varchar(20)        DEFAULT NULL COMMENT '出片玻璃id',
    glass_id     varchar(20)        DEFAULT NULL COMMENT '磨边前玻璃id',
    in_place     int                DEFAULT 0 COMMENT '就位信号',
    current_cell int                DEFAULT '0' COMMENT '当前层号',
    start_cell   int                DEFAULT '0' COMMENT '层号',
    end_cell     int                DEFAULT NULL COMMENT '预留层号',
    task_state   int                DEFAULT NULL COMMENT '任务状态 0默认空任务 1执行中 2结束任务',
    task_type    int                DEFAULT NULL COMMENT '任务类型',
    create_time  timestamp NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (id) USING BTREE
);
-- rollback DROP TABLE edg_storage_device_task_history;

-- changeset zsh:20241107006
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'edg_glass_task_queue_info' and table_schema = 'hangzhoumes';
CREATE TABLE edg_glass_task_queue_info
(
    glass_id    varchar(20)        DEFAULT NULL COMMENT '磨边前玻璃id',
    width       int                DEFAULT NULL COMMENT '宽',
    height      int                DEFAULT NULL COMMENT '高',
    thickness   int                DEFAULT NULL COMMENT '厚',
    state       int                DEFAULT NULL COMMENT '状态',
    line        int                DEFAULT NULL COMMENT '线路',
    create_time timestamp NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
);
-- rollback DROP TABLE edg_glass_task_queue_info;

-- changeset zsh:20241107007
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'load_glass_device_one_task' and table_schema = 'hangzhoumes';
CREATE TABLE load_glass_device_one_task
(
    task_running     int                DEFAULT '0' COMMENT '任务请求 0无任务 1上片',
    raw_glass_width  int                DEFAULT '0' COMMENT '原片宽',
    raw_glass_height int                DEFAULT '0' COMMENT '原片高',
    slot             int                DEFAULT '0' COMMENT '上片位编号',
    inkage_state     int                DEFAULT '0' COMMENT '联机状态',
    task_state       int                DEFAULT NULL COMMENT '任务状态 0默认空任务 1执行中 2结束任务',
    create_time      timestamp NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time      timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    total_count      int                DEFAULT '0' COMMENT '上片总数量',
    finish_count     int                DEFAULT '0' COMMENT '已完成数量',
    damage_count     int                DEFAULT '0' COMMENT '破损数量'
);
-- rollback DROP TABLE load_glass_device_one_task;

-- changeset zsh:20241107008
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM load_glass_device_one_task;
INSERT INTO load_glass_device_one_task (task_running, raw_glass_width, raw_glass_height, slot, inkage_state, task_state,
                                        total_count, finish_count, damage_count)
VALUES (0, 0, 0, 0, 0, 0, 0, 0, 0);

-- changeset zsh:20241107009
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'load_glass_device_two_task' and table_schema = 'hangzhoumes';
CREATE TABLE load_glass_device_two_task
(
    task_running     int                DEFAULT '0' COMMENT '任务请求 0无任务 1上片',
    raw_glass_width  int                DEFAULT '0' COMMENT '原片宽',
    raw_glass_height int                DEFAULT '0' COMMENT '原片高',
    slot             int                DEFAULT '0' COMMENT '上片位编号',
    inkage_state     int                DEFAULT '0' COMMENT '联机状态',
    task_state       int                DEFAULT NULL COMMENT '任务状态 0默认空任务 1执行中 2结束任务',
    create_time      timestamp NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time      timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    total_count      int                DEFAULT '0' COMMENT '上片总数量',
    finish_count     int                DEFAULT '0' COMMENT '已完成数量',
    damage_count     int                DEFAULT '0' COMMENT '破损数量'
);
-- rollback DROP TABLE load_glass_device_two_task;

-- changeset zsh:20241107010
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM load_glass_device_two_task;
INSERT INTO load_glass_device_two_task (task_running, raw_glass_width, raw_glass_height, slot, inkage_state, task_state,
                                        total_count, finish_count, damage_count)
VALUES (0, 0, 0, 0, 0, 0, 0, 0, 0);


-- changeset zsh:20241107011
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'load_glass_device_task_history' and table_schema = 'hangzhoumes';
CREATE TABLE load_glass_device_task_history
(
    id               bigint    NOT NULL AUTO_INCREMENT COMMENT '历史任务id',
    task_running     int                DEFAULT '0' COMMENT '任务请求 0无任务 1上片',
    raw_glass_width  int                DEFAULT '0' COMMENT '原片宽',
    raw_glass_height int                DEFAULT '0' COMMENT '原片高',
    station          int                DEFAULT '0' COMMENT '上片设备编号',
    slot             int                DEFAULT '0' COMMENT '上片位编号',
    inkage_state     int                DEFAULT '0' COMMENT '联机状态',
    task_state       int                DEFAULT NULL COMMENT '任务状态 0默认空任务 1执行中 2结束任务',
    create_time      timestamp NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time      timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    total_count      int                DEFAULT '0' COMMENT '上片总数量',
    finish_count     int                DEFAULT '0' COMMENT '已完成数量',
    damage_count     int                DEFAULT '0' COMMENT '破损数量',
    PRIMARY KEY (id) USING BTREE
);
-- rollback DROP TABLE load_glass_device_task_history;

-- changeset zsh:20241112001
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_cage_history_task' and table_schema = 'hangzhoumes';
CREATE TABLE big_storage_cage_history_task
(
    id          int       NOT NULL AUTO_INCREMENT,
    glass_id    varchar(32)        DEFAULT NULL COMMENT '玻璃id',
    start_slot  int                DEFAULT '0' COMMENT '起始格子',
    target_slot int                DEFAULT '0' COMMENT '目标格子',
    task_state  int                DEFAULT NULL COMMENT '任务状态 ',
    glass_count int                DEFAULT NULL COMMENT '玻璃数量',
    task_type   int                DEFAULT NULL COMMENT '任务类型',
    create_time timestamp NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (id)
);
-- rollback DROP TABLE big_storage_cage_history_task;

-- changeset zsh:20241112002
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_cage_in_one_task' and table_schema = 'hangzhoumes';
CREATE TABLE big_storage_cage_in_one_task
(
    glass_id    varchar(32) DEFAULT NULL COMMENT '玻璃id',
    start_slot  int         DEFAULT '0' COMMENT '起始格子',
    target_slot int         DEFAULT '0' COMMENT '目标格子',
    task_state  int         DEFAULT NULL COMMENT '任务状态 '
)
-- rollback DROP TABLE big_storage_cage_in_one_task;

-- changeset zsh:20241112003
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM big_storage_cage_in_one_task;
INSERT INTO big_storage_cage_in_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);


-- changeset zsh:20241112004
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_cage_in_two_task' and table_schema = 'hangzhoumes';
CREATE TABLE big_storage_cage_in_two_task
(
    glass_id    VARCHAR(32) COMMENT '玻璃id',
    start_slot  INT DEFAULT '0' COMMENT '起始格子',
    target_slot INT DEFAULT '0' COMMENT '目标格子',
    task_state  INT DEFAULT NULL COMMENT '任务状态 '
);
-- rollback DROP TABLE big_storage_cage_in_two_task;

-- changeset zsh:20241112005
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM big_storage_cage_in_two_task;
INSERT INTO big_storage_cage_in_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_in_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);

-- changeset zsh:20241113001
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_cage_out_one_task' and table_schema = 'hangzhoumes';
CREATE TABLE big_storage_cage_out_one_task
(
    glass_id    varchar(32) DEFAULT NULL COMMENT '玻璃id',
    start_slot  int         DEFAULT '0' COMMENT '起始格子',
    target_slot int         DEFAULT '0' COMMENT '目标格子',
    task_state  int         DEFAULT NULL COMMENT '任务状态 '
)
-- rollback DROP TABLE big_storage_cage_out_one_task;

-- changeset zsh:20241113002
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM big_storage_cage_out_one_task;
INSERT INTO big_storage_cage_out_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_one_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);


-- changeset zsh:20241113003
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_cage_out_two_task' and table_schema = 'hangzhoumes';
CREATE TABLE big_storage_cage_out_two_task
(
    glass_id    VARCHAR(32) COMMENT '玻璃id',
    start_slot  INT DEFAULT '0' COMMENT '起始格子',
    target_slot INT DEFAULT '0' COMMENT '目标格子',
    task_state  INT DEFAULT NULL COMMENT '任务状态 '
);
-- rollback DROP TABLE big_storage_cage_out_two_task;
-- changeset zsh:20241113004
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM big_storage_cage_out_two_task;
INSERT INTO big_storage_cage_out_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
INSERT INTO big_storage_cage_out_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);


-- changeset zsh:20241126001
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_glass_info' and table_schema = 'hangzhoumes';
CREATE TABLE big_storage_glass_info
(
    id                      bigint NOT NULL AUTO_INCREMENT COMMENT '大理片笼信息表id',
    glass_id                varchar(20) DEFAULT NULL COMMENT '玻璃id',
    flow_card_id            varchar(20) DEFAULT NULL COMMENT '流程卡号',
    glass_type              int         DEFAULT NULL COMMENT '玻璃类型',
    width                   double      DEFAULT NULL COMMENT '宽',
    height                  double      DEFAULT NULL COMMENT '高',
    thickness               double      DEFAULT NULL COMMENT '厚度',
    tempering_layout_id     int         DEFAULT NULL COMMENT '钢化版图id',
    tempering_feed_sequence int         DEFAULT NULL COMMENT '钢化版图片序',
    x_coordinate            int         DEFAULT NULL COMMENT 'x坐标',
    y_coordinate            int         DEFAULT NULL COMMENT 'y坐标',
    engineer_id             varchar(50) DEFAULT NULL,
    layer                   int         DEFAULT NULL COMMENT '层号',
    virtual_slot            int         DEFAULT NULL COMMENT '虚拟格子号',
    slot_sequence           int         DEFAULT NULL COMMENT '格子次序',
    PRIMARY KEY (id) USING BTREE
);
-- rollback DROP TABLE big_storage_glass_info;

-- changeset zsh:20241126002
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_glass_relation_info' and table_schema = 'hangzhoumes';
CREATE TABLE big_storage_glass_relation_info
(
    id                      bigint NOT NULL AUTO_INCREMENT COMMENT '钢化玻璃关系表id',
    engineer_id             varchar(50) DEFAULT NULL,
    glass_id                varchar(20) DEFAULT NULL COMMENT '玻璃id',
    tempering_layout_id     int         DEFAULT NULL COMMENT '钢化版图id',
    tempering_feed_sequence int         DEFAULT NULL COMMENT '钢化版图片序',
    virtual_slot            int         DEFAULT NULL COMMENT '虚拟格子',
    slot_sequence           int         DEFAULT NULL COMMENT '格子内次序',
    slot                    int         DEFAULT NULL COMMENT '实际格子号',
    device_id               int         DEFAULT NULL COMMENT '实际笼子号',
    PRIMARY KEY (id) USING BTREE
);
-- rollback DROP TABLE big_storage_glass_relation_info;

