ALTER TABLE `asr_wrk_mast`
    ADD COLUMN `send_fail_count` INT NOT NULL DEFAULT 0 COMMENT '命令下发失败次数' AFTER `system_msg`;

ALTER TABLE `asr_wrk_mast_log`
    ADD COLUMN `send_fail_count` INT NOT NULL DEFAULT 0 COMMENT '命令下发失败次数' AFTER `system_msg`;

INSERT INTO `asr_bas_wrk_status` (`wrk_sts`, `wrk_desc`, `modi_user`, `modi_time`, `appe_user`, `appe_time`)
SELECT 6, '入库待人工回滚', NULL, NOW(), NULL, NOW()
WHERE NOT EXISTS (SELECT 1 FROM `asr_bas_wrk_status` WHERE `wrk_sts` = 6);

INSERT INTO `asr_bas_wrk_status` (`wrk_sts`, `wrk_desc`, `modi_user`, `modi_time`, `appe_user`, `appe_time`)
SELECT 106, '出库待人工回滚', NULL, NOW(), NULL, NOW()
WHERE NOT EXISTS (SELECT 1 FROM `asr_bas_wrk_status` WHERE `wrk_sts` = 106);

INSERT INTO `asr_bas_wrk_status` (`wrk_sts`, `wrk_desc`, `modi_user`, `modi_time`, `appe_user`, `appe_time`)
SELECT 506, '移库待人工回滚', NULL, NOW(), NULL, NOW()
WHERE NOT EXISTS (SELECT 1 FROM `asr_bas_wrk_status` WHERE `wrk_sts` = 506);

INSERT INTO `sys_config` (`name`, `code`, `value`, `type`, `status`, `select_type`)
SELECT '设备命令自动回滚上限', 'deviceCommandAutoRollbackLimit', '3', 1, 1, 'crn'
WHERE NOT EXISTS (SELECT 1 FROM `sys_config` WHERE `code` = 'deviceCommandAutoRollbackLimit');
