-- liquibase formatted sql

-- changeset zsh:20240904001
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sys_dict_type' and table_schema = 'hangzhoumes';
CREATE TABLE sys_dict_type
(
    dict_id     INT AUTO_INCREMENT PRIMARY KEY,
    dict_name   VARCHAR(32) NOT NULL,
    dict_type   VARCHAR(32) NOT NULL,
    state       CHAR(1)     NOT NULL DEFAULT TRUE,
    description VARCHAR(32),
    create_time TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP,
    deleted     char(1)              DEFAULT 0
);
-- rollback DROP TABLE sys_dict_type;

-- changeset zsh:20240904002
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sys_dict_data' and table_schema = 'hangzhoumes';
CREATE TABLE sys_dict_data
(
    dict_id         INT AUTO_INCREMENT PRIMARY KEY,
    dict_sort       INT         NOT NULL,
    dict_label      VARCHAR(32) NOT NULL,
    dict_value      VARCHAR(32) NOT NULL,
    dict_type       VARCHAR(32) NOT NULL,
    dict_type_value varchar(32),
    state           CHAR(1)     NOT NULL DEFAULT TRUE,
    description     VARCHAR(32),
    create_time     TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP,
    deleted         char(1)              DEFAULT 0
);
-- rollback DROP TABLE sys_dict_data;


-- changeset zsh:20240904003
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM sys_dict_type WHERE dict_type in ('clearGlass', 'silver', 'doubleSilver', 'thirdSilver', 'ultraClear', 'heatReflect');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('白玻', 'clearGlass', '1', '0', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('单银', 'silver', '1', '1', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('双银', 'doubleSilver', '1', '2', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('三银', 'thirdSilver', '1', '3', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('超白', 'ultraClear', '1', '4', '0');
INSERT INTO sys_dict_type (dict_name, dict_type, state, description, deleted)
VALUES ('热反射', 'heatReflect', '1', '5', '0');
-- rollback DELETE FROM sys_dict_type WHERE dict_type in ('clearGlass', 'silver', 'doubleSilver', 'thirdSilver', 'ultraClear', 'heatReflect');

-- changeset zsh:20240904004
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM sys_dict_data WHERE dict_type in ('白玻', '单银', '双银');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (1, '白玻', 'clearGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (2, '超白', 'ultraClear', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (3, '来料白玻', 'incomingClearGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (4, '欧州茶', 'europeTeaColor', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (5, '水晶灰', 'cristalGrey', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (6, '灰玻', 'grayGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (7, '灰镀膜', 'grayCoating', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (8, '磨砂', 'frosted', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (9, '福特蓝', 'fordBlue', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (10, '福特蓝镀膜', 'fordBlueCoating', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (11, '蓝星灰', 'blueAstralGrey', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (12, '蓝玻', 'blueGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (13, '超白长虹', 'ultraClearChanghong', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (14, '金晶灰', 'jinjinGrey', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (15, '金晶灰茶', 'jinjinTeaGrey', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (16, '镀膜', 'coatingFilm', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (17, '长虹', 'clearGlassChanghong', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (18, '阳光膜', 'solorControl', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (19, '高反底透', 'arGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (20, '高白', 'arClear', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (21, '黑玻', 'blackGlass', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (22, '玉砂', 'emery', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (23, '超白磨砂', 'ultraClearFrosted', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (24, '金茶玻', 'goldenTea', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (25, '蓝灰镀膜', 'blueGraycoatingFilm', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (26, '单项透视', 'onePoint', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (27, '超白镀膜', 'ultraClearCoatingFilm', '白玻', '0', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (1, 'F绿', 'fGreen', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (2, 'F绿lowe', 'fGreenLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (3, 'F绿镀膜', 'fGreenCoating', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (4, 'Low-e', 'lowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (5, 'super52', 'super52', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (6, '中玻在线', 'zgOnlineGlass', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (7, '北玻60离线lowe', 'ng60OfflineLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (8, '南玻在线lowe', 'csgOnlineLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (9, '台玻81A', 'tg81a', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (10, '台玻lowe70', 'tgLowe70', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (11, '台玻LOWE78', 'tgLowe78', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (12, '河北金瑞lowe80', 'hbJinruiLowe80', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (13, '福特蓝lowe', 'fordBlueLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (14, '福莱特FXB60', 'flatFxb60', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (15, '福莱特lowe60', 'flatLowe60', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (16, '福莱特lowe70', 'flatLowe70', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (17, '福莱特lowe80', 'flatLowe80', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (18, '耀皮在线LOWE', 'sypOnlineLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (19, '超白Lowe', 'ultraClearLowe', '单银', '1', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (1, '双银lowe', 'doubleSilverLowe', '双银', '2', '1', '1', '0');
INSERT INTO sys_dict_data(dict_sort, dict_label, dict_value, dict_type, dict_type_value, state, description, deleted)
VALUES (2, '超白双银Lowe', 'ultraDoubleSilverLowe', '双银', '2', '1', '1', '0');
-- rollback DELETE FROM sys_dict_data WHERE dict_type in ('白玻', '单银', '双银');


-- changeset zsh:20240918001
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_details' and table_schema = 'hangzhoumes';
CREATE TABLE raw_glass_storage_details
(
    id                bigint       NOT NULL AUTO_INCREMENT,
    device_id         int          NULL DEFAULT NULL COMMENT '设备id',
    slot              int          NULL DEFAULT NULL COMMENT '格子id',
    pattern_width     double(8, 2) NULL DEFAULT NULL COMMENT '原片宽',
    pattern_height    double(8, 2) NULL DEFAULT NULL COMMENT '原片高',
    pattern_thickness double(8, 2) NULL DEFAULT NULL COMMENT '原片厚度',
    films_id          varchar(64)  NULL DEFAULT NULL COMMENT '膜系',
    create_time       datetime     NOT NULL COMMENT '创建时间',
    remain_quantity   int          NULL DEFAULT NULL COMMENT '剩余数量',
    state             int          NULL DEFAULT NULL COMMENT '状态',
    PRIMARY KEY (id) USING BTREE
);
-- rollback DROP TABLE raw_glass_storage_details;

-- changeset zsh:20240918002
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_station' and table_schema = 'hangzhoumes';
CREATE TABLE raw_glass_storage_station
(
    id           bigint       NOT NULL AUTO_INCREMENT,
    device_id    int          NULL DEFAULT NULL COMMENT '设备id',
    slot         int          NULL DEFAULT NULL COMMENT '栅格号',
    enable_state varchar(255) NULL DEFAULT NULL COMMENT '启用标记',
    PRIMARY KEY (id)
);
-- rollback DROP TABLE raw_glass_storage_station;


-- changeset zsh:20240918003
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_task' and table_schema = 'hangzhoumes';
CREATE TABLE raw_glass_storage_task
(
    id               bigint   NOT NULL AUTO_INCREMENT,
    start_slot       int      NULL DEFAULT NULL COMMENT '起始格子',
    end_slot         int      NULL DEFAULT NULL COMMENT '目标格子',
    pattern_quantity int      NULL DEFAULT NULL COMMENT '原片数量',
    task_type        int      NULL DEFAULT NULL COMMENT '任务类型',
    enable_state     int      NULL DEFAULT NULL COMMENT '任务状态',
    create_time      datetime NULL DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (id) USING BTREE
);
-- rollback DROP TABLE raw_glass_storage_task;


-- changeset zsh:20241015001
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 SELECT count(0) FROM information_schema.columns WHERE table_schema = 'hangzhoumes' AND table_name = 'engineering' AND column_name = 'station_cell';
ALTER TABLE engineering
    ADD COLUMN station_cell varchar(20);

-- changeset zsh:20241017001
-- preconditions onFail:CONTINUE onError:CONTINUE
-- precondition-sql-check expectedResult:0 select count(1) from raw_glass_storage_station;
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (1, 1, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (2, 1, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (3, 1, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (4, 2, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (5, 2, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (6, 2, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (7, 2, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (8, 2, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (9, 2, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (10, 2, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (11, 2, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (12, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (13, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (14, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (15, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (16, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (17, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (18, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (19, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (20, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (21, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (22, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (23, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (24, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (25, 3, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (98, 4, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (99, 4, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (101, 5, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (102, 5, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (103, 6, '1');
INSERT INTO raw_glass_storage_station (slot, device_id, enable_state)
VALUES (104, 6, '1');



