All tables
tables · table

prodscrap

The prodscrap table serves as a granular transactional log for recording scrap and rework quantities associated with specific production runs (prodno). It categorizes losses using standardized reason codes (scrapcode) and distinguishes between permanent scrap and items slated for rework via the RW_Scrap_Flag. The table also facilitates tracking of scrap/rework responsibilities or destinations through vendor/supplier links (vsCode, vsType) and maintains audit-trail details through challan references.

Row count
162,656
Last entry
Source
tables

Columns

9
ColumnTypeNullableMeaning
indexintNOInternal unique identifier for the record.
compcodestringNOUnique identifier for the company/legal entity.
prodnointNOReference number to the production order/entry.
scrapcodeintNOReason code for the rejection or scrap.
scrapqtynumberYESThe quantity of material rejected or scrapped.
RW_Scrap_FlagstringYESDistinguishes between Scrap and Rework status.
vsCodestringYESThe code of the Vendor or Supplier associated with the rejection.
vsTypestringYESIdentifies the entity type stored in `vsCode`.
ChallanDetailstringYESFree-text field for challan numbers or specific transaction remarks.

Full documentation

### 1. Overview
 The `prodscrap` table serves as a granular transactional log for recording scrap and rework quantities associated with specific production runs (`prodno`). It categorizes losses using standardized reason codes (`scrapcode`) and distinguishes between permanent scrap and items slated for rework via the `RW_Scrap_Flag`. The table also facilitates tracking of scrap/rework responsibilities or destinations through vendor/supplier links (`vsCode`, `vsType`) and maintains audit-trail details through challan references.
 
 ### 2. Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | int | NO | Internal unique identifier for the record. | | Primary Key |
 | **compcode** | string | NO | Unique identifier for the company/legal entity. | e.g., 'DAS', 'BPL' | Join, Filter |
 | **prodno** | int | NO | Reference number to the production order/entry. | | Join to `product2`, `rmproduct1` |
 | **scrapcode** | int | NO | Reason code for the rejection or scrap. | | Join to `rejectionmas.rejcode` |
 | **scrapqty** | number | YES | The quantity of material rejected or scrapped. | | Aggregation (SUM) |
 | **RW_Scrap_Flag** | string | YES | Distinguishes between Scrap and Rework status. | 'S' (Scrap), 'R' (Rework) | Filter |
 | **vsCode** | string | YES | The code of the Vendor or Supplier associated with the rejection. | | Join to `vendmas.vendcode` / `suppmas.supcode` |
 | **vsType** | string | YES | Identifies the entity type stored in `vsCode`. | 'V' (Vendor), 'S' (Supplier) | Conditional Join Logic |
 | **ChallanDetail** | string | YES | Free-text field for challan numbers or specific transaction remarks. | | Documentation |
 
 ### 3. Relationships & Join Map
 
 #### Primary Relationships (Strictly Based on SCHEMA_MAP)
 * **Production Records**: Joins to `dbo.product2` or `dbo.rmproduct1` on `prodno` and `compcode` to retrieve production dates, item codes, and machine details.
 * **Rejection Reasons**: Joins to `dbo.rejectionmas` on `scrapcode` = `rejcode` and `compcode`. This is used to fetch the human-readable reason (`rejreason`).
 * **Entity Resolution**: 
  * If `vsType` = 'V', joins to `dbo.vendmas` on `vsCode` = `vendcode` and `compcode`.
  * If `vsType` = 'S', joins to `dbo.suppmas` on `vsCode` = `supcode` and `compcode`.
 
 #### Inferred Relationships (Likely)
 * **Historical Production**: Heavy usage in stored procedures suggests a join to a table named `product1` (though not present in the provided physical schema map) on `prodno` and `compcode`.
 * **Operation Context**: Indirectly relates to `dbo.oprmas` via production headers to identify which process step resulted in the scrap.