
-- 蝌蚪文需求建表语句
CREATE TABLE `fct_agv1` (
    `ID` varchar(50) NOT NULL COMMENT 'ID',
    `SLOT` varchar(50) NOT NULL COMMENT '生产批号',
    `SPLT` varchar(50) NOT NULL COMMENT '产品托盘号',
    `SPROD` varchar(50) NOT NULL COMMENT '产品',
    `SSHIFT` varchar(50) NOT NULL COMMENT '班组',
    `CREATEDATE` datetime NOT NULL COMMENT '创建时间',
    `CREATEBY` varchar(50) NOT NULL COMMENT '创建人',
    `STATUS` varchar(10) NOT NULL COMMENT '状态 0-未处理 1-AGV处理 2-人工处理 默认传0',
    `SPRODTYPE` varchar(10) NOT NULL COMMENT '类型 硫酸镍-LSN 氯化镍-LHN',
    PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='批号相关信息表(BMS系统直连)';


CREATE TABLE `fct_agv2` (
    `ID` varchar(50) NOT NULL COMMENT 'ID',
    `SLOT` varchar(50) NOT NULL COMMENT '生产批号',
    `ISQCL` varchar(10) NOT NULL COMMENT '是否质检（Y:已质检  N:未质检）',
    `DSQCDATE` date NOT NULL COMMENT '质检时间',
    `PROCESSFLAG` varchar(10) NOT NULL COMMENT '是否已处理（Y:已处理  N:未处理）由AGV更新',
    `CREATEDATE` date NOT NULL COMMENT '创建时间',
    `CREATEBY` varchar(50) NOT NULL,
    PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='质检相关信息(BMS系统直连)';



-- 给蝌蚪文系统账号赋权限
    CREATE USER `KDW`@`%` IDENTIFIED WITH mysql_native_password;
    GRANT Delete, Insert, Select, Update ON TABLE `warewms-jnmc-jinco`.`fct_agv1` TO `KDW`@`%`;
    GRANT Delete, Insert, Select, Update ON TABLE `warewms-jnmc-jinco`.`fct_agv2` TO `KDW`@`%`;
    ALTER USER `KDW`@`%` IDENTIFIED WITH mysql_native_password BY 'kdwadmin';
    FLUSH PRIVILEGES;
