1
0
forked from erp-dev/erp

feat: support pre_sales_order convert to sales_order api

This commit is contained in:
2026-02-02 15:58:29 +08:00
parent 2572c5aab4
commit fb93582b06
13 changed files with 379 additions and 7 deletions

View File

@@ -135,6 +135,73 @@
- `DELETE /api/v1/pre-sales-orders/{id}/`
- 响应:`204 NO CONTENT`
## 6) 转换为销售单(仅严进严出仓库)
- `POST /api/v1/pre-sales-orders/{id}/convert-to-sales/`
约束:
- 仅支持仓库模式为 **严进严出RESTRICT_IN_OUT** 的预销售单
- 若不是严进严出,返回 `403`
- 需要已存在有效配货记录(用于生成销售单明细的 `consume_detail_ids`
响应:`201 CREATED`
```json
{
"id": 1001,
"human_id": "XS20260202000001",
"status": 1,
"message": "预销售单已转换为销售单,等待审批"
}
```
错误示例403
```json
{
"error": "仅支持严进严出仓库模式"
}
```
错误示例400
```json
{
"error": "明细 123 缺少配货库存明细"
}
## 7) Allocations
### 7.1
- `POST /api/v1/pre-sales-order-items/{item_id}/allocations/`
JSON
```json
{
"stock_ids": [1, 2, 3],
"quantity": "10.00",
"unit": "KG",
"remarks": "备注信息"
}
```
响应:`201 CREATED`,返回配货记录详情。
### 7.2 撤销配货记录(含解冻库存)
- `DELETE /api/v1/pre-sales-order-items/{item_id}/allocations/{pk}/`
行为说明:
- 将配货记录状态置为撤销status=2
- **同时解冻**该配货记录创建时冻结的库存StockFreeze.status=取消)
响应:`200 OK`,返回配货记录详情。
```
## 预销售单字段说明(响应)
预销售单对象字段(`results[]` 与详情一致):