Production task
Production tasks assigned to workers
INFO
Har bir javob umumiy konvertda qaytadi — code, message, messages, status_code, time — foydali yuk esa data ichida. Quyidagi jadvallar faqat data ichini tavsiflaydi.
POST /production-task/create
Create a new production task with tech-map items and warehouse assignments. Returns the hydrated task including items, route-sheet steps, materials, and warehouse quantities.
So‘rov tanasi
| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
responsible_id | string | Ha | Employee ObjectId responsible for the task (required) |
currency_id | string | Ha | Currency ObjectId for cost tracking (required) |
organization_id | string | Ha | Organization ObjectId the task belongs to (required) |
produced_warehouse_id | string | Ha | Warehouse ObjectId where finished goods land (required) |
items | object[] | Ha | Tech-map line items — at least one required |
items[].tech_map_id | string | Ha | ProductionTechMap ObjectId (recipe/BOM reference) |
items[].amount | number | Ha | Planned production quantity (positive number) |
used_warehouse_items | object[] | Ha | Per-step warehouse assignments — at least one required |
used_warehouse_items[].used_warehouse_id | string | Ha | Warehouse ObjectId materials are consumed from for this step |
used_warehouse_items[].step_id | string | Ha | ProductionStep ObjectId this warehouse assignment applies to |
code | string | Yo‘q | Optional human-readable task code |
note | string | Yo‘q | Optional free-text note |
date | string (date) | Yo‘q | Optional task date (ISO 8601 YYYY-MM-DD) |
attachments | object[] | Yo‘q | Optional pre-uploaded attachment object refs |
{
"responsible_id": "string",
"currency_id": "string",
"organization_id": "string",
"produced_warehouse_id": "string",
"items": [
{
"tech_map_id": "string",
"amount": 0
}
],
"used_warehouse_items": [
{
"used_warehouse_id": "string",
"step_id": "string"
}
],
"code": "string",
"note": "string",
"date": "string",
"attachments": [
{}
]
}Javob
| Maydon | Tur | Tavsif |
|---|---|---|
_id | string | Production task ObjectId |
number | string | Auto-generated sequential task number |
code | string | Human-readable task code |
note | string | Free-text note |
date | string (date-time) | Task date |
state | string | Current task state. Mumkin qiymatlar: new, in_progress, done, canceled |
organization | object | |
organization._id | string | |
organization.name | string | |
produced_warehouse | object | |
produced_warehouse._id | string | |
produced_warehouse.name | string | |
responsible | object | |
responsible._id | string | |
responsible.full_name | string | |
responsible.number | string | |
used_warehouse_items | object[] | |
used_warehouse_items[].step_id | string | |
used_warehouse_items[].step | object | |
used_warehouse_items[].step._id | string | |
used_warehouse_items[].step.name | string | |
used_warehouse_items[].used_warehouse_id | string | |
used_warehouse_items[].used_warehouse | object | |
used_warehouse_items[].used_warehouse._id | string | |
used_warehouse_items[].used_warehouse.name | string | |
items | object[] | Hydrated tech-map items with route-sheet steps, materials, and warehouse quantities |
attachments | object[] | |
created_at | string (date-time) | |
updated_at | string (date-time) |
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"_id": "string",
"number": "string",
"code": "string",
"note": "string",
"date": "2025-05-01T12:00:00Z",
"state": "new",
"organization": {
"_id": "string",
"name": "string"
},
"produced_warehouse": {
"_id": "string",
"name": "string"
},
"responsible": {
"_id": "string",
"full_name": "string",
"number": "string"
},
"used_warehouse_items": [
{
"step_id": "string",
"step": {
"_id": null,
"name": null
},
"used_warehouse_id": "string",
"used_warehouse": {
"_id": null,
"name": null
}
}
],
"items": [
{}
],
"attachments": [
{}
],
"created_at": "2025-05-01T12:00:00Z",
"updated_at": "2025-05-01T12:00:00Z"
},
"time": "2025-05-01T12:00:00Z"
}GET /production-task/get-by-id/{id}
Fetch a single production task by ObjectId. Returns the same hydrated shape as create/update.
Yo‘l parametrlari
| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
id | string | Ha | Production-task ObjectId |
So‘rov tanasi
So‘rov tanasi talab qilinmaydi.
Javob
Javob tuzilishi quyidagi bilan bir xil: POST /production-task/create.
POST /production-task/get-paging
Paginated list of production tasks, filterable by organization and state.
So‘rov tanasi
| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
page | number | Ha | Standart: 1 |
limit | number | Ha | Standart: 20 |
organization_id | string | Yo‘q | Filter by organization ObjectId |
state | string | Yo‘q | Filter by task state. Mumkin qiymatlar: new, in_progress, done, canceled |
search | string | Yo‘q | Free-text search across number and code fields |
sort_by | string | Yo‘q | Field to sort by (e.g. created_at) |
asc | number | Yo‘q | Sort direction: 1 ascending, -1 descending. Mumkin qiymatlar: 1, -1 |
{
"page": 1,
"limit": 20,
"organization_id": "string",
"state": "new",
"search": "string",
"sort_by": "string",
"asc": 1
}Javob
| Maydon | Tur | Tavsif |
|---|---|---|
total | number | |
list | object[] | |
list[]._id | string | Production task ObjectId |
list[].number | string | Auto-generated sequential task number |
list[].code | string | Human-readable task code |
list[].note | string | Free-text note |
list[].date | string (date-time) | Task date |
list[].state | string | Current task state. Mumkin qiymatlar: new, in_progress, done, canceled |
list[].organization | object | |
list[].organization._id | string | |
list[].organization.name | string | |
list[].produced_warehouse | object | |
list[].produced_warehouse._id | string | |
list[].produced_warehouse.name | string | |
list[].responsible | object | |
list[].responsible._id | string | |
list[].responsible.full_name | string | |
list[].responsible.number | string | |
list[].created_at | string (date-time) | |
list[].updated_at | string (date-time) |
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"total": 0,
"list": [
{
"_id": "string",
"number": "string",
"code": "string",
"note": "string",
"date": "2025-05-01T12:00:00Z",
"state": "new",
"organization": {
"_id": null,
"name": null
},
"produced_warehouse": {
"_id": null,
"name": null
},
"responsible": {
"_id": null,
"full_name": null,
"number": null
},
"created_at": "2025-05-01T12:00:00Z",
"updated_at": "2025-05-01T12:00:00Z"
}
]
},
"time": "2025-05-01T12:00:00Z"
}PUT /production-task/update/{id}
Update an existing production task. Only allowed while the task is in state new. Replaces items and warehouse assignments; re-runs tech-map hydration. Returns the updated hydrated task.
Yo‘l parametrlari
| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
id | string | Ha | Production-task ObjectId to update |
So‘rov tanasi
| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
responsible_id | string | Ha | Employee ObjectId responsible for the task (required) |
currency_id | string | Ha | Currency ObjectId for cost tracking (required) |
organization_id | string | Ha | Organization ObjectId the task belongs to (required) |
produced_warehouse_id | string | Ha | Warehouse ObjectId where finished goods land (required) |
items | object[] | Ha | Tech-map line items — at least one required |
items[].tech_map_id | string | Ha | ProductionTechMap ObjectId (recipe/BOM reference) |
items[].amount | number | Ha | Planned production quantity (positive number) |
used_warehouse_items | object[] | Ha | Per-step warehouse assignments — at least one required |
used_warehouse_items[].used_warehouse_id | string | Ha | Warehouse ObjectId materials are consumed from for this step |
used_warehouse_items[].step_id | string | Ha | ProductionStep ObjectId this warehouse assignment applies to |
code | string | Yo‘q | Optional human-readable task code |
note | string | Yo‘q | Optional free-text note |
date | string (date) | Yo‘q | Optional task date (ISO 8601 YYYY-MM-DD) |
attachments | object[] | Yo‘q | Optional pre-uploaded attachment object refs |
{
"responsible_id": "string",
"currency_id": "string",
"organization_id": "string",
"produced_warehouse_id": "string",
"items": [
{
"tech_map_id": "string",
"amount": 0
}
],
"used_warehouse_items": [
{
"used_warehouse_id": "string",
"step_id": "string"
}
],
"code": "string",
"note": "string",
"date": "string",
"attachments": [
{}
]
}Javob
Javob tuzilishi quyidagi bilan bir xil: POST /production-task/create.
PUT /production-task/set-status/{id}
Transition a production task to a new state. Valid transitions: new→[in_progress, canceled, done]; in_progress→[canceled, done]; done→[canceled]; canceled→[]. Transitioning to canceled cascades cancellation of all linked production operations. NOTE: the reason field is accepted by the contract but is NOT persisted (the model has no reason field).
Yo‘l parametrlari
| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
id | string | Ha | Production-task ObjectId |
So‘rov tanasi
| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
status | string | Ha | Target state for the production task (required). Valid transitions: new→[in_progress, canceled, done]; in_progress→[canceled, done]; done→[canceled]; canceled→[].. Mumkin qiymatlar: new, in_progress, done, canceled |
reason | string | Yo‘q | Optional reason for the state transition. Accepted by the API contract but NOT persisted — the ProductionTask model has no reason field. |
{
"status": "new",
"reason": "string"
}Javob
Javob tuzilishi quyidagi bilan bir xil: POST /production-task/create.
PUT /production-task/produce/{id}
Record production output against one step of the task's technological map. This is the write that actually moves material: the step's inputs are consumed from the used warehouse, amount of its output is produced into the produced warehouse, and the task advances. Reverse it with cancel-produced.
Yo‘l parametrlari
| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
id | string | Ha | Production-task ObjectId |
So‘rov tanasi
| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
tech_map_id | string | Ha | Technological-map ObjectId the step belongs to |
step_id | string | Ha | Production-step ObjectId being produced |
responsible_id | string | Ha | Employee ObjectId credited with the output |
amount | number | Ha | Quantity produced in this call |
used_date | string (date-time) | Ha | When the inputs were consumed (ISO 8601) |
produced_date | string (date-time) | Ha | When the output was produced (ISO 8601) |
code | string | Yo‘q | Optional external code for the resulting operation |
state | string | Yo‘q | Optional initial state for the resulting production operation |
note | string | Yo‘q | Optional free-text note |
create_reminder | boolean | Yo‘q | Create a follow-up reminder for the responsible employee |
additional_costs | object[] | Yo‘q | Extra costs to fold into the produced item's cost price |
additional_costs[].cost_id | string | Yo‘q | Extra-cost ObjectId |
additional_costs[].amount | number | Yo‘q | Cost amount |
{
"tech_map_id": "string",
"step_id": "string",
"responsible_id": "string",
"amount": 0,
"used_date": "2025-05-01T12:00:00Z",
"produced_date": "2025-05-01T12:00:00Z",
"code": "string",
"state": "string",
"note": "string",
"create_reminder": false,
"additional_costs": [
{
"cost_id": "string",
"amount": 0
}
]
}Javob
Javob tuzilishi quyidagi bilan bir xil: POST /production-task/create.
PUT /production-task/cancel-produced/{id}
Reverse a previously recorded production for one step of the task. Cancels the operation the matching produce call created and returns the consumed material to stock. tech_map_id + step_id identify which produced step to undo.
Yo‘l parametrlari
| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
id | string | Ha | Production-task ObjectId |
So‘rov tanasi
| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
tech_map_id | string | Ha | Technological-map ObjectId the produced step belongs to |
step_id | string | Ha | Production-step ObjectId whose production is being reversed |
{
"tech_map_id": "string",
"step_id": "string"
}Javob
Javob tuzilishi quyidagi bilan bir xil: POST /production-task/create.
POST /production-task/state-report/by-product
Paginated production-task state report grouped by product. Answers how much of each product is planned, in progress, done or canceled across tasks — rather than listing the tasks themselves. Accepts the same filters as get-paging.
So‘rov tanasi
| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
page | number | Ha | Standart: 1 |
limit | number | Ha | Standart: 20 |
organization_id | string | Yo‘q | Filter by organization ObjectId |
state | string | Yo‘q | Filter by task state. Mumkin qiymatlar: new, in_progress, done, canceled |
search | string | Yo‘q | Free-text search across number and code fields |
sort_by | string | Yo‘q | Field to sort by (e.g. created_at) |
asc | number | Yo‘q | Sort direction: 1 ascending, -1 descending. Mumkin qiymatlar: 1, -1 |
{
"page": 1,
"limit": 20,
"organization_id": "string",
"state": "new",
"search": "string",
"sort_by": "string",
"asc": 1
}Javob
| Maydon | Tur | Tavsif |
|---|---|---|
total | number | |
list | object[] | |
list[].product_id | string | Product ObjectId |
list[].product | object | Hydrated product |
list[].product._id | string | |
list[].product.name | string | |
list[].new | number | Quantity on tasks still in the new state |
list[].in_progress | number | Quantity on tasks in progress |
list[].done | number | Quantity on completed tasks |
list[].canceled | number | Quantity on canceled tasks |
list[].total | number | Total planned quantity across all states |
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"total": 0,
"list": [
{
"product_id": "string",
"product": {
"_id": null,
"name": null
},
"new": 0,
"in_progress": 0,
"done": 0,
"canceled": 0,
"total": 0
}
]
},
"time": "2025-05-01T12:00:00Z"
}Bu sahifa OpenAPI spetsifikatsiyasidan yaratilgan.