68 lines
2.2 KiB
Markdown
68 lines
2.2 KiB
Markdown
# ERP事项三:ERP查看库存接口优化——实施方案
|
|
|
|
## 1. 范围与确认结果
|
|
|
|
- 接口:`POST /api/Inventory/Search`
|
|
- 订单号字段:已确认使用 `Inventory.SourceCode`。
|
|
- 新参数:已确认使用 `CompanyIsEmpty`、`OrderIsEmpty`。
|
|
- 兼容要求:两个参数都不传或传 `null` 时,不增加任何筛选条件,旧ERP调用结果不受影响。
|
|
|
|
## 2. 最小修改方案
|
|
|
|
只修改请求模型和原查询链:
|
|
|
|
1. `InventoryApiSearcher` 增加两个 `bool?` 参数。
|
|
2. `InventoryApiListVM` 在参数有明确值时追加空/非空条件。
|
|
3. 不修改Controller、接口地址、请求方式、分页、响应模型和数据库结构。
|
|
4. 不修改 `default` / `cp` 数据连接选择逻辑。
|
|
|
|
| 参数 | 值 | 行为 |
|
|
| --- | --- | --- |
|
|
| `CompanyIsEmpty` | 不传/`null` | 不筛选公司 |
|
|
| | `true` | `CompanyCode` 为 `NULL` 或空字符串 |
|
|
| | `false` | `CompanyCode` 非 `NULL` 且非空字符串 |
|
|
| `OrderIsEmpty` | 不传/`null` | 不筛选订单号 |
|
|
| | `true` | `SourceCode` 为 `NULL` 或空字符串 |
|
|
| | `false` | `SourceCode` 非 `NULL` 且非空字符串 |
|
|
|
|
仅包含空格的值按非空处理,本次没有增加 `Trim` 或数据清洗,避免扩大影响。
|
|
|
|
## 3. 请求示例
|
|
|
|
旧请求保持不变:
|
|
|
|
```json
|
|
{"WareHouse":"xb","Page":1,"Limit":20}
|
|
```
|
|
|
|
查询公司为空且订单号非空:
|
|
|
|
```json
|
|
{
|
|
"WareHouse": "xb",
|
|
"CompanyIsEmpty": true,
|
|
"OrderIsEmpty": false,
|
|
"Page": 1,
|
|
"Limit": 20
|
|
}
|
|
```
|
|
|
|
## 4. 双数据库说明
|
|
|
|
该接口仍使用当前实例的 `default` 数据连接;`WareHouse` 只参与库区筛选,不负责把连接切换到 `cp`。因此:
|
|
|
|
- 线边库实例的 `default` 指向线边库数据库;
|
|
- 成品库实例的 `default` 指向成品库数据库;
|
|
- 本事项不做跨库查询或动态连接改造。
|
|
|
|
## 5. 代码、SQL与回退
|
|
|
|
代码只涉及:
|
|
|
|
- `InventoryApiSearcher.cs`
|
|
- `InventoryApiListVM.cs`
|
|
|
|
本事项没有DDL和数据更新。上线前可分别在两库执行只读脚本 [20260717_inventory_empty_filters_verify.sql](../sql/20260717_inventory_empty_filters_verify.sql),用于预览空/非空数据分布。
|
|
|
|
回退只需恢复上述两个代码文件,不需要数据库回退。
|