-- 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',
    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 '更新时间',
    width        int                DEFAULT NULL COMMENT '宽',
    height       int                DEFAULT NULL COMMENT '高',
    thickness    int                DEFAULT NULL COMMENT '厚',
    film_remove  int                DEFAULT NULL 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, glass_id_in, glass_id_out, current_cell, start_cell,
                                         end_cell, task_state, task_type, width, height, thickness, film_remove)
VALUES (0, NULL, 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',
    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 '更新时间',
    width        int                DEFAULT NULL COMMENT '宽',
    height       int                DEFAULT NULL COMMENT '高',
    thickness    int                DEFAULT NULL COMMENT '厚',
    film_remove  int                DEFAULT NULL 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, glass_id_in, glass_id_out, current_cell, start_cell,
                                         end_cell, task_state, task_type, width, height, thickness, film_remove)
VALUES (0, NULL, 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',
    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 '上片位编号',
    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, task_state, total_count,
                                        finish_count, damage_count)
VALUES (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 '上片位编号',
    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, task_state, total_count,
                                        finish_count, damage_count)
VALUES (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 '上片位编号',
    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;