# Production

> How YoPrint splits an order's production into jobs and tasks, where tasks come from, the two kinds of production status, the schedule, rush work and artwork approvals.

Web page: https://developer.yoprint.com/how-yoprint-works/production/

A sales order says what's sold. Production is how the shop makes it, and YoPrint splits that work into **jobs** and **tasks**. In the web app they're under **Production**: **All Jobs**, **All Tasks** and **Production Control**.

## Jobs and tasks

A **job** is one piece of production work on an order, such as "front logo on 48 tees". It holds the order's lines that are made together, how they're decorated, and the files the shop prints from. Its work is broken into **tasks**, the steps the shop takes.

**Diagram:** Lines outside any job are standalone, such as a fee or a product sold as it is.

- **Sales order** (or quote)
  - **Job** "Front logo tees", with a job status, rush flag and production dates
    - **Lines** made together: the tees, in their sizes
    - **Decoration**: a service such as screen printing, at a print location such as the front
    - **Files**: mockups for the customer, production files for the shop
    - **Task** "Burn screens", with a task status, dates and people
    - **Task** "Print"
  - **Another job**

A **job preset** is a ready-made job: adding one to an order copies its name, note, services, tasks, files, and the teammates still on the team.

## Where tasks come from

Each team sets up **task presets** in its settings: the kinds of step it takes, such as "Screen prep" or "Print", each with its own list of statuses. The API calls a task preset a **pipeline** (`pipeline_id`). A task is one pipeline's step on one job: tasks have their own operations and webhook under the name **work pipeline**, and a job lists them in `pipelines`.

**Diagram:** A task preset is defined once. Every task made from it uses its statuses.

1. **Task preset (pipeline)**: In the settings: a kind of step, such as "Print", with its own statuses
2. **Task, on a job**: Added from a pipeline, with dates and people
3. **Task status**: One of that pipeline's statuses

## Two kinds of status

A job and each of its tasks have their own status, and they don't follow each other: finishing every task doesn't move the job. The shop moves each one.

|                  | Job status                                      | Task status                            |
| ---------------- | ----------------------------------------------- | -------------------------------------- |
| Chosen from      | The team's job statuses                         | The statuses of the task's task preset |
| Shows            | Where the whole job stands                      | Where one step stands                  |
| On a draft order | Can't change: the order must be published first | Can change                             |
| Webhook          | `job.status_changed`                            | `work_pipeline.status_changed`         |

Every status also has a **type**, which tells YoPrint how far along it is. A team can have many statuses of each type. Here's how the job statuses a new team starts with line up:

**Diagram:** Customers see each status's customer label in the Customer Portal, such as Order started or Finalizing. Without one, they see Pending, In progress or Completed, by type.

1. **start**: Pending
2. **pre_production**: Waiting for stock
3. **in_progress**: Pull from inventory, In production, Ready for QA, Ready to ship
4. **end**: Completed

## The schedule

Jobs and tasks each have a start and a due date. The two are kept in step:

| When you…                           | YoPrint also…                                                         |
| ----------------------------------- | --------------------------------------------------------------------- |
| Move a job's dates                  | Moves its dated tasks by the same amount, within the job's new dates. |
| Date a task                         | Resets its job's dates to cover all of the job's dated tasks.         |
| Unschedule a job (both dates empty) | Clears its tasks' dates too.                                          |

The web app schedules in whole days in the person's timezone, from 00:00:00 on the first day to 23:59:59 on the last, sent as UTC. The shop sees the schedule three ways: the **job calendar**, the **task calendar**, and **Production Control**, a timeline (Gantt chart) of orders with their jobs and tasks.

## Rush

Each job has its own **rush** flag, and so does the order. The order action `mark_order_as_rush` marks the order and all its jobs. `mark_all_job_as_rush` marks only the jobs. Turning one job's flag on or off with a job update fires `job.marked_as_rush` or `job.marked_as_not_rush`. The order actions send no job webhook.

## Artwork approvals

Before printing, the shop usually asks the customer to approve the job's mockups in the Customer Portal. The answer fires `job_approval.approved` or `job_approval.change_requested`. It doesn't change the job's status. See [Approvals and the Customer Portal](https://developer.yoprint.com/how-yoprint-works/quotes-and-sales-orders.md#approvals-and-the-customer-portal).

## Shop-floor paperwork

Each job prints its **job details** (with or without its mockups) and **labels**, and a list of jobs prints as a **job list**, for the people doing the work.

## In the API

[Schedule and track production](https://developer.yoprint.com/guides/jobs-and-production.md): Create jobs, schedule them, move statuses and work with tasks.

[Jobs reference](https://developer.yoprint.com/reference/jobs.md): Every job operation, with its tasks under it.
