fix: rebuild MES as compilable go-zero+ent backend (renamed bj_power_mes), restore 3 workstation projects from pristine original, align naming; all Go projects go build clean

This commit is contained in:
SunYF
2026-08-27 10:56:41 +08:00
parent 380715f8a9
commit 371b494c54
523 changed files with 67923 additions and 24758 deletions
+46 -186
View File
@@ -1,186 +1,46 @@
-- ============================================================================
-- 磨床自动化单元 - PLC信号种子数据
-- ============================================================================
-- 说明:
-- id: 信号ID
-- is_status: 0=任务信号(PC→PLC触发), 1=状态信号(PLC→PC通知)
-- sender: 1=PC(软件), 2=PLC
-- address: 西门子S7 PLC地址(M区); 位地址如 M3600.0, 字节地址如 M3600
-- reply_offset: 回复信号地址偏移量(通常+9),状态信号为0
-- data_type: 数据类型(bool/byte),默认bool。byte类型信号需显式标记
-- ============================================================================
DELETE FROM signal;
INSERT INTO signal (id, is_status, name, sender, address, reply_offset, data_type, description) VALUES
-- ========== 接驳台 Dock (M2000-M2019) ==========
(1, 0, 'DockFetchReq', 1, 'M2000', 9, 'byte', '软件_接驳台取料信号'),
(2, 0, 'DockFetchPos', 1, 'M2001', 0, 'byte', '软件_接驳台取位置号(1-42)'),
(3, 0, 'DockFetchTray', 1, 'M2002', 0, 'byte', '软件_接驳台取料(1=接驳台1,2=接驳台2)'),
(4, 1, 'DockReserve01', 2, 'M2003', 0, 'byte', '备用'),
(5, 1, 'DockReserve02', 2, 'M2004', 0, 'byte', '备用'),
(6, 1, 'DockReserve03', 2, 'M2005', 0, 'byte', '备用'),
(7, 1, 'DockReserve04', 2, 'M2006', 0, 'byte', '备用'),
(8, 1, 'DockReserve05', 2, 'M2007', 0, 'byte', '备用'),
(9, 1, 'DockReserve06', 2, 'M2008', 0, 'byte', '备用'),
(10, 1, 'DockFetchDone', 2, 'M2009', 0, 'byte', 'PLC_接驳台取料完成'),
(11, 0, 'DockPlaceReq', 1, 'M2010', 9, 'byte', '软件_接驳台放料信号'),
(12, 0, 'DockPlacePos', 1, 'M2011', 0, 'byte', '软件_接驳台放位置号(1-42)'),
(13, 0, 'DockPlaceTray', 1, 'M2012', 0, 'byte', '软件_接驳台放料(1=接驳台1,2=接驳台2)'),
(14, 1, 'DockReserve07', 2, 'M2013', 0, 'byte', '备用'),
(15, 1, 'DockReserve08', 2, 'M2014', 0, 'byte', '备用'),
(16, 1, 'DockReserve09', 2, 'M2015', 0, 'byte', '备用'),
(17, 1, 'DockReserve10', 2, 'M2016', 0, 'byte', '备用'),
(18, 1, 'DockReserve11', 2, 'M2017', 0, 'byte', '备用'),
(19, 1, 'DockReserve12', 2, 'M2018', 0, 'byte', '备用'),
(20, 1, 'DockPlaceDone', 2, 'M2019', 0, 'byte', 'PLC_接驳台放料完成'),
-- ========== 相机 Camera (M2020-M2029) ==========
(21, 0, 'CameraShootReq', 1, 'M2020', 9, 'byte', '软件_相机拍照'),
(22, 0, 'CameraShootTray', 1, 'M2021', 0, 'byte', '软件_接驳台拍照'),
(23, 0, 'CameraWorkType', 1, 'M2022', 0, 'byte', '软件_工件类型(product_type.id)'),
(24, 0, 'CameraShootPos', 1, 'M2023', 0, 'byte', '软件_相机拍照位置号'),
(25, 1, 'CameraReserve02', 2, 'M2024', 0, 'byte', '备用'),
(26, 1, 'CameraReserve03', 2, 'M2025', 0, 'byte', '备用'),
(27, 1, 'CameraReserve04', 2, 'M2026', 0, 'byte', '备用(原接驳台清零完成,已移除)'),
(28, 1, 'CameraShootResult', 2, 'M2027', 0, 'byte', 'PLC_拍照结果(1=有料,0=无料)'),
(29, 0, 'CameraWorkTypeReserve', 1, 'M2028', 0, 'byte', '软件_工件类型(暂时不用)'),
(30, 1, 'CameraShootDone', 2, 'M2029', 0, 'byte', 'PLC_拍照完成'),
-- ========== 磨床 Grinder (M2030-M2059) ==========
(31, 0, 'GrinderFetchReq', 1, 'M2030', 9, 'byte', '软件_磨床取料信号'),
(32, 1, 'GrinderReserve01', 2, 'M2031', 0, 'byte', '备用'),
(33, 1, 'GrinderReserve02', 2, 'M2032', 0, 'byte', '备用'),
(34, 1, 'GrinderReserve03', 2, 'M2033', 0, 'byte', '备用'),
(35, 1, 'GrinderReserve04', 2, 'M2034', 0, 'byte', '备用'),
(36, 1, 'GrinderReserve05', 2, 'M2035', 0, 'byte', '备用'),
(37, 1, 'GrinderReserve06', 2, 'M2036', 0, 'byte', '备用'),
(38, 1, 'GrinderReserve07', 2, 'M2037', 0, 'byte', '备用'),
(39, 1, 'GrinderReserve08', 2, 'M2038', 0, 'byte', '备用(原磨削完成→M3600.0)'),
(40, 1, 'GrinderFetchDone', 2, 'M2039', 0, 'byte', 'PLC_磨床取料完成'),
(41, 0, 'GrinderPlaceReq', 1, 'M2040', 9, 'byte', '软件_磨床放料信号'),
(42, 1, 'GrinderReserve09', 2, 'M2041', 0, 'byte', '备用'),
(43, 1, 'GrinderReserve10', 2, 'M2042', 0, 'byte', '备用'),
(44, 1, 'GrinderReserve11', 2, 'M2043', 0, 'byte', '备用'),
(45, 1, 'GrinderReserve12', 2, 'M2044', 0, 'byte', '备用'),
(46, 1, 'GrinderReserve13', 2, 'M2045', 0, 'byte', '备用'),
(47, 1, 'GrinderReserve14', 2, 'M2046', 0, 'byte', '备用'),
(48, 1, 'GrinderReserve15', 2, 'M2047', 0, 'byte', '备用'),
(49, 1, 'GrinderReserve16', 2, 'M2048', 0, 'byte', '备用'),
(50, 1, 'GrinderPlaceDone', 2, 'M2049', 0, 'byte', 'PLC_磨床放料完成'),
(51, 0, 'GrinderExchangeReq', 1, 'M2050', 9, 'byte', '软件_磨床换料信号'),
(52, 1, 'GrinderReserve17', 2, 'M2051', 0, 'byte', '备用'),
(53, 1, 'GrinderReserve18', 2, 'M2052', 0, 'byte', '备用'),
(54, 1, 'GrinderReserve19', 2, 'M2053', 0, 'byte', '备用'),
(55, 1, 'GrinderReserve20', 2, 'M2054', 0, 'byte', '备用'),
(56, 1, 'GrinderReserve21', 2, 'M2055', 0, 'byte', '备用'),
(57, 1, 'GrinderReserve22', 2, 'M2056', 0, 'byte', '备用'),
(58, 1, 'GrinderReserve23', 2, 'M2057', 0, 'byte', '备用'),
(59, 1, 'GrinderReserve24', 2, 'M2058', 0, 'byte', '备用'),
(60, 1, 'GrinderExchangeDone', 2, 'M2059', 0, 'byte', 'PLC_磨床换料完成信号'),
-- ========== 换向机构 TurnTable (M2060-M2079) ==========
(61, 0, 'TurnTableFetchReq', 1, 'M2060', 9, 'byte', '软件_换向机构取料信号'),
(62, 1, 'TurnTableReserve01', 2, 'M2061', 0, 'byte', '备用'),
(63, 1, 'TurnTableReserve02', 2, 'M2062', 0, 'byte', '备用'),
(64, 1, 'TurnTableReserve03', 2, 'M2063', 0, 'byte', '备用'),
(65, 1, 'TurnTableReserve04', 2, 'M2064', 0, 'byte', '备用'),
(66, 1, 'TurnTableReserve05', 2, 'M2065', 0, 'byte', '备用'),
(67, 1, 'TurnTableReserve06', 2, 'M2066', 0, 'byte', '备用'),
(68, 1, 'TurnTableReserve07', 2, 'M2067', 0, 'byte', '备用'),
(69, 1, 'TurnTableReserve08', 2, 'M2068', 0, 'byte', '备用'),
(70, 1, 'TurnTableFetchDone', 2, 'M2069', 0, 'byte', 'PLC_换向机构取料完成信号'),
(71, 0, 'TurnTablePlaceReq', 1, 'M2070', 9, 'byte', '软件_换向机构放料信号'),
(72, 1, 'TurnTableReserve09', 2, 'M2071', 0, 'byte', '备用'),
(73, 1, 'TurnTableReserve10', 2, 'M2072', 0, 'byte', '备用'),
(74, 1, 'TurnTableReserve11', 2, 'M2073', 0, 'byte', '备用'),
(75, 1, 'TurnTableReserve12', 2, 'M2074', 0, 'byte', '备用'),
(76, 1, 'TurnTableReserve13', 2, 'M2075', 0, 'byte', '备用'),
(77, 1, 'TurnTableReserve14', 2, 'M2076', 0, 'byte', '备用'),
(78, 1, 'TurnTableReserve15', 2, 'M2077', 0, 'byte', '备用'),
(79, 1, 'TurnTableReserve16', 2, 'M2078', 0, 'byte', '备用'),
(80, 1, 'TurnTablePlaceDone', 2, 'M2079', 0, 'byte', 'PLC_换向机构放料完成信号'),
-- ========== 全检台换料 FullCheckExchange (M2080-M2089) ==========
(81, 0, 'FullCheckExchangeReq', 1, 'M2080', 9, 'byte', '软件_全检台换料信号'),
(82, 0, 'FullCheckExchangeFetchPos', 1, 'M2081', 0, 'byte', '软件_全检台取位置号(换料时写M2091)'),
(83, 0, 'FullCheckExchangePlacePos', 1, 'M2082', 0, 'byte', '软件_全检台放位置号(换料时写M2101)'),
(84, 1, 'FullCheckExchangeReserve01', 2, 'M2083', 0, 'byte', '备用'),
(85, 1, 'FullCheckExchangeReserve02', 2, 'M2084', 0, 'byte', '备用'),
(86, 1, 'FullCheckExchangeReserve03', 2, 'M2085', 0, 'byte', '备用'),
(87, 1, 'FullCheckExchangeReserve04', 2, 'M2086', 0, 'byte', '备用'),
(88, 1, 'FullCheckExchangeReserve05', 2, 'M2087', 0, 'byte', '备用'),
(89, 1, 'FullCheckExchangeReserve06', 2, 'M2088', 0, 'byte', '备用'),
(90, 1, 'FullCheckExchangeDone', 2, 'M2089', 0, 'byte', 'PLC_全检台换料完成'),
-- ========== 全检台 FullCheck (M2090-M2109) ==========
(91, 0, 'FullCheckFetchReq', 1, 'M2090', 9, 'byte', '软件_全检台取料信号'),
(92, 0, 'FullCheckFetchPos', 1, 'M2091', 0, 'byte', '软件_全检台取位置号'),
(93, 1, 'FullCheckReserve01', 2, 'M2092', 0, 'byte', '备用'),
(94, 1, 'FullCheckReserve02', 2, 'M2093', 0, 'byte', '备用'),
(95, 1, 'FullCheckReserve03', 2, 'M2094', 0, 'byte', '备用'),
(96, 1, 'FullCheckReserve04', 2, 'M2095', 0, 'byte', '备用'),
(97, 1, 'FullCheckReserve05', 2, 'M2096', 0, 'byte', '备用'),
(98, 1, 'FullCheckReserve06', 2, 'M2097', 0, 'byte', '备用'),
(99, 1, 'FullCheckInspectDone', 2, 'M2098', 0, 'byte', 'PLC_全检台检测完成在取放料位'),
(100, 1, 'FullCheckFetchDone', 2, 'M2099', 0, 'byte', 'PLC_全检台取料完成信号'),
(101, 0, 'FullCheckPlaceReq', 1, 'M2100', 9, 'byte', '软件_全检台放料信号'),
(102, 0, 'FullCheckPlacePos', 1, 'M2101', 0, 'byte', '软件_全检台放位置号'),
(103, 0, 'FullCheckPlaceDoneRequestInspect', 1, 'M2102', 0, 'byte', '软件_待检放料完成请求检验'),
(104, 1, 'FullCheckReserve09', 2, 'M2103', 0, 'byte', '备用'),
(105, 1, 'FullCheckReserve10', 2, 'M2104', 0, 'byte', '备用'),
(106, 1, 'FullCheckReserve11', 2, 'M2105', 0, 'byte', '备用'),
(107, 1, 'FullCheckReserve12', 2, 'M2106', 0, 'byte', '备用'),
(108, 1, 'FullCheckReserve13', 2, 'M2107', 0, 'byte', '备用'),
(109, 1, 'FullCheckDetecting', 2, 'M2108', 0, 'byte', 'PLC_全检台人工检验中'),
(110, 1, 'FullCheckPlaceDone', 2, 'M2109', 0, 'byte', 'PLC_全检台放料完成信号'),
-- ========== 缓存台 Cache (M2110-M2129) ==========
(111, 0, 'CacheFetchReq', 1, 'M2110', 9, 'byte', '软件_缓存台取料信号'),
(112, 0, 'CacheFetchPos', 1, 'M2111', 0, 'byte', '软件_缓存台取料位置号'),
(113, 1, 'CacheReserve01', 2, 'M2112', 0, 'byte', '备用'),
(114, 1, 'CacheReserve02', 2, 'M2113', 0, 'byte', '备用'),
(115, 1, 'CacheReserve03', 2, 'M2114', 0, 'byte', '备用'),
(116, 1, 'CacheReserve04', 2, 'M2115', 0, 'byte', '备用'),
(117, 1, 'CacheReserve05', 2, 'M2116', 0, 'byte', '备用'),
(118, 1, 'CacheReserve06', 2, 'M2117', 0, 'byte', '备用'),
(119, 1, 'CacheReserve07', 2, 'M2118', 0, 'byte', '备用'),
(120, 1, 'CacheFetchDone', 2, 'M2119', 0, 'byte', 'PLC_缓存台取料完成信号'),
(121, 0, 'CachePlaceReq', 1, 'M2120', 9, 'byte', '软件_缓存台放料信号'),
(122, 0, 'CachePlacePos', 1, 'M2121', 0, 'byte', '软件_缓存台放料位置号'),
(123, 1, 'CacheReserve08', 2, 'M2122', 0, 'byte', '备用'),
(124, 1, 'CacheReserve09', 2, 'M2123', 0, 'byte', '备用'),
(125, 1, 'CacheReserve10', 2, 'M2124', 0, 'byte', '备用'),
(126, 1, 'CacheReserve11', 2, 'M2125', 0, 'byte', '备用'),
(127, 1, 'CacheReserve12', 2, 'M2126', 0, 'byte', '备用'),
(128, 1, 'CacheReserve13', 2, 'M2127', 0, 'byte', '备用'),
(129, 1, 'CacheReserve14', 2, 'M2128', 0, 'byte', '备用'),
(130, 1, 'CachePlaceDone', 2, 'M2129', 0, 'byte', 'PLC_缓存台放料完成信号'),
-- ========== 清洗 Wash (M2130-M2139) ==========
(131, 0, 'WashStartReq', 1, 'M2130', 9, 'byte', '软件_工件清洗'),
(132, 1, 'AirBlowReserve01', 2, 'M2131', 0, 'byte', '备用'),
(133, 1, 'AirBlowReserve02', 2, 'M2132', 0, 'byte', '备用'),
(134, 1, 'AirBlowReserve03', 2, 'M2133', 0, 'byte', '备用'),
(135, 1, 'AirBlowReserve04', 2, 'M2134', 0, 'byte', '备用'),
(136, 1, 'AirBlowReserve05', 2, 'M2135', 0, 'byte', '备用'),
(137, 1, 'AirBlowReserve06', 2, 'M2136', 0, 'byte', '备用'),
(138, 1, 'AirBlowReserve07', 2, 'M2137', 0, 'byte', '备用'),
(139, 1, 'AirBlowReserve08', 2, 'M2138', 0, 'byte', '备用'),
(140, 1, 'AirBlowCompleteDone', 2, 'M2139', 0, 'byte', 'PLC_清洗完成'),
-- data_type=byte: AirBlowCompleteDone(M2139) 是字节类型,非位地址
-- ========== 设备状态位 M3600.x ==========
(141, 1, 'GrinderMachiningDone', 2, 'M3600.0', 0, 'bool', 'PLC_磨床加工完成'),
(142, 1, 'GrinderAllowEntry', 2, 'M3600.1', 0, 'bool', 'PLC_磨床允许进入'),
(143, 1, 'TurnTableClamped', 2, 'M3601.0', 0, 'bool', 'PLC_换向机构夹紧到位'),
(144, 1, 'TurnTableReleased', 2, 'M3601.1', 0, 'bool', 'PLC_换向机构松开到位'),
(145, 1, 'Dock1Present', 2, 'M3604.0', 0, 'bool', 'PLC_接驳台1在位'),
(146, 1, 'Dock2Present', 2, 'M3604.1', 0, 'bool', 'PLC_接驳台2在位');
-- 注意:机器人错误码信号 ErrorCode(PC←PLC,读 8 字节)无种子数据。
-- internal/plc.GetErrorCode 依赖 DB signal 表中名为 ErrorCode 的信号;
-- 当前未配置时该方法返回 ErrInvalidAddress(明确报错),如需启用请按
-- PLC 图纸在此补充配置(地址/数据类型以现场为准,勿用占位地址)。
-- 重置ID序列
SELECT setval('signal_id_seq', (SELECT MAX(id) FROM signal));
DELETE
FROM signal;
ALTER sequence signal_id_seq restart with 1;
INSERT INTO signal (is_status, name, sender, address, reply_offset, description)
VALUES (1, 'DockStates', 2, 'M3010.0', 0, '接驳台状态'),
(1, 'TempStates', 2, 'M1152.0', 0, '暂存台状态'),
(1, 'CNCDone1', 2, 'M1140.0', 0, '数控机床1加工完成'),
(1, 'CNCDone2', 2, 'M1141.0', 0, '数控机床2加工完成'),
(1, 'CNCDone3', 2, 'M1142.0', 0, '数控机床3加工完成'),
(1, 'CNCDone4', 2, 'M1143.0', 0, '数控机床4加工完成'),
(1, 'WasherDone', 2, 'M1144.0', 0, '高压清洗机加工完成'),
(1, 'WasherReady', 2, 'M1144.1', 0, '高压清洗机就绪'),
(1, 'WasherStartup', 1, 'M1144.2', 0, '高压清洗机开始运行'),
(1, 'DeburrDone', 2, 'M1145.0', 0, '热能去毛刺机加工完成'),
(1, 'CleaningDone', 2, 'M1146.0', 0, '清洗线加工完成'),
(1, 'CleaningReady', 2, 'M1146.1', 0, '清洗线就绪'),
(1, 'CleaningStartup', 1, 'M1146.2', 0, '清洗线放行'),
(1, 'CleaningRequestLoading', 1, 'M1146.3', 0, '请求清洗线上料'),
(1, 'RollingReady', 2, 'M1147.0', 0, '滚筒线就绪'),
(1, 'MeasureOK', 2, 'M1148.0', 0, '内窥镜检测OK信号'),
(1, 'MeasureNG', 2, 'M1148.1', 0, '内窥镜检测NG信号'),
(1, 'StartMeasure', 2, 'M1148.2', 0, '滚筒线开始检测'),
(1, 'SamplingRequest', 2, 'M1150.0', 0, '抽检请求信号'),
(1, 'WasteReady', 2, 'M1150.1', 0, '废料台Ready信号'),
(1, 'SamplingOK', 2, 'M1151.0', 0, '抽检OK信号'),
(1, 'SamplingNG', 2, 'M1151.1', 0, '抽检NG信号'),
(1, 'ScanCodeData', 2, 'DB28.DBB2', 32, '扫码结果'),
(1, 'ErrorCode', 2, 'M5000', 0, '机器人错误码'),
(0, 'FetchWorkpieceFromDock', 1, 'M1000', 9, '从接驳台取工件'),
(0, 'PlaceWorkpieceToDock', 1, 'M1010', 9, '放工件到接驳台'),
(0, 'FetchWorkpieceFromTempStation', 1, 'M1020', 9, '从暂存台取工件'),
(0, 'PlaceWorkpieceToTempStation', 1, 'M1030', 9, '放工件到暂存台'),
(0, 'PlaceWorkpieceToMachine', 1, 'M1040', 9,
'放工件到加工设备(包括 CNC机床、高压清洗机、除锈清洗线,其它设备使用专用放置接口)'),
(0, 'FetchWorkpieceFromMachine', 1, 'M1050', 9,
'从加工设备取工件(包括 CNC机床、高压清洗机、除锈清洗线,其它设备使用专用取走接口)'),
(0, 'ExchangeWorkpieceToMachine', 1, 'M1060', 9,
'给加工设备换料(包括 CNC机床、高压清洗机、除锈清洗线,其它设备不支持换料)'),
(0, 'PlaceWorkpieceToRollingLine', 1, 'M1070', 9, '放工件到滚筒线'),
(0, 'FetchWorkpieceFromRollingLine', 1, 'M1080', 9, '从滚筒线取工件'),
(0, 'PlaceWorkpieceToWasteStation', 1, 'M1140', 9, '放工件到废料台'),
(0, 'PlaceWorkpieceToSamplingStation', 1, 'M1090', 9, '放工件到抽检台'),
(0, 'FetchWorkpieceFromSamplingStation', 1, 'M1100', 9, '从抽检台取工件'),
(0, 'MoveWorkpieceToMarkingStation', 1, 'M1110', 9, '把工件移动到打标台'),
(0, 'StartScanCode', 1, 'M1130', 9, '开始扫码'),
(0, 'StartMarking', 1, 'M1110', 9, '开始打标');