create table adjustcruc
(
    mesmoname varchar(255) not null
        primary key,
    crucible  varchar(255) null
);

create table allfeedingdetail
(
    feeding_task_id   bigint         null,
    mesmoname         varchar(255)   null,
    area              varchar(255)   null,
    area1             varchar(255)   null,
    eqpmodel          varchar(255)   null,
    eqpid             varchar(255)   null,
    moprodname        varchar(255)   null,
    moproddesc        varchar(255)   null,
    feeding_task_code varchar(255)   null,
    stovetype         varchar(255)   null,
    stovetypedesc     varchar(255)   null,
    rx                int            null,
    finishmark        varchar(255)   null,
    finishmarkdesc    varchar(255)   null,
    crucprodname      varchar(255)   null,
    crucproddesc      varchar(255)   null,
    cruciblesn        varchar(255)   null,
    prodname          varchar(255)   null,
    proddesc          varchar(255)   null,
    material_type     varchar(255)   null,
    material_type1    varchar(255)   null,
    level             varchar(255)   null,
    serial_no         varchar(255)   null,
    weight            decimal(10, 2) null,
    stovetime         datetime       null,
    mfgdate           datetime       null,
    month             varchar(255)   null,
    factory           varchar(255)   null,
    cate1             varchar(255)   null,
    cate2             varchar(255)   null,
    cate3             varchar(255)   null,
    material_level    varchar(255)   null,
    type              varchar(255)   null,
    subprod           varchar(255)   null
);

create table allfeedingdetail_cloud
(
    feeding_task_id   bigint                                  null,
    mesmoname         varchar(255) collate utf8mb4_general_ci null,
    area              varchar(255) collate utf8mb4_general_ci null,
    area1             varchar(255) collate utf8mb4_general_ci null,
    eqpmodel          varchar(255) collate utf8mb4_general_ci null,
    eqpid             varchar(255) collate utf8mb4_general_ci null,
    moprodname        varchar(255) collate utf8mb4_general_ci null,
    moproddesc        varchar(255) collate utf8mb4_general_ci null,
    feeding_task_code varchar(255) collate utf8mb4_general_ci null,
    stovetype         varchar(255) collate utf8mb4_general_ci null,
    stovetypedesc     varchar(255) collate utf8mb4_general_ci null,
    rx                int                                     null,
    finishmark        varchar(255) collate utf8mb4_general_ci null,
    finishmarkdesc    varchar(255) collate utf8mb4_general_ci null,
    crucprodname      varchar(255) collate utf8mb4_general_ci null,
    crucproddesc      varchar(255) collate utf8mb4_general_ci null,
    cruciblesn        varchar(255) collate utf8mb4_general_ci null,
    prodname          varchar(255) collate utf8mb4_general_ci null,
    proddesc          varchar(255) collate utf8mb4_general_ci null,
    material_type     varchar(255) collate utf8mb4_general_ci null,
    material_type1    varchar(255) collate utf8mb4_general_ci null,
    level             varchar(255) collate utf8mb4_general_ci null,
    batch_no          varchar(255) collate utf8mb4_general_ci null,
    weight            decimal(10, 2)                          null,
    stovetime         datetime                                null,
    mfgdate           datetime                                null
)
    engine = FEDERATED
    charset = utf8mb3;

create table dict
(
    id      int auto_increment
        primary key,
    cate    varchar(255) null,
    dictkey varchar(255) null,
    value   varchar(255) null,
    value1  varchar(255) null
);

create table equipment
(
    序号     varchar(255) null,
    site     varchar(255) null,
    area1    varchar(255) null,
    eqpid    varchar(255) not null
        primary key,
    eqpmodel varchar(255) null,
    area     varchar(255) null
)
    comment '炉台信息表' row_format = DYNAMIC;

create table mostatus
(
    area1           varchar(255)   null,
    eqpid           varchar(255)   null,
    MESmoname       varchar(255)   not null
        primary key,
    ERPmoname       varchar(255)   null,
    prodname        varchar(255)   null,
    proddesc        varchar(255)   null,
    crusize         varchar(255)   null,
    stovetime       datetime       null,
    feeding_task_id varchar(50)    null,
    crucible        varchar(100)   null,
    crucprodname    varchar(255)   null,
    crucproddesc    varchar(255)   null,
    cruciblesn      varchar(255)   null,
    subprod         varchar(400)   null,
    mostatus        varchar(50)    null,
    mostatusdesc    varchar(255)   null,
    finish_time     datetime       null,
    runtime         decimal(10, 2) null,
    rx              varchar(255)   null,
    prodtype        varchar(255)   null,
    remark          varchar(255)   null
);

create index MoName
    on mostatus (MESmoname);

create table mostatus_cloud
(
    area1           varchar(255) collate utf8mb4_general_ci null,
    eqpid           varchar(255) collate utf8mb4_general_ci null,
    MESmoname       varchar(255) collate utf8mb4_general_ci not null
        primary key using se_specific,
    ERPmoname       varchar(255) collate utf8mb4_general_ci null,
    prodname        varchar(255) collate utf8mb4_general_ci null,
    proddesc        varchar(255) collate utf8mb4_general_ci null,
    crusize         varchar(255) collate utf8mb4_general_ci null,
    stovetime       datetime                                null,
    feeding_task_id varchar(50) collate utf8mb4_general_ci  null,
    crucible        varchar(100) collate utf8mb4_general_ci null,
    crucprodname    varchar(255) collate utf8mb4_general_ci null,
    crucproddesc    varchar(255) collate utf8mb4_general_ci null,
    cruciblesn      varchar(255) collate utf8mb4_general_ci null,
    subprod         varchar(400) collate utf8mb4_general_ci null,
    mostatus        varchar(50) collate utf8mb4_general_ci  null,
    mostatusdesc    varchar(255) collate utf8mb4_general_ci null,
    finish_time     datetime                                null,
    runtime         decimal(10, 2)                          null,
    rx              varchar(255) collate utf8mb4_general_ci null,
    prodtype        varchar(255) collate utf8mb4_general_ci null,
    remark          varchar(255) collate utf8mb4_general_ci null
)
    engine = FEDERATED
    charset = utf8mb3;

create index MoName
    on mostatus_cloud (MESmoname)
    using se_specific;

create table outputtargetsetting
(
    id          int auto_increment
        primary key,
    eqpid       varchar(255)   null,
    area        varchar(255)   null,
    area1       varchar(255)   null,
    mfgdate     datetime       null,
    targetmodel varchar(255)   null,
    crusize     varchar(255)   null,
    prod        varchar(255)   null,
    crucible    varchar(255)   null,
    outputb     decimal(10, 3) null,
    outputc     decimal(10, 3) null,
    updateby    varchar(255)   null,
    updatetime  datetime       null
);

create table prod
(
    code   varchar(255) not null
        primary key,
    round  varchar(255) null,
    square varchar(255) null,
    cate1  varchar(255) null,
    cate2  varchar(255) null,
    cate3  varchar(255) null
);

create table product
(
    prodname varchar(255) null,
    proddesc varchar(255) null,
    cate1    varchar(255) null,
    type     varchar(255) null,
    level    varchar(255) null,
    cate2    varchar(255) null,
    cate3    varchar(255) null
);

create table recyclematerialouput
(
    lotsn       varchar(255) not null
        primary key,
    prodname    varchar(255) null,
    proddesc    varchar(255) null,
    prodtype    varchar(255) null,
    level       varchar(255) null,
    resistivity varchar(255) null,
    weight      double       null,
    cate1       varchar(255) null,
    type        varchar(255) null,
    cate2       varchar(255) null,
    cate3       varchar(255) null,
    update_time datetime     null,
    mfgdate     datetime     null,
    month       varchar(255) null
);

create table siteonlinecrucibleyield
(
    mfgdate                     datetime       null comment '计产日期',
    crystalbarno                varchar(255)   not null comment '晶编'
        primary key,
    eqpid                       varchar(255)   null comment '炉台号',
    area                        varchar(255)   null comment '车间',
    area1                       varchar(255)   null comment '片区',
    eqpmodel                    varchar(255)   null comment '炉型',
    outlength                   decimal(10, 2) null comment '出炉长度',
    outweight                   decimal(10, 2) null comment '出炉重量',
    outtime                     datetime       null comment '出炉时间',
    qclength                    decimal(10, 2) null comment '有效长度',
    qcweight                    decimal(10, 2) null comment '有效重量',
    qctime                      datetime       null comment 'qc时间',
    crucible                    varchar(255)   null comment '坩埚厂家',
    crusize                     varchar(255)   null comment '热场尺寸',
    crunum                      varchar(255)   null comment '坩埚编码',
    lastcrystalbarno            varchar(255)   null comment '上一棒晶编',
    lastouttime                 datetime       null comment '上一棒时间',
    timeinterval                decimal(10, 2) null comment '生产时间',
    crudesc                     varchar(255)   null comment '坩埚物料描述',
    prod                        varchar(255)   null comment '产品简称',
    subprod                     varchar(255)   null comment '产品规格',
    erpmoname                   varchar(255)   null comment 'ERP工单号',
    mesmoname                   varchar(255)   null comment 'MES工单号',
    savedate                    datetime       null comment '归档时间',
    moprodname                  varchar(255)   null comment '工单产品编码',
    moproddesc                  varchar(255)   null comment '工单物料描述',
    actualprodname              varchar(255)   null comment '实际生产的物料编码',
    actualproddesc              varchar(255)   null,
    feeding_task_id             varchar(255)   null comment '配料的任务id，用来匹配炉次的首次投炉日期',
    hair_rod_coefficient        decimal(10, 2) null comment '毛棒折重系数',
    round_rod_coefficient       decimal(10, 2) null comment '圆棒折重系数',
    hair_square_rod_coefficient decimal(10, 2) null comment '毛方棒折重系数',
    stovetime                   datetime       null comment '该炉次的首次投炉日期',
    adjustcrucible              varchar(255)   null comment '修正的坩埚厂商

使用运营的数据修正',
    adjustcruciblecode          varchar(255)   null comment '修正的坩埚厂商代码，简称，使用2-3位字母',
    squareqcweight              decimal(10, 2) null comment 'Qc长度折方棒重量'
);

create table siteonlinecrucibleyield_cloud
(
    mfgdate                     datetime                                null comment '计产日期',
    crystalbarno                varchar(255) collate utf8mb4_general_ci not null comment '晶编'
        primary key using se_specific,
    eqpid                       varchar(255) collate utf8mb4_general_ci null comment '炉台号',
    area                        varchar(255) collate utf8mb4_general_ci null comment '车间',
    area1                       varchar(255) collate utf8mb4_general_ci null comment '片区',
    eqpmodel                    varchar(255) collate utf8mb4_general_ci null,
    outlength                   decimal(10, 2)                          null comment '出炉长度',
    outweight                   decimal(10, 2)                          null comment '出炉重量',
    outtime                     datetime                                null comment '出炉时间',
    qclength                    decimal(10, 2)                          null comment '有效长度',
    qcweight                    decimal(10, 2)                          null comment '有效重量',
    qctime                      datetime                                null comment 'qc时间',
    crucible                    varchar(255) collate utf8mb4_general_ci null comment '坩埚厂家',
    crusize                     varchar(255) collate utf8mb4_general_ci null comment '热场尺寸',
    crunum                      varchar(255) collate utf8mb4_general_ci null comment '坩埚编码',
    lastcrystalbarno            varchar(255) collate utf8mb4_general_ci null comment '上一棒晶编',
    lastouttime                 datetime                                null comment '上一棒时间',
    timeinterval                decimal(10, 2)                          null comment '生产时间',
    crudesc                     varchar(255) collate utf8mb4_general_ci null comment '坩埚物料描述',
    prod                        varchar(255) collate utf8mb4_general_ci null comment '产品简称',
    subprod                     varchar(255) collate utf8mb4_general_ci null comment '产品规格',
    erpmoname                   varchar(255) collate utf8mb4_general_ci null comment 'ERP工单号',
    mesmoname                   varchar(255) collate utf8mb4_general_ci null comment 'MES工单号',
    savedate                    datetime                                null comment '归档时间',
    moprodname                  varchar(255) collate utf8mb4_general_ci null comment '工单产品编码',
    moproddesc                  varchar(255) collate utf8mb4_general_ci null,
    actualprodname              varchar(255) collate utf8mb4_general_ci null,
    actualproddesc              varchar(255) collate utf8mb4_general_ci null,
    feeding_task_id             varchar(255) collate utf8mb4_general_ci null,
    hair_rod_coefficient        decimal(10, 2)                          null comment '毛棒折重系数',
    round_rod_coefficient       decimal(10, 2)                          null comment '圆棒折重系数',
    hair_square_rod_coefficient decimal(10, 2)                          null comment '毛方棒折重系数',
    stovetime                   datetime                                null
)
    engine = FEDERATED
    charset = utf8mb3;

create table updatelog
(
    id         int auto_increment
        primary key,
    tablename  varchar(255) null,
    updatetime datetime     null,
    status     varchar(400) null,
    remark     varchar(400) null
);

