-- erp_job_mtl_confirm: table
CREATE TABLE `erp_job_mtl_confirm` (
  `id` bigint NOT NULL COMMENT '主键',
  `job_mtl_manage_task_id` bigint DEFAULT NULL COMMENT 'job管理任务id',
  `job_mtl_manage_detail_id` bigint DEFAULT NULL COMMENT 'job管理详情id',
  `job_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT 'job单号',
  `mtl_seq` int DEFAULT NULL COMMENT '物料序号',
  `part_num` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '物料编号',
  `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '物料描述',
  `revision_num` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '物料版本',
  `required_qty` decimal(18,8) DEFAULT NULL COMMENT '需求数量',
  `apply_qty` decimal(18,8) DEFAULT NULL COMMENT '申请数量',
  `actual_qty` decimal(18,8) DEFAULT NULL COMMENT '实际数量',
  `warehouse_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '申请仓库',
  `mium` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '单位',
  `apply_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '申请人',
  `apply_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '申请人id',
  `apply_time` datetime DEFAULT NULL COMMENT '申请时间',
  `send_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '仓管出料人',
  `send_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '仓管出料人id',
  `send_time` datetime DEFAULT NULL COMMENT '仓管出料时间',
  `confirm_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '收料确认人',
  `confirm_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '收料确认人id',
  `confirm_time` datetime DEFAULT NULL COMMENT '收料确认时间',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `confirm_status` tinyint DEFAULT NULL COMMENT '确认状态：-1:已废除 0：待处理 1：进行中 2：已完成 3:已关闭',
  `send_status` tinyint DEFAULT NULL COMMENT '发料状态：-1:已废除 0：待处理 1：进行中 2：已完成 3:已关闭',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/erp_job_mtl_confirm';

-- erp_job_mtl_send: table
CREATE TABLE `erp_job_mtl_send` (
  `id` bigint NOT NULL COMMENT '主键',
  `job_mtl_confirm_id` bigint DEFAULT NULL COMMENT 'job发料确认id',
  `part_num` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '物料编号',
  `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '物料描述',
  `batch` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '批次号',
  `ium` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '单位',
  `our_qty` decimal(18,8) DEFAULT NULL COMMENT '库存数量',
  `send_qty` decimal(18,8) DEFAULT NULL COMMENT '发料量',
  `warehouse_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '库位',
  `send_erp_status` tinyint DEFAULT '0' COMMENT '发送erp状态 0；未发送 1：已经发送',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/erp_job_mtl_send';

-- mes_crystal_order: table
CREATE TABLE `mes_crystal_order` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工单编码',
  `last_order_id` bigint DEFAULT NULL COMMENT '上一炉编码',
  `stove_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '炉台编码',
  `job_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Job单编码',
  `plan_total` decimal(10,2) DEFAULT NULL COMMENT '计划数量',
  `finish_total` decimal(10,2) DEFAULT NULL COMMENT '报工数量',
  `run_device_count` int DEFAULT NULL COMMENT '运行中设备',
  `run_time` datetime DEFAULT NULL COMMENT '设备运行时间',
  `thermal_field` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '热场尺寸',
  `plan_rod_count` int DEFAULT NULL COMMENT '计划毛棒数',
  `step` int NOT NULL COMMENT '1初装报料 2工单排产 3初装配方 4初装投料 5母合金 6初装投炉 7加料报料 8加料配方 9加料投料 10加料运输 11加料投炉 12开副室 13完成 14取棒 15画线 16截断',
  `status` int(1) unsigned zerofill DEFAULT '0' COMMENT '工单状态：0：待排产、1：已排产、2：关闭、3：已完成  4:停止投料 5:停止投炉',
  `material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '成品物料编码',
  `material_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '成品物料名称',
  `specs` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格代码',
  `product_type` varchar(35) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品类型',
  `source_type` int DEFAULT NULL COMMENT '来源 1：手动、2：自动',
  `schedule_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '排产备注',
  `schedule_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '排产人',
  `schedule_time` datetime DEFAULT NULL COMMENT '排产时间',
  `close_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关单备注',
  `report_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '初装报料备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `close_cause_id` bigint DEFAULT NULL COMMENT '关单原因Id',
  `close_cause` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关单原因',
  `finish_flag` int DEFAULT '0' COMMENT '完结棒 0： 未完结、1：已完结',
  `dismantle_flag` int DEFAULT '0' COMMENT '拆请是否完成:0 未完成 1已完成',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_crystal_order` (`order_no`,`stove_no`,`material_code`,`material_name`,`product_type`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_crystal_order';

-- No native definition for element: idx_crystal_order (index)

-- mes_disposable_qc_task: table
CREATE TABLE `mes_disposable_qc_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `clean_id` bigint DEFAULT NULL COMMENT '清洗任务Id',
  `order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '单号',
  `location_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '库位码',
  `material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料编码',
  `material_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料名称',
  `product_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品类型 1-P 2-N 3-ESS 4-ESS2',
  `material_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料类别',
  `classify_level` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类等级',
  `resistivity` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电阻率',
  `weight` decimal(64,2) DEFAULT NULL COMMENT '净重',
  `status` int DEFAULT '1' COMMENT '状态 1：待处理、2：处理中、3：已完成',
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '领取人',
  `qualified` int DEFAULT NULL COMMENT '质量质检 1：合格、2：不合格',
  `qualified_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '质量质检人',
  `qualified_time` datetime DEFAULT NULL COMMENT '质量质检时间',
  `remark` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_disposable_qc_task';

-- mes_draw_line_task: table
CREATE TABLE `mes_draw_line_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `hairy_rod_crystal_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '毛棒晶编',
  `erp_job` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'erpJob单号',
  `square_material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '开方物料编码',
  `square_material_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '开方物料名称',
  `status` tinyint DEFAULT NULL COMMENT '状态 1:待处理、3：已完成',
  `draw_list` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '质检画线列表',
  `exception_list` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '异常段(不做任何处理)',
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '领取人',
  `material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '物料编码',
  `material_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '物料名称',
  `specs` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '产品规格代码',
  `vehicle_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '毛棒车编码',
  `max_diameter` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '最大直径',
  `min_diameter` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '最小直径',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint DEFAULT '0' COMMENT '0：正常。1：已删除',
  `close_mode` tinyint DEFAULT NULL COMMENT '收尾模式 (1:完好收尾 2:等径断棱 3:收尾不良)',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `mes_draw_line_task_code_index` (`hairy_rod_crystal_code`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_draw_line_task';

-- No native definition for element: mes_draw_line_task_code_index (index)

-- mes_feeding_detail: table
CREATE TABLE `mes_feeding_detail` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '投料明细id',
  `feeding_task_id` bigint DEFAULT NULL COMMENT '投料任务id',
  `batches_num` int DEFAULT NULL COMMENT '所属桶数',
  `material_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料编号',
  `material_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料名称',
  `material_type` int DEFAULT NULL COMMENT '物料类型(1:坩埚、2:硅料、3:母合金)',
  `factory` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '厂家',
  `serial_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '序列号',
  `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '批次号',
  `resistivity` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电阻率',
  `scan_flag` tinyint(1) DEFAULT NULL COMMENT '扫描标识 (0:不需要扫描 1:需要扫描)',
  `photograph_flag` tinyint(1) DEFAULT NULL COMMENT '拍照标识 (0:不需要拍照 1:必须拍照上传)',
  `charging_car_flag` tinyint(1) DEFAULT NULL COMMENT '拍照标识 (0:不需要拍照 1:必须拍照上传)',
  `weight` decimal(10,2) DEFAULT NULL COMMENT '重量 小数点两位、单位kg',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 (0:未完成扫描 1:已完成扫描)',
  `attachment` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '附件',
  `vehicle_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '加料车编码',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0',
  `ratio` decimal(8,2) DEFAULT NULL COMMENT '比例',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_feeding_detail';

-- mes_feeding_task: table
CREATE TABLE `mes_feeding_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '投料明细id',
  `report_material_id` bigint DEFAULT NULL COMMENT '报料任务id',
  `old_report_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '老的报料任务Id集合 逗号分隔（多次切换）',
  `task_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务编码',
  `batches_num` int DEFAULT NULL COMMENT '所属筒',
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工单编码',
  `stove_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '炉台编码',
  `product_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品编码',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品名称',
  `specs` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格',
  `feeding_times` int DEFAULT '0' COMMENT '加料次数 默认初装为0，每次加料要料加1',
  `material_time` datetime DEFAULT NULL COMMENT '要料时间',
  `status` int DEFAULT NULL COMMENT '状态 1:待处理、2:进行中 3:已完成 4:已终止、5：待挪用',
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务操作人',
  `type` tinyint(1) DEFAULT NULL COMMENT '投料类型 1:初装投料 2:加料投料',
  `finish_rod` int DEFAULT '0' COMMENT '是否为完结棒 0：是、1：否',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_feeding_task';

-- mes_furnace_detail: table
CREATE TABLE `mes_furnace_detail` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '投炉明细id',
  `furnace_task_id` bigint DEFAULT NULL COMMENT '投料任务id',
  `batches_num` int DEFAULT NULL COMMENT '所属桶数',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 (0:未完成扫描 1:已完成扫描)',
  `vehicle_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '加料车编码',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_furnace_detail';

-- mes_furnace_task: table
CREATE TABLE `mes_furnace_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '投炉明细id',
  `feeding_task_id` bigint DEFAULT NULL COMMENT '投炉任务id',
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工单编码',
  `stove_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '炉台编码',
  `product_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品编码',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品名称',
  `specs` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格',
  `feeding_times` int DEFAULT '0' COMMENT '加料次数 默认初装为0，每次加料要料加1',
  `material_time` datetime DEFAULT NULL COMMENT '要料时间',
  `status` int DEFAULT NULL COMMENT '状态 1:待处理、2:进行中 3:已完成 4:暂停',
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务操作人',
  `type` tinyint(1) DEFAULT NULL COMMENT '投料类型 1:初装投料 2:加料投料',
  `finish_rod` int DEFAULT '0' COMMENT '是否为完结棒 0：是、1：否',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0',
  `task_code` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '任务编码',
  `feeding_task_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '投料任务编码',
  `vehicle_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '车辆编码',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_furnace_task';

-- mes_lifting_box_task: table
CREATE TABLE `mes_lifting_box_task` (
  `id` bigint NOT NULL COMMENT '主键',
  `box_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '箱号',
  `material_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料编码',
  `material_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料名称',
  `material_size` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料规格',
  `resistance_specification` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电阻档位',
  `product_grade` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品品级',
  `classify_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类码',
  `classify_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类名',
  `classify_max_size` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类规格最大尺寸',
  `classify_min_size` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类规格最小尺寸',
  `classify_num` int DEFAULT NULL COMMENT '分类拼棒数（定长或单包 数量为1）',
  `product_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '导电类型',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `status` int DEFAULT '1' COMMENT '状态：1.空箱 2.未满箱 3.满箱',
  `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `delete_flag` tinyint DEFAULT NULL COMMENT '软删 0：正常 1：删除',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `box_code` (`box_code`),
  UNIQUE KEY `box_code_2` (`box_code`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_lifting_box_task';

-- mes_packing_task: table
CREATE TABLE `mes_packing_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `box_code` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '起托箱号',
  `box_layer` int DEFAULT NULL COMMENT '箱层：1-9',
  `crystal_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '晶编',
  `material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料编码',
  `material_name` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料名称',
  `actual_length` decimal(8,2) DEFAULT NULL COMMENT '实际长度',
  `effective_length` decimal(8,2) DEFAULT '0.00' COMMENT '有效长度',
  `deduction_length` decimal(8,2) DEFAULT NULL COMMENT '扣减长度',
  `material_specifications` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料规格',
  `product_specifications` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格',
  `deduction_type` tinyint DEFAULT NULL COMMENT '扣减类型: 1 崩边',
  `deduction_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '扣减类型名',
  `weight` decimal(8,2) DEFAULT NULL COMMENT '重量',
  `a_side_margin` decimal(8,2) DEFAULT NULL COMMENT 'A面边距',
  `b_side_margin` decimal(8,2) DEFAULT NULL COMMENT 'B面边距',
  `a_resistance` decimal(8,2) DEFAULT NULL COMMENT 'A面中心电阻',
  `b_resistance` decimal(8,2) DEFAULT NULL COMMENT 'B面中心电阻',
  `a_lifetime` decimal(8,2) DEFAULT NULL COMMENT 'A面寿命',
  `b_lifetime` decimal(8,2) DEFAULT NULL COMMENT 'B面寿命',
  `product_grade` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品品级',
  `resistance_grade` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电阻等级',
  `receive_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '领取人',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `is_downgrade` int DEFAULT '0' COMMENT '是否判断为降级 0：不是、1：是',
  `status` tinyint DEFAULT NULL COMMENT '状态：-1退箱 1.暂存 2.进行中 3.完成',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0' COMMENT '0：正常 1：已删除',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_packing_task';

-- mes_poi_formula: table
CREATE TABLE `mes_poi_formula` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `report_material_id` bigint NOT NULL COMMENT '报料Id',
  `material_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料编号',
  `material_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料名称',
  `ratio` decimal(8,2) DEFAULT NULL COMMENT '比例',
  `weight` decimal(10,2) DEFAULT NULL COMMENT '重量 小数点两位、单位kg',
  `batches_num` int DEFAULT NULL COMMENT '所属桶数',
  `material_type` int DEFAULT NULL COMMENT '物料类型 1：坩埚、2：硅料、3：母合金',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建时间',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT NULL COMMENT '软删标识',
  `recipe_type` int DEFAULT NULL COMMENT '配方类型 1：初始配方、2手动修改配方',
  `remark` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_poi_formula';

-- mes_production: table
CREATE TABLE `mes_production` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '晶体编码',
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工单编码',
  `stove_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '炉台编码',
  `product_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品编码',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品名称',
  `product_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '成品类型（规格代码）',
  `specs` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格代码',
  `weight` decimal(10,2) DEFAULT NULL COMMENT '重量',
  `length` decimal(10,2) DEFAULT NULL COMMENT '长度',
  `max_diameter` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '最大直径',
  `min_diameter` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '最小直径',
  `close_mode` tinyint(1) DEFAULT NULL COMMENT '收尾模式 (1:完好收尾 2:等径断棱 3:收尾不良 4:掉棒)',
  `vehicle_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '车辆编码',
  `type` tinyint(1) DEFAULT '1' COMMENT '类型 (1:正常棒 2:断棒)',
  `finish_rod` tinyint(1) DEFAULT '0' COMMENT '是否为完结棒 0：是、1：否',
  `cold_stoking` tinyint(1) DEFAULT NULL COMMENT '是否闷炉  0:是 1:否',
  `oxygen_content` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '氧含量',
  `carbon_content` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '碳含量',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态',
  `stay_time` datetime DEFAULT NULL COMMENT '毛棒停留时间（取棒时毛棒绑定毛棒车生成）',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0',
  `is_transport` tinyint DEFAULT '0' COMMENT '是否质检划线 0：否、 1：是',
  `erp_job` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'erp机加工单编码',
  `square_material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '开方物料编码',
  `square_material_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '开方物料名称',
  `surplus_status` tinyint(1) DEFAULT '0' COMMENT '0表示没有生成余料回收确认任务 1 表示有',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`),
  UNIQUE KEY `code_2` (`code`),
  UNIQUE KEY `code_3` (`code`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_production';

-- mes_recycle_material_storage: table
CREATE TABLE `mes_recycle_material_storage` (
  `id` bigint NOT NULL,
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '单号',
  `material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料编码',
  `material_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料名称',
  `product_type` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '产品类型 1-P 2-N 3-ESS 4-ESS2',
  `material_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料类别',
  `classify_level` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类等级',
  `resistivity` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电阻率',
  `weight` decimal(64,2) DEFAULT NULL COMMENT '净重',
  `gross` decimal(64,2) DEFAULT NULL COMMENT '毛重',
  `tare` decimal(64,2) DEFAULT NULL COMMENT '皮重',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 1-进行中 2-已完成 3-已废除',
  `oper` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `operator_time` datetime DEFAULT NULL COMMENT '起托时间',
  `packer` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '装箱人',
  `pack_time` datetime DEFAULT NULL COMMENT '装箱时间',
  `start_check` tinyint(1) DEFAULT NULL COMMENT '是否发起免洗循环质检',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP,
  `delete_flag` tinyint DEFAULT '0',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `order_no` (`order_no`),
  UNIQUE KEY `order_no_2` (`order_no`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_recycle_material_storage';

-- mes_report_task: table
CREATE TABLE `mes_report_task` (
  `id` bigint NOT NULL,
  `crystal_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '拉晶工单编码',
  `task_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务编码',
  `last_id` bigint DEFAULT NULL COMMENT '上次任务Id',
  `report_type` int DEFAULT NULL COMMENT '报料类型： 1：初装、2：加料',
  `status` int DEFAULT '0' COMMENT '状态 0：待配方、1：已完成',
  `source_type` int DEFAULT NULL COMMENT '来源 1：手动、2：自动',
  `last_total_quantity` decimal(10,2) DEFAULT NULL COMMENT '上一炉台总量',
  `total_quantity` decimal(8,2) DEFAULT NULL COMMENT '总量',
  `leave_poi_quantity` decimal(8,2) DEFAULT NULL COMMENT '留锅量',
  `feed_times` int DEFAULT NULL COMMENT '加料次数',
  `finish_rod` tinyint NOT NULL COMMENT '是否为完结棒 0：是、1：否',
  `feed_quantity` decimal(8,2) DEFAULT NULL COMMENT '加料量',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `recipe_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '配方人员',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人',
  `recipe_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '配方备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `recipe_time` datetime DEFAULT NULL COMMENT '配方完成时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '软删标识',
  `termination_flag` int DEFAULT '1' COMMENT '是否被终止 1： 正常、2：终止',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_report_task` (`report_type`,`delete_flag`,`create_time`,`crystal_code`,`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_report_task';

-- No native definition for element: idx_report_task (index)

-- mes_roll_rub_quality_task: table
CREATE TABLE `mes_roll_rub_quality_task` (
  `id` bigint NOT NULL COMMENT '主键',
  `square_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '方棒编码',
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务领取人',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `status` int DEFAULT '0' COMMENT '状态 1：进行中、2：已完成',
  `is_qualified` int DEFAULT NULL COMMENT '是否合格 1：合格、2：不合格',
  `row_json` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '反切段数据',
  `exception_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '异常类型 1：崩边、2：内裂、3：晶裂',
  `handle_type` int DEFAULT NULL COMMENT '处理类型1：反切、2：转制、3：循环料、4籽晶',
  `material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '转制物料编码',
  `material_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '转制物料名称',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_roll_rub_quality_task';

-- mes_round_bar: table
CREATE TABLE `mes_round_bar` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `production_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '晶体编码',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '圆棒段名称',
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '圆棒晶编号',
  `draw_length` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '画线长度',
  `actual_length` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '真实长度',
  `vehicle_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '车辆编码',
  `column_field1` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'A面中心电阻',
  `column_field2` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'A面少子',
  `column_field3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'A面上R/2电阻',
  `column_field4` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'A面下R/2电阻',
  `column_field5` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'B面中心电阻',
  `column_field6` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'B面少子',
  `column_field7` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'B面上R/2电阻',
  `column_field8` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'B面下R/2电阻',
  `abnormal_appearance_status` tinyint(1) DEFAULT NULL COMMENT '外观异常 0, 1, 2',
  `status` tinyint(1) DEFAULT '0' COMMENT '0-未知,1-正常,2-异常,4-籽晶圆棒,5-循环料',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0',
  `product_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品编码',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品名称',
  `type` tinyint(1) DEFAULT NULL COMMENT '圆棒类型： 1：正常、2：直径细',
  `categorize` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类',
  `oxygen_content` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `carbon_content` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `column_field9` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'A面电阻R/2',
  `column_field10` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'A面电阻R/2',
  `column_field11` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'B面电阻R/2',
  `column_field12` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'B面电阻R/2',
  `length` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '画线长度',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`),
  UNIQUE KEY `code_2` (`code`),
  UNIQUE KEY `code_3` (`code`),
  UNIQUE KEY `code_4` (`code`),
  UNIQUE KEY `code_5` (`code`),
  KEY `idx_mes_round_bar_production_code` (`production_code`),
  KEY `idx_mes_round_bar_create_time` (`create_time`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_round_bar';

-- No native definition for element: idx_mes_round_bar_production_code (index)

-- No native definition for element: idx_mes_round_bar_create_time (index)

-- mes_round_bar_status: table
CREATE TABLE `mes_round_bar_status` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `round_bar_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '圆棒编号',
  `parent_round_bar_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '反切父圆棒晶编',
  `oxygen_carbon_status` tinyint(1) DEFAULT '0' COMMENT '氧碳检测 0未检测, 1已检测',
  `resistive_status` tinyint(1) DEFAULT '0' COMMENT '电阻少子检测 0未检测, 1已检测',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0',
  `resistance_gauging_date` datetime DEFAULT NULL COMMENT '电阻少子检测时间',
  `oxygenated_carbon_date` datetime DEFAULT NULL COMMENT '氧碳检测时间',
  `exception_desc` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '异常',
  `disposition` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '处理方式',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `round_bar_code` (`round_bar_code`),
  UNIQUE KEY `round_bar_code_2` (`round_bar_code`),
  UNIQUE KEY `round_bar_code_3` (`round_bar_code`),
  UNIQUE KEY `round_bar_code_4` (`round_bar_code`),
  KEY `idx_mes_round_bar_status_round_bar_code` (`round_bar_code`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_round_bar_status';

-- No native definition for element: idx_mes_round_bar_status_round_bar_code (index)

-- mes_square: table
CREATE TABLE `mes_square` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '和圆棒编码一致',
  `actual_length` decimal(8,2) DEFAULT NULL COMMENT '开方后长度（mm）',
  `actual_weight` decimal(8,2) DEFAULT NULL COMMENT '真实重量',
  `deduct_length` decimal(8,2) DEFAULT NULL COMMENT '扣减长度（mm）',
  `min_chamfer` decimal(8,2) DEFAULT NULL COMMENT '最小倒角（mm）',
  `min_diagonal_length` decimal(8,2) DEFAULT NULL COMMENT '最小对角线（mm）',
  `min_margin` decimal(8,2) DEFAULT NULL COMMENT '最小边距',
  `max_margin` decimal(8,2) DEFAULT NULL COMMENT '最大边距',
  `min_face_vertical` decimal(8,2) DEFAULT NULL COMMENT '最小端面垂直角度',
  `max_face_vertical` decimal(8,2) DEFAULT NULL COMMENT '最大端面垂直角度',
  `min_chord_length` decimal(8,2) DEFAULT NULL COMMENT '最小弦长',
  `max_chord_length` decimal(8,2) DEFAULT NULL COMMENT '最大弦长',
  `deduct_type` tinyint DEFAULT NULL COMMENT '扣减类型 1：崩边',
  `max_chamfer` decimal(8,2) DEFAULT NULL COMMENT '最大倒角（mm）',
  `chamfer_c` decimal(8,2) DEFAULT NULL COMMENT '倒角c',
  `chamfer_d` decimal(8,2) DEFAULT NULL COMMENT '倒角d',
  `chamfer_e` decimal(8,2) DEFAULT NULL COMMENT '倒角e',
  `chamfer_f` decimal(8,2) DEFAULT NULL COMMENT '倒角f',
  `max_diagonal_length` decimal(8,2) DEFAULT NULL COMMENT '最大对角线（mm）',
  `product_name` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品名称',
  `product_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品编码',
  `specs` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格代码',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '软删标识',
  `is_qualified` tinyint DEFAULT NULL COMMENT '是否合格 1：合格、2：不合格',
  `parent_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '父级编码',
  `draw_length` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '画线长度',
  `is_seed_crystal` int DEFAULT '0' COMMENT '是否判断为籽晶棒 0：不是、1：是',
  `is_downgrade` int DEFAULT '0' COMMENT '是否判断为降级 0：不是、1：是',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `min_square_margin` decimal(8,2) DEFAULT NULL COMMENT '矩形棒边距1',
  `max_square_margin` decimal(8,2) DEFAULT NULL COMMENT '矩形棒边距2',
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`),
  UNIQUE KEY `code_2` (`code`),
  UNIQUE KEY `code_3` (`code`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_square';

-- mes_stick_task: table
CREATE TABLE `mes_stick_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '工单编码',
  `stove_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '炉台编码',
  `crystal_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '晶编',
  `vehicle_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '毛棒车编码',
  `product_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品编码',
  `product_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品名称',
  `finish_rod` tinyint(1) DEFAULT NULL COMMENT '是否为完结棒 0：是、1：否',
  `receive_time` datetime DEFAULT NULL COMMENT '取棒时间',
  `type` tinyint(1) DEFAULT '1' COMMENT '1:正常棒  2:断棒',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 1:待处理  2:进行中 3:已完成 4:已关闭',
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务操作人',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0' COMMENT '0：正常。1：已删除',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `crystal_code` (`crystal_code`),
  UNIQUE KEY `crystal_code_2` (`crystal_code`),
  UNIQUE KEY `crystal_code_3` (`crystal_code`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_stick_task';

-- mes_surplus: table
CREATE TABLE `mes_surplus` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `product_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '毛棒晶编',
  `material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料编码',
  `material_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料名称',
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '余料晶编',
  `spec` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格',
  `surplus_material_type` tinyint DEFAULT NULL COMMENT '余料类型：1.提渣 2.提肩 3.吊多晶',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '软删标识',
  `categorize` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类',
  `resistivity` decimal(10,2) DEFAULT NULL COMMENT '电阻率',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_surplus';

-- mes_surplus_collect_task: table
CREATE TABLE `mes_surplus_collect_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `stove_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '炉台号',
  `product_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品晶编',
  `surplus_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '余料晶编=产品晶编+（YL1（提渣），YL2（提肩），YL3（吊多晶））',
  `material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料编码',
  `material_name` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料名称',
  `product_spec` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格',
  `surplus_material_type` tinyint DEFAULT NULL COMMENT '余料类型：1.提渣 2.提肩 3.吊多晶',
  `weight` decimal(8,2) DEFAULT NULL COMMENT '重量',
  `product_time` datetime DEFAULT NULL COMMENT '生产时间',
  `status` int NOT NULL DEFAULT '1' COMMENT '状态 1：待处理、2：进行中、3：已完成',
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务领取人',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '软删标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_surplus_collect_task';

-- mes_surplus_confirm_task: table
CREATE TABLE `mes_surplus_confirm_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `product_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '毛棒晶编',
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '余料晶编',
  `spec` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格',
  `type` tinyint DEFAULT NULL COMMENT '1.提渣 2.提肩 3.吊多晶 4.头料 5.尾料 6.头片 7.尾片 8.样品切片 10.棒子',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '软删标识',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 1:待处理  2:进行中 3:已完成 4:已关闭',
  `categorize` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类',
  `resistivity` decimal(10,2) DEFAULT NULL COMMENT '电阻率',
  `detector` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '检测仪',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`),
  KEY `idx_mes_surplus_confirm_task_code_status` (`code`,`status`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_surplus_confirm_task';

-- No native definition for element: idx_mes_surplus_confirm_task_code_status (index)

-- mes_transport_task: table
CREATE TABLE `mes_transport_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `type` int DEFAULT NULL COMMENT '运输类型 1：初装运输、2：加料运输、3 毛棒运输、4：圆棒运输、5：循环料运输',
  `belong_area` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属区域',
  `status` int DEFAULT NULL COMMENT '状态 1：未处理、2：处理中、3：已完成',
  `vehicle_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '运输工具编码',
  `target` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '目标地点编码',
  `location` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '起始地点编码',
  `bind_time` datetime DEFAULT NULL COMMENT '绑定时间',
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务领取人',
  `transport_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '运输人',
  `transport_finish` datetime DEFAULT NULL COMMENT '运输完成时间',
  `last_step_id` bigint DEFAULT NULL COMMENT '上一工序业务Id',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `crystal_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '毛棒晶编',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/mes_transport_task';

-- yz_mes_spec: table
CREATE TABLE `yz_mes_spec` (
  `id` bigint NOT NULL COMMENT '主键',
  `spec_code` varchar(64) DEFAULT NULL COMMENT '规格代码',
  `cooling_time` decimal(6,0) DEFAULT NULL COMMENT '冷却时间',
  `spec_category` varchar(32) DEFAULT NULL COMMENT '类别',
  `conductive_type` varchar(32) DEFAULT NULL COMMENT '导电类型',
  `remarks` varchar(255) DEFAULT NULL COMMENT '备注',
  `hair_rod_coefficient` decimal(4,2) DEFAULT NULL COMMENT '毛棒折重系数',
  `round_rod_coefficient` decimal(4,2) DEFAULT NULL COMMENT '圆棒折重系数',
  `hair_square_rod_coefficient` decimal(4,2) DEFAULT NULL COMMENT '毛方棒折重系 ',
  `square_rod_coefficient` decimal(4,2) DEFAULT NULL COMMENT '方棒折重系数',
  `allow_customer` varchar(64) DEFAULT NULL COMMENT '可发客户',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `org_id` varchar(32) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/yz_mes_spec';

-- yz_mes_spec_value: table
CREATE TABLE `yz_mes_spec_value` (
  `id` bigint NOT NULL COMMENT '主键',
  `spec_id` bigint DEFAULT NULL COMMENT '规格外键',
  `spec_attribute_name` varchar(64) DEFAULT NULL COMMENT '属性名称',
  `spec_attribute_type` varchar(64) DEFAULT NULL COMMENT '属性类型',
  `standard_value` varchar(64) DEFAULT NULL COMMENT '属性标准值/上值',
  `value` varchar(64) DEFAULT NULL COMMENT '属性公差/下值',
  `is_contain` varchar(4) DEFAULT '0' COMMENT '是否包含上下值 0全部包含 1包含上值 2 包含下值',
  PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='[REDACTED]/raipiot-mes/yz_mes_spec_value';

