/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 80041
 Source Host           : localhost:3306
 Source Schema         : vwed_task

 Target Server Type    : MySQL
 Target Server Version : 80041
 File Encoding         : 65001

 Date: 12/10/2025 10:34:23
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for vwed_taskrecord
-- ----------------------------
DROP TABLE IF EXISTS `vwed_taskrecord`;
CREATE TABLE `vwed_taskrecord`  (
  `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '记录ID',
  `def_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对应的任务定义ID',
  `def_label` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务标签',
  `def_version` int NULL DEFAULT NULL COMMENT '任务定义版本',
  `ended_on` datetime(6) NULL DEFAULT NULL COMMENT '结束时间',
  `ended_reason` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '结束原因',
  `status` int NULL DEFAULT NULL COMMENT '任务状态（1000: 运行成功, 1001: 进行中, 1002: 队列中, 2000: 失败, 2001: 取消,2002: 暂停）',
  `input_params` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '输入参数',
  `path` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '执行路径（记录AGV移动路径）',
  `agv_id` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '执行任务的AGV设备ID',
  `parent_task_record_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父任务记录ID',
  `root_task_record_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '根任务记录ID',
  `state_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态描述',
  `executor_time` int NULL DEFAULT NULL COMMENT '执行时间',
  `first_executor_time` datetime(6) NULL DEFAULT NULL COMMENT '首次执行时间',
  `if_have_child_task` bit(1) NULL DEFAULT NULL COMMENT '是否有子任务',
  `periodic_task` int NOT NULL COMMENT '是否为周期任务',
  `priority` int NOT NULL COMMENT '优先级',
  `root_block_state_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '根块状态ID',
  `work_stations` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工作站',
  `work_types` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工作类型',
  `task_def_detail` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '任务定义详情',
  `variables` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '变量信息',
  `call_work_station` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '调用工作站',
  `call_work_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '调用工作类型',
  `source_type` int NOT NULL COMMENT '任务来源类型（1: 系统调度, 2:  呼叫机, 3: 第三方系统, 4: 手持电脑）',
  `source_system` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源系统标识（如：WMS、MES等系统编号）',
  `source_user` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '下达任务的用户ID或账号',
  `source_device` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '下达任务的硬件设备标识（设备ID、MAC地址等）',
  `source_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '下达任务的IP地址',
  `source_time` datetime(6) NOT NULL COMMENT '任务下达时间',
  `source_client_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '客户端设备信息（用户代理、浏览器、操作系统等）',
  `source_remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '任务来源备注信息',
  `allow_restart_same_location` tinyint(1) NULL DEFAULT NULL COMMENT '运行状态时相同地址是否可再次启动该任务',
  `created_at` datetime(6) NULL DEFAULT NULL COMMENT '创建时间',
  `updated_at` datetime(6) NULL DEFAULT NULL COMMENT '更新时间',
  `is_deleted` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除（软删除标记）',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_vwed_taskrecord_status`(`status` ASC) USING BTREE,
  INDEX `idx_vwed_taskrecord_def_id`(`def_id` ASC) USING BTREE,
  INDEX `idx_vwed_taskrecord_agv_id`(`agv_id` ASC) USING BTREE,
  INDEX `idx_vwed_taskrecord_parent_id`(`parent_task_record_id` ASC) USING BTREE,
  INDEX `idx_vwed_taskrecord_root_id`(`root_task_record_id` ASC) USING BTREE,
  INDEX `idx_vwed_taskrecord_source_time`(`source_time` ASC) USING BTREE,
  INDEX `idx_vwed_taskrecord_created_at`(`created_at` ASC) USING BTREE,
  INDEX `idx_vwed_taskrecord_priority`(`priority` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of vwed_taskrecord
-- ----------------------------
INSERT INTO `vwed_taskrecord` VALUES ('e7191efc-4af9-4068-9d6c-cd421585d94e', '571985c1-cfa5-4186-8acd-6e3868a5e08c', 'test', 209, '2025-10-12 10:33:31.598625', '任务执行中', 1001, '[{\"name\": \"values111\", \"type\": \"OBJECT\", \"label\": \"测试值\", \"required\": false, \"defaultValue\": \"{\\\"test\\\":{\\\"name\\\": \\\"123\\\"}}\", \"remark\": \"\"}]', NULL, 'Fake-12', NULL, NULL, NULL, 46507, '2025-10-12 10:32:45.082527', NULL, 0, 1, NULL, NULL, NULL, '{\"inputParams\": [], \"outputParams\": [], \"rootBlock\": {\"id\": -1, \"name\": \"-1\", \"blockType\": \"RootBp\", \"inputParams\": {}, \"children\": {\"default\": [{\"id\": 5, \"name\": \"b2\", \"blockType\": \"CSelectAgvBp\", \"inputParams\": {\"group\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"keyRoute\": {\"type\": \"Simple\", \"value\": \"AP1\", \"required\": true}, \"priority\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"vehicle\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}}, \"children\": {\"default\": [{\"id\": 5, \"name\": \"b3\", \"blockType\": \"CAgvOperationBp\", \"inputParams\": {\"spin\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"targetSiteLabel\": {\"type\": \"Simple\", \"value\": \"AP1\", \"required\": true}, \"task\": {\"type\": \"Simple\", \"value\": \"pick\", \"required\": false}, \"inspired_unique\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"unique_file\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}}, \"children\": {}, \"refTaskDefId\": \"\", \"selected\": false, \"expanded\": true, \"description\": \"\", \"label\": \"机器人通用动作\"}, {\"id\": 6, \"name\": \"b4\", \"blockType\": \"CAgvOperationBp\", \"inputParams\": {\"spin\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"targetSiteLabel\": {\"type\": \"Simple\", \"value\": \"AP23\", \"required\": true}, \"task\": {\"type\": \"Simple\", \"value\": \"drop\", \"required\": false}, \"inspired_unique\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}}, \"children\": {}, \"refTaskDefId\": \"\", \"selected\": false, \"expanded\": true, \"description\": \"\", \"label\": \"机器人通用动作\"}]}, \"refTaskDefId\": \"\", \"selected\": false, \"expanded\": true, \"description\": \"\", \"label\": \"选择执行机器人\"}, {\"id\": \"1704fcf9-9953-4673-acda-7905a37e101b\", \"name\": \"sw_1704fcf9\", \"blockType\": \"CSelectAgvBp\", \"inputParams\": {\"group\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"keyRoute\": {\"type\": \"Simple\", \"value\": \"AP1\", \"required\": true}, \"priority\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"vehicle\": {\"value\": \"Fake-12\", \"type\": \"Simple\", \"required\": false}}, \"children\": {\"default\": [{\"id\": \"7adf6f31-aa74-46e5-b510-6adb75077a03\", \"name\": \"sw_7adf6f31\", \"blockType\": \"CAgvOperationBp\", \"inputParams\": {\"spin\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"targetSiteLabel\": {\"type\": \"Simple\", \"value\": \"AP1\", \"required\": true}, \"task\": {\"type\": \"Simple\", \"value\": \"pick\", \"required\": false}, \"inspired_unique\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"unique_file\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}}, \"children\": {}, \"refTaskDefId\": \"\", \"selected\": false, \"expanded\": true, \"description\": \"\", \"label\": \"机器人通用动作\"}, {\"id\": \"9a272c7f-d5aa-4472-8223-80da5bcdaade\", \"name\": \"sw_9a272c7f\", \"blockType\": \"CAgvOperationBp\", \"inputParams\": {\"spin\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}, \"targetSiteLabel\": {\"type\": \"Simple\", \"value\": \"AP23\", \"required\": true}, \"task\": {\"type\": \"Simple\", \"value\": \"drop\", \"required\": false}, \"inspired_unique\": {\"type\": \"Simple\", \"value\": \"\", \"required\": false}}, \"children\": {}, \"refTaskDefId\": \"\", \"selected\": false, \"expanded\": true, \"description\": \"\", \"label\": \"机器人通用动作\"}]}, \"refTaskDefId\": \"\", \"selected\": false, \"expanded\": true, \"description\": \"\", \"label\": \"选择执行机器人\"}]}, \"refTaskDefId\": \"\", \"selected\": false, \"expanded\": true, \"description\": \"\", \"label\": \"\"}}', NULL, NULL, NULL, 1, '123', NULL, '123', '127.0.0.1', '2025-10-12 10:32:44.897206', '{\"user_agent\": \"PostmanRuntime/7.48.0\", \"headers\": {\"x-access-token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NTEzMjU4MDksInVzZXJuYW1lIjoiYWRtaW4ifQ.VMDCQhLMqbFKyXVeEwWha_jcqjW7PSG6Wn7ROeovsfs\", \"content-type\": \"application/json\", \"user-agent\": \"PostmanRuntime/7.48.0\", \"accept\": \"*/*\", \"postman-token\": \"3d5d8698-95d4-4198-90cc-89657e9cb722\", \"host\": \"127.0.0.1:8000\", \"accept-encoding\": \"gzip, deflate, br\", \"connection\": \"keep-alive\", \"content-length\": \"404\"}, \"method\": \"POST\", \"url\": \"http://127.0.0.1:8000/api/vwed-task-edit/run\"}', NULL, 1, '2025-10-12 10:32:44.908439', '2025-10-12 10:33:33.064777', 0);

SET FOREIGN_KEY_CHECKS = 1;
