3.0 KiB
3.0 KiB
4793 房务配房库存扣减选择与库存口径快照 - 前端待处理 - 管理后台
- 工单:#4793
- 状态:前端待处理
- 后端分支:
fix/4793-house-deduct-inventory-switch - 影响页面:房务订单详情 / 配房弹窗 / 替换酒店弹窗 / 已配房展示
背景
房务配房时不是所有订单都使用系统资源库存。有些订单使用线下确认房量或非自有库存,不能在保存配房时扣减资源酒店房型库存。
后端已把库存口径从“按产品类型固定判断”改为“按每条配房显式选择”。
前端必须调整
1. 提交配房每条 item 必传 deductInventory
接口:
POST /v3/admin/order/hotel-requirements/{requirementId}/assignments
items[] 新增必填字段:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
deductInventory |
Boolean | 是 | true=保存配房并扣减资源酒店房型库存;false=仅保存配房快照,不扣资源库存 |
示例:
{
"dayNumber": 1,
"hotelId": "200001",
"roomTypeId": "300001",
"roomCategory": "STANDARD",
"roomCount": 1,
"protoPrice": "320.00",
"settlementPrice": "300.00",
"sellPrice": "340.00",
"deductInventory": true,
"syncProtocolPrice": false,
"syncSettlementPrice": false
}
缺失时后端返回:
| code | message |
|---|---|
808124 |
是否扣减资源库存不能为空 |
2. 配房弹窗需要让房务显式选择
建议文案:
扣减系统库存不扣系统库存
前端不能静默默认,需要房务选择后才能提交。若产品经理要求默认选项,也必须在 UI 上可见并可改。
3. 回显字段
提交配房出参 items[] 新增:
| 字段 | 类型 | 说明 |
|---|---|---|
deductInventory |
Boolean | 本条配房是否扣减资源库存 |
订单详情房务行程中每条已配房 assignments[] 新增:
| 字段 | 类型 | 说明 |
|---|---|---|
deductInventory |
Boolean | 本条配房是否扣减资源库存 |
内部配房查询 GET /v3/internal/house/orders/{orderId}/assignments 也返回该字段,供其他服务识别当时配置口径。
4. 行为规则
deductInventory=true:保存配房时扣减 resource 库存;删除/替换/清空/取消时释放。deductInventory=false:只保存配房快照;不会扣减 resource 库存;删除/替换/清空/取消时也不会释放。- 同一天同酒店同房型同
deductInventory不能重复提交。 - 同一天同酒店同房型如果确实要拆成“部分扣库存 + 部分不扣库存”,可以拆两条,但
deductInventory必须不同。 - 价格同步仍按
syncProtocolPrice/syncSettlementPrice显式选择,和deductInventory是两个独立开关。
后端已覆盖
house_hotel_assignment新增deduct_inventory,历史数据默认 true。- 配房保存按
deductInventory决定是否调用资源库存扣减。 - 删除、替换、清空、需求作废释放只释放实际扣过库存的行。
- 单测已覆盖缺字段、false 不扣库存、true/false 切换释放边界、清空只释放已扣库存行。