-- 生产线扫码入库菜单与按钮权限
-- 菜单挂载到一袋一码管理（602630），组件路径与前端动态路由一致。
UPDATE system_menu
SET parent_id = 602630, sort = 7, updater = '1', update_time = NOW()
WHERE id = 602650 AND deleted = 0;
INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name,
                         status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted)
SELECT 602650, '生产线扫码入库', '', 2, 7, 602630, 'scan-in', 'ep:camera', 'mes/pro/scan-in/index', 'MesProScanIn',
       0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM system_menu WHERE id = 602650 AND deleted = 0);

INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name,
                         status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted)
SELECT 602651, '扫码入库查询', 'mes:pro-scan-in:query', 3, 1, 602650, '', '', '', '',
       0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM system_menu WHERE id = 602651 AND deleted = 0);

INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name,
                         status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted)
SELECT 602652, '扫码入库', 'mes:pro-scan-in:inbound', 3, 2, 602650, '', '', '', '',
       0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM system_menu WHERE id = 602652 AND deleted = 0);

INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name,
                         status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted)
SELECT 602653, '扫码入库看板', 'mes:pro-scan-in:dashboard', 3, 3, 602650, '', '', '', '',
       0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM system_menu WHERE id = 602653 AND deleted = 0);
