/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 80032 (8.0.32)
 Source Host           : localhost:3306
 Source Schema         : aoi_pcb

 Target Server Type    : MySQL
 Target Server Version : 80032 (8.0.32)
 File Encoding         : 65001

 Date: 30/07/2024 19:00:32
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for defect
-- ----------------------------
DROP TABLE IF EXISTS `defect`;
CREATE TABLE `defect`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `cam_id` int NOT NULL COMMENT '相机编号',
  `type` int NOT NULL COMMENT '缺陷类型',
  `board_id` int NOT NULL COMMENT '板号',
  `defect_id` int NOT NULL COMMENT '缺陷ID',
  `defect_x` float NOT NULL COMMENT '缺陷中心在参考图的x轴坐标',
  `defect_y` float NOT NULL COMMENT '缺陷中心在参考图的y轴坐标',
  `defect_rect_x` float NULL DEFAULT NULL COMMENT '缺陷矩形左上角x轴坐标',
  `defect_rect_y` float NULL DEFAULT NULL COMMENT '缺陷矩形左上角y轴坐标',
  `defect_rect_w` float NULL DEFAULT NULL COMMENT '缺陷矩形宽度',
  `defect_rect_h` float NULL DEFAULT NULL COMMENT '缺陷矩形高度',
  `defect_pic_x` float NULL DEFAULT NULL COMMENT '缺陷中心在单个相机扫描图矩形的x轴坐标',
  `defect_pic_y` float NULL DEFAULT NULL COMMENT '缺陷中心在单个相机扫描图矩形的y轴坐标',
  `defect_pic_rect_x` float NULL DEFAULT NULL COMMENT '缺陷矩形在单个相机扫描图的x轴坐标',
  `defect_pic_rect_y` float NULL DEFAULT NULL COMMENT '缺陷矩形在单个相机扫描图的y轴坐标',
  `defect_pic_rect_w` float NULL DEFAULT NULL COMMENT '缺陷矩形在单个相机扫描图的宽度',
  `defect_pic_rect_h` float NULL DEFAULT NULL COMMENT '缺陷矩形在单个相机扫描图的高度',
  `defect_pic_path` varchar(300) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '缺陷图保存在主工位的路径',
  `material` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '料号',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `defect_defect_id_index`(`defect_id` ASC) USING BTREE INVISIBLE
) ENGINE = InnoDB AUTO_INCREMENT = 23476 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for detection_task
-- ----------------------------
DROP TABLE IF EXISTS `detection_task`;
CREATE TABLE `detection_task`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `status` int UNSIGNED NOT NULL DEFAULT 1 COMMENT '任务状态：0 新增 1进行中 2已结束',
  `board_id` int UNSIGNED NOT NULL,
  `priority` int NOT NULL COMMENT '是否优先：0.不优先，1.优先',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3199 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for id_seq_tmp
-- ----------------------------
DROP TABLE IF EXISTS `id_seq_tmp`;
CREATE TABLE `id_seq_tmp`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `product_id` int UNSIGNED NOT NULL COMMENT '产品id',
  `product_seq` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '产品编号',
  `board_sum` int UNSIGNED NOT NULL COMMENT '板数量',
  `board_id` int UNSIGNED NOT NULL COMMENT '板id',
  `board_order` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '板序号：a，b，c，d',
  `material` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '板物料号',
  `cam_id` int NOT NULL COMMENT '相机编号',
  `materials` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '所有料号',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 730 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for pcb
-- ----------------------------
DROP TABLE IF EXISTS `pcb`;
CREATE TABLE `pcb`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `product_id` int UNSIGNED NOT NULL COMMENT '产品id',
  `product_seq` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品编号',
  `board_id` int UNSIGNED NOT NULL COMMENT '板子id',
  `board_sum` int UNSIGNED NOT NULL COMMENT '板子总数',
  `board_order` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '板子序号：a,b,c,d',
  `material` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '料号',
  `cam_id` int UNSIGNED NOT NULL COMMENT '相机编号,也是分片编号',
  `status` int NOT NULL COMMENT '10:扫描成功,11:扫描失败,20: 分析成功,21:分析失败,22:分析中',
  `defect_count` int NULL DEFAULT NULL COMMENT '缺陷数',
  `scan_end_time` datetime NULL DEFAULT NULL COMMENT '扫描结束时间',
  `detection_end_time` datetime NULL DEFAULT NULL COMMENT '分析结束时间',
  `materials` varchar(400) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品所有料号',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 92393 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for pcb_summary
-- ----------------------------
DROP TABLE IF EXISTS `pcb_summary`;
CREATE TABLE `pcb_summary`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `product_id` int NOT NULL COMMENT '产品id',
  `product_seq` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品编号',
  `board_id` int NOT NULL COMMENT '板子id',
  `board_sum` int NOT NULL COMMENT '板子总数',
  `board_order` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '板子序号：a,b,c,d',
  `material` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '料号',
  `status` int NOT NULL COMMENT '10:扫描成功11:扫描失败,20: 分析成功,21:分析失败,22:分析中',
  `defect_count` int NULL DEFAULT NULL COMMENT '缺陷数',
  `scan_summary_time` datetime NULL DEFAULT NULL COMMENT '扫描汇总时间',
  `detection_summary_time` datetime NULL DEFAULT NULL COMMENT '分析汇总时间',
  `materials` varchar(400) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品所有料号',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 92343 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
