forked from erp-dev/erp
feat: support pre_sales_order convert to sales_order api
This commit is contained in:
@@ -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[]` 与详情一致):
|
||||
|
||||
Reference in New Issue
Block a user