From 716793e190602612f58243da9bfdde380e8def40 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 15 Jul 2016 12:54:58 -0700 Subject: [PATCH] Add goldphoenix as a possible partslist target gold phoenix wants partslists in a specific format that include vendor and manufacturer information. Signed-off-by: Keith Packard --- bin/partslist-vendor | 49 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/bin/partslist-vendor b/bin/partslist-vendor index 03e3aae..28fc548 100755 --- a/bin/partslist-vendor +++ b/bin/partslist-vendor @@ -136,6 +136,51 @@ void process_seeed(string[string] entry) printf(",%s,%s\n", quoted(entry["mfg_part_number"]), entry["quantity"]); } +void process_goldphoenix(string[string] entry) +{ + int units = 1000; + + if (entry["loadstatus"] == "noload") + return; + + static int item = 1; + static bool start = true; + if (start) { + printf("#Item,Description,Designator,Package,Manufacturer,Manufacturer Part Number#,Supplier,Supplier Part #,QTY/BOARD,Order QTY,Unit Price, Subtotal \n"); + start = false; + } + + string[*] refdes = String::wordsplit(entry["refdes"], " \t"); + printf("%d,", item); + + /* description */ + printf("%s %s,", + quoted(entry["device"]), + quoted(entry["value"])); + + /* designators */ + if (dim(refdes) > 1) + printf ("\""); + for (int i = 0; i < dim(refdes); i++) { + printf("%s", refdes[i]); + if (i < dim(refdes) - 1) + printf (","); + } + if (dim(refdes) > 1) + printf ("\""); + + /* rest */ + printf(",%s,%s,%s,%s,%s,%s,%d\n", + quoted(entry["footprint"]), + quoted(entry["mfg"]), + quoted(entry["mfg_part_number"]), + quoted(entry["vendor"]), + quoted(entry["vendor_part_number"]), + entry["quantity"], + dim(refdes) * units); + item++; +} + void process_digikey(string[string] entry) { if (entry["loadstatus"] == "noload") @@ -156,7 +201,7 @@ void process_mouser(string[string] entry) static bool start = true; if (start) { - printf("Mouser Part Number,Manufacturer Part Number,Quantity 1\n"); + printf("Mouser Part Number,Manufacturer Part Number,Quantity\n"); start = false; } @@ -184,6 +229,8 @@ void process_file(file f) { string vendor = entry["vendor"]; if (!is_uninit(&vendors) && has_vendor(vendors, "seeed")) { process_seeed(entry); + } else if (!is_uninit(&vendors) && has_vendor(vendors, "goldphoenix")) { + process_goldphoenix(entry); } else if ((!is_uninit(&vendors) && has_vendor(vendors, vendor)) || (!is_uninit(¬_vendors) && !has_vendor(not_vendors, vendor))) { switch (entry["vendor"]) { -- 2.30.2