From abaa6dfafad2862e5d8b8825cd84298dcb76429f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 1 Nov 2023 21:33:24 -0700 Subject: [PATCH] partslist-vendor: Support "seeed_part_number" field This allows us to leave the existing 4ucon parts in place while substituting more common part numbers when generating seeed quotes. Signed-off-by: Keith Packard --- bin/partslist-vendor | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/partslist-vendor b/bin/partslist-vendor index 423796e..6ac4217 100755 --- a/bin/partslist-vendor +++ b/bin/partslist-vendor @@ -114,8 +114,15 @@ string quoted(string v) void process_seeed(string[string] entry) { - if (entry["loadstatus"] == "noload") - return; + string part_number = entry["mfg_part_number"]; + if (hash_test(entry, "seeed_part_number") && entry["seeed_part_number"] != "unknown") { + part_number = entry["seeed_part_number"]; + } else { + if (entry["loadstatus"] == "noload") { + File::fprintf(stderr, "skipping part %v\n", entry); + return; + } + } static bool start = true; if (start) { @@ -133,7 +140,7 @@ void process_seeed(string[string] entry) } if (dim(refdes) > 1) printf ("\""); - printf(",%s,%s\n", quoted(entry["mfg_part_number"]), entry["quantity"]); + printf(",%s,%s\n", quoted(part_number), entry["quantity"]); } void process_goldphoenix(string[string] entry) -- 2.30.2