CREATE TABLE `mdm_machine_group` (
  `id` bigint NOT NULL COMMENT '主键',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '000000' COMMENT '租户ID',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机床组名称',
  `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机床组编号',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_user` bigint DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `status` int DEFAULT '1' COMMENT '状态',
  `is_deleted` int DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='机床组';


CREATE TABLE `mdm_machine` (
  `id` bigint NOT NULL,
  `tenant_id` varchar(6) DEFAULT NULL COMMENT '所属租户',
  `code` varchar(100) NOT NULL COMMENT '机床编号',
  `name` varchar(100) CHARACTER SET gbk COLLATE gbk_chinese_ci NOT NULL COMMENT '机床名称',
  `avatar` varchar(1000) DEFAULT NULL COMMENT '图片地址',
  `machine_group_id` bigint DEFAULT NULL COMMENT '所属机床组ID',
  `status` int DEFAULT NULL COMMENT '业务状态',
  `create_dept` bigint DEFAULT NULL COMMENT '创建单位',
  `is_deleted` int DEFAULT NULL,
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `update_user` bigint DEFAULT NULL COMMENT '更新人'
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uniqueCodeIndex` (`code`,`is_deleted`) USING BTREE,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='机床';


CREATE TABLE `mdm_nc_program` (
  `id` bigint NOT NULL,
  `tenant_id` varchar(6) DEFAULT NULL COMMENT '所属租户',
  `code` varchar(100) NOT NULL COMMENT '程序编号',
  `name` varchar(100) NOT NULL COMMENT '程序名称',
  `machine_group_id` bigint DEFAULT NULL COMMENT '所属机床组ID',
  `flow_task_id` bigint DEFAULT NULL COMMENT '任务ID，接收下发任务时确定的任务id，非流程示例id',
  `is_cured` int DEFAULT NULL COMMENT '是否固化,1是;0否',
  `status` int DEFAULT NULL COMMENT '业务状态',
  `create_dept` bigint DEFAULT NULL COMMENT '创建单位',
  `is_deleted` int DEFAULT NULL,
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `update_user` bigint DEFAULT NULL COMMENT '更新人'
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uniqueCodeIndex` (`code`,`is_deleted`) USING BTREE,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='数控程序';


CREATE TABLE `mdm_task_receive` (
  `id` bigint NOT NULL,
  `name` varchar(100) NOT NULL COMMENT '程序名称',
  `machine_group_id` bigint DEFAULT NULL COMMENT '所属机床组ID',
  `flow_task_id` bigint DEFAULT NULL COMMENT '任务ID，接收下发任务时确定的任务id，非流程示例id',
  `is_cured` int DEFAULT NULL COMMENT '是否固化,1是;0否',
  `status` int DEFAULT NULL COMMENT '业务状态',
  `create_dept` bigint DEFAULT NULL COMMENT '创建单位',
  `is_deleted` int DEFAULT NULL,
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `update_user` bigint DEFAULT NULL COMMENT '更新人'
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uniqueCodeIndex` (`name`,`is_deleted`) USING BTREE,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='任务接收表';
