From 95a41e14430509b150c3dbcfb3e7af207f9c5ba0 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Thu, 28 Nov 2024 12:06:25 -0500 Subject: [PATCH] Script will now print out list of parts with no price that have BOM entries --- README.md | 20 ++++++++++---------- hardware/contact_printer_BOM_total.csv | 4 ++-- hardware/prices.csv | 1 + scripts/bom.sh | 10 +++++++++- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3c1be44..422d237 100644 --- a/README.md +++ b/README.md @@ -41,21 +41,21 @@ Actual price of a full build may be higher. | Part | Qty | Cost (USD) | |-------------------------------------|-----|------------| -| M4 hex bolt 40mm | 4 | 5.0 | -| M3 sliding t slot nut | 25 | 1.5 | -| M3 hex cap bolt 8mm | 25 | 2.25 | +| M4 hex bolt 40mm | 4 | 2.4 | +| M3 sliding t slot nut | 25 | 1.25 | +| M3 hex cap bolt 8mm | 25 | 2.0 | | M3 hex cap bolt 6mm | 8 | 0.56 | -| M3 hex cap bolt 12mm | 1 | 0.0 | -| L298N Motor driver module | 1 | 2.89 | +| M3 hex cap bolt 12mm | 1 | 0.08 | +| L298N Motor driver module | 1 | 2.87 | | ESP32 GPIO breakout board | 1 | 5.99 | | ESP32 Dev board | 1 | 6.66 | +| 608-RS Ball Bearing | 1 | 0.17 | | 250RPM DC geared motor | 2 | 29.98 | -| 2020 Aluminum extrusion 420mm | 2 | 5.22 | -| 2020 Aluminum extrusion 260mm | 4 | 6.44 | -| 100RPM DC geared motor with encoder | 1 | 17.02 | +| 2020 Aluminum extrusion 420mm | 2 | 5.1 | +| 2020 Aluminum extrusion 260mm | 4 | 6.4 | +| 100RPM DC geared motor with encoder | 1 | 16.19 | |---------|---------------|------------------------------------| -| TOTAL | 75 | 83.51 | - +| TOTAL | 76 | 79.65 | diff --git a/hardware/contact_printer_BOM_total.csv b/hardware/contact_printer_BOM_total.csv index dd1e387..3e32dbf 100644 --- a/hardware/contact_printer_BOM_total.csv +++ b/hardware/contact_printer_BOM_total.csv @@ -3,7 +3,7 @@ quantity,part,part_id,price 25,"M3 sliding t slot nut",N/A,125 25,"M3 hex cap bolt 8mm",N/A,200 8,"M3 hex cap bolt 6mm",N/A,56 -1,"M3 hex cap bolt 12mm",N/A,0 +1,"M3 hex cap bolt 12mm",N/A,8 1,"L298N Motor driver module",N/A,287 1,"ESP32 GPIO breakout board",N/A,599 1,"ESP32 Dev board",N/A,666 @@ -12,4 +12,4 @@ quantity,part,part_id,price 2,"2020 Aluminum extrusion 420mm",N/A,510 4,"2020 Aluminum extrusion 260mm",N/A,640 1,"100RPM DC geared motor with encoder",N/A,1619 -76,TOTAL,N/A,7957 +76,TOTAL,N/A,7965 diff --git a/hardware/prices.csv b/hardware/prices.csv index 6575899..38d2861 100644 --- a/hardware/prices.csv +++ b/hardware/prices.csv @@ -2,6 +2,7 @@ part,part_id,price,quantity,url M3 hex nut,N/A,999,300,https://amzn.to/4hAnwjc M3 hex cap bolt 6mm,N/A,726,100,https://amzn.to/3AwiZxo M3 hex cap bolt 8mm,N/A,899,100,https://amzn.to/3YEvWNB +M3 hex cap bolt 12mm,N/A,836,100,https://amzn.to/48CGa5Y M3 sliding t slot nut,N/A,599,105,https://amzn.to/48GRrSU 2020 Aluminum extrusion 260mm,N/A,7399,46,https://amzn.to/418OicC 2020 Aluminum extrusion 420mm,N/A,7399,29,https://amzn.to/418OicC diff --git a/scripts/bom.sh b/scripts/bom.sh index aa746ba..a5a3425 100644 --- a/scripts/bom.sh +++ b/scripts/bom.sh @@ -61,4 +61,12 @@ sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom" -cmd '.mode markdo "SELECT 'TOTAL', SUM(quantity), CAST(SUM(price) / 100.00 as MONEY) FROM bom;" | grep -v 'SUM(' sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom"\ - "SELECT SUM(quantity), 'TOTAL', 'N/A', SUM(price) FROM bom;" | tr -d '"' >> "${TOTAL}" \ No newline at end of file + "SELECT SUM(quantity), 'TOTAL', 'N/A', SUM(price) FROM bom;" | tr -d '"' >> "${TOTAL}" + +NONEFOUND=$(sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${DESTINATION} bom" -cmd ".import ${PRICES} prices" -cmd '.mode column' -cmd '.headers off' \ + 'SELECT DISTINCT part FROM bom WHERE part NOT IN (SELECT part FROM prices) ORDER BY part;') + +if [[ "${NONEFOUND}" != "" ]]; then + echo "No price found for the following parts:" + echo "${NONEFOUND}" +fi \ No newline at end of file