Files
junhong_cmp_fiber/openspec/changes/fix-device-import-slot-mapping/proposal.md

33 lines
1.7 KiB
Markdown
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.
## Why
feature-2026-04-device-import-slot-mapping
当前设备导入会把 Excel 中非空 ICCID 列压缩成连续列表导致“卡2、卡3”这类原始槽位信息在导入时丢失最终被错误写入为“槽1、槽2”。该问题会直接造成设备与卡槽关系失真影响后续设备查询、切卡和运维判断需要尽快在规格和实现层统一修正。
## What Changes
- 修改设备导入规格,明确 `卡1~卡4` 列表示固定槽位,导入时必须保留原始列位信息,不得按非空顺序重排。
- 修改设备导入执行规则,设备卡绑定记录的 `slot_position` 必须与 Excel 列号一一对应。
- 新增越界约束:当 `max_sim_slots` 小于某个已填写 ICCID 的槽位编号时,该行导入失败,避免写入超出设备最大槽位数的绑定关系。
- 补充典型场景覆盖“仅填写卡2/卡3”“前置空槽保留”“超出最大槽位失败”等业务行为。
## Capabilities
### New Capabilities
无新增功能
### Modified Capabilities
- `device-import`: 设备导入的槽位语义从“按非空 ICCID 顺序绑定”调整为“按 Excel 固定列位绑定到对应槽位”,并补充超出 `max_sim_slots` 的失败规则。
## Impact
- 受影响规格:`openspec/specs/device-import/spec.md`
- 受影响代码:
- `pkg/utils/excel.go` 中设备导入行的 ICCID 解析结构
- `internal/task/device_import.go` 中设备卡绑定创建逻辑
- 受影响数据:新导入设备的 `tb_device_sim_binding.slot_position` 写入规则
- 受影响业务链路:设备详情、设备卡绑定列表、依赖槽位判断的运维操作
- 依赖与接口:不新增外部依赖,不新增 API仅修正既有导入行为