aboutsummaryrefslogtreecommitdiff
path: root/src/ee/templates
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-10-16 16:25:55 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-10-16 16:25:55 +0200
commit3d6f086c0ac32b25d770b9451af5fac9069b40f5 (patch)
tree5cbff6dfa57f1269e3f29964d3579c104c0c070f /src/ee/templates
parentc368b1d4b7d1dfe148ba93ffc1c0de7122c4e66b (diff)
downloadee-python-3d6f086c0ac32b25d770b9451af5fac9069b40f5.tar.gz
ee-python-3d6f086c0ac32b25d770b9451af5fac9069b40f5.tar.bz2
ee-python-3d6f086c0ac32b25d770b9451af5fac9069b40f5.tar.xz
ee-python-3d6f086c0ac32b25d770b9451af5fac9069b40f5.zip
bom: Much better report.
Diffstat (limited to 'src/ee/templates')
-rw-r--r--src/ee/templates/bom.rst.j259
1 files changed, 39 insertions, 20 deletions
diff --git a/src/ee/templates/bom.rst.j2 b/src/ee/templates/bom.rst.j2
index c8bed20..454d3f1 100644
--- a/src/ee/templates/bom.rst.j2
+++ b/src/ee/templates/bom.rst.j2
@@ -2,41 +2,59 @@
BOM
===
-{% if unresolved_parts %}
+{%- if unresolved_parts %}
+Unresolved Parts
+----------------
+
{{- unresolved_parts|length }} unresolved parts:
-{% for op in unresolved_parts %}
-* `{{ op.ref }} <ref-{{ op.ref }}_>`_
+{% for bp in unresolved_parts %}
+* `{{ bp.ref }} <ref-{{ bp.ref }}_>`_
{%- endfor %}
{%- endif %}
++-{{ "-"*30 }}-+-{{ "-"*60 }}-+-{{ "-"*60 }}-+
+| {{ "%-30s" | format("Reference") }} | {{ "%-60s" | format("MPN") }} | {{ "%-60s" | format("MPN") }} |
++={{ "="*30 }}=+={{ "="*60 }}=+={{ "="*60 }}=+
+{%- for bp in bom_parts %}
+{%- set ref="_`{}`".format(bp.ref, bp.ref) %}
+{%- set mpn=bp.selected_part.get_only_mpn().valueProp %}
+{%- set spn=bp.selected_part.get_only_spn().valueProp %}
+{%- set spn="`{} <part-{}_>`_".format(spn, spn) %}
+| {{ "%-30s" | format(ref) }} | {{ "%-60s" | format(mpn) }} | {{ "%-60s" | format(spn) }} |
++-{{ "-"*30 }}-+-{{ "-"*60 }}-+-{{ "-"*60 }}-+
+{%- endfor %}
+{#
Parts for BOM
===============
-{% for op in bom_parts %}
-.. _ref-{{ op.ref }}:
+{% for bp in bom_parts %}
+.. _ref-{{ bp.ref }}:
-{{ op.ref | subsection }}
-{% if op.available_from|length == 0 %}
+{{ bp.ref | subsection }}
+{% if not bp.selected_part %}
Could not find part.
-{% if op.part.get_mpns()|length == 1 -%}
-MPN: {{ op.part.get_mpns()[0].valueProp }}
-{% elif op.part.get_mpns()|length > 1 -%}
-{%- for mpn in op.part.get_mpns() %}
+{% if bp.part.get_mpns()|length == 1 -%}
+MPN: {{ bp.part.get_mpns()[0].valueProp }}
+{% elif bp.part.get_mpns()|length > 1 -%}
+{%- for mpn in bp.part.get_mpns() %}
MPNs:
-* {{ mpn.valueProp }}
+* {{ mpn.valuePrbp }}
{%- endfor %}
{%- endif -%}
-{% if op.part.get_spns()|length == 1 -%}
-SPN: {{ op.part.get_spns()[0].valueProp }}
-{% elif op.part.get_spns()|length > 1 -%}
-{%- for spn in op.part.get_spns() %}
+#}
+{# #}{#
+
+{% if bp.part.get_spns()|length == 1 -%}
+SPN: {{ bp.part.get_spns()[0].valueProp }}
+{% elif bp.part.get_spns()|length > 1 -%}
+{%- for spn in bp.part.get_spns() %}
SPNs:
* {{ spn.valueProp }}
{%- endfor %}
{%- endif -%}
-{% elif op.available_from|length == 1 %}
-{%- set part=op.available_from.values()|first %}
+{% elif bp.selected_part %}
+{%- set part=bp.selected_part %}
{%- set pn=part|first_pn %}
{%- set spn=part|first_spn %}
Selected supplier: {{ part.supplier }}{{ (", pn: " + pn.valueProp) if pn else "" }}{{ (", spn: " + spn.valueProp) if spn else "" }}.
@@ -45,6 +63,7 @@ Part: `{{pn.valueProp}} <part-{{pn.valueProp}}_>`_
MANY
{% endif %}
{%- endfor %}
+#}
Part details
============
@@ -56,7 +75,7 @@ Part details
{%- set pn=part|first_pn %}
{%- set spn=part|first_spn %}
{%- set title=pn.valueProp if pn else (spn.valueProp if spn else "???") %}
-.. _part-{{title}}:
+.. _part-{{spn.valueProp}}:
{{ title|subsubsection }}
@@ -66,7 +85,7 @@ Description {{ part.description }}
{%- endif %}
MPN {{ pn.value }}
SPN {{ spn.value }}
-Used by: {% for op in bom_part_uri_idx.get(part.uriProp) %}`{{ op.ref }} <ref-{{ op.ref }}_>`_{{ ", " if not loop.last }}{% endfor %}
+Used by: {% for bp in bom_part_uri_idx.get(part.uri) %}`{{ bp.ref }} <{{ bp.ref }}_>`_{{ ", " if not loop.last }}{% endfor %}
=========== ===
{#
Facts