/
Context data available in Production Sheets

Context data available in Production Sheets

Part production sheet

The outermost structure looks like that:

{ "theme_font": "Open Sans", "theme_date_format": "d.m.Y", "logo_url": <url to the service logo picture> "issue_date": <date + time when the sheet was created>, "parts": (explained below), }

parts attribute is a list containing all of the selected MesParts.

That’s why you would usually iterate over the parts in the template.
Example:

{% for part in parts %} ... {% endfor %}

 

Following attributes are available for every item in parts:

 

  • issue_date
    Date + time when the prod sheet was created
    Example:
    {{ part.issue_date }}

  • picture_url
    Url to get the part thumbnail
    Example:

    <img src="{{ part.picture_url }}" alt="part_image" class="line-image" >

     

  • part_url
    Url to the part detail page of a part
    It is used to create a qr code, that’s why ?qr is added at the end of the URL
    Example:

    {% qr_from_text part.part_url size="2" image_format="png" error_correction="L" %}

     

  • project_name
    Name of the part’s project
    Example:
    {{ part.project_name }}

  • order_date
    Date + time when the part’s order was created
    Example:
    {{ part.order_date }}

  • order_number
    Number of the part’s order
    Example:
    {{ part.order_number }}

  • order_reference
    Customer reference provided while creating the part’s order
    Example:
    {{ part.order_reference }}

  • shipping_method
    Shipping method specified in the part’s order
    Example:
    {{ part.shipping_method }}

  • payment_method
    Payment method specified in the part’s order
    Example:
    {{ part.payment_method }}

  • customer_name
    Full name of the person who ordered the part
    Example:
    {{ part.customer_name }}

  • customer_phone
    Mobile phone number of the person who ordered the part
    Example:
    {{ part.customer_phone }}

  • customer_email
    Email address of the person who ordered the part
    Example:
    {{ part.customer_email }}

  • production_steps
    This will be only populated if part has exactly one sequence.
    List of the workflow step objects - ordered steps from the parts’s workflow.
    Each object have multiple attributes. This is the structure of the step object:

    { "name": <name of the step> "description": <step description> "possible_workstations": <list of the workstation objects. Those objects have fields that are available in `b3_mes_workstation` table> following attributes are only populated if there is a job created for this step "workstation": <name of the job's workstation> "job_id": <job's id> "assignees": <list of full names of users who are assigned to the job> "duration": { "days": <job duration in days> "hours": <job duration in hours> "minutes": <job duration in minutes> "date": <job's start date> } }


    Example:

    {% for step in part.production_steps %} <tr> <td>{{ forloop.counter }}</td> <td>{{ step.name }}</td> <td>{{ step.workstation }}</td> <td>{% if step.assignees %}{{ step.assignees|join:', ' }}{% endif %}</td> <td>{% if step.duration %} {% if step.duration.days %}{{ step.duration.days }}d{% endif %} {{ step.duration.hours }}h {{ step.duration.minutes }}m &nbsp;&nbsp; {{ step.duration.date|date:"d.m.Y" }} {% endif %} </td> </tr> {% endfor %}

     

  • production_steps_raw
    List of the workflow step objects - ordered steps from the parts’s workflow.
    Each object has all the attributes you can find in b3_mes_workflowstatus table.
    Example:

    {% for step in part.production_steps_raw %} {{ step.name }} {% endfor %}

     

  • name
    Part’s name
    Example:
    {{ part.name }}

  • number
    Part’s id
    Example:
    {{ part.number }}

  • quantity
    Number of part’s copies to be printed
    Example:
    {{ part.quantity }}

  • material
    Name of the part’s configured material
    Example:
    {{ part.material }}

  • technology
    Name of the technology, used to print with a given material
    Example:
    {{ part.technology }}

  • dimensions
    Part’s dimensions specified in the STL file
    Example:

    {{ part.dimensions.h }} {{ part.dimensions.w }} {{ part.dimensions.d }}

     

  • measure_unit
    Unit used to specify dimensions in the STL file
    Example:
    {{ part.measure_unit }}

  • post_processings
    List of the part’s post processings objects.
    Each object have two attributes: title and colorTitle.
    Example:

    {% if part.post_processings %} {% for pp in part.post_processings %} {{ pp.title }}{% if pp.colorTitle %}: {{ pp.colorTitle }}{% endif %}{% if not forloop.last %} | {% endif %} {% endfor %} {% else %}

     

  • instructions
    Instructions related to processing the part
    Example:
    {{ part.instructions }}

  • attachments
    List of attachment objects added in the part detail view.
    Each object has all the attributes you can find in b3_mes_partattachment table.
    Example:

    {% for attachment in part.attachments %} {{ attachment.filename }} {% endfor %}

     

  • assignees
    List of user objects, that are attached to the part as assignees.
    Each object has all the attributes you can find in auth_user table + b3_organization_userprofile.
    Example:

    {% for assignee in part.assignees %} <div>{{ assignee.userprofile.full_name }}</div> {% endfor %}

     

  • target_date
    Part’s target date
    Example:
    {{ part.target_date }}

  • part_requirements
    List of field objects, that are attached to the part as part requirements.
    Each object has multiple attributes: label, type, value.
    Example:

    {% for field in part.part_requirements %} <span><b>{{ field.label }}:</b></span> <span>{{ field.value }}</span> {% endfor %}

Job production sheet

The outermost structure looks like that:

{ "theme_font": "Open Sans", "theme_date_format": "d.m.Y", "logo_url": <url to the service logo picture> "issue_date": <date + time when the sheet was created>, "parts": (explained below), .... job attrbiutes (explained below) ... }

parts attribute is a list containing all of the sequences of a job.

You would usually iterate over the parts in the template.
Example:

{% for part in parts %} ... {% endfor %}

Every object in parts contain the same attributes as objects in the sequence prod sheet. Please reference Sequence prod sheet from this doc below.

Available job attributes:

  • job
    Job object.
    It has all the attributes you can find in b3_mes_job table.
    Example:

    {{ job.workstation.name }}

  • group_quantity
    A sum of all sequence quantities.
    Example:
    {{ group_quantity }}

  • job_documentation
    List of field objects, that are attached to the job as job requirements.
    Each object has multiple attributes: label, type, value.
    Example:

    {% if job_documentation %} {% for field in job_documentation %} <div class="small-marg-top"> <span><b>{{ field.label }}:</b></span> <span>{{ field.value }}</span> </div> {% endfor %} {% endif %}

     

  • job_url
    Url to the job detail page of the job
    It is used to create a qr code, that’s why ?qr is added at the end of the URL
    Example:

    {% qr_from_text job_url size="2" image_format="png" error_correction="L" %}

     

  • job_assignees
    A string containing the full names of users who are assigned to the job.
    Example:

    {{ job_assignees }}

  • job_duration
    Job’s duration in the format HH:MM:SS
    Example:

    {{ job_duration }}

  • job_material_lots
    A string containing internal_lot_numbers of lots assigned to the job.
    Example:

    {{ job_material_lots }}

  • job_material
    Name of the material which is used in the job.
    Example:
    {{ job_material }}

  • job_technology
    Name of the technology that is used to print with the configured material.
    Example:
    {{ job_technology }}

  • job_attachments
    List of attachment objects added in the job detail view.
    Each object has all the attributes you can find in b3_mes_jobattachment table.
    Example:

    {% if job_attachments %} {% for attachment in job_attachments %} <div>{{ attachment.filename }}</div> {% endfor %} {% endif %}

Sequence production sheet

The outermost structure looks like that:

{ "theme_font": "Open Sans", "theme_date_format": "d.m.Y", "logo_url": <url to the service logo picture> "issue_date": <date + time when the sheet was created>, "parts": (explained below), }

parts attribute is a list containing all of the selected sequences.

You would usually iterate over the parts in the template.
Example:

{% for part in parts %} ... {% endfor %}

Every object in parts contain the same data as objects in Part prod sheet + few extra attributes.
Extra parts attributes:

  • sequence_amount
    Quantity of items in a given sequence.
    Example:

    {{ part.sequence_amount }}

  • sequence_id
    ID of the sequence.
    Example:
    {{ part.sequence_id }}

  • sequence_url
    Url to the hidden detail view of the sequence.
    It is used to create a qr code, that’s why ?qr is added at the end of the URL
    Example:

    {% qr_from_text part.sequence_url size="2" image_format="png" error_correction="L" %}

     

  • sequence_steps
    This is the same object as `production_steps` in Part prod sheet.
    It is always populated.

Related content