-- 预警推送：按工段/角色分对象接收人
ALTER TABLE `work_alert_push_config`
  ADD COLUMN `recipient_rules` text DEFAULT NULL COMMENT '分对象接收人JSON，如{"机一工段":"staffId1"}' AFTER `ding_user_ids`;

-- 拆分工序汇报为两项（保留 getProductionOrder 兼容旧配置）
INSERT INTO `work_alert_push_config` (`push_code`, `push_name`, `push_time`, `enabled`, `sort_order`, `remark`, `create_time`) VALUES
('getProcessReportNotInspected', '汇报未质检', '08:35', '0', 61, '私发：填写质检人员 StaffId', NOW()),
('getProcessReportNotStockedIn', '质检未入库', '08:36', '0', 62, '私发：填写库房人员 StaffId', NOW())
ON DUPLICATE KEY UPDATE push_name = VALUES(push_name), remark = VALUES(remark);

UPDATE `work_alert_push_config`
SET `push_name` = '工序汇报预警(合并)', `remark` = '未质检+未入库双Sheet；建议改用拆分项'
WHERE `push_code` = 'getProductionOrder';

UPDATE `work_alert_push_config`
SET `remark` = '配置 recipient_rules 按工段长分人私发；留空则多Sheet群发'
WHERE `push_code` IN ('getMassageTransInPendingOut', 'getMassageStartedNotTransIn');
