1
0
forked from erp-dev/erp

feat: added some filed to shipment serializers

This commit is contained in:
2026-04-23 17:51:48 +08:00
parent 35a03218d8
commit d4fbb2c7fe
11 changed files with 287 additions and 1 deletions

View File

@@ -45,6 +45,8 @@ Authorization: <AGENT_ACCESS_KEY>
"merchant_id": 10,
"customer": 5,
"customer_name": "客户A",
"fabric": "棉布 40S",
"order_description": "订单备注",
"shipment_date": "2026-04-14",
"address": "广州市天河区",
"contact_name": "张三",
@@ -154,6 +156,8 @@ Authorization: <AGENT_ACCESS_KEY>
- "未出货"定义:`delivery` 为空,即尚未关联送货单
- `delivery_id` 始终返回送货单ID未关联时为 `null`
- `fabric` 来自该出货单所关联销售品对应生产订单的 `fabric`;若当前出货单没有销售品则返回 `null`
- `order_description` 来自该出货单所关联销售品对应生产订单的 `description`;若当前出货单没有销售品则返回 `null`
- 结果按 `created_at` 降序排列
- 只返回 `merchant_id` 对应商户的数据
- `sales_items` 包含该出货单的所有销售品(软删除的条目自动排除)

View File

@@ -53,6 +53,8 @@
"merchant_name": "测试印花厂",
"customer": 1,
"customer_name": "客户A",
"fabric": "棉布 40S",
"order_description": "订单备注",
"shipment_date": "2026-01-14",
"status": 1,
"status_display": "草稿(未发布)",
@@ -79,6 +81,8 @@
- `sales_items` 现在返回的是带图片字段的销售品详情结构
- `delivery_id` 始终返回送货单ID未绑定送货单时为 `null`
- `fabric` 来自该出货单所关联销售品对应生产订单的 `fabric`;若当前出货单没有销售品,则返回 `null`
- `order_description` 来自该出货单所关联销售品对应生产订单的 `description`;若当前出货单没有销售品,则返回 `null`
- `delivery_id=null` 不会触发过滤;如需按是否绑定送货单筛选,请使用 `delivery_isnull`
- 若销售品关联的 `PrintingJob.product` 存在主图,则会返回 `product_image_url`
- 若无关联图片,则 `product_image_url``null`
@@ -226,6 +230,8 @@
| merchant_name | string | 所属商户名称(从当前登录用户推导) |
| customer | int | 客户ID |
| customer_name | string | 客户名称 |
| fabric | string/null | 面料;来自关联生产订单,若当前出货单没有销售品则为 null |
| order_description | string/null | 订单备注;来自关联生产订单的 `description`,若当前出货单没有销售品则为 null |
| shipment_date | string | 出货日期 |
| delivery_id | int/null | 关联送货单ID未绑定时为 null |
| address | string | 地址 |

View File

@@ -47,6 +47,7 @@
- `vehicle_capacity`
- `remark`
- `internal_remark`
- `shipment_order_ids`
- `status`
- `started_at`
- `delivered_at`
@@ -67,6 +68,7 @@
- `merchant` 用于多商户隔离
- 创建、修改、状态流转时,会根据 `request.user.employee` 自动写入 `operator`
- 取消送货单时会写入 `cancelled_at``cancelled_by`
- `shipment_order_ids` 是前端自管的出货单顺序 JSON 字段;后端只保存和返回,不据此自动排序 `shipments`
## API 列表
@@ -112,6 +114,7 @@ GET /api/v1/shipment/deliveries/?status=2&driver_name=张&vehicle_trip=001&limit
"vehicle_capacity": "9.6米厢车",
"remark": "先装车",
"internal_remark": "注意对账",
"shipment_order_ids": [11, 10],
"status": 1,
"status_display": "待送货",
"started_at": null,
@@ -123,6 +126,7 @@ GET /api/v1/shipment/deliveries/?status=2&driver_name=张&vehicle_trip=001&limit
"id": 10,
"customer": 5,
"customer_name": "客户A",
"order_description": null,
"shipment_date": "2026-04-03",
"status": 2,
"status_display": "已发布",
@@ -156,6 +160,7 @@ GET /api/v1/shipment/deliveries/?status=2&driver_name=张&vehicle_trip=001&limit
"vehicle_capacity": "9.6米厢车",
"remark": "先装车",
"internal_remark": "注意对账",
"shipment_order_ids": [11, 10],
"shipments": [10, 11]
}
```
@@ -168,6 +173,7 @@ GET /api/v1/shipment/deliveries/?status=2&driver_name=张&vehicle_trip=001&limit
- `vehicle_capacity`: 可选,车辆容量
- `remark`: 可选,备注
- `internal_remark`: 可选,内部备注
- `shipment_order_ids`: 可选,前端自管的出货单顺序 JSON 数组;可传 `null`;未传时默认 `[]`
- `shipments`: 可选,出货单 ID 列表
创建规则:
@@ -198,6 +204,7 @@ GET /api/v1/shipment/deliveries/?status=2&driver_name=张&vehicle_trip=001&limit
"vehicle_capacity": "13米高栏",
"remark": "改派车辆",
"internal_remark": "已电话确认",
"shipment_order_ids": [11, 12],
"shipments": [11, 12]
}
```
@@ -205,6 +212,7 @@ GET /api/v1/shipment/deliveries/?status=2&driver_name=张&vehicle_trip=001&limit
修改规则:
- `driver_name``vehicle_trip``contact_phone``vehicle_capacity``remark``internal_remark` 可单独修改
- `shipment_order_ids` 按普通字段处理,后端仅保存与返回;值必须是数组或 `null`
- `shipments` 如果传入,则视为“整体替换当前绑定的出货单集合”
- 替换绑定时,出货单仍然必须满足“当前商户、已审核、未绑定到其他送货单”
- 更新接口不支持直接修改 `status`