-- sic_mes.warehouse_allot_bill definition

CREATE TABLE `warehouse_allot_bill`
(
    `id`                   int(11) NOT NULL AUTO_INCREMENT,
    `bill_no`              varchar(40) CHARACTER SET utf8 NOT NULL COMMENT '调拨单号',
    `status`               varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '单据状态。 待审核，审核成功，审核失败',
    `allot_warehouse_id`   varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '调拨库位ID',
    `allot_warehouse_name` varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '调拨库位名称',
    `remark`               varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注',
    `reject_reason`        varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '拒收原因',
    `reject_reason_remark` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '拒收原因备注',
    `auto_audit`           bit(1)                          DEFAULT b'0' COMMENT '是否自动审核，0 否，默认否。1 自动审核',
    `create_time`          datetime                        DEFAULT NULL COMMENT '创建时间',
    `create_user_id`       int(11) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`     varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '创建人',
    `update_time`          datetime                        DEFAULT NULL COMMENT '操作时间',
    `update_user_id`       int(10) DEFAULT NULL COMMENT '操作人ID',
    `update_user_name`     varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '操作人姓名',
    PRIMARY KEY (`id`),
    KEY                    `idx_bill_no` (`bill_no`),
    KEY                    `idx_create_time` (`create_time`),
    KEY                    `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='【线边仓管理】调拨单';


-- sic_mes.warehouse_allot_bill_detail definition

CREATE TABLE `warehouse_allot_bill_detail`
(
    `id`                     int(11) NOT NULL AUTO_INCREMENT,
    `allot_bill_id`          int(11) DEFAULT NULL COMMENT '调拨单ID',
    `allot_bill_no`          varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '调拨单号',
    `material_model_id`      int(10) NOT NULL COMMENT '物料主数据ID',
    `material_model_code`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据料号',
    `material_model_name`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据名称',
    `material_type_name`     varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据类型',
    `material_category_name` varchar(40)                    DEFAULT NULL COMMENT '物料类别名称',
    `unique_code`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '唯一码',
    `batch_no`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '批次号',
    `supplier`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据供应商',
    `specification`          varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据规格',
    `material_th`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据图号',
    `count`                  decimal(10, 4)                 DEFAULT NULL COMMENT '调拨数量',
    `unit_name`              varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料单位',
    `warehouse_id`           int(10) DEFAULT NULL COMMENT '原库位ID',
    `warehouse_name`         varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '原库位名称',
    `allot_warehouse_id`     int(10) DEFAULT NULL COMMENT '调拨库位ID',
    `allot_warehouse_name`   varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '调拨库位名称',
    `create_user_id`         int(10) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人名称',
    `create_time`            datetime                       DEFAULT NULL COMMENT '创建时间',
    `update_user_id`         int(10) DEFAULT NULL COMMENT '操作人ID',
    `update_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '操作人名称',
    `update_time`            datetime                       DEFAULT NULL COMMENT '操作时间',
    `inventory_id`           int(11) DEFAULT NULL COMMENT '原库存数据ID',
    `remark`                 varchar(250)                   DEFAULT NULL COMMENT '备注',
    `status`                 varchar(100)                   DEFAULT NULL COMMENT '审核状态',
    PRIMARY KEY (`id`),
    KEY                      `idx_allot_bill_id` (`allot_bill_id`),
    KEY                      `idx_allot_bill_no` (`allot_bill_no`),
    KEY                      `idx_batch_no` (`batch_no`),
    KEY                      `idx_material_model_code` (`material_model_code`),
    KEY                      `idx_material_model_name` (`material_model_name`),
    KEY                      `idx_unique_code` (`unique_code`),
    KEY                      `idx_update_time` (`update_time`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='【线边仓管理】调拨单明细';


-- sic_mes.warehouse_allot_record_bill definition

CREATE TABLE `warehouse_allot_record_bill`
(
    `id`                   int(11) NOT NULL AUTO_INCREMENT,
    `record_bill_no`       varchar(40) CHARACTER SET utf8 NOT NULL COMMENT '调拨审核单号',
    `status`               varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '单据状态。 待审核，审核成功，审核失败',
    `allot_warehouse_id`   varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '调拨库位ID',
    `allot_warehouse_name` varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '调拨库位名称',
    `remark`               varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注',
    `reject_reason`        varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '拒收原因',
    `reject_reason_remark` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '拒收原因备注',
    `auto_audit`           bit(1)                          DEFAULT b'0' COMMENT '是否自动审核，0 否，默认否。1 自动审核',
    `create_time`          datetime                        DEFAULT NULL COMMENT '创建时间',
    `create_user_id`       int(11) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`     varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '创建人',
    `update_time`          datetime                        DEFAULT NULL COMMENT '操作时间',
    `update_user_id`       int(10) DEFAULT NULL COMMENT '操作人ID',
    `update_user_name`     varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '操作人姓名',
    `allot_bill_no`        varchar(100)                   NOT NULL COMMENT '调拨申请单号',
    `allot_bill_id`        int(10) NOT NULL COMMENT '调拨单ID',
    PRIMARY KEY (`id`),
    KEY                    `idx_bill_no` (`record_bill_no`) USING BTREE,
    KEY                    `idx_create_time` (`create_time`) USING BTREE,
    KEY                    `idx_status` (`status`) USING BTREE,
    KEY                    `idx_allot_bill_no` (`allot_bill_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='【线边仓管理】调拨审核记录单';


-- sic_mes.warehouse_allot_record_bill_detail definition

CREATE TABLE `warehouse_allot_record_bill_detail`
(
    `id`                     int(11) NOT NULL AUTO_INCREMENT,
    `record_bill_id`         int(11) NOT NULL COMMENT '调拨审核记录单ID',
    `record_bill_no`         varchar(40) CHARACTER SET utf8 NOT NULL COMMENT '调拨审核记录单号',
    `material_model_id`      int(10) NOT NULL COMMENT '物料主数据ID',
    `material_model_code`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据料号',
    `material_model_name`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据名称',
    `material_type_name`     varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据类型',
    `material_category_name` varchar(40)                    DEFAULT NULL COMMENT '物料类别名称',
    `unique_code`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '唯一码',
    `batch_no`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '批次号',
    `supplier`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据供应商',
    `specification`          varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据规格',
    `material_th`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据图号',
    `count`                  decimal(10, 4)                 DEFAULT NULL COMMENT '调拨数量',
    `unit_name`              varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料单位',
    `warehouse_id`           int(10) DEFAULT NULL COMMENT '原库位ID',
    `warehouse_name`         varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '原库位名称',
    `allot_warehouse_id`     int(10) DEFAULT NULL COMMENT '调拨库位ID',
    `allot_warehouse_name`   varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '调拨库位名称',
    `create_user_id`         int(10) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人名称',
    `create_time`            datetime                       DEFAULT NULL COMMENT '创建时间',
    `update_user_id`         int(10) DEFAULT NULL COMMENT '操作人ID',
    `update_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '操作人名称',
    `update_time`            datetime                       DEFAULT NULL COMMENT '操作时间',
    `inventory_id`           int(11) DEFAULT NULL COMMENT '原库存数据ID',
    `remark`                 varchar(250)                   DEFAULT NULL COMMENT '备注',
    `status`                 varchar(100)                   DEFAULT NULL COMMENT '审核状态',
    `allot_bill_no`          varchar(100)                   NOT NULL COMMENT '调拨申请单号',
    `allot_bill_id`          int(10) NOT NULL COMMENT '调拨申请单ID',
    PRIMARY KEY (`id`),
    KEY                      `idx_record_bill_id` (`record_bill_id`) USING BTREE,
    KEY                      `idx_record_bill_no` (`record_bill_no`) USING BTREE,
    KEY                      `idx_batch_no` (`batch_no`) USING BTREE,
    KEY                      `idx_material_model_code` (`material_model_code`) USING BTREE,
    KEY                      `idx_material_model_name` (`material_model_name`) USING BTREE,
    KEY                      `idx_unique_code` (`unique_code`) USING BTREE,
    KEY                      `idx_update_time` (`update_time`) USING BTREE,
    KEY                      `idx_allot_bill_no` (`allot_bill_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='【线边仓管理】调拨审核记录单明细';


-- sic_mes.warehouse_input_bill definition

CREATE TABLE `warehouse_input_bill`
(
    `id`                   int(11) NOT NULL AUTO_INCREMENT,
    `bill_no`              varchar(40) CHARACTER SET utf8 NOT NULL COMMENT '入库单号',
    `create_time`          datetime                        DEFAULT NULL COMMENT '创建时间',
    `create_user_id`       int(11) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`     varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '创建人',
    `status`               varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '单据状态。 待接收，已入库，拒收',
    `update_time`          datetime                        DEFAULT NULL COMMENT '操作时间',
    `update_user_id`       int(10) DEFAULT NULL COMMENT '操作人ID',
    `update_user_name`     varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '操作人姓名',
    `type`                 varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '入库类型',
    `remark`               varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注',
    `reject_reason`        varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '拒收原因',
    `reject_reason_remark` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '拒收原因备注',
    `auto_audit`           bit(1)                          DEFAULT b'0' COMMENT '是否自动审核，0 否，默认否。1 自动审核',
    PRIMARY KEY (`id`),
    UNIQUE KEY `bill_no_unique` (`bill_no`),
    KEY                    `idx_create_time` (`create_time`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=138 COMMENT='【线边仓管理】入库单';


-- sic_mes.warehouse_input_bill_detail definition

CREATE TABLE `warehouse_input_bill_detail`
(
    `id`                     int(11) NOT NULL AUTO_INCREMENT,
    `input_bill_id`          int(11) DEFAULT NULL COMMENT '入库单ID',
    `material_model_id`      int(10) NOT NULL COMMENT '物料主数据ID',
    `material_model_code`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据料号',
    `material_model_name`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据名称',
    `material_type_name`     varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据类型',
    `unique_code`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '唯一码',
    `batch_no`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '批次号',
    `supplier`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据供应商',
    `specification`          varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据规格',
    `material_th`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据图号',
    `count`                  decimal(10, 4)                 DEFAULT NULL COMMENT '入库数量',
    `unit_name`              varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料单位',
    `warehouse_id`           int(10) DEFAULT NULL COMMENT '库位ID',
    `warehouse_name`         varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '库位名称',
    `create_user_id`         int(10) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人名称',
    `create_time`            datetime                       DEFAULT NULL COMMENT '创建时间',
    `update_user_id`         int(10) DEFAULT NULL COMMENT '操作人ID',
    `update_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '操作人名称',
    `update_time`            datetime                       DEFAULT NULL COMMENT '操作时间',
    `type`                   varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '入库类型',
    `input_bill_no`          varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '入库单号',
    `status`                 varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '单据状态',
    `material_category_name` varchar(40)                    DEFAULT NULL COMMENT '物料类别名称',
    `material_level`         varchar(40)                    DEFAULT NULL COMMENT '物料等级',
    `diameter`               varchar(40)                    DEFAULT NULL COMMENT '直径',
    PRIMARY KEY (`id`),
    KEY                      `idx_batch_no` (`batch_no`),
    KEY                      `idx_input_bill_id` (`input_bill_id`),
    KEY                      `idx_input_bill_no` (`input_bill_no`),
    KEY                      `idx_material_model_code` (`material_model_code`),
    KEY                      `idx_material_model_name` (`material_model_name`),
    KEY                      `idx_unique_code` (`unique_code`),
    KEY                      `idx_update_time` (`update_time`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=284 COMMENT='【线边仓管理】入库单明细';


-- sic_mes.warehouse_input_record_bill definition

CREATE TABLE `warehouse_input_record_bill`
(
    `id`                   int(11) NOT NULL AUTO_INCREMENT,
    `record_bill_no`       varchar(40) CHARACTER SET utf8 NOT NULL COMMENT '入库审核记录单号',
    `create_time`          datetime                        DEFAULT NULL COMMENT '创建时间',
    `create_user_id`       int(11) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`     varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '创建人',
    `status`               varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '单据状态。 待接收，已入库，拒收',
    `update_time`          datetime                        DEFAULT NULL COMMENT '操作时间',
    `update_user_id`       int(10) DEFAULT NULL COMMENT '操作人ID',
    `update_user_name`     varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '操作人姓名',
    `type`                 varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '入库类型',
    `remark`               varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注',
    `reject_reason`        varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '拒收原因',
    `reject_reason_remark` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '拒收原因备注',
    `auto_audit`           bit(1)                          DEFAULT b'0' COMMENT '是否自动审核，0 否，默认否。1 自动审核',
    `input_bill_no`        varchar(100)                   NOT NULL COMMENT '入库申请表单据号',
    `input_bill_id`        varchar(100)                   NOT NULL COMMENT '入库申请单ID',
    PRIMARY KEY (`id`),
    UNIQUE KEY `record_bill_no_unique` (`record_bill_no`),
    KEY                    `idx_create_time` (`create_time`) USING BTREE,
    KEY                    `input_bill_no_idx` (`input_bill_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='【线边仓管理】入库审核记录单';


-- sic_mes.warehouse_input_record_bill_detail definition

CREATE TABLE `warehouse_input_record_bill_detail`
(
    `id`                     int(11) NOT NULL AUTO_INCREMENT,
    `record_bill_id`         int(11) NOT NULL COMMENT '入库审核记录ID',
    `material_model_id`      int(10) NOT NULL COMMENT '物料主数据ID',
    `material_model_code`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据料号',
    `material_model_name`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据名称',
    `material_type_name`     varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据类型',
    `unique_code`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '唯一码',
    `batch_no`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '批次号',
    `supplier`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据供应商',
    `specification`          varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据规格',
    `material_th`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据图号',
    `count`                  decimal(10, 4)                 DEFAULT NULL COMMENT '入库数量',
    `unit_name`              varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料单位',
    `warehouse_id`           int(10) DEFAULT NULL COMMENT '库位ID',
    `warehouse_name`         varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '库位名称',
    `create_user_id`         int(10) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人名称',
    `create_time`            datetime                       DEFAULT NULL COMMENT '创建时间',
    `update_user_id`         int(10) DEFAULT NULL COMMENT '操作人ID',
    `update_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '操作人名称',
    `update_time`            datetime                       DEFAULT NULL COMMENT '操作时间',
    `type`                   varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '入库类型',
    `input_bill_no`          varchar(40) CHARACTER SET utf8 NOT NULL COMMENT '入库申请单号',
    `status`                 varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '单据状态',
    `material_category_name` varchar(40)                    DEFAULT NULL COMMENT '物料类别名称',
    `material_level`         varchar(40)                    DEFAULT NULL COMMENT '物料等级',
    `diameter`               varchar(40)                    DEFAULT NULL COMMENT '直径',
    `record_bill_no`         varchar(100)                   NOT NULL COMMENT '入库审核记录单号',
    `input_bill_id`          int(10) NOT NULL COMMENT '入库申请单ID',
    PRIMARY KEY (`id`),
    KEY                      `idx_batch_no` (`batch_no`) USING BTREE,
    KEY                      `idx_input_bill_id` (`record_bill_id`) USING BTREE,
    KEY                      `idx_input_bill_no` (`input_bill_no`) USING BTREE,
    KEY                      `idx_material_model_code` (`material_model_code`) USING BTREE,
    KEY                      `idx_material_model_name` (`material_model_name`) USING BTREE,
    KEY                      `idx_unique_code` (`unique_code`) USING BTREE,
    KEY                      `idx_update_time` (`update_time`) USING BTREE,
    KEY                      `idx_record_bill_no` (`record_bill_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='【线边仓管理】入库审核记录单明细';


-- sic_mes.warehouse_inventory definition

CREATE TABLE `warehouse_inventory`
(
    `id`                     int(11) NOT NULL AUTO_INCREMENT,
    `material_model_id`      int(10) NOT NULL COMMENT '物料主数据ID',
    `material_model_code`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据料号',
    `material_model_name`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据名称',
    `material_type_name`     varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据类型',
    `unique_code`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '唯一码',
    `batch_no`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '批次号',
    `supplier`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据供应商',
    `specification`          varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据规格',
    `material_th`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据图号',
    `quantity`               decimal(10, 4)                 DEFAULT '0.0000' COMMENT '库存数量',
    `unit_name`              varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料单位',
    `warehouse_id`           int(10) DEFAULT NULL COMMENT '库位ID',
    `warehouse_name`         varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '库位名称',
    `receive_user_id`        int(10) DEFAULT NULL COMMENT '入库人ID',
    `receive_user_name`      varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '入库人名称',
    `receive_time`           datetime                       DEFAULT NULL COMMENT '接受时间',
    `material_xh`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料型号',
    `residence_time`         int(10) DEFAULT NULL COMMENT '停留时间',
    `time_unit`              varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '停留时间单位',
    `safety_stock`           varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '安全库存',
    `lock_quantity`          decimal(10, 4)                 DEFAULT '0.0000' COMMENT '锁定数量',
    `material_category_name` varchar(40)                    DEFAULT NULL COMMENT '物料类别名称',
    `material_level`         varchar(40)                    DEFAULT NULL COMMENT '物料等级',
    `diameter`               varchar(40)                    DEFAULT NULL COMMENT '直径',
    `del`                    bit(1)                         DEFAULT b'0' COMMENT '逻辑删除，1：删除，0：未删除',
    PRIMARY KEY (`id`),
    KEY                      `idx_batch_no` (`batch_no`),
    KEY                      `idx_material_code` (`material_model_code`),
    KEY                      `idx_material_model_id` (`material_model_id`),
    KEY                      `idx_material_name` (`material_model_name`),
    KEY                      `idx_material_type_name` (`material_type_name`),
    KEY                      `idx_unique_code` (`unique_code`),
    KEY                      `idx_warehouse_id` (`warehouse_id`),
    KEY                      `idx_warehouse_name` (`warehouse_name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=348 COMMENT='【线边仓管理】库存表';


-- sic_mes.warehouse_material definition

CREATE TABLE `warehouse_material`
(
    `id`                  int(10) NOT NULL AUTO_INCREMENT COMMENT 'id',
    `lower_limit`         decimal(10, 4)                 DEFAULT NULL COMMENT '库存下限',
    `upper_limit`         decimal(10, 4)                 DEFAULT NULL COMMENT '库存上限',
    `residence_time`      int(10) DEFAULT NULL COMMENT '停留时间',
    `time_unit`           varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '时间单位',
    `default_location`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '默认仓库地点',
    `batch`               bit(1)                         DEFAULT b'0' COMMENT '是否开启批次管理，1开启，0不开启',
    `unique_code`         bit(1)                         DEFAULT b'0' COMMENT '是否开启唯一码管理，1开启，0不开启',
    `material_id`         int(10) NOT NULL COMMENT '物料ID',
    `default_location_id` int(10) DEFAULT NULL COMMENT '默认仓库地点ID',
    `safety_stock`        varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '安全库存',
    `create_time`         datetime                       DEFAULT NULL COMMENT '创建时间',
    `create_user_id`      int(10) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`    varchar(40)                    DEFAULT NULL COMMENT '创建人名称',
    `update_time`         datetime                       DEFAULT NULL COMMENT '更新时间',
    `update_user_id`      int(10) DEFAULT NULL COMMENT '更新人ID',
    `update_user_name`    varchar(40)                    DEFAULT NULL COMMENT '更新人名称',
    `material_code`       varchar(40)                    DEFAULT NULL COMMENT '物料编码',
    `material_name`       varchar(40)                    DEFAULT NULL COMMENT '物料名称',
    PRIMARY KEY (`id`),
    KEY                   `idx_material_id` (`material_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=268 COMMENT='【线边仓管理】线边库-物料模型';


-- sic_mes.warehouse_model definition

CREATE TABLE `warehouse_model`
(
    `id`               int(11) NOT NULL AUTO_INCREMENT,
    `name`             varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '名称',
    `code`             varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '库位编码',
    `parent_id`        int(11) DEFAULT '0' COMMENT '父ID',
    `parent_name`      varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '父库位名称',
    `create_time`      datetime                       DEFAULT NULL COMMENT '创建时间',
    `create_user_id`   int(11) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人',
    `update_time`      datetime                       DEFAULT NULL COMMENT '更新时间',
    `update_user_id`   varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '更新人ID',
    `update_user_name` varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '更新人名称',
    `type`             varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '仓库类型(厂区、仓库、库区、库位)',
    `factory_id`       int(10) DEFAULT NULL COMMENT '所属工厂id',
    `warehouse_id`     int(10) DEFAULT NULL COMMENT '所属仓库id',
    `area_id`          int(10) DEFAULT NULL COMMENT '所属库区id',
    PRIMARY KEY (`id`),
    KEY                `idx_code` (`code`),
    KEY                `idx_name` (`name`),
    KEY                `idx_parent_id` (`parent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=744 COMMENT='【线边仓管理】线边库模型';


-- sic_mes.warehouse_output_bill definition

CREATE TABLE `warehouse_output_bill`
(
    `id`               int(11) NOT NULL AUTO_INCREMENT,
    `bill_no`          varchar(40) CHARACTER SET utf8 NOT NULL COMMENT '出库单号',
    `create_time`      datetime                        DEFAULT NULL COMMENT '创建时间',
    `create_user_id`   int(11) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name` varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '创建人',
    `status`           varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '单据状态。待出库、已出库、锁定、取消',
    `update_time`      datetime                        DEFAULT NULL COMMENT '出库时间',
    `update_user_id`   int(10) DEFAULT NULL COMMENT '出库人ID',
    `update_user_name` varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '出库人姓名',
    `type`             varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '出库类型',
    `remark`           varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注',
    `destination`      varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '去向',
    `auto_audit`       bit(1)                          DEFAULT b'0' COMMENT '是否自动出库，1 是，0否',
    `scan_code`        varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '扫描的物料号/唯一码/批次号',
    PRIMARY KEY (`id`),
    UNIQUE KEY `bill_no_unique` (`bill_no`),
    KEY                `idx_create_time` (`create_time`),
    KEY                `idx_destination` (`destination`),
    KEY                `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=252 COMMENT='【线边仓管理】出库单';


-- sic_mes.warehouse_output_bill_detail definition

CREATE TABLE `warehouse_output_bill_detail`
(
    `id`                     int(11) NOT NULL AUTO_INCREMENT,
    `output_bill_id`         int(11) DEFAULT NULL COMMENT '出库单ID',
    `output_bill_no`         varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '出库单号',
    `material_model_id`      int(10) DEFAULT NULL COMMENT '物料主数据ID',
    `material_model_code`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据料号',
    `material_model_name`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据名称',
    `material_type_name`     varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据类型',
    `unique_code`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '唯一码',
    `batch_no`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '批次号',
    `supplier`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据供应商',
    `specification`          varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据规格',
    `material_th`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据图号',
    `output_count`           decimal(10, 4)                 DEFAULT NULL COMMENT '出库数量',
    `unit_name`              varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料单位',
    `warehouse_id`           int(10) DEFAULT NULL COMMENT '库位ID',
    `warehouse_name`         varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '库位名称',
    `create_user_id`         int(10) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人名称',
    `create_time`            datetime                       DEFAULT NULL COMMENT '创建时间',
    `update_user_id`         int(10) DEFAULT NULL COMMENT '出库人ID',
    `update_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '出库人名称',
    `update_time`            datetime                       DEFAULT NULL COMMENT '出库时间',
    `type`                   varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '出库类型',
    `destination`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '去向',
    `status`                 varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '单据状态。待出库、已出库、锁定、取消',
    `require_count`          decimal(10, 4)                 DEFAULT NULL COMMENT '需求数量',
    `quantity`               decimal(10, 4)                 DEFAULT NULL COMMENT '库存数量',
    `material_category_name` varchar(40)                    DEFAULT NULL COMMENT '物料类别',
    PRIMARY KEY (`id`),
    KEY                      `idx_batch_no` (`batch_no`),
    KEY                      `idx_input_bill_id` (`output_bill_id`),
    KEY                      `idx_material_model_code` (`material_model_code`),
    KEY                      `idx_material_model_name` (`material_model_name`),
    KEY                      `idx_unique_code` (`unique_code`),
    KEY                      `idx_update_time` (`update_time`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=294 COMMENT='【线边仓管理】出库单明细';


-- sic_mes.warehouse_output_record_bill definition

CREATE TABLE `warehouse_output_record_bill`
(
    `id`               int(11) NOT NULL AUTO_INCREMENT,
    `record_bill_no`   varchar(40) CHARACTER SET utf8 NOT NULL COMMENT '出库审核记录单号',
    `create_time`      datetime                        DEFAULT NULL COMMENT '创建时间',
    `create_user_id`   int(11) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name` varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '创建人',
    `status`           varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '单据状态。待出库、已出库、锁定、取消',
    `update_time`      datetime                        DEFAULT NULL COMMENT '出库时间',
    `update_user_id`   int(10) DEFAULT NULL COMMENT '出库人ID',
    `update_user_name` varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '出库人姓名',
    `type`             varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '出库类型',
    `remark`           varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注',
    `destination`      varchar(40) CHARACTER SET utf8  DEFAULT NULL COMMENT '去向',
    `auto_audit`       bit(1)                          DEFAULT b'0' COMMENT '是否自动出库，1 是，0否',
    `scan_code`        varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '扫描的物料号/唯一码/批次号',
    `output_bill_no`   varchar(100)                   NOT NULL COMMENT '出库申请单号',
    `output_bill_id`   int(10) NOT NULL COMMENT '出库申请单ID',
    PRIMARY KEY (`id`),
    UNIQUE KEY `bill_no_unique` (`record_bill_no`),
    KEY                `idx_create_time` (`create_time`) USING BTREE,
    KEY                `idx_destination` (`destination`) USING BTREE,
    KEY                `idx_status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='【线边仓管理】出库审核记录单';


-- sic_mes.warehouse_output_record_bill_detail definition

CREATE TABLE `warehouse_output_record_bill_detail`
(
    `id`                     int(11) NOT NULL AUTO_INCREMENT,
    `record_bill_id`         int(11) NOT NULL COMMENT '出库审核记录单ID',
    `record_bill_no`         varchar(40) CHARACTER SET utf8 NOT NULL COMMENT '出库审核记录单号',
    `material_model_id`      int(10) DEFAULT NULL COMMENT '物料主数据ID',
    `material_model_code`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据料号',
    `material_model_name`    varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据名称',
    `material_type_name`     varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据类型',
    `unique_code`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '唯一码',
    `batch_no`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '批次号',
    `supplier`               varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据供应商',
    `specification`          varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据规格',
    `material_th`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料主数据图号',
    `output_count`           decimal(10, 4)                 DEFAULT NULL COMMENT '出库数量',
    `unit_name`              varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '物料单位',
    `warehouse_id`           int(10) DEFAULT NULL COMMENT '库位ID',
    `warehouse_name`         varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '库位名称',
    `create_user_id`         int(10) DEFAULT NULL COMMENT '创建人ID',
    `create_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人名称',
    `create_time`            datetime                       DEFAULT NULL COMMENT '创建时间',
    `update_user_id`         int(10) DEFAULT NULL COMMENT '出库人ID',
    `update_user_name`       varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '出库人名称',
    `update_time`            datetime                       DEFAULT NULL COMMENT '出库时间',
    `type`                   varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '出库类型',
    `destination`            varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '去向',
    `status`                 varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '单据状态。待出库、已出库、锁定、取消',
    `require_count`          decimal(10, 4)                 DEFAULT NULL COMMENT '需求数量',
    `quantity`               decimal(10, 4)                 DEFAULT NULL COMMENT '库存数量',
    `material_category_name` varchar(40)                    DEFAULT NULL COMMENT '物料类别',
    `output_bill_no`         varchar(100)                   NOT NULL COMMENT '出库申请单号',
    `output_bill_id`         int(10) NOT NULL COMMENT '出库申请单ID',
    PRIMARY KEY (`id`),
    KEY                      `idx_batch_no` (`batch_no`) USING BTREE,
    KEY                      `idx_input_bill_id` (`record_bill_id`) USING BTREE,
    KEY                      `idx_material_model_code` (`material_model_code`) USING BTREE,
    KEY                      `idx_material_model_name` (`material_model_name`) USING BTREE,
    KEY                      `idx_unique_code` (`unique_code`) USING BTREE,
    KEY                      `idx_update_time` (`update_time`) USING BTREE,
    KEY                      `idx_output_bill_no` (`output_bill_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='【线边仓管理】出库审核记录单明细';