drop table if exists gmms_task;
drop table if exists gmms_user;

create table gmms_task (
	id bigint auto_increment,
	title varchar(128) not null,
	description varchar(255),
	user_id bigint not null,
    primary key (id)
) engine=InnoDB;

create table gmms_user (
	id bigint auto_increment,
	login_name varchar(64) not null unique,
	name varchar(64) not null,
	password varchar(255) not null,
	salt varchar(64) not null,
	roles varchar(255) not null,
	groups varchar(255) not null,
	register_date timestamp not null default 0,
	primary key (id)
) engine=InnoDB;

insert into gmms_task (id, title, description, user_id) values(1, 'Study PlayFramework 2.0','http://www.playframework.org/', 2);
insert into gmms_task (id, title, description, user_id) values(2, 'Study Grails 2.0','http://www.grails.org/', 2);
insert into gmms_task (id, title, description, user_id) values(3, 'Try SpringFuse','http://www.springfuse.com/', 2);
insert into gmms_task (id, title, description, user_id) values(4, 'Try Spring Roo','http://www.springsource.org/spring-roo', 2);
insert into gmms_task (id, title, description, user_id) values(5, 'Release SpringSide 4.0','As soon as posibble.', 2);

insert into gmms_user (id, login_name, name, password, salt, roles, groups, register_date) values(1,'admin','admin','691b14d79bf0fa2215f155235df5e670b64394cc','7efbd59d9741d34f','admin','1','2012-06-04 01:00:00');
insert into gmms_user (id, login_name, name, password, salt, roles, groups, register_date) values(2,'cangchu','cangchu','0b758ab9fb7b358b93961ab047224fda16a8bf6a','d04571a0f1ca1a30','cangchu','1','2012-06-04 02:00:00');
insert into gmms_user (id, login_name, name, password, salt, roles, groups, register_date) values(3,'qiege','qiege','1f6ca85a796572b9d236e0487521c870a7a60be1','fc961ed3a7d9da04','qiege','1','2012-06-04 02:00:00');
insert into gmms_user (id, login_name, name, password, salt, roles, groups, register_date) values(4,'qiege2','qiege2','1f6ca85a796572b9d236e0487521c870a7a60be1','fc961ed3a7d9da04','qiege2','2','2012-06-04 02:00:00');
insert into gmms_user (id, login_name, name, password, salt, roles, groups, register_date) values(5,'hmi','hmi','cdb74c7e0af74d02b1d8ddb31748f490f325bbad','56c1988f1539be86','hmi','1','2012-11-19 02:00:00');
insert into gmms_user (id, login_name, name, password, salt, roles, groups, register_date) values(7,'xiapian','xiapian','[REDACTED]','ec1f393b29ae0179','xiapian','1','2012-06-04 02:00:00');
insert into gmms_user (id, login_name, name, password, salt, roles, groups, register_date) values(10,'xiapian2','xiapian2','aa85bd5a296f54105a1180197d400cc0203bcda7','ec1f393b29ae0179','xiapian','2','2012-06-04 02:00:00');
create table gmms_raw_package_txt (
    id bigint auto_increment,
    txt_name varchar(50),
    groups varchar(50),
    status varchar(50),
    operator varchar(50),
    create_time timestamp,
    primary key (id)
)engine=InnoDB;

create table gmms_prod_line_state (
    id bigint auto_increment,
    line int,
    state boolean,
    standalonestate boolean,
    primary key (id)
)engine=InnoDB;

insert into gmms_prod_line_state (id, line, state,standalonestate) values(1, 1, false,false);
insert into gmms_prod_line_state (id, line, state,standalonestate) values(2, 2, false,false);

create table gmms_break_report (
    id bigint auto_increment,
    opt_batch varchar(50),
    glass_id varchar(50),
    width double,
    height double,
    thickness double,
    color varchar(50),
    loadmachine_number varchar(5),
    break_time timestamp,
    primary key (id)
)engine=InnoDB;

create table gmms_gaoliwei_machine(
	id bigint auto_increment,
	number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    port int,
	primary key (id)
)engine=InnoDB;

create table gmms_grind_edge_machine_two (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    port int,
    proximity_switch varchar(50),
    allow_control varchar(50),
    glass_info varchar(50),
    primary key (id)
)engine=InnoDB;

create table gmms_cut_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    picture_url varchar(255),
    port integer,
    primary key (id)
)engine=InnoDB;

create table gmms_cut_machine_message (
    id bigint auto_increment,
    cut_machine_id bigint,
    reada boolean,
    message_type varchar(50),
    client_address varchar(255),
    client_port varchar(10),
    content varchar(5000),
    send_time timestamp,
    receive_time timestamp,
    primary key (id),
    foreign key (cut_machine_id) references gmms_cut_machine(id)ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_glass_number_color (
    id bigint auto_increment,
    glass_id varchar(50),
    flag varchar(50),
    primary key (id)
);

create table gmms_glass_commer (
    id bigint auto_increment,
    name varchar(50),
    primary key (id)
);

create table gmms_shelf (
    id bigint auto_increment,
    number varchar(50),
    port integer,
    state varchar(50),
    connect_state varchar(50),
    primary key (id)
)engine=InnoDB;

create table gmms_raw_package (
    id bigint auto_increment,
    glass_id varchar(50),
    pieces int,
    state varchar(50),
    width double,
    height double,
    thickness double,
    color varchar(50),
    left_pieces int,
    manufacturer varchar(255),
    comment varchar(255),
    create_time timestamp,
    flag varchar(255),
    raw_package_txt_id bigint,
    primary key (id),
    foreign key (raw_package_txt_id) references gmms_raw_package_txt(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_rank (
    id bigint auto_increment,
    glass_id varchar(50),
    pieces int,
    flag varchar(255),
    width double,
    height double,
    thickness double,
    color varchar(50),
    manufacturer varchar(255),
    createtime timestamp,
    endtime timestamp,
    flag varchar(255),
    shelf_rank_id bigint,
    primary key (id),
    foreign key (shelf_rank_id) references gmms_shelf_rank(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_shelf_rank (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    usestatu varchar(50),
    raw_package_id bigint,
    lastest_time timestamp,
    glass_id  varchar(50),
    pieces varchar(50),
    width double,
    length double,
    thickness double,
    color varchar(50),
    precent varchar(50),
    create_time timestamp,
    complete_pieces int,
    flag varchar(255),
    primary key (id),
    foreign key (raw_package_id) references gmms_raw_package(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_shelf_hoist (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    raw_package_id bigint,
    primary key (id),
    foreign key (raw_package_id) references gmms_raw_package(id)
)engine=InnoDB;

create table gmms_load_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    port integer,
    message varchar(255),
    opt_name varchar(255),
    cut_machine_id bigint,
    primary key (id),
    foreign key (cut_machine_id) references gmms_cut_machine(id) ON UPDATE CASCADE
)engine=InnoDB;


create table gmms_load_machine_rack (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    message varchar(255),
    raw_package_id bigint,
    load_machine_id bigint,
    raw_package_ready varchar(50),
    primary key (id),
    foreign key (raw_package_id) references gmms_raw_package(id) ON UPDATE CASCADE,
    foreign key (load_machine_id) references gmms_load_machine(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_grind_face_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    port integer,
    allow_control_one varchar(50),
    fault_one varchar(50),
    allow_control_two varchar(50),
    fault_two varchar(50),
    primary key (id)
)engine=InnoDB;

create table gmms_grind_edge_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    port integer,
    proximity_switch varchar(50),
    allow_control varchar(50),
    glass_info varchar(50),
    primary key (id)
)engine=InnoDB;

create table gmms_wash_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    picture_url varchar(255),
    port integer,
    primary key (id)
)engine=InnoDB;

create table gmms_film_remove_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    picture_url varchar(255),
    port integer,
    primary key (id)
)engine=InnoDB;

create table gmms_count_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    port integer,
    primary key (id)
)engine=InnoDB;

create table gmms_measure_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    picture_url varchar(255),
    port integer,
    primary key (id)
)engine=InnoDB;

create table gmms_shelf_message (
    id bigint auto_increment,
    shelf_id bigint,
    reada boolean,
    message_type varchar(50),
    client_address varchar(255),
    client_port varchar(10),
    content varchar(5000),
    send_time timestamp,
    receive_time timestamp,
    primary key (id),
    foreign key (shelf_id) references gmms_shelf(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_manufacture_batch (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    create_time timestamp,
    start_time timestamp,
    complete_time timestamp,
    primary key (id)
)engine=InnoDB;

create table gmms_manufacture_batch_machine (
    id bigint auto_increment,
    machine_type varchar(100),
    machine_id bigint,
    manufacture_batch_id bigint,
    primary key (id),
    foreign key (manufacture_batch_id) references gmms_manufacture_batch(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_glass (
    id bigint auto_increment,
    glass_id int,
    length double,
    width double,
    thickness double,
    color varchar(25),
    customer varchar(255),
    state varchar(50),
    groups varchar(50),
    apart_id varchar(50),
    manufacture_batch varchar(255),
    pieces int,
    complete_pieces int,
    damage_pieces int,
    arrange_pieces int,
    arrange_statu varchar(50),
    raw_package_txt_id bigint,
    application varchar(50),
    production varchar(50),
    floor_number varchar(50),
    order_number varchar(50),
    piece_sign varchar(50),
    remark varchar(50),
    thingsout varchar(50),
    send_state varchar(50),
    send_states varchar(50),
    flag int,
    primary key (id),
    foreign key (raw_package_txt_id) references gmms_raw_package_txt(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_print_machine (
    id bigint auto_increment,
    pattern varchar(255),
    name varchar(255),
    statu varchar(255),
    line varchar(255),
    primary key (id)
)engine=InnoDB;

create table gmms_card_number(
	id bigint auto_increment,
    number varchar(50),
	state varchar(50),
    primary key (id)
)engine=InnoDB;

create table gmms_opt_pattern (
    id bigint auto_increment,
    opt_id varchar(50),
    glass_id varchar(50),
    glass_description varchar(255),
    glass_thickness double,
    pieces int,
    completed_pieces int,
    width double,
    height double,
    state varchar(50),
    color varchar(50),
    content varchar(10000),
    batch varchar(255),
    groups varchar(255),
    raw_package_txt_id bigint,
    primary key (id),
    foreign key (raw_package_txt_id) references gmms_raw_package_txt(id) ON UPDATE CASCADE
)engine=InnoDB;


create table gmms_singal_glass (
    id bigint auto_increment,
    glass_id int,
    length double,
    width double,
    thickness double,
    color varchar(25),
    customer varchar(255),
    state varchar(50),
    groups varchar(50),
    apart_id varchar(50),
    manufacture_batch varchar(255),
    pieces int,
    complete_pieces int,
    arrange_pieces int,
    arrange_statu varchar(50),
    manufacture_batch_id bigint,
    opt_pattern_id bigint,
    application varchar(50),
    production varchar(50),
    floor_number varchar(50),
    order_number varchar(50),
    piece_sign varchar(50),
    remark varchar(50),
    primary key (id),
    foreign key (opt_pattern_id) references gmms_opt_pattern(id) ON UPDATE CASCADE,
    foreign key (manufacture_batch_id) references gmms_manufacture_batch(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_report_task (
    id bigint auto_increment,
    opt_name varchar(50),
    piece int,
    complete_piece int,
    state varchar(50),
    start_time timestamp,
    complete_time timestamp,
    reson varchar(255),
    area double,
    load_machine_id bigint,
    opt_pattern_id bigint,
    primary key (id),
    foreign key (load_machine_id) references gmms_load_machine(id) ON UPDATE CASCADE,
    foreign key (opt_pattern_id) references gmms_opt_pattern(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_report_task_load (
    id bigint auto_increment,
    opt_name varchar(50),
    piece int,
    complete_piece int,
    state varchar(50),
    start_time timestamp,
    complete_time timestamp,
    reson varchar(255),
    area double,
    load_machine_id bigint,
    opt_pattern_id bigint,
    primary key (id),
    foreign key (load_machine_id) references gmms_load_machine(id) ON UPDATE CASCADE,
    foreign key (opt_pattern_id) references gmms_opt_pattern(id) ON UPDATE CASCADE
)engine=InnoDB;


create table gmms_load_machine_task (
    id bigint auto_increment,
    state varchar(50),
    description varchar(255),
    create_time timestamp,
    start_time timestamp,
    complete_time timestamp,
    load_machine_id bigint,
    load_machine_rack_id bigint,
    raw_package_id bigint,
    opt_pattern_id bigint,
    primary key (id),
    foreign key (raw_package_id) references gmms_raw_package(id) ON UPDATE CASCADE,
    foreign key (opt_pattern_id) references gmms_opt_pattern(id) ON UPDATE CASCADE,
    foreign key (load_machine_id) references gmms_load_machine(id) ON UPDATE CASCADE,
    foreign key (load_machine_rack_id) references gmms_load_machine_rack(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_count_machine_task (
    id bigint auto_increment,
    state varchar(50),
    description varchar(255),
    create_time timestamp,
    start_time timestamp,
    complete_time timestamp,
    length double,
    width double,
    apart varchar(50),
    count_machine_id bigint,
    glass_id bigint,
    gmms_raw_package_txt_id bigint,
    primary key (id),
    foreign key (glass_id) references gmms_glass(id) ON UPDATE CASCADE,
    foreign key (count_machine_id) references gmms_count_machine(id) ON UPDATE CASCADE,
    foreign key (gmms_raw_package_txt_id) references gmms_raw_package_txt(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_shelf_task (
    id bigint auto_increment,
    state varchar(50),
    task_type varchar(255),
    message varchar(255),
    flag varchar(255),
    shelf_hoist_id bigint,
    shelf_rank_id bigint,
    load_machine_rack_id bigint,
    create_time timestamp,
    start_time timestamp,
    complete_time timestamp,
    primary key (id),
    foreign key (shelf_hoist_id) references gmms_shelf_hoist(id) ON UPDATE CASCADE,
    foreign key (shelf_rank_id) references gmms_shelf_rank(id) ON UPDATE CASCADE,
    foreign key (load_machine_rack_id) references gmms_load_machine_rack(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_cut_machine_task (
    id bigint auto_increment,
    state varchar(50),
    message varchar(255),
    cut_machine_id bigint,
    load_machine_id bigint,
    opt_pattern_id bigint,
    create_time timestamp,
    start_time timestamp,
    complete_time timestamp,
    primary key (id),
     foreign key (opt_pattern_id) references gmms_opt_pattern(id) ON UPDATE CASCADE,
    foreign key (load_machine_id) references gmms_load_machine(id) ON UPDATE CASCADE,
    foreign key (cut_machine_id) references gmms_cut_machine(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_toughening_glass (
    id bigint auto_increment,
    actual_length double,
    actual_width double,
    state varchar(50),
    glass_id bigint,
    manufacture_batch_id bigint,
    measure_machine_id bigint,
    primary key (id),
    foreign key (manufacture_batch_id) references gmms_manufacture_batch(id) ON UPDATE CASCADE,
    foreign key (glass_id) references gmms_glass(id) ON UPDATE CASCADE,
    foreign key (measure_machine_id) references gmms_measure_machine(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_identify_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    port integer,
    initialized boolean,
    ceiling integer,
    floor integer,
    primary key (id)
)engine=InnoDB;

create table gmms_manufacture_sequence (
    id bigint auto_increment,
    manufacture_date varchar(50),
    max_sequence int,
    primary key (id)
)engine=InnoDB;

create table gmms_preprocessing_glass (
    id bigint auto_increment,
    actual_length double,
    actual_width double,
    state varchar(50),
    glass_id bigint,
    gmms_raw_package_txt_id bigint,
    identify_machine_id bigint,
    primary key (id),
    foreign key (gmms_raw_package_txt_id) references gmms_raw_package_txt(id) ON UPDATE CASCADE,
    foreign key (glass_id) references gmms_glass(id) ON UPDATE CASCADE,
    foreign key (identify_machine_id) references gmms_identify_machine(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_grind_edge_machine_task (
    id bigint auto_increment,
    state varchar(50),
    description varchar(255),
    glass_id bigint,
    manufacture_batch_id bigint,
    grind_edge_machine_id bigint,
    create_time timestamp,
    start_time timestamp,
    complete_time timestamp,
    primary key (id),
    foreign key (manufacture_batch_id) references gmms_manufacture_batch(id) ON UPDATE CASCADE,
    foreign key (grind_edge_machine_id) references gmms_grind_edge_machine(id) ON UPDATE CASCADE,
    foreign key (glass_id) references gmms_glass(id) ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_identify_pattern (
    id bigint auto_increment,
    pattern varchar(255),
    line varchar(255),
    thinckness int,
    primary key (id)
)engine=InnoDB;

create table gmms_identify_floor (
    id bigint auto_increment,
    ceiling integer,
    floor integer,
    primary key (id)
)engine=InnoDB;

create table gmms_arrange_machine_rank (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    toughening_glass_id bigint,
    primary key (id),
    foreign key (toughening_glass_id) references gmms_toughening_glass(id)ON UPDATE CASCADE
)engine=InnoDB;


create table gmms_arrange_machine (
    id bigint auto_increment,
    number varchar(50),
    state varchar(50),
    connect_state varchar(50),
    picture_url varchar(255),
    port integer,
    primary key (id)
)engine=InnoDB;

create table gmms_arrange_machine_task (
    id bigint auto_increment,
    state varchar(50),
    goals varchar(50),
    description varchar(255),
    create_time timestamp,
    start_time timestamp,
    complete_time timestamp,
    task_type varchar(50),
    toughening_glass_id bigint,
    measure_machine_id bigint,
    arrange_machine_rank_id bigint,
    primary key (id),
    foreign key (toughening_glass_id) references gmms_toughening_glass(id)ON UPDATE CASCADE,
    foreign key (measure_machine_id) references gmms_measure_machine(id)ON UPDATE CASCADE,
    foreign key (arrange_machine_rank_id) references gmms_arrange_machine_rank(id)ON UPDATE CASCADE
)engine=InnoDB;

create table gmms_arrange_machine_statu(
	id bigint auto_increment,
    state varchar(50),
    primary key (id)
)engine=InnoDB;

create table gmms_toughening_group (
    id bigint auto_increment,
    number varchar(50),
    primary key (id)
)engine=InnoDB;

create table gmms_with_pieces_statu(
	id bigint auto_increment,
    state varchar(50),
    primary key (id)
)engine=InnoDB;

create table gmms_test_out (
    id bigint auto_increment,
    start_time timestamp,
    end_time timestamp,
    name varchar(50),
    primary key (id)
)engine=InnoDB;

insert into gmms_identify_floor (id, ceiling, floor) values (1, 2, 2);
insert into gmms_identify_floor (id, ceiling, floor) values (2, 2, 2);
insert into gmms_with_pieces_statu (id, state) values (1, 'waiting');
insert into gmms_identify_pattern(id, pattern, thinckness) values(1,'old',5);
insert into gmms_identify_pattern(id, pattern, thinckness) values(2,'old',5);

insert into gmms_shelf (id, number, port) values (1, '01', 8110);
insert into gmms_cut_machine (id, number, port) values (1, '01', 3000);
insert into gmms_cut_machine (id, number, port) values (2, '02', 3001);
insert into gmms_load_machine (id, number, port, cut_machine_id) values (1, '01', 8120, 1);
insert into gmms_gaoliwei_machine (id, number, port) values (1, '01', 8130);
insert into gmms_gaoliwei_machine (id, number, port) values (2, '02', 8131);
insert into gmms_count_machine (id, number, port) values (1, '01', 8150);
insert into gmms_count_machine (id, number, port) values (2, '02', 8151);


insert into gmms_shelf_rank (id, number, state) values (1, '01', '空闲');
insert into gmms_shelf_rank (id, number, state) values (2, '02', '空闲');
insert into gmms_shelf_rank (id, number, state) values (3, '03', '空闲');
insert into gmms_shelf_rank (id, number, state) values (4, '04', '空闲');
insert into gmms_shelf_rank (id, number, state) values (5, '05', '空闲');
insert into gmms_shelf_rank (id, number, state) values (6, '06', '空闲');
insert into gmms_shelf_rank (id, number, state) values (7, '07', '空闲');
insert into gmms_shelf_rank (id, number, state) values (8, '08', '空闲');
insert into gmms_shelf_rank (id, number, state) values (9, '09', '空闲');
insert into gmms_shelf_rank (id, number, state) values (10, '10', '空闲');
insert into gmms_shelf_rank (id, number, state) values (11, '11', '空闲');
insert into gmms_shelf_rank (id, number, state) values (12, '12', '空闲');
insert into gmms_shelf_rank (id, number, state) values (13, '13', '空闲');
insert into gmms_shelf_rank (id, number, state) values (14, '14', '空闲');
insert into gmms_shelf_rank (id, number, state) values (15, '15', '空闲');
insert into gmms_shelf_rank (id, number, state) values (16, '16', '空闲');
insert into gmms_shelf_rank (id, number, state) values (17, '17', '空闲');
insert into gmms_shelf_rank (id, number, state) values (18, '18', '空闲');
insert into gmms_shelf_rank (id, number, state) values (19, '19', '空闲');
insert into gmms_shelf_rank (id, number, state) values (51, '51', '空闲');
insert into gmms_shelf_rank (id, number, state) values (52, '52', '空闲');
insert into gmms_shelf_rank (id, number, state) values (53, '53', '空闲');
insert into gmms_shelf_rank (id, number, state) values (54, '54', '空闲');
insert into gmms_shelf_rank (id, number, state) values (55, '55', '空闲');
insert into gmms_shelf_rank (id, number, state) values (56, '56', '空闲');
insert into gmms_shelf_rank (id, number, state) values (57, '57', '空闲');
insert into gmms_shelf_rank (id, number, state) values (58, '58', '空闲');
insert into gmms_shelf_rank (id, number, state) values (59, '59', '空闲');
insert into gmms_shelf_rank (id, number, state) values (60, '60', '空闲');
insert into gmms_shelf_rank (id, number, state) values (61, '61', '空闲');
insert into gmms_shelf_rank (id, number, state) values (62, '62', '空闲');
insert into gmms_shelf_rank (id, number, state) values (63, '63', '空闲');

insert into gmms_shelf_hoist (id, number,state ) values (1, '99','空闲');

insert into gmms_load_machine_rack (id, number, state, load_machine_id) values (1, '101', '空闲', 1);
insert into gmms_load_machine_rack (id, number, state, load_machine_id) values (2, '102', '空闲', 1);

insert into gmms_arrange_machine_rank (id, number) values (1, '01');
insert into gmms_arrange_machine_rank (id, number) values (2, '02');
insert into gmms_arrange_machine_rank (id, number) values (3, '03');
insert into gmms_arrange_machine_rank (id, number) values (4, '04');
insert into gmms_arrange_machine_rank (id, number) values (5, '05');
insert into gmms_arrange_machine_rank (id, number) values (6, '06');
insert into gmms_arrange_machine_rank (id, number) values (7, '07');
insert into gmms_arrange_machine_rank (id, number) values (8, '08');
insert into gmms_arrange_machine_rank (id, number) values (9, '09');
insert into gmms_arrange_machine_rank (id, number) values (10, '10');
insert into gmms_arrange_machine_rank (id, number) values (11, '11');
insert into gmms_arrange_machine_rank (id, number) values (12, '12');
insert into gmms_arrange_machine_rank (id, number) values (13, '13');
insert into gmms_arrange_machine_rank (id, number) values (14, '14');
insert into gmms_arrange_machine_rank (id, number) values (15, '15');
insert into gmms_arrange_machine_rank (id, number) values (16, '16');
insert into gmms_arrange_machine_rank (id, number) values (17, '17');
insert into gmms_arrange_machine_rank (id, number) values (18, '18');
insert into gmms_arrange_machine_rank (id, number) values (19, '19');
insert into gmms_arrange_machine_rank (id, number) values (20, '20');
insert into gmms_arrange_machine_rank (id, number) values (21, '21');
insert into gmms_arrange_machine_rank (id, number) values (22, '22');
insert into gmms_arrange_machine_rank (id, number) values (23, '23');
insert into gmms_arrange_machine_rank (id, number) values (24, '24');
insert into gmms_arrange_machine_rank (id, number) values (25, '25');
insert into gmms_arrange_machine_rank (id, number) values (26, '26');
insert into gmms_arrange_machine_rank (id, number) values (27, '27');
insert into gmms_arrange_machine_rank (id, number) values (28, '28');
insert into gmms_arrange_machine_rank (id, number) values (29, '29');
insert into gmms_arrange_machine_rank (id, number) values (30, '30');
insert into gmms_arrange_machine_rank (id, number) values (31, '31');
insert into gmms_arrange_machine_rank (id, number) values (32, '32');
insert into gmms_arrange_machine_rank (id, number) values (33, '33');
insert into gmms_arrange_machine_rank (id, number) values (34, '34');
insert into gmms_arrange_machine_rank (id, number) values (35, '35');
insert into gmms_arrange_machine_rank (id, number) values (36, '36');
insert into gmms_arrange_machine_rank (id, number) values (37, '37');
insert into gmms_arrange_machine_rank (id, number) values (38, '38');
insert into gmms_arrange_machine_rank (id, number) values (39, '39');
insert into gmms_arrange_machine_rank (id, number) values (40, '40');

insert into gmms_glass_number_color (id, glass_id, flag) values (1, 'white','0');
insert into gmms_glass_number_color (id, glass_id, flag) values (2, 'low_e','0');

create table gmms_shelf_statu (
	id bigint auto_increment,
	autostate varchar(50),
	errorstate varchar(50),
	plcid varchar(50),
	mesid varchar(50),
	statuid varchar(50),
	set_time timestamp,
    primary key (id)
) engine=InnoDB;
insert into gmms_shelf_statu (id, autostate, errorstate, plcid, mesid, statuid) values (1,'手动状态','0','0','0','0');

create table gmms_load_statu (
	id bigint auto_increment,
	autostate varchar(50),
	errorstate varchar(50),
	loadfinish varchar(50),
	plcid varchar(50),
	mesid varchar(50),
	statuid varchar(50),
	set_time timestamp,
    primary key (id)
) engine=InnoDB;
insert into gmms_load_statu (id, autostate, errorstate, loadfinish, plcid, mesid, statuid) values (1,'手动状态','0','0','0','0','0');


create table gmms_gaoliwei_statu (
	id bigint auto_increment,
	messagetype varchar(50),
	glassid varchar(50),
	plcid varchar(50),
	mesid varchar(50),
	set_time timestamp,
    primary key (id)
) engine=InnoDB;
insert into gmms_gaoliwei_statu (id, messagetype, plcid, mesid) values (1,'0000','0','0');
insert into gmms_gaoliwei_statu (id, messagetype, plcid, mesid) values (2,'0000','0','0');

create table gmms_print_name (
	id bigint auto_increment,
	printname varchar(255),
	primary key (id)
)engine=InnoDB;
insert into gmms_print_name (id, printname) values (1,'ZDesigner GK888t (EPL)one');
insert into gmms_print_name (id, printname) values (2,'ZDesigner GK888t (EPL)two');


create table gmms_print_size (
	id bigint auto_increment,
	apartidsize integer,
	apartidw integer,
	apartidh integer,
	customersize integer,
	customerw integer,
	customerh integer,
	productionsize integer,
	productionw integer,
	productionh integer,
	lengthStrsize integer,
	lengthStrw integer,
	lengthStrh integer,
	applicationsize integer,
	applicationw integer,
	applicationh integer,
	width integer,
	length integer,
    primary key (id)
) engine=InnoDB;

--固定料架--
create table gmms_load_machine_fix_rack (
    id bigint auto_increment,
    glass_id varchar(50),
    pieces int,
    state varchar(50),
    number varchar(50),
    width double,
    height double,
    thickness double,
    color varchar(50),
    left_pieces int,
    create_time timestamp,
    primary key (id)
)engine=InnoDB;

create table gmms_dummy_fix_rack (
    id bigint auto_increment,
    glass_id varchar(50),
    pieces int,
    state varchar(50),
    number varchar(50),
    width double,
    height double,
    thickness double,
    color varchar(50),
    left_pieces int,
    create_time timestamp,
    primary key (id)
)engine=InnoDB;

insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(1,'空闲','01',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(2,'空闲','02',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(3,'空闲','03',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(4,'空闲','04',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(5,'空闲','05',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(6,'空闲','06',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(7,'空闲','07',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(8,'空闲','08',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(9,'空闲','09',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(10,'空闲','10',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(11,'空闲','11',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(12,'空闲','12',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(13,'空闲','13',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(14,'空闲','14',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(15,'空闲','15',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(16,'空闲','16',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(17,'空闲','17',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(18,'空闲','18',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(19,'空闲','19',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(20,'空闲','20',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(21,'空闲','21',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(22,'空闲','22',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(23,'空闲','23',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(24,'空闲','24',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(25,'空闲','25',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(26,'空闲','26',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(27,'空闲','27',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(28,'空闲','28',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(29,'空闲','29',0,0,0,0,0,'2019-03-18 11:17:03');
insert into gmms_dummy_fix_rack (id ,state ,number,width,height,thickness,pieces,left_pieces,create_time)values(30,'空闲','30',0,0,0,0,0,'2019-03-18 11:17:03');


create table gmms_label(
	id bigint auto_increment,
  fieldname VARCHAR(50),
	xlength int ,
  ylength int,
  size int,
    primary key (id)
) engine=InnoDB;


create table gmms_error (
	id bigint auto_increment,
	machinestatu varchar(128) not null,
	description varchar(255),
	message varchar(255),
	set_time timestamp,
    primary key (id)
) engine=InnoDB;

