-- base_coefficient_conversion: table
CREATE TABLE `base_coefficient_conversion` (
  `id` bigint NOT NULL COMMENT '主键',
  `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '类型',
  `model_alias` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '类型别名',
  `standard_diameter` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `conversion_factor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `square_rod_coefficient` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef4` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef5` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef6` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef7` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef8` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef9` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `vdef10` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `sort` int DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- erp_job_mtl: table
CREATE TABLE `erp_job_mtl` (
  `id` bigint NOT NULL COMMENT '主键',
  `job_head_id` bigint DEFAULT NULL COMMENT '工单头id',
  `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '公司',
  `job_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '工单号',
  `assembly_seq` int DEFAULT NULL COMMENT '次半成品序号',
  `mtl_seq` int DEFAULT NULL COMMENT '物料序号',
  `part_num` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料编号',
  `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料描述',
  `revision_num` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料版本',
  `stage_c` int DEFAULT NULL COMMENT '投料阶段',
  `qty_per` decimal(18,8) DEFAULT NULL COMMENT '单位用量百分比',
  `related_operation` int DEFAULT NULL COMMENT '所属工序',
  `warehouse_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '收料仓库',
  `required_qty` double(18,8) DEFAULT NULL COMMENT '需求数量',
  `issued_qty` double(18,8) DEFAULT NULL COMMENT '发料数量',
  `mium` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '单位',
  `fixed_qty` tinyint(1) DEFAULT NULL COMMENT '固定数量',
  `back_flush` tinyint(1) DEFAULT NULL COMMENT '反冲',
  `direct` tinyint(1) DEFAULT NULL COMMENT '直接生产',
  `buy_it` tinyint(1) DEFAULT NULL COMMENT '直接采购',
  `issued_complete` tinyint(1) 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='05_工单物料（覆盖）';

-- 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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='82_发料申请';

-- erp_job_mtl_manage_detail: table
CREATE TABLE `erp_job_mtl_manage_detail` (
  `id` bigint NOT NULL COMMENT '主键',
  `job_mtl_manage_task_id` bigint DEFAULT NULL COMMENT '任务id',
  `job_head_id` bigint DEFAULT NULL COMMENT '工单头id',
  `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '公司',
  `job_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '工单号',
  `assembly_seq` int DEFAULT NULL COMMENT '次半成品序号',
  `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 '物料版本',
  `stage_c` int DEFAULT NULL COMMENT '投料阶段',
  `qty_per` decimal(18,8) DEFAULT NULL COMMENT '单位用量百分比',
  `related_operation` int DEFAULT NULL COMMENT '所属工序',
  `warehouse_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '收料仓库',
  `required_qty` double(18,8) DEFAULT NULL COMMENT '需求数量',
  `issued_qty` double(18,8) DEFAULT NULL COMMENT '发料数量',
  `mium` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '单位',
  `fixed_qty` tinyint(1) DEFAULT NULL COMMENT '固定数量',
  `back_flush` tinyint(1) DEFAULT NULL COMMENT '反冲',
  `direct` tinyint(1) DEFAULT NULL COMMENT '直接生产',
  `buy_it` tinyint(1) DEFAULT NULL COMMENT '直接采购',
  `issued_complete` tinyint(1) 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 '软删标识',
  `status` tinyint DEFAULT NULL COMMENT '-1:已废除 0：待处理 1：进行中 2：已完成',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='04_job单管理物料详情（新增）';

-- erp_job_mtl_manage_task: table
CREATE TABLE `erp_job_mtl_manage_task` (
  `id` bigint NOT NULL COMMENT '主键',
  `old_id` bigint DEFAULT NULL COMMENT '历史任务id',
  `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '公司',
  `job_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '工单号',
  `product_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '成品物料编码',
  `product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '成品物料名称',
  `plan_total` decimal(10,2) DEFAULT NULL COMMENT '计划总量',
  `finish_total` decimal(10,2) DEFAULT NULL COMMENT '已报告总量',
  `ium` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '单位',
  `req_due_date` datetime DEFAULT NULL COMMENT '需求日期',
  `receive_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci DEFAULT NULL COMMENT '任务处理人',
  `status` tinyint DEFAULT '0' COMMENT '-1:已废除  0：进行中   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 '0' COMMENT '软删标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='03_job单物料同步记录（新增）';

-- 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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='83_pda发料';

-- erp_job_opr: table
CREATE TABLE `erp_job_opr` (
  `id` bigint NOT NULL COMMENT '主键',
  `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '公司',
  `job_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '工单号',
  `job_complete` tinyint(1) DEFAULT NULL COMMENT '完成  0=未完成；1=已完成',
  `op_complete` tinyint(1) DEFAULT NULL COMMENT '工序完成 0=未完成；1=已完成',
  `assembly_seq` int DEFAULT NULL COMMENT '次半成品序号',
  `opr_seq` int DEFAULT NULL COMMENT '工序序号',
  `op_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '工序编号',
  `op_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '工序描述',
  `primary_prod_op_dtl` int DEFAULT NULL COMMENT '资源（生产）ID',
  `primary_setup_op_dtl` int DEFAULT NULL COMMENT '资源（设置）ID',
  `labor_entry_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '报工方式',
  `prod_standard` double(10,2) DEFAULT NULL COMMENT '标准工时',
  `std_format` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '工时单位',
  `sched_relation` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '排程方式',
  `opr_start_date` date DEFAULT NULL COMMENT '工序开始日期',
  `opr_due_date` date DEFAULT NULL COMMENT '工序结束日期',
  `op_dtl_seq` int DEFAULT NULL COMMENT '已安排资源序号',
  `op_dtl_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '已安排资源描述',
  `resource_grp_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '资源组ID',
  `resource_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '资源ID',
  `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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='07_ERP工序';

-- hj_util: table
CREATE TABLE `hj_util` (
  `col1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col4` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col5` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col6` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col7` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col8` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col9` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- mes_abnormal_feedback: table
CREATE TABLE `mes_abnormal_feedback` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '编码',
  `one_classify` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '一级分类（数据字典dict_value）',
  `second_classify` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '二级分类（数据字典dict_value）',
  `task_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工单或者晶编',
  `module` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '模块名',
  `feedback_content` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '反馈内容',
  `reply_content` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '回复内容',
  `images` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '图片路径',
  `status` tinyint(1) DEFAULT '0' COMMENT '状态 0:待处理 1:进行中 2:已处理',
  `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 '删除标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `code` (`code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1669546759727161346 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='93_异常反馈';

-- mes_crystal_flow: table
CREATE TABLE `mes_crystal_flow` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `crystal_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '晶体编码',
  `crystal_type` tinyint DEFAULT NULL COMMENT '1毛棒 2 圆棒 3 方棒',
  `binding_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '绑定编码',
  `binding_type` tinyint DEFAULT NULL COMMENT '4周转车 5库位',
  `delete_flag` tinyint DEFAULT '0' 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 '物料名称',
  `specs` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格',
  `status` tinyint 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 NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_mes_crystal_flow_crystal_code` (`crystal_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677234476149051395 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='80_晶体流转表';

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

-- 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`) USING BTREE,
  KEY `idx_crystal_order` (`order_no`,`stove_no`,`material_code`,`material_name`,`product_type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689161176541777922 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='08_工单排产';

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

-- mes_device: table
CREATE TABLE `mes_device` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '编码',
  `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '名称',
  `type_lable` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '类型标签(数据字典dict_label)',
  `type_value` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '类型键值（数据字典dict_value）',
  `spec_model` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '规格型号',
  `unit_lable` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '计量单位标签(数据字典dict_label)',
  `unit_value` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '计量单位键值（数据字典dict_value）',
  `iot_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'iot设备IP地址',
  `iot_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'iot设备id',
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态（0:启用 1:停用 -1:其他）',
  `remark` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' 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`) USING BTREE,
  UNIQUE KEY `uk_code` (`code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1207 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='90_设备信息表';

-- mes_device_attribute: table
CREATE TABLE `mes_device_attribute` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `device_code` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '设备编码',
  `gb_height` decimal(10,2) DEFAULT NULL COMMENT '埚邦高度',
  `zl_volume` decimal(10,2) DEFAULT NULL COMMENT '装料量',
  `max_zl_volume` decimal(10,2) DEFAULT NULL COMMENT '最大装料量',
  `thermal_field_size` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '热场尺寸',
  `main_opera_user` varchar(1000) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '主操作人',
  `main_opera_user_name` varchar(1000) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '主操作人名',
  `company` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '公司Id',
  `company_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '公司名',
  `factory` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '工厂Id',
  `factory_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '工厂名',
  `work_shop` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '所属车间Id',
  `work_shop_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '所属车间名',
  `area` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '所属区域Id',
  `area_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '所属区域名',
  `resource_group` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '资源组',
  `resource` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '资源',
  `provice_type` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '产品类型',
  `create_by` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `update_by` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1674984202726449155 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='91_设备属性表';

-- mes_dict: table
CREATE TABLE `mes_dict` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典编码',
  `dict_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '字典标签',
  `dict_value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '字典键值',
  `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '字典类型',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `delete_flag` tinyint(1) NOT NULL DEFAULT '0',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1565614710672777219 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字典数据表';

-- mes_dismantle_task: table
CREATE TABLE `mes_dismantle_task` (
  `id` bigint NOT NULL AUTO_INCREMENT 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 '炉台编码',
  `thermal_field_size` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '热场尺寸',
  `calcination_flag` tinyint(1) DEFAULT NULL COMMENT '是否煅烧(0:否 1:是)',
  `status` int DEFAULT NULL 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 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',
  `remark` varchar(500) 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677228586213691394 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='32_拆清任务表';

-- mes_dismantle_thermal: table
CREATE TABLE `mes_dismantle_thermal` (
  `id` bigint NOT NULL,
  `task_id` bigint NOT NULL COMMENT '拆清任务Id',
  `change_reason_lab` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更换原因',
  `change_reason_value` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更换原因',
  `calcination_flag` tinyint(1) DEFAULT '0' COMMENT '是否煅烧(0:否 1:是)',
  `material_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料编码',
  `material_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料名称',
  `spec_model` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '规格型号',
  `thermal_serial` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '热场件序列号（唯一）',
  `supplier` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '供应商',
  `batch_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '批次号',
  `drawing_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '图纸号',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint NOT NULL DEFAULT '0',
  `install_time` datetime DEFAULT NULL COMMENT '安装时间',
  `install_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '安装人',
  `replace_time` datetime DEFAULT NULL COMMENT '更换时间',
  `replace_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更换人',
  `stove_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '炉台编码',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='33_拆清更换热场件信息';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=14503 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='76_免洗质检任务';

-- 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_general_ci NOT NULL COMMENT '毛棒晶编',
  `erp_job` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'erpJob单号',
  `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 '开方物料名称',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 1:待处理、3：已完成',
  `draw_list` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '质检画线列表',
  `exception_list` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '异常段(不做任何处理)',
  `receive_user` 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 '物料名称',
  `specs` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格代码',
  `vehicle_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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 '最小直径',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_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_general_ci DEFAULT '' COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0' COMMENT '0：正常。1：已删除',
  `close_mode` tinyint DEFAULT NULL COMMENT '收尾模式 (1:完好收尾 2:等径断棱 3:收尾不良)',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `mes_draw_line_task_code_index` (`hairy_rod_crystal_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689163292924477442 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='40_质检画线任务';

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

-- mes_electrical_performance_task: table
CREATE TABLE `mes_electrical_performance_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `round_bar_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '圆棒编号',
  `production_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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 '物料名称',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 1:待处理  2:进行中 3:已完成 4:已关闭',
  `disposal_confirmation` tinyint(1) DEFAULT NULL COMMENT '处置确认 1反切、2转制、3降级、4籽晶圆棒、5循环料、6正常开方',
  `disposal_result` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '处置结果',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_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(1) DEFAULT '0',
  `categorize` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `is_qualified` int DEFAULT NULL COMMENT '是否合格 0不合格 1合格',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `round_bar_code` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_2` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_3` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_4` (`round_bar_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677235496569315331 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='47_电性能判定表';

-- mes_electrical_performance_task_log: table
CREATE TABLE `mes_electrical_performance_task_log` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `round_bar_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '圆棒编号',
  `production_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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 '物料名称',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 1:待处理  2:进行中 3:已完成 4:已关闭',
  `disposal_confirmation` tinyint(1) DEFAULT NULL COMMENT '处置确认 1反切、2转制、3降级、4籽晶圆棒、5循环料、6正常开方',
  `disposal_result` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '处置结果',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_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(1) DEFAULT '0',
  `categorize` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
  `operate_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '操作类型',
  `electrical_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '电性能类型',
  `round_bar_codes` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '反切圆棒晶编',
  `specimens` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '反切样片晶编',
  `operate_times` int DEFAULT NULL COMMENT '操作次数',
  `row_json` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '截断段',
  `is_qualified` int DEFAULT NULL COMMENT '是否合格 0不合格 1合格',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677235714441809923 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='电性能判定表日志';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689160882572091395 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='13_投料明细';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689160880353304579 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='12_投料任务';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689163005007261699 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='16_加料投炉明细';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689162702291161091 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='15_投炉任务';

-- mes_job: table
CREATE TABLE `mes_job` (
  `id` bigint NOT NULL,
  `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '公司id',
  `job_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'job编码',
  `revision_num` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '成品版本',
  `version_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '配方版本',
  `plan_total` decimal(20,2) DEFAULT NULL COMMENT 'Job计划总量',
  `finish_total` decimal(20,2) DEFAULT NULL COMMENT '已报工总量',
  `run_device_count` int DEFAULT NULL COMMENT '运行设备数量',
  `product_code` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '成品编码',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '成品名称',
  `product_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '成品类型',
  `specs` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '产品规格',
  `req_due_date` date DEFAULT NULL COMMENT '需求日期',
  `start_date` date DEFAULT NULL COMMENT '开始日期',
  `due_date` date DEFAULT NULL COMMENT '到期日期',
  `closed` tinyint DEFAULT NULL COMMENT '关闭  0=已关闭；1=未关闭',
  `closed_date` date DEFAULT NULL COMMENT '关闭日期',
  `complete` tinyint DEFAULT NULL COMMENT '完成 0=已完成；1=未完成',
  `complete_date` date 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 NOT NULL DEFAULT '0' COMMENT '软删标识',
  `sched_code` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '优先级',
  `ium` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '单位',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='02_同步Job（覆盖）';

-- mes_job_recipe: table
CREATE TABLE `mes_job_recipe` (
  `id` bigint NOT NULL COMMENT '主键',
  `job_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'job单号',
  `product_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '成品物料编码',
  `version_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '配方版本',
  `material_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '生产物料编码',
  `material_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '生产物料名称',
  `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '"1"： 原生多晶硅料、"2"： 循环料、"3"： 成品/半成品、4：生产辅材',
  `ratio` decimal(18,8) DEFAULT NULL COMMENT '比例',
  `unit` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '单位',
  `process` int DEFAULT NULL COMMENT '工序 0：初装、1以后代表加料以及加料次数',
  `product_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '产品类型',
  `is_default` tinyint DEFAULT '0' COMMENT '默认数据:0否  1是',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '软删标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='06_ERP配方（覆盖）';

-- 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`) USING BTREE,
  UNIQUE KEY `box_code` (`box_code`) USING BTREE,
  UNIQUE KEY `box_code_2` (`box_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='54_方棒起箱';

-- mes_magnet_choice: table
CREATE TABLE `mes_magnet_choice` (
  `id` bigint NOT NULL,
  `order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '单号',
  `job_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'job单号',
  `batch` 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_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '物料类型',
  `weight` decimal(8,2) DEFAULT NULL COMMENT '磁选重量',
  `resistivity` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电阻率',
  `supplier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '供应商',
  `operator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作人',
  `operator_time` datetime 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 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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='75_磁选记录表';

-- mes_material: table
CREATE TABLE `mes_material` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Erp中物料编码',
  `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料名称',
  `type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料类型 1: 坩埚、2：配料、3：母合金、4：产品 、5：边皮',
  `material_size` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料规格',
  `material_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '5：边皮',
  `product_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '产品类型 1-P 2-N 3-ESS 4-ESS2',
  `classify_level` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '分类等级',
  `plan_rod_count` int DEFAULT NULL COMMENT '计划毛棒数量',
  `resistivity` decimal(8,2) DEFAULT NULL COMMENT '电阻率',
  `resistance_grade` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '电阻挡位',
  `attribute` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料属性',
  `company` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '公司名称',
  `part_description` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料描述',
  `uom_class_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '单位类别',
  `ium` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '库存单位',
  `sale_sum` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '销售单位',
  `pum` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '采购单位',
  `prod_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '产品群组',
  `product_specifications` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '产品规格',
  `product_grade` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '产品等级',
  `class_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料类别',
  `track_lots` tinyint(1) DEFAULT NULL COMMENT '追踪批次',
  `track_serial_num` tinyint(1) DEFAULT NULL COMMENT '追踪序号',
  `non_stock` tinyint(1) DEFAULT NULL COMMENT '非库存项',
  `qty_bearing` tinyint(1) DEFAULT NULL COMMENT '数量关系',
  `inactive` tinyint(1) 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='06_物料表（作用不明，删了初装配方报错）';

-- mes_mother_alloy: table
CREATE TABLE `mes_mother_alloy` (
  `id` bigint NOT NULL COMMENT '主键',
  `report_id` bigint DEFAULT NULL COMMENT '报料Id',
  `feed_id` bigint DEFAULT NULL COMMENT '投料任务ID',
  `mother_alloy_name` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '母合金名称',
  `mother_alloy_code` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '母合金编码',
  `weight` decimal(8,4) DEFAULT NULL COMMENT '重量',
  `batch` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '批次',
  `resistivity` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT '电阻率',
  `photograph_flag` tinyint DEFAULT '1' COMMENT '拍照标识 (0:不需要拍照 1:必须拍照上传)',
  `create_by` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_by` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT NULL COMMENT '软删标识',
  `status` int DEFAULT '0' COMMENT '母合金状态：0：待领取、1：待投料、2已投料',
  `attachment` varchar(1000) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '附件',
  `batch_num` int DEFAULT NULL COMMENT '所属筒',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='11_母合金信息表';

-- mes_mother_alloy_bind: table
CREATE TABLE `mes_mother_alloy_bind` (
  `id` bigint NOT NULL,
  `mother_alloy_task_id` bigint NOT NULL COMMENT '母合金任务id',
  `report_task_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '报料任务编码',
  `feeding_task_code` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT '投料任务code',
  `car_no` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT '加料车',
  `feeding_times` int DEFAULT NULL COMMENT '投料次数',
  `status` int DEFAULT NULL COMMENT '状态：1已绑定 2解绑',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='母合金绑定记录表';

-- mes_mother_alloy_task: table
CREATE TABLE `mes_mother_alloy_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '母合金任务id',
  `feeding_task_id` bigint DEFAULT NULL COMMENT '投料任务id',
  `report_material_id` bigint DEFAULT NULL COMMENT '报料任务id',
  `task_code` varchar(64) 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 NOT NULL COMMENT '产品编码',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品名称',
  `batch_num` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '批次号',
  `resistivity` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电阻率',
  `standard_weight` decimal(10,4) DEFAULT NULL COMMENT '标准重量 小数点两位、单位kg',
  `receive_weight` decimal(10,4) DEFAULT NULL COMMENT '领取重量 小数点两位、单位kg',
  `feeding_times` int DEFAULT '0' COMMENT '加料次数 默认初装为0，每次加料要料加1',
  `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:加料投料',
  `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',
  `material_time` datetime DEFAULT NULL,
  `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 '物料名称',
  `report_task_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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677235979282665475 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='10_母合金任务';

-- mes_multi_cut: table
CREATE TABLE `mes_multi_cut` (
  `id` bigint NOT NULL COMMENT 'id',
  `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '方棒晶编',
  `product_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料编码',
  `product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '物料名称',
  `actual_length` decimal(8,2) DEFAULT NULL COMMENT '真实长度',
  `machine_no` varbinary(255) DEFAULT NULL COMMENT '截断机码',
  `row_json` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '截断json列表',
  `status` int DEFAULT '1' COMMENT '任务状态 1:进行中 2:已完成',
  `type` int DEFAULT NULL COMMENT '外观反切(不改变晶编) 2：多刀与外观反切(改变晶编) 3:半棒加工',
  `code_type` int DEFAULT NULL COMMENT '晶编类型：1：圆棒  2:方棒 3:籽晶圆棒 4:半棒加工',
  `receive_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '任务领取人id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  `delete_flag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT '软删表示 0:正常 1:删除',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `is_qualified` int DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='56_外观反切/断刀';

-- mes_order_tracing: table
CREATE TABLE `mes_order_tracing` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `order_no` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '工单编号',
  `code` varchar(500) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '编号',
  `operator` varchar(500) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '操作人',
  `name` varchar(500) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '名称',
  `detail` varchar(500) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '细节',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `close` tinyint(1) DEFAULT NULL COMMENT '是否关闭',
  `create_by` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `update_by` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236164683485186 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='81_工单追溯表';

-- mes_oxygen_carbon_detection_task: table
CREATE TABLE `mes_oxygen_carbon_detection_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工单编码',
  `specimen_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '样片晶编号',
  `production_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '毛棒编号',
  `round_bar_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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 '物料名称',
  `detector` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '检测仪',
  `oxygen_content` decimal(10,2) DEFAULT NULL COMMENT '氧含量',
  `carbon_content` decimal(5,2) DEFAULT NULL COMMENT '碳含量',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 1:待处理  2:进行中 3:已完成 4:已关闭',
  `receive_user` 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 '备注',
  `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',
  `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称',
  `lettering_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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236207591215106 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='45_氧碳检测任务';

-- mes_packing_detail: table
CREATE TABLE `mes_packing_detail` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `packing_task_id` bigint DEFAULT NULL COMMENT '包装任务id',
  `box_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '箱子编号',
  `layer` int DEFAULT NULL COMMENT '层',
  `square_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '方棒晶编号',
  `weight` decimal(10,2) DEFAULT NULL COMMENT '重量',
  `qualified_length` int DEFAULT NULL COMMENT '合格长度',
  `type` tinyint(1) DEFAULT NULL COMMENT '扣减类型',
  `deduction_length` decimal(10,2) DEFAULT NULL COMMENT '扣减长度',
  `margin_min` decimal(10,2) DEFAULT NULL COMMENT '边距最小值',
  `margin_max` decimal(10,2) DEFAULT NULL COMMENT '边距最大值',
  `resistance_gear` tinyint(1) DEFAULT NULL COMMENT '电阻档位',
  `life_gear` tinyint(1) DEFAULT NULL COMMENT '寿命档位',
  `is_qualified` tinyint(1) DEFAULT '0' COMMENT '是否合格 0：正常 1：已删除',
  `remark` varchar(200) 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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='包装详情';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689163518779543554 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='55_包装任务';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=690499 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='09_MES配方';

-- mes_pre_clean: table
CREATE TABLE `mes_pre_clean` (
  `id` bigint NOT NULL,
  `silicon_material_code` 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(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品名称',
  `material_type` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '物料类别',
  `receive_user` 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 '电阻率',
  `inventory_level` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '入库等级',
  `net_weight` decimal(8,2) DEFAULT NULL COMMENT '净重',
  `status` tinyint DEFAULT '1' COMMENT '状态 1：处理中、2： 已完成',
  `is_send` int DEFAULT NULL COMMENT '是否发起非免洗质检 1：是、2：否',
  `receive_time` datetime DEFAULT NULL COMMENT '领料时间',
  `lifting_time` datetime DEFAULT NULL COMMENT '起托时间',
  `lifting_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '起托人员',
  `storage_time` datetime DEFAULT NULL COMMENT '装箱时间',
  `storage_by` 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,
  `delete_flag` tinyint DEFAULT '0',
  `product_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '产品类型',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='62_预清洗';

-- 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`) USING BTREE,
  UNIQUE KEY `code` (`code`) USING BTREE,
  UNIQUE KEY `code_2` (`code`) USING BTREE,
  UNIQUE KEY `code_3` (`code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689162546293010434 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='41_毛棒表';

-- 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`) USING BTREE,
  UNIQUE KEY `order_no` (`order_no`) USING BTREE,
  UNIQUE KEY `order_no_2` (`order_no`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='60_循环料起托入库';

-- mes_recycle_material_storage_detail: table
CREATE TABLE `mes_recycle_material_storage_detail` (
  `id` bigint NOT NULL,
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '单号',
  `main_id` bigint DEFAULT NULL COMMENT '主id',
  `status` tinyint(1) DEFAULT NULL COMMENT '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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='64_循环料拆合批记录';

-- 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=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

-- mes_resistance_gauging_task: table
CREATE TABLE `mes_resistance_gauging_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `round_bar_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '圆棒晶编号',
  `production_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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 '物料名称',
  `detector_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '检测仪',
  `column_field1` decimal(10,2) DEFAULT NULL COMMENT 'A 电阻 中心',
  `column_field2` decimal(10,2) DEFAULT NULL COMMENT 'A 少子 中心',
  `column_field3` decimal(10,2) DEFAULT NULL COMMENT 'A 电阻 R 2-1',
  `column_field4` decimal(10,2) DEFAULT NULL COMMENT 'A 电阻 R 2-2',
  `column_field5` decimal(5,2) DEFAULT NULL COMMENT 'B 电阻 中心',
  `column_field6` decimal(10,2) DEFAULT NULL COMMENT 'B 少子 中心',
  `column_field7` decimal(10,2) DEFAULT NULL COMMENT 'B 电阻 R 2-1',
  `column_field8` decimal(10,2) DEFAULT NULL COMMENT 'B 电阻 R 2-2',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 1:待处理  2:进行中 3:已完成 4:已关闭',
  `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 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',
  `abnormal_appearance_status` tinyint(1) DEFAULT '0' COMMENT '外观异常 0, 1, 2',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `round_bar_code` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_2` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_3` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_4` (`round_bar_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236429428035586 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='44_电子少阻检测任务';

-- 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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='52_方棒终检';

-- mes_roll_rub_task: table
CREATE TABLE `mes_roll_rub_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 '任务领取人',
  `roll_machine` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '滚磨机',
  `status` int DEFAULT '1' COMMENT '状态 1：进行中、2：已完成',
  `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',
  `feed_time` datetime DEFAULT NULL COMMENT '上料时间',
  `report_work_time` datetime DEFAULT NULL COMMENT '报工时间',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='51_滚磨任务表';

-- 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`) USING BTREE,
  UNIQUE KEY `code` (`code`) USING BTREE,
  UNIQUE KEY `code_2` (`code`) USING BTREE,
  UNIQUE KEY `code_3` (`code`) USING BTREE,
  UNIQUE KEY `code_4` (`code`) USING BTREE,
  UNIQUE KEY `code_5` (`code`) USING BTREE,
  KEY `idx_mes_round_bar_production_code` (`production_code`) USING BTREE,
  KEY `idx_mes_round_bar_create_time` (`create_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689163114872262659 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='48_圆棒表';

-- 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_label: table
CREATE TABLE `mes_round_bar_label` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `round_bar_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '圆棒晶编号',
  `chipping` tinyint(1) DEFAULT '0' COMMENT '崩边',
  `interna_break` tinyint(1) DEFAULT '0' COMMENT '内裂',
  `crystal_cleavage` tinyint(1) DEFAULT '0' COMMENT '晶裂',
  `low_life` tinyint(1) DEFAULT '0' COMMENT '寿命低',
  `hyperoxia` tinyint(1) DEFAULT '0' COMMENT '氧高',
  `carbon_high` tinyint(1) DEFAULT '0' COMMENT '碳高',
  `resistance_high` tinyint(1) DEFAULT '0' COMMENT '电阻高',
  `resistance_low` tinyint(1) DEFAULT '0' COMMENT '电阻低',
  `life_ratio_low` tinyint(1) DEFAULT '0' COMMENT '寿命比值低',
  `zhi_Jing_xi` tinyint(1) DEFAULT '0' COMMENT '直径细',
  `niu_qu` tinyint(1) DEFAULT '0' COMMENT '扭曲',
  `bian_xing` tinyint(1) DEFAULT '0' COMMENT '变形',
  `duo_leng_xian` tinyint(1) DEFAULT '0' 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 DEFAULT 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`) USING BTREE,
  UNIQUE KEY `round_bar_code` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_2` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_3` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_4` (`round_bar_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236083888607235 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='42_圆棒标签表';

-- 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`) USING BTREE,
  UNIQUE KEY `round_bar_code` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_2` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_3` (`round_bar_code`) USING BTREE,
  UNIQUE KEY `round_bar_code_4` (`round_bar_code`) USING BTREE,
  KEY `idx_mes_round_bar_status_round_bar_code` (`round_bar_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689163310838349826 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='49_圆棒状态表';

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

-- mes_schedule: table
CREATE TABLE `mes_schedule` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工单编号',
  `source_type` int DEFAULT NULL COMMENT '排产来源 1、对接ERP  2、手动排产',
  `product_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品编码',
  `product_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品名称',
  `thermal_field_size` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '热场尺寸 下拉框',
  `plan_rod_count` int DEFAULT NULL COMMENT '计划毛棒数量',
  `plan_starts_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 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 NOT NULL DEFAULT '0' COMMENT '软删标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='排产信息表';

-- mes_seed_crystal: table
CREATE TABLE `mes_seed_crystal` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `job_num` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `crystal_spec_value` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '籽晶规格',
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '籽晶编码',
  `round_bar_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '圆棒编码',
  `task_id` bigint NOT NULL COMMENT '任务Id',
  `create_by` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0：正常。1：已删除',
  `serial_num` int DEFAULT NULL COMMENT '序号',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='58_籽晶表';

-- mes_seed_crystal_machine_task: table
CREATE TABLE `mes_seed_crystal_machine_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `round_bar_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '圆棒编码',
  `product_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '物料编码',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '物料名称',
  `job_num` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'JOB单',
  `crystal_spec_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `crystal_spec_value` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `serial_start_val` int DEFAULT NULL,
  `serial_end_val` int DEFAULT NULL,
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务领取人',
  `count` int DEFAULT '0' COMMENT '确认提交次数',
  `create_by` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0：正常。1：已删除',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='57_籽晶排产';

-- mes_seedcrystal_change: table
CREATE TABLE `mes_seedcrystal_change` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `stove_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '炉台编码',
  `seedcrystal_no` 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,
  `product_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `create_by` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1675350011667574786 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='18_籽晶更换记录';

-- mes_silicon_clean_auto: table
CREATE TABLE `mes_silicon_clean_auto` (
  `id` bigint NOT NULL COMMENT '主键',
  `clean_id` bigint NOT NULL COMMENT '清洗任务Id',
  `clean_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '清洗类型：1、人工 2、机洗',
  `clean_machine` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '清洗机器',
  `order_classes` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '班次：1、白班，2 夜班',
  `clean_process` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '清洗工艺 1：水洗、2：酸洗',
  `opera_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作人名称',
  `water_conductivity` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '水电导率',
  `sink_p_h` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '水槽ph值',
  `clean_date` 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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='73_清洗记录';

-- mes_silicon_clean_fracture: table
CREATE TABLE `mes_silicon_clean_fracture` (
  `id` bigint NOT NULL COMMENT '主键',
  `clean_id` bigint DEFAULT NULL COMMENT '清洗任务id',
  `fracture_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '破碎方式 1、人工，2、机器',
  `order_classes` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '班次：1、白班，2、夜班',
  `material_specification` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '破碎规格 1、大料，2、小料',
  `opera_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作人员名',
  `fracture_time` datetime DEFAULT NULL COMMENT '破碎时间',
  `fracture_weight` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '破碎质量',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='74_清洗破碎';

-- mes_silicon_clean_soak: table
CREATE TABLE `mes_silicon_clean_soak` (
  `id` bigint NOT NULL COMMENT '主键',
  `clean_id` bigint NOT NULL COMMENT '清洗任务Id',
  `acid_use_days` int DEFAULT NULL COMMENT '酸使用天数',
  `standard_soaking_time` int DEFAULT NULL COMMENT '标准浸泡时间(6,12,24)',
  `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 '软删标识',
  `opera_user` varchar(255) 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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='71_清洗浸泡';

-- mes_silicon_clean_soak_manage: table
CREATE TABLE `mes_silicon_clean_soak_manage` (
  `id` bigint NOT NULL COMMENT '主键',
  `soak_id` bigint DEFAULT NULL COMMENT '浸泡任务id',
  `actual_soak_time` bigint DEFAULT NULL COMMENT '实际浸泡时间',
  `start_soak_time` datetime DEFAULT NULL COMMENT '开始浸泡时间',
  `discharge_time` datetime DEFAULT NULL COMMENT '出料时间',
  `opera_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '操作人',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识（0正常，1删除）',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='72_浸泡浸泡子表';

-- mes_silicon_clean_task: table
CREATE TABLE `mes_silicon_clean_task` (
  `id` bigint NOT NULL COMMENT '主键',
  `type` tinyint(1) DEFAULT NULL COMMENT '类型：1：原料  2：循环料',
  `order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '单号',
  `job_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'job单号',
  `job_material_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'job物料',
  `job_material_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'job物料名称',
  `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 '电阻率',
  `supplier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '供应商',
  `weight` decimal(64,2) DEFAULT NULL COMMENT '净重',
  `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '批次号',
  `packer` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '装箱人',
  `pack_time` datetime DEFAULT NULL COMMENT '装箱时间',
  `qualified` tinyint(1) 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 '品检时间',
  `technology_qualified` tinyint(1) DEFAULT NULL COMMENT '工艺是否合格 1:合格 2:不合格',
  `technology_qualified_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工艺质检人',
  `technology_qualified_time` datetime DEFAULT NULL COMMENT '工艺时间',
  `receive_user` 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` tinyint(1) DEFAULT NULL COMMENT '状态：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 '0' COMMENT '软删标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `is_multi` tinyint(1) DEFAULT NULL COMMENT '0:常规 1:联合工单',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='70_硅料清洗任务表';

-- mes_specimen: table
CREATE TABLE `mes_specimen` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '样品晶编',
  `production_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '毛棒晶编',
  `draw_length` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '画线长度',
  `type` int DEFAULT NULL COMMENT '类型：1：头盖、2：头片、3：尾盖、4：尾片、5. 多棱线、6： 晶裂、7： 变形、8： 扭曲、9： 无棱、10： 位错、11：直径细 12:头反切 13:收尾',
  `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_content` decimal(10,2) DEFAULT NULL COMMENT '氧含量',
  `carbon_content` decimal(10,2) DEFAULT NULL COMMENT '碳含量',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
  `create_time` datetime 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,
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `actual_length` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '真实长度',
  `categorize` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `detector` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '检测仪',
  `life_time` decimal(10,2) 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`) USING BTREE,
  UNIQUE KEY `code` (`code`) USING BTREE,
  UNIQUE KEY `code_2` (`code`) USING BTREE,
  UNIQUE KEY `code_3` (`code`) USING BTREE,
  UNIQUE KEY `code_4` (`code`) USING BTREE,
  UNIQUE KEY `code_5` (`code`) USING BTREE,
  UNIQUE KEY `code_6` (`code`) USING BTREE,
  KEY `idx_mes_specimen_production_code_type` (`production_code`,`type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236313522638851 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='46_氧碳检测详情';

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

-- mes_split_storage: table
CREATE TABLE `mes_split_storage` (
  `id` bigint NOT NULL,
  `order_no` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT '单号',
  `recycle_id` bigint DEFAULT NULL COMMENT '循环料id',
  `split_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分选人',
  `split_time` datetime DEFAULT NULL COMMENT '分选时间',
  `status` tinyint(1) DEFAULT NULL COMMENT '1-进行中 2-已完成',
  `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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='61_分选';

-- 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`) USING BTREE,
  UNIQUE KEY `code` (`code`) USING BTREE,
  UNIQUE KEY `code_2` (`code`) USING BTREE,
  UNIQUE KEY `code_3` (`code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689163417919115267 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='53_方棒表';

-- mes_square_task: table
CREATE TABLE `mes_square_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `round_bar_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 '物料名称',
  `specs` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格',
  `vehicle_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '容器编码(圆棒车编码)',
  `vehicle_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '容器名(圆棒车名)',
  `area_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '区域id',
  `area_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '区域名',
  `device_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '设备编号',
  `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '设备名',
  `status` int NOT NULL COMMENT '状态 1 待处理、2 进行中、3 已完成',
  `receive_user_id` varchar(64) 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 NOT NULL DEFAULT '0' COMMENT '软删标识',
  `categorize` 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`) USING BTREE,
  UNIQUE KEY `round_bar_code` (`round_bar_code`) USING BTREE,
  KEY `mes_cut_square_task_round_bar_code_uindex` (`round_bar_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236616603672579 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='50_开方任务表';

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

-- 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`) USING BTREE,
  UNIQUE KEY `crystal_code` (`crystal_code`) USING BTREE,
  UNIQUE KEY `crystal_code_2` (`crystal_code`) USING BTREE,
  UNIQUE KEY `crystal_code_3` (`crystal_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689162546305593347 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='30_取棒任务';

-- mes_sub_chamber_task: table
CREATE TABLE `mes_sub_chamber_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 NOT NULL COMMENT '炉台编码',
  `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '晶编',
  `opening_times` tinyint DEFAULT '0' COMMENT '开副室次数',
  `feed_times` tinyint(1) DEFAULT NULL COMMENT '加料次数',
  `opening_time` datetime DEFAULT NULL COMMENT '开副室时间',
  `induced_crystal_times` int DEFAULT '1' COMMENT '引晶次数',
  `cold_stoking` tinyint(1) DEFAULT '0' COMMENT '是否闷炉  0:是 1:否',
  `cold_stoking_weight` decimal(10,2) DEFAULT NULL COMMENT '闷炉重量',
  `cauldron_bottom_weight` decimal(10,2) DEFAULT NULL COMMENT '埚底料',
  `surplus_sizing_weight` decimal(10,2) DEFAULT '0.00' COMMENT '余料重量',
  `type` tinyint(1) DEFAULT NULL COMMENT ' 物料类型 1:正常取棒  2:断棒 3:拉晶余料',
  `product_no` 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 '产品名称',
  `specs` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格代码',
  `product_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品规格',
  `surplus_material_type` int DEFAULT NULL COMMENT '余料类型：(1.提渣 2.提肩 3.吊多晶)',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_flag` tinyint(1) DEFAULT '0' COMMENT '0：正常。1：已删除',
  `close_mode` int DEFAULT NULL COMMENT '取棒类型 1 完好收尾 2 等径断棱 3收尾不良 4 掉棒',
  `finish_rod` int DEFAULT NULL COMMENT '是否完结棒  0:是 1:否',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `code` (`code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236488278941698 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='17_开副室任务';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677099173836951554 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='21_余料表';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677218938463129602 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='20_余料收集任务';

-- 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`) USING BTREE,
  UNIQUE KEY `code` (`code`) USING BTREE,
  KEY `idx_mes_surplus_confirm_task_code_status` (`code`,`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236701785792515 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='22_余料收集确认任务表';

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

-- mes_task_send_erp: table
CREATE TABLE `mes_task_send_erp` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `task_id` bigint DEFAULT NULL COMMENT '报工任务id',
  `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '晶编',
  `op_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工序code',
  `op_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工序名称',
  `send_weight` decimal(10,2) DEFAULT NULL COMMENT '报工重量或长度',
  `send_user_id` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报工传输人员id',
  `send_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报工传输人员姓名',
  `send_work_hour` decimal(10,2) DEFAULT NULL COMMENT '报工工时',
  `status` tinyint(1) DEFAULT NULL COMMENT '0: 未报工 1: 已经报工',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '修改人',
  `update_time` datetime 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236488920670210 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='17__任务报工管理表';

-- mes_thermal_field_material: table
CREATE TABLE `mes_thermal_field_material` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '热场编码',
  `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '热场件名称',
  `life_span` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '热场件寿命',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '软删标识',
  `texture` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '热场材质',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='热场件物料信息';

-- 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`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1689162787603120131 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='14_运输任务';

-- mes_truncation_task: table
CREATE TABLE `mes_truncation_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `crystal_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '晶编',
  `machine_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机器编码',
  `status` tinyint(1) DEFAULT '0' COMMENT '截断任务状态 0:待处理、1：进行中、2：已完成',
  `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` int DEFAULT NULL COMMENT '类型 1：正常、2：综合判定反切、3：方棒终检反切',
  `vehicle_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '车辆编码',
  `row_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '画线JSON',
  `receive_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '领取任务人Id',
  `remark` varchar(255) 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：已删除',
  `specs` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格代码',
  `antigen_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '反切JSON',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `electrical_log_id` bigint DEFAULT NULL COMMENT '电性能操作日志id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677236587864301571 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='43_截断任务表';

-- mes_turnover_container: table
CREATE TABLE `mes_turnover_container` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `code` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号',
  `name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称',
  `specs` varchar(500) 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(1) DEFAULT '0',
  `status` tinyint(1) DEFAULT '0' COMMENT '0启动1禁用',
  `type_label` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据字典类型',
  `type_value` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据字典值',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1673237770482946051 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='92_周转容器管理';

-- mes_vehicle_crystal: table
CREATE TABLE `mes_vehicle_crystal` (
  `id` bigint NOT NULL,
  `crystal_weave` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '晶编',
  `vehicle_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '车辆编码',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='31_车辆晶体管理表';

-- mes_vehicle_feed_task: table
CREATE TABLE `mes_vehicle_feed_task` (
  `id` bigint NOT NULL,
  `feed_task_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '投料任务编码',
  `vehicle_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin 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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='14__加料车临时表';

-- mes_washable_silicon_qc_task: table
CREATE TABLE `mes_washable_silicon_qc_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `washable_silicon_storage_id` bigint DEFAULT NULL COMMENT '非免洗循环料入库id',
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '单号',
  `box_code` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '箱号',
  `box_weight` decimal(10,2) DEFAULT NULL,
  `box_area` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `location_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  `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 '物料名称',
  `material_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '分类等级(5:边皮)',
  `product_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产品类型 1-P 2-N 3-ESS 4-ESS2',
  `batch_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '批次号',
  `model` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'P/N型',
  `classify_level` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类参杂',
  `cause` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '产生原因',
  `gross_weight` decimal(10,2) DEFAULT NULL COMMENT '毛重/kg',
  `suttle` decimal(10,2) DEFAULT NULL COMMENT '净重/kg',
  `qualified` tinyint(1) 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 '品检时间',
  `qualified_remark` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '品检备注',
  `technology_qualified` tinyint(1) DEFAULT NULL COMMENT '工艺是否合格 1:合格 2:不合格',
  `technology_qualified_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工艺质检人',
  `technology_qualified_time` datetime DEFAULT NULL COMMENT '工艺时间',
  `resistivity` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电阻档位',
  `technology_qualified_remark` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工艺备注',
  `status` tinyint(1) DEFAULT '1' COMMENT '状态 1:待处理  2:进行中 3:已完成 4:已关闭',
  `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,
  `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(1) DEFAULT '0',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1677221768205479938 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='63_非免洗循环料质检任务';

-- mes_work_order: table
CREATE TABLE `mes_work_order` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工单编码',
  `last_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 '炉台编码',
  `step` int NOT NULL COMMENT '当前工序步骤 1:初装报料、2 工单排产、3 初装坩埚配方、4：初装投料、5 母合金称重、6 初装投炉、7加料报料、8加料配方、9 加料投料、10加料运输、11加料投炉',
  `status` int DEFAULT '0' COMMENT '工单状态：0：待处理、1：进行中、2：已完成、3：关闭',
  `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 '软删标识',
  `org_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='工单表';

-- mes_work_order_job: table
CREATE TABLE `mes_work_order_job` (
  `id` bigint NOT NULL COMMENT '主键',
  `job_num` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '工单号',
  `part_num` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '产品编号',
  `part_description` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '产品描述',
  `revision_num` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '版本',
  `prod_qty` double(10,2) DEFAULT NULL COMMENT '数量',
  `unit` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '单位',
  `req_due_date` datetime DEFAULT NULL COMMENT '需求时间',
  `sale_order_num` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '需求订单号',
  `order_line` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '订单行号',
  `order_rel_num` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '发货行号',
  `oper_seq` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '工序序号',
  `oper_desc` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '工序描述',
  `oper_code` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '工序代码',
  `qty_per` double(10,2) DEFAULT NULL COMMENT '数量系数',
  `est_scrap` double(10,2) DEFAULT NULL COMMENT '报废',
  `prod_standard` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '工序标准',
  `est_set_hours_per_mch` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '每台机器设\r\n每台机器设置时间',
  `resource_grp_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '资源组',
  `resource_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='停_工单排产';

-- mes_work_order_job_detail: table
CREATE TABLE `mes_work_order_job_detail` (
  `id` bigint NOT NULL COMMENT '主键',
  `mtl_seq` int DEFAULT NULL COMMENT '物料序列',
  `part_num` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '物料编码',
  `revision_num` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '物料版本',
  `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '物料描述',
  `related_operation` int DEFAULT NULL COMMENT '工序序号',
  `qty_per` double(10,2) DEFAULT NULL COMMENT '明细物料 数量/父项',
  `unit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '明细物料 单位',
  `est_scrap_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '明细物料 报废类型',
  `est_scrap` double(10,2) DEFAULT NULL COMMENT '明细物料 报废数量',
  `order_job_id` bigint DEFAULT NULL COMMENT '工单排产id',
  `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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='明细物料';

-- mes_work_order_job_half: table
CREATE TABLE `mes_work_order_job_half` (
  `id` bigint NOT NULL COMMENT '主键',
  `assembly_seq` int DEFAULT NULL COMMENT '父项序号',
  `part_num` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '父项产品',
  `revision_num` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '父项版本',
  `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '父项描述',
  `related_operation` int DEFAULT NULL COMMENT '相关工序',
  `op_desc` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '相关工序描述\r\n',
  `half_part_num` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '半成品编号',
  `half_revision_num` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '半成品版本',
  `half_description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '半成品描述',
  `half_qty_per` double(10,2) DEFAULT NULL COMMENT '数量\r\n/\r\n父项',
  `order_job_id` bigint DEFAULT NULL COMMENT '工单排产id',
  `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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='停_半成品';

-- raipiot_log_api: table
CREATE TABLE `raipiot_log_api` (
  `id` bigint NOT NULL COMMENT '编号',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '000000' COMMENT '租户ID',
  `service_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务ID',
  `server_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务器名',
  `server_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务器IP地址',
  `env` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务器环境',
  `type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '1' COMMENT '日志类型',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '日志标题',
  `method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作方式',
  `request_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求URI',
  `user_agent` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户代理',
  `remote_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作IP地址',
  `method_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '方法类',
  `method_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '方法名',
  `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '操作提交的数据',
  `time` 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 '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='接口日志表';

-- raipiot_log_error: table
CREATE TABLE `raipiot_log_error` (
  `id` bigint NOT NULL COMMENT '编号',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '000000' COMMENT '租户ID',
  `service_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务ID',
  `server_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务器名',
  `server_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务器IP地址',
  `env` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '系统环境',
  `method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作方式',
  `request_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求URI',
  `user_agent` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户代理',
  `stack_trace` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '堆栈',
  `exception_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '异常名',
  `message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '异常信息',
  `line_number` int DEFAULT NULL COMMENT '错误行数',
  `remote_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作IP地址',
  `method_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '方法类',
  `file_name` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文件名',
  `method_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '方法名',
  `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '操作提交的数据',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='错误日志表';

-- raipiot_log_usual: table
CREATE TABLE `raipiot_log_usual` (
  `id` bigint NOT NULL COMMENT '编号',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '000000' COMMENT '租户ID',
  `service_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务ID',
  `server_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务器名',
  `server_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务器IP地址',
  `env` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '系统环境',
  `log_level` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '日志级别',
  `log_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '日志业务id',
  `log_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '日志数据',
  `method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作方式',
  `request_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求URI',
  `remote_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作IP地址',
  `method_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '方法类',
  `method_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '方法名',
  `user_agent` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户代理',
  `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '操作提交的数据',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='通用日志表';

-- sys_dict_data: table
CREATE TABLE `sys_dict_data` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典编码',
  `dict_sort` int DEFAULT '0' COMMENT '字典排序',
  `dict_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '字典标签',
  `dict_value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '字典键值',
  `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '字典类型',
  `css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '样式属性（其他样式扩展）',
  `list_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '表格回显样式',
  `is_default` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'N' COMMENT '是否默认（Y是 N否）',
  `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '状态（0正常 1停用）',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `delete_flag` tinyint(1) NOT NULL DEFAULT '0',
  `org_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1676767540680241155 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='字典数据表';

-- sys_dict_type: table
CREATE TABLE `sys_dict_type` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典主键',
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '字典名称',
  `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '字典类型',
  `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '状态（0正常 1停用）',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `delete_flag` tinyint(1) DEFAULT '0',
  `org_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `dict_type` (`type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1676760885791842307 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='字典类型表';

-- sys_package_version_manage: table
CREATE TABLE `sys_package_version_manage` (
  `id` bigint NOT NULL COMMENT '主键',
  `app_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'appId',
  `app_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '应用名称',
  `title` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新标题',
  `content` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新内容',
  `platform` int DEFAULT NULL COMMENT '平台：1 苹果、2：安卓',
  `version_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '版本号',
  `upload_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文件上传路径',
  `force_flag` int DEFAULT NULL COMMENT '是否强制更新 1： 否 、2： 是',
  `online_issue` int DEFAULT NULL COMMENT '上线发行 1：否 2：是',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `delete_flag` tinyint DEFAULT '0' COMMENT '软删标识',
  `type` int DEFAULT NULL COMMENT '应用类型： 1：mes系统',
  `update_type` int DEFAULT NULL COMMENT '更新类型 1：热更新、2：整包更新',
  `remark` varchar(2000) 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`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='94_APP包版本管理表';

-- yz_mes_spec: table
CREATE TABLE `yz_mes_spec` (
  `id` bigint NOT NULL COMMENT '主键',
  `spec_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格代码',
  `cooling_time` decimal(6,0) DEFAULT NULL COMMENT '冷却时间',
  `spec_category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '类别',
  `conductive_type` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '导电类型',
  `remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格配置';

-- 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) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性名称',
  `spec_attribute_type` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性类型',
  `standard_value` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性标准值/上值',
  `value` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性公差/下值',
  `is_contain` varchar(4) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否包含上下值 0全部包含 1包含上值 2 包含下值',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- SyncMesData_every_12_hours(): routine
CREATE DEFINER=`root`@`%` PROCEDURE `SyncMesData_every_12_hours`()
BEGIN
#REPLACE into mes_sync.mes_job SELECT * from mes_origin.mes_job;
#REPLACE into mes_sync.erp_job_mtl_manage_task SELECT * from mes_origin.erp_job_mtl_manage_task;
#REPLACE into mes_sync.erp_job_mtl_manage_detail SELECT * from mes_origin.erp_job_mtl_manage_detail;
#REPLACE into mes_sync.erp_job_mtl SELECT * from mes_origin.erp_job_mtl;
#REPLACE into mes_sync.mes_job_recipe SELECT * from mes_origin.mes_job_recipe;
#REPLACE into mes_sync.mes_material SELECT * from mes_origin.mes_material;
#REPLACE into mes_sync.erp_job_opr SELECT * from mes_origin.erp_job_opr;
#REPLACE into mes_sync.mes_mother_alloy_task SELECT * from mes_origin.mes_mother_alloy_task;
#REPLACE into mes_sync.mes_mother_alloy SELECT * from mes_origin.mes_mother_alloy;
#REPLACE into mes_sync.mes_vehicle_feed_task SELECT * from mes_origin.mes_vehicle_feed_task;
#REPLACE into mes_sync.mes_task_send_erp SELECT * from mes_origin.mes_task_send_erp;
#REPLACE into mes_sync.mes_sub_chamber_task SELECT * from mes_origin.mes_sub_chamber_task;
#REPLACE into mes_sync.mes_seedcrystal_change SELECT * from mes_origin.mes_seedcrystal_change;
#REPLACE into mes_sync.mes_surplus_collect_task SELECT * from mes_origin.mes_surplus_collect_task;
#REPLACE into mes_sync.mes_surplus SELECT * from mes_origin.mes_surplus;
#REPLACE into mes_sync.mes_surplus_confirm_task SELECT * from mes_origin.mes_surplus_confirm_task;
#REPLACE into mes_sync.mes_vehicle_crystal SELECT * from mes_origin.mes_vehicle_crystal;
#REPLACE into mes_sync.mes_dismantle_task SELECT * from mes_origin.mes_dismantle_task;
#REPLACE into mes_sync.mes_dismantle_thermal SELECT * from mes_origin.mes_dismantle_thermal;
#REPLACE into mes_sync.mes_draw_line_task SELECT * from mes_origin.mes_draw_line_task;
#REPLACE into mes_sync.mes_round_bar_label SELECT * from mes_origin.mes_round_bar_label;
#REPLACE into mes_sync.mes_truncation_task SELECT * from mes_origin.mes_truncation_task;
#REPLACE into mes_sync.mes_resistance_gauging_task SELECT * from mes_origin.mes_resistance_gauging_task;
#REPLACE into mes_sync.mes_oxygen_carbon_detection_task SELECT * from mes_origin.mes_oxygen_carbon_detection_task;
#REPLACE into mes_sync.mes_specimen SELECT * from mes_origin.mes_specimen;
#REPLACE into mes_sync.mes_electrical_performance_task SELECT * from mes_origin.mes_electrical_performance_task;
#REPLACE into mes_sync.mes_square_task SELECT * from mes_origin.mes_square_task;
#REPLACE into mes_sync.mes_roll_rub_task SELECT * from mes_origin.mes_roll_rub_task;
#REPLACE into mes_sync.mes_multi_cut SELECT * from mes_origin.mes_multi_cut;
#REPLACE into mes_sync.mes_seed_crystal_machine_task SELECT * from mes_origin.mes_seed_crystal_machine_task;
#REPLACE into mes_sync.mes_seed_crystal SELECT * from mes_origin.mes_seed_crystal;
REPLACE into mes_sync.mes_recycle_material_storage SELECT * from mes_origin.mes_recycle_material_storage;
#REPLACE into mes_sync.mes_split_storage SELECT * from mes_origin.mes_split_storage;
#REPLACE into mes_sync.mes_pre_clean SELECT * from mes_origin.mes_pre_clean;
#REPLACE into mes_sync.mes_washable_silicon_qc_task SELECT * from mes_origin.mes_washable_silicon_qc_task;
#REPLACE into mes_sync.mes_recycle_material_storage_detail SELECT * from mes_origin.mes_recycle_material_storage_detail;
#REPLACE into mes_sync.mes_silicon_clean_task SELECT * from mes_origin.mes_silicon_clean_task;
#REPLACE into mes_sync.mes_silicon_clean_soak SELECT * from mes_origin.mes_silicon_clean_soak;
#REPLACE into mes_sync.mes_silicon_clean_soak_manage SELECT * from mes_origin.mes_silicon_clean_soak_manage;
#REPLACE into mes_sync.mes_silicon_clean_auto SELECT * from mes_origin.mes_silicon_clean_auto;
#REPLACE into mes_sync.mes_silicon_clean_fracture SELECT * from mes_origin.mes_silicon_clean_fracture;
#REPLACE into mes_sync.mes_magnet_choice SELECT * from mes_origin.mes_magnet_choice;
#REPLACE into mes_sync.mes_disposable_qc_task SELECT * from mes_origin.mes_disposable_qc_task;
#REPLACE into mes_sync.mes_crystal_flow SELECT * from mes_origin.mes_crystal_flow;
#REPLACE into mes_sync.mes_order_tracing SELECT * from mes_origin.mes_order_tracing;
#REPLACE into mes_sync.mes_device SELECT * from mes_origin.mes_device;
#REPLACE into mes_sync.mes_device_attribute SELECT * from mes_origin.mes_device_attribute;
#REPLACE into mes_sync.mes_turnover_container SELECT * from mes_origin.mes_turnover_container;
#REPLACE into mes_sync.mes_abnormal_feedback SELECT * from mes_origin.mes_abnormal_feedback;
#REPLACE into mes_sync.sys_package_version_manage SELECT * from mes_origin.sys_package_version_manage;
#REPLACE into mes_sync.mes_packing_detail SELECT * from mes_origin.mes_packing_detail;
#REPLACE into mes_sync.raipiot_log_error SELECT * from mes_origin.raipiot_log_error;
#REPLACE into mes_sync.mes_electrical_performance_task_log SELECT * from mes_origin.mes_electrical_performance_task_log;
#REPLACE into mes_sync.mes_work_order SELECT * from mes_origin.mes_work_order;
REPLACE into mes_sync.yz_mes_spec SELECT * from mes_origin.yz_mes_spec;
REPLACE into mes_sync.yz_mes_spec_value SELECT * from mes_origin.yz_mes_spec_value;
#REPLACE into mes_sync.raipiot_log_api SELECT * from mes_origin.raipiot_log_api;
#REPLACE into mes_sync.mes_work_order_job_detail SELECT * from mes_origin.mes_work_order_job_detail;
#REPLACE into mes_sync.mes_mother_alloy_bind SELECT * from mes_origin.mes_mother_alloy_bind;
#REPLACE into mes_sync.mes_schedule SELECT * from mes_origin.mes_schedule;
#REPLACE into mes_sync.mes_thermal_field_material SELECT * from mes_origin.mes_thermal_field_material;
#REPLACE into mes_sync.mes_work_order_job_half SELECT * from mes_origin.mes_work_order_job_half;
#REPLACE into mes_sync.mes_work_order_job SELECT * from mes_origin.mes_work_order_job;
#REPLACE into mes_sync.raipiot_log_usual SELECT * from mes_origin.raipiot_log_usual;
#REPLACE into mes_sync.sys_dict_type SELECT * from mes_origin.sys_dict_type;
#REPLACE into mes_sync.mes_dict SELECT * from mes_origin.mes_dict;
#REPLACE into mes_sync.sys_dict_data SELECT * from mes_origin.sys_dict_data;

END;

-- SyncMesData_every_2_hours(): routine
CREATE DEFINER=`root`@`%` PROCEDURE `SyncMesData_every_2_hours`()
BEGIN

REPLACE into mes_sync.mes_report_task SELECT * from mes_origin.mes_report_task;
REPLACE into mes_sync.mes_crystal_order SELECT * from mes_origin.mes_crystal_order;
REPLACE into mes_sync.mes_poi_formula SELECT * from mes_origin.mes_poi_formula;
REPLACE into mes_sync.mes_feeding_task SELECT * from mes_origin.mes_feeding_task;
REPLACE into mes_sync.mes_feeding_detail SELECT * from mes_origin.mes_feeding_detail;
REPLACE into mes_sync.mes_transport_task SELECT * from mes_origin.mes_transport_task;
REPLACE into mes_sync.mes_furnace_task SELECT * from mes_origin.mes_furnace_task;
REPLACE into mes_sync.mes_furnace_detail SELECT * from mes_origin.mes_furnace_detail;
REPLACE into mes_sync.mes_stick_task SELECT * from mes_origin.mes_stick_task;
REPLACE into mes_sync.mes_production SELECT * from mes_origin.mes_production;
REPLACE into mes_sync.mes_round_bar SELECT * from mes_origin.mes_round_bar;
REPLACE into mes_sync.mes_round_bar_status SELECT * from mes_origin.mes_round_bar_status;
REPLACE into mes_sync.mes_roll_rub_quality_task SELECT * from mes_origin.mes_roll_rub_quality_task;
REPLACE into mes_sync.mes_square SELECT * from mes_origin.mes_square;
REPLACE into mes_sync.mes_lifting_box_task SELECT * from mes_origin.mes_lifting_box_task;
REPLACE into mes_sync.mes_packing_task SELECT * from mes_origin.mes_packing_task;
REPLACE into mes_sync.erp_job_mtl_confirm SELECT * from mes_origin.erp_job_mtl_confirm;
REPLACE into mes_sync.erp_job_mtl_send SELECT * from mes_origin.erp_job_mtl_send;
REPLACE into mes_sync.mes_draw_line_task SELECT * from mes_origin.mes_draw_line_task;
REPLACE into mes_sync.mes_disposable_qc_task SELECT * from mes_origin.mes_disposable_qc_task;

END;

-- UpdateAllfeedingdetail(): routine
CREATE DEFINER=`root`@`%` PROCEDURE `UpdateAllfeedingdetail`()
BEGIN
DELETE from reportdata.allfeedingdetail;
replace into reportdata.allfeedingdetail(`month`,mfgdate,mesmoname,eqpid,moprodname,moproddesc,
	subprod,rx,stovetype,stovetypedesc,stovetime,prodname,proddesc,material_type,factory,serial_no,weight,
	cate1,cate2,cate3,material_level,type,area,area1,eqpmodel,feeding_task_code)
SELECT
	CONCAT('M',DATE_FORMAT(DATE_add(ft.update_time,interval -510 MINUTE),'%m')) `month`,
	DATE_FORMAT(DATE_add(ft.update_time,interval -510 MINUTE),'%Y-%m-%d') mfgdate,
	ft.order_no mesmoname,
	ft.stove_no eqpid,
	ft.product_no moprodname,
	ft.product_name moproddesc,
	case when LOCATE('自产',ft.product_name) >0 then mid(ft.product_name,LOCATE('自产',ft.product_name)+3,6)
		when LOCATE('代工',ft.product_name) >0 then mid(ft.product_name,LOCATE('代工',ft.product_name)+3,6) end subprod,
	ft.feeding_times rx,
	ft.type stovetype,
	case when ft.type = '1' then '初装'
		when ft.type = '2' then '二加' end stovetypedesc,
	ft.update_time stovetime,
	fd.material_no prodname,
	fd.material_name proddesc,
	fd.material_type,
	fd.factory,
	fd.batch_no serial_no,
	fd.weight,
	p.cate1,
	p.cate2,
	p.cate3,
	p.`level`,
	p.type,
	eq.area,
	eq.area1,
	eq.eqpmodel,
	ft.feeding_task_code
	from  mes_sync.mes_furnace_task ft
	right join mes_sync.mes_feeding_detail fd on(ft.feeding_task_id = fd.feeding_task_id and fd.material_type = '2')
	left join reportdata.product p on (fd.material_no = p.prodname)
	left join reportdata.Equipment eq on (ft.stove_no = eq.eqpid)
	where ft.`status` = '3';
END;

-- UpdateMostatus(): routine
CREATE DEFINER=`root`@`%` PROCEDURE `UpdateMostatus`()
BEGIN

REPLACE into reportdata.Mostatus(area1,MESmoname,ERPmoname,eqpid,prodname,proddesc,crusize,stovetime,feeding_task_id,crucible,subprod,mostatus,mostatusdesc,finish_time,runtime)
select left(ft.stove_no,1) area1,ft.order_no MESmoname,co.job_code ERPmoname,ft.stove_no eqpid,ft.product_no prodname,ft.product_name proddesc, co.thermal_field crusize,ft.update_time stovetime,ft.feeding_task_id,fd.factory crucible,
case when LOCATE('自产',product_name) >0 then mid(product_name,LOCATE('自产',product_name)+3,6)
		when LOCATE('代工',product_name) >0 then mid(product_name,LOCATE('代工',product_name)+3,6) end subprod,
co.finish_flag mostatus,
case when co.finish_flag = '1' then '完结'
	when co.finish_flag = '0' then '非完结' end mostatusdesc,
case when co.finish_flag = '1' then f.max_time end finish_time,
case when co.finish_flag = '1' then datediff(f.max_time,ft.update_time) end rutime
from mes_sync.mes_furnace_task ft
LEFT JOIN mes_sync.mes_crystal_order co on(ft.order_no = co.order_no)
LEFT JOIN mes_sync.mes_feeding_detail fd on(ft.feeding_task_id = fd.feeding_task_id and fd.material_type = '1')
left join
	(
		SELECT DISTINCT order_no,min(finish_rod) finish_rod FROM mes_sync.`mes_stick_task` GROUP BY order_no
			) st on (ft.order_no = st.order_no)
left join
	(
	SELECT DISTINCT order_no,max(create_time) max_time from mes_sync.mes_production GROUP BY order_no
	) f on(f.order_no = ft.order_no)
where 1=1
and ft.`status` = '3'	# 已正常投炉
and ft.type = '1'  #初装
and fd.material_type = '1' #material_type为'1'的是坩埚
order by ft.create_time desc;


##该炉台有新工单的，即使上一棒未完结的，也更新成完结
update reportdata.mostatus mo,(SELECT eqpid,max(stovetime) newtime from reportdata.mostatus group by eqpid) st
set mo.mostatusdesc = '完结' ,mo.mostatus = '1'
where 1=1
and mo.eqpid = st.eqpid
and mo.stovetime < st.newtime;


##异常完结的更新完结时间及运行时间
update reportdata.mostatus mo,(SELECT DISTINCT order_no,max(create_time) max_time,max(substring(code,11,1)) rx from mes_sync.mes_production GROUP BY order_no) f
set mo.finish_time = f.max_time,mo.runtime = datediff(f.max_time,mo.stovetime)
where 1=1
and mo.MESmoname =  f.order_no
and mo.finish_time is null
and mo.mostatus = '1' ;

update reportdata.mostatus mo
inner join
(
select DISTINCT mesmoname,rx from reportdata.allfeedingdetail
)af on(mo.mesmoname = af.mesmoname)
set mo.rx=af.rx ;

##将归档的数据上传到云
REPLACE into reportdata.mostatus_cloud SELECT * from reportdata.mostatus;

END;

-- UpdateRecyclematerialouput(): routine
CREATE DEFINER=`root`@`%` PROCEDURE `UpdateRecyclematerialouput`()
BEGIN
replace into reportdata.recyclematerialouput(lotsn,prodname,proddesc,prodtype,level,
	resistivity,weight,cate1,type,cate2,cate3,update_time,mfgdate,month)
SELECT order_no lotsn,
material_code prodname,
material_name proddesc,
replace(replace(product_type,'（',''),'）','') prodtype,
material_type level,
resistivity,
weight,
pd.cate1,
pd.type,
pd.cate2,
pd.cate3,
update_time,
DATE_FORMAT(DATE_add(ms.update_time,interval -510 MINUTE),'%Y-%m-%d') mfgdate,
CONCAT('M',DATE_FORMAT(DATE_add(ms.update_time,interval -510 MINUTE),'%m')) `month`
FROM mes_sync.mes_recycle_material_storage  ms
left join reportdata.product pd on (ms.material_code = pd.prodname)
and substring(material_code,6,1) = '1'
where `status` = '2';
END;

-- UpdateSiteOnlineYield(): routine
CREATE DEFINER=`root`@`%` PROCEDURE `UpdateSiteOnlineYield`()
    COMMENT '更新产量表存储过称'
BEGIN
replace into reportdata.siteonlinecrucibleyield(crystalbarno,MESmoname,eqpid,actualprodname,actualproddesc,outweight,outlength,outtime)
SELECT code,order_no,stove_no,product_no,product_name,weight,length,update_time
from mes_sync.mes_production mp
order by update_time;

##更新炉台信息
UPDATE reportdata.siteonlinecrucibleyield sy
inner join reportdata.equipment eq on sy.eqpid = eq.eqpid
set sy.area = eq.area,sy.area1= eq.area1,sy.eqpmodel=eq.eqpmodel
where sy.eqpmodel is null;

##更新坩埚信息
UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN mes_sync.mes_crystal_order co
on sy.mesmoname = co.order_no
set sy.erpmoname = co.job_code,sy.moprodname = co.material_code,sy.moproddesc = co.material_name,sy.crusize = co.thermal_field
where sy.crusize is null;

##更新工单相关信息
UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN reportdata.mostatus mo on (sy.mesmoname = mo.MESmoname)
set sy.crucible = mo.crucible,sy.crunum = mo.cruciblesn,sy.crudesc = mo.crucproddesc,sy.subprod = mo.subprod,sy.stovetime=mo.stovetime
where sy.crucible is null;

###更新折重系数
UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN mes_sync.yz_mes_spec yms on(sy.subprod = yms.spec_code)
set sy.hair_rod_coefficient = yms.hair_rod_coefficient,sy.round_rod_coefficient = yms.round_rod_coefficient
where sy.hair_rod_coefficient is null or sy.round_rod_coefficient is null or sy.hair_square_rod_coefficient is null;

###更新折重系数——MES中未维护的使用自己维护的补充
UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN reportdata.prod p on(sy.subprod = p.code)
set sy.hair_rod_coefficient = p.round,sy.hair_square_rod_coefficient = p.square
where sy.hair_rod_coefficient is null or sy.round_rod_coefficient is null or sy.hair_square_rod_coefficient is null;

###更新有效长度
UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN (
SELECT
	production_code,sum(draw_length) qclength
 FROM mes_sync.mes_round_bar
where right(code,1) = '0'
group by production_code
)ps on (sy.crystalbarno = ps.production_code)
set sy.qclength = ps.qclength
where sy.qclength is null;

##更新QC时间及计产日期
UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN mes_sync.mes_draw_line_task dlt on (sy.crystalbarno = dlt.hairy_rod_crystal_code and dlt.`status` = '3')
set sy.qctime = dlt.update_time,
sy.mfgdate = DATE_FORMAT(DATE_add(dlt.update_time,interval -510 MINUTE),'%Y-%m-%d')
where sy.qctime is null;

##更新QC重量
UPDATE reportdata.siteonlinecrucibleyield set qcweight = qclength/hair_rod_coefficient where qcweight is null;
UPDATE reportdata.siteonlinecrucibleyield set squareqcweight = qclength/hair_square_rod_coefficient where squareqcweight is null;

######建临时表处理两棒工序时间########################################
DROP TEMPORARY TABLE IF EXISTS crystalbarno;
CREATE TEMPORARY TABLE crystalbarno (
id int,
idd varchar(100),
eqpid VARCHAR(100),
crystalbarno varchar(200),
outtime datetime,
lastcrystalbarno VARCHAR(200),
lastouttime datetime
);
insert into crystalbarno(id,idd,eqpid,crystalbarno,outtime)
SELECT
	ROW_NUMBER() over(partition by stove_no order by UPDATE_time desc) id,
	CONCAT(stove_no,'-',ROW_NUMBER() over(partition by stove_no order by UPDATE_time desc)) idd,
	stove_no,code, UPDATE_time
	from mes_sync.mes_production;
UPDATE crystalbarno cy
INNER JOIN
(
	SELECT
	ROW_NUMBER() over(partition by stove_no order by UPDATE_time desc) -1 id,
	CONCAT(stove_no,'-',ROW_NUMBER() over(partition by stove_no order by UPDATE_time desc)-1) idd,
	stove_no,code, UPDATE_time
	from mes_sync.mes_production
) mp on (cy.idd = mp.idd)
set cy.lastouttime = mp.UPDATE_time,cy.lastcrystalbarno = mp.code;
UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN crystalbarno cr on (sy.crystalbarno = cr.crystalbarno)
set sy.lastcrystalbarno = cr.lastcrystalbarno,sy.lastouttime = cr.lastouttime
where sy.lastcrystalbarno is null;
DROP TEMPORARY TABLE crystalbarno;
######删除临时表########################################


###更新运行时间
UPDATE reportdata.siteonlinecrucibleyield sy
set timeinterval = timestampdiff(second,lastouttime,outtime) / (24 * 60 * 60)
where timeinterval is null;

###更新首棒停炉时间过长的运行时间
UPDATE reportdata.siteonlinecrucibleyield sy
set timeinterval = timestampdiff(second,stovetime,outtime) / (24 * 60 * 60) + 8/24
where 1=1
and datediff(stovetime,lastouttime) >= 18/24
and crystalbarno like '%11N';

##处理坩埚厂商乱码
UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN reportdata.adjustcruc ac on (sy.mesmoname = ac.mesmoname)
set sy.adjustcrucible = ac.crucible
where sy.adjustcrucible is null;
##根据坩埚
UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN reportdata.dict d on (sy.adjustcrucible = d.dictkey and d.cate = 'cruccode')
set sy.adjustcruciblecode = d.value;

UPDATE reportdata.siteonlinecrucibleyield sy
INNER JOIN reportdata.dict d on (sy.crucible = d.dictkey and d.cate = 'crucname')
set sy.adjustcruciblecode = d.value,sy.adjustcrucible = d.value1;

END;

-- SyncMesData_every_12_hours: scheduled event
CREATE DEFINER=`root`@`%` EVENT `SyncMesData_every_12_hours` ON SCHEDULE EVERY 2 HOUR STARTS '2023-07-07 19:00:49' ON COMPLETION NOT PRESERVE ENABLE COMMENT '每12小时更新重要的表' DO call SyncMesData_every_12_hours();

-- SyncMesData_every_2_hours: scheduled event
CREATE DEFINER=`root`@`%` EVENT `SyncMesData_every_2_hours` ON SCHEDULE EVERY 2 HOUR STARTS '2023-07-07 16:31:49' ON COMPLETION NOT PRESERVE ENABLE COMMENT '每两小时更新重要的表' DO call SyncMesData_every_2_hours();

-- UpdateAllfeedingdetail_4_hours: scheduled event
CREATE DEFINER=`root`@`%` EVENT `UpdateAllfeedingdetail_4_hours` ON SCHEDULE EVERY 4 HOUR STARTS '2023-07-08 08:40:00' ON COMPLETION PRESERVE ENABLE COMMENT '归档配料明细' DO call UpdateAllfeedingdetail();

-- UpdateMostatus: scheduled event
CREATE DEFINER=`root`@`%` EVENT `UpdateMostatus` ON SCHEDULE EVERY 30 MINUTE STARTS '2023-07-07 16:56:53' ON COMPLETION NOT PRESERVE ENABLE DO call mes_sync.UpdateMostatus();

-- UpdateRecyclematerialouput: scheduled event
CREATE DEFINER=`root`@`%` EVENT `UpdateRecyclematerialouput` ON SCHEDULE EVERY 1 HOUR STARTS '2023-07-08 08:32:38' ON COMPLETION NOT PRESERVE ENABLE COMMENT '更新循环料产出' DO call UpdateRecyclematerialouput();

-- UpdateSiteOnlineYield_1_hours: scheduled event
CREATE DEFINER=`root`@`%` EVENT `UpdateSiteOnlineYield_1_hours` ON SCHEDULE EVERY 1 HOUR STARTS '2023-08-08 08:43:55' ON COMPLETION PRESERVE ENABLE COMMENT '更新产量' DO call UpdateSiteOnlineYield();

