evoToK3Cloud/script/sql/update/plm-receive-log.sql
2026-08-11 14:29:31 +08:00

35 lines
3.0 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- PLM 总装配 BOM / 工艺路线推送接收留痕(防扯皮)
-- 每次推送追加一条,保留完整请求 JSON不随业务表先删后插而丢失。
CREATE TABLE IF NOT EXISTS `plm_receive_log` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`biz_type` varchar(32) NOT NULL COMMENT 'ASSEMBLY_BOM / PROCESS_ROUTE',
`api_path` varchar(128) NOT NULL COMMENT '接口路径',
`production_order_no` varchar(64) DEFAULT NULL COMMENT '生产令号(统一字段)',
`payload_json` longtext NOT NULL COMMENT '完整请求 JSON 原文',
`payload_sha256` varchar(64) DEFAULT NULL COMMENT '请求体 SHA-256',
`payload_size` int DEFAULT NULL COMMENT '请求体字符数',
`summary_json` varchar(2000) DEFAULT NULL COMMENT '成功摘要 JSON',
`line_count` int DEFAULT NULL COMMENT '总装行数 / 工艺物料数',
`saved_count` int DEFAULT NULL COMMENT '实际入库相关行数摘要',
`replaced` tinyint(1) DEFAULT NULL COMMENT '是否覆盖原令号数据',
`status` varchar(16) NOT NULL COMMENT 'SUCCESS / FAIL',
`error_msg` varchar(2000) DEFAULT NULL COMMENT '失败原因',
`client_ip` varchar(64) DEFAULT NULL COMMENT '客户端 IP',
`receive_time` datetime NOT NULL COMMENT '接收时间',
PRIMARY KEY (`id`),
KEY `idx_plm_recv_order` (`production_order_no`),
KEY `idx_plm_recv_type_time` (`biz_type`, `receive_time`),
KEY `idx_plm_recv_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='PLM总装BOM/工艺路线接收留痕';
-- 菜单parent_id 请按实际菜单树调整21210 起避免与 PDF 推送菜单冲突)
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (21210, 'PLM接收留痕', 0, 21, 'plmReceiveLog', 'system/plmReceiveLog/index', 1, 0, 'C', '0', '0', 'system:plmReceiveLog:list', 'log', 'admin', sysdate(), '', NULL, 'PLM总装BOM/工艺路线推送防扯皮留痕');
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (21211, 'PLM接收留痕查询', 21210, 1, '#', '', 1, 0, 'F', '0', '0', 'system:plmReceiveLog:query', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (21212, '同步到BOM明细', 21210, 2, '#', '', 1, 0, 'F', '0', '0', 'system:plmReceiveLog:syncBomDetails', '#', 'admin', sysdate(), '', NULL, '将production_order总装行手动写入bom_details');