aboutsummaryrefslogtreecommitdiff
path: root/src/ee/part/create_distributor_search_list.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-03-28 16:38:50 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-03-28 16:43:14 +0100
commitfa85d46af0b91477cf354947df628af0dc0d2800 (patch)
treeb18b775d232560f57eaeb3f43d0861b98201d4ef /src/ee/part/create_distributor_search_list.py
parent52401b170d8f1c9deaa153acca76e7d6060a06df (diff)
downloadee-python-fa85d46af0b91477cf354947df628af0dc0d2800.tar.gz
ee-python-fa85d46af0b91477cf354947df628af0dc0d2800.tar.bz2
ee-python-fa85d46af0b91477cf354947df628af0dc0d2800.tar.xz
ee-python-fa85d46af0b91477cf354947df628af0dc0d2800.zip
ee.xsd:
o Renaming <part-uri> to <part-reference>. o Adding <supplier> on <part>, removing from <supplier-part-number>. A part can have exactly one part. create-order: o Creating anonymous part objects, with two references, one schematic reference and one part-uri reference to the selected part. o Redoing how the order is calculated with the new ObjDb structure. ee.part.Part: o Absorbing bom_file_utils into Part. Much better wrapper object around the xml goop.
Diffstat (limited to 'src/ee/part/create_distributor_search_list.py')
-rw-r--r--src/ee/part/create_distributor_search_list.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/ee/part/create_distributor_search_list.py b/src/ee/part/create_distributor_search_list.py
index 10160d4..be362a8 100644
--- a/src/ee/part/create_distributor_search_list.py
+++ b/src/ee/part/create_distributor_search_list.py
@@ -1,7 +1,7 @@
from pathlib import Path
-from ee.part import PartDb, load_db, save_db
-from ee.xml import types, bom_file_utils
+from ee.part import PartDb, load_db, save_db, Part
+from ee.xml import types
__all__ = ["create_distributor_search_list"]
@@ -12,12 +12,13 @@ def create_distributor_search_list(in_path: Path, out_path: Path):
print("loaded {} existing parts".format(in_parts.size()))
- for part in in_parts.iterparts():
- pn_value = next((p.valueProp for p in bom_file_utils.part_numbers(part)), None)
+ for xml in in_parts.iterparts():
+ part = Part(xml)
+ pn_value = next((p.valueProp for p in part.get_mpns()), None)
if pn_value is None:
# TODO: use schematic reference if found
- print("Skipping part with no part number: uri={}".format(part.uriProp))
+ print("Skipping part with no part number: uri={}".format(xml.uriProp))
continue
entry = out_parts.find_by_pn(pn_value)
@@ -25,8 +26,8 @@ def create_distributor_search_list(in_path: Path, out_path: Path):
if entry is not None:
continue
- new_part = types.Part(id=pn_value)
- new_part.referencesProp = part.referencesProp
+ new_part = types.Part()
+ new_part.referencesProp = xml.referencesProp
out_parts.add_entry(new_part, True)