forked from erp-dev/erp
2.0 KiB
2.0 KiB
印染任务查询(按客户+日期范围)- API v2
说明:接口视图为
api_v2.views.printing.PrintingJobByCustomerView,URL 需在api_v2/urls.py绑定后生效(例如/api/v2/printing/jobs/)。
请求
- 方法:
GET - Query 参数(必填)
customer_id:客户 IDdate_from:开始日期,格式YYYY-MM-DDdate_to:结束日期,格式YYYY-MM-DD(闭区间,包含当日 23:59:59.999999)
- Query 参数(可选过滤)
printing_order:按印染主订单 IDproduct_id:按产品 IDproduct_name:按产品名称(模糊)product_human_id:按产品编号(模糊)product_width_size:按产品幅宽(精确数值)product_color:按产品颜色(模糊)
时间范围说明
date_from 至 date_to 为闭区间,等价于:
created_at >= date_from 00:00:00created_at <= date_to 23:59:59.999999
响应
- 成功:
200 OK - 失败:
400 Bad Request(参数缺失或格式错误)
响应字段(列表,每个元素)
id:印染任务 IDprinting_order:印染主订单 IDproduct:产品 IDwork_state:业务进展(枚举值)quantity:数量unit:单位size:一段尺寸pieces:件数description:备注business_object_id:流程实例 IDcreated_at/updated_atbilled_quantity:开单数量(关联全部SalesOrderItem.quantity之和)
示例
请求
GET /api/v2/printing/jobs/?customer_id=12&date_from=2025-12-01&date_to=2025-12-10&product_name=花布
成功响应(示例)
[
{
"id": 101,
"printing_order": 55,
"product": 2001,
"work_state": 1,
"quantity": 300,
"unit": "米",
"size": "150cm",
"pieces": 10,
"description": "加急",
"business_object_id": 888,
"created_at": "2025-12-05T10:00:00Z",
"updated_at": "2025-12-06T08:00:00Z",
"billed_quantity": "120.00"
}
]