aboutsummaryrefslogtreecommitdiff
path: root/src/ee/part
diff options
context:
space:
mode:
Diffstat (limited to 'src/ee/part')
-rw-r--r--src/ee/part/__init__.py5
-rw-r--r--src/ee/part/create_distributor_search_list.py7
2 files changed, 9 insertions, 3 deletions
diff --git a/src/ee/part/__init__.py b/src/ee/part/__init__.py
index 84a6174..e0b0087 100644
--- a/src/ee/part/__init__.py
+++ b/src/ee/part/__init__.py
@@ -91,7 +91,10 @@ def save_db(dir_path: Path, db: PartDb):
idx.filesProp = indexFile.FileList()
files = idx.filesProp.fileProp
- for part in db.iterparts():
+ parts = db.iterparts()
+ parts = sorted(parts, key=lambda p: p.idProp)
+
+ for part in parts:
id_ = part.id
path = dir_path / "{}.xml".format(id_)
with path.open("w") as f:
diff --git a/src/ee/part/create_distributor_search_list.py b/src/ee/part/create_distributor_search_list.py
index ef91e1f..cfbe0d5 100644
--- a/src/ee/part/create_distributor_search_list.py
+++ b/src/ee/part/create_distributor_search_list.py
@@ -1,6 +1,7 @@
from pathlib import Path
from ee.part import PartDb, load_db, save_db
+from ee.xml import bomFile
from ee.xml.bom_file_utils import *
__all__ = ["create_distributor_search_list"]
@@ -26,8 +27,10 @@ def create_distributor_search_list(in_dir: Path, out_dir: Path):
if entry is not None:
continue
- part.id = pn_value
- out_parts.add_entry(part, True)
+ new_part = bomFile.Part(id=pn_value)
+ new_part.part_numbersProp = part.part_numbersProp
+
+ out_parts.add_entry(new_part, True)
print("Saving {} work parts".format(out_parts.size()))
save_db(out_dir, out_parts)