From 65833dc333f7314446bedcd7615a6c59d3df73b7 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 12 Jan 2021 15:21:34 -0300 Subject: [PATCH] Internal BoM: The "Quantity" column no longer includes the DNF/C status. - This status was moved to a separated column named `Status`. - You can join both columns if you want. Some people pointed out that adding characters to the qty column prevents computations applied to the CSV files. --- CHANGELOG.md | 3 + kibot/bom/bom.py | 14 ++- kibot/bom/columnlist.py | 4 + tests/test_plot/test_int_bom.py | 93 ++++++++++--------- .../int_bom_no_number_rows.kibot.yaml | 1 + .../int_bom_sheet_path.kibot.yaml | 2 +- 6 files changed, 65 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16280618..6bbd45bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Now the default output name applies to the DRC and ERC report names. This provides more coherent file names. +- Internal BoM: The "Quantity" column no longer includes the DNF/C status. + This status was moved to a separated column named `Status`. + You can join both columns if you want. ## [0.9.0] - 2021-01-04 diff --git a/kibot/bom/bom.py b/kibot/bom/bom.py index 3e7cc1f6..c7ff1112 100644 --- a/kibot/bom/bom.py +++ b/kibot/bom/bom.py @@ -233,12 +233,16 @@ class ComponentGroup(object): self.fields[ColumnList.COL_REFERENCE_L] = self.get_refs() # Quantity q = self.get_count() - self.fields[ColumnList.COL_GRP_QUANTITY_L] = "{n}{dnf}{dnc}".format( - n=q, - dnf=" (DNF)" if not self.is_fitted() else "", - dnc=" (DNC)" if self.is_fixed() else "") - + self.fields[ColumnList.COL_GRP_QUANTITY_L] = str(q) self.fields[ColumnList.COL_GRP_BUILD_QUANTITY_L] = str(q * self.cfg.number) if self.is_fitted() else "0" + # Group status + status = ' ' + if not self.is_fitted(): + status += '(DNF)' + if self.is_fixed(): + status += '(DNC)' + self.fields[ColumnList.COL_STATUS_L] = status + # Component data comp = self.components[0] self.fields[ColumnList.COL_VALUE_L] = comp.value self.fields[ColumnList.COL_PART_L] = comp.name diff --git a/kibot/bom/columnlist.py b/kibot/bom/columnlist.py index ab4aaf1d..73d71a01 100644 --- a/kibot/bom/columnlist.py +++ b/kibot/bom/columnlist.py @@ -41,6 +41,8 @@ class ColumnList: COL_SHEETPATH_L = COL_SHEETPATH.lower() COL_ROW_NUMBER = 'Row' COL_ROW_NUMBER_L = COL_ROW_NUMBER.lower() + COL_STATUS = 'Status' + COL_STATUS_L = COL_STATUS.lower() # Default columns for groups COL_GRP_QUANTITY = 'Quantity Per PCB' @@ -53,6 +55,7 @@ class ColumnList: COL_GRP_QUANTITY_L: 1, COL_GRP_BUILD_QUANTITY_L: 1, COL_ROW_NUMBER_L: 1, + COL_STATUS_L: 1, } # Default columns @@ -67,6 +70,7 @@ class ColumnList: COL_FP_LIB, COL_GRP_QUANTITY, COL_GRP_BUILD_QUANTITY, + COL_STATUS, COL_DATASHEET, COL_SHEETPATH ] diff --git a/tests/test_plot/test_int_bom.py b/tests/test_plot/test_int_bom.py index 16e1bed9..ccbfdabb 100644 --- a/tests/test_plot/test_int_bom.py +++ b/tests/test_plot/test_int_bom.py @@ -58,16 +58,17 @@ BOM_DIR = 'BoM' REF_COLUMN_NAME = 'References' REF_COLUMN_NAME_R = 'Referencias' QTY_COLUMN_NAME = 'Quantity Per PCB' +STATUS_COLUMN_NAME = 'Status' COMP_COLUMN_NAME = 'Row' COMP_COLUMN_NAME_R = 'Renglón' VALUE_COLUMN_NAME = 'Value' DATASHEET_COLUMN_NAME = 'Datasheet' -KIBOM_TEST_HEAD = [COMP_COLUMN_NAME, 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, +KIBOM_TEST_HEAD = [COMP_COLUMN_NAME, 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, 'Status', DATASHEET_COLUMN_NAME, 'Config'] KIBOM_TEST_HEAD_TOL = [c for c in KIBOM_TEST_HEAD] KIBOM_TEST_HEAD_TOL.insert(-1, 'Tolerance') KIBOM_RENAME_HEAD = [COMP_COLUMN_NAME_R, REF_COLUMN_NAME_R, 'Componente', 'Valor', 'Código Digi-Key', 'Cantidad por PCB'] -CONN_HEAD = [COMP_COLUMN_NAME, 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, +CONN_HEAD = [COMP_COLUMN_NAME, 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, 'Status', DATASHEET_COLUMN_NAME] KIBOM_TEST_COMPONENTS = ['C1', 'C2', 'C3', 'C4', 'R1', 'R2', 'R3', 'R4', 'R5', 'R7', 'R8', 'R9', 'R10'] KIBOM_TEST_COMPONENTS_ALT = ['C1-C4', 'R9-R10', 'R7', 'R8', 'R1-R5'] @@ -114,10 +115,10 @@ def check_kibom_test_netlist(rows, ref_column, groups, exclude, comps, ref_sep=' logging.debug("list of components OK") -def check_dnc(rows, comp, ref, qty, datasheet=None): +def check_dnc(rows, comp, ref, status, datasheet=None): for row in rows: if row[ref].find(comp) != -1: - assert row[qty] == '1 (DNC)' + assert '(DNC)' in row[status] logging.debug(comp + " is DNC OK") if datasheet is not None: assert row[datasheet].startswith('