Quality Control - [QC Entry]
Doubt
- In QC1 delete not given. From QC main how can I delete uploaded file since there will be different item grps.
- Grn lines without TrnId we will not take right even for manual?
Objective
- The QC module manages quality inspections for business documents like:
- Goods Receipt (Incoming QC)
- Production (In-Process QC)
- Invoice (Outgoing QC)
- It supports:
- Manual QC (certificate-based)
- System QC (parameter-based validation)
- Mix QC (Combination of System + Manual based on item groups)
Data Model Overview
QC_Main (Header)
↓
QC_Line (Item Group Level)
↓
QC_Parameter (Parameter Level – only for system/mix mode)Tables
CREATE TABLE QualityControl
(
Id INT IDENTITY(1,1) PRIMARY KEY,
qcno NVARCHAR(6),
qcDate DATETIME,
yearqcno NVARCHAR(12),
qcStage NVARCHAR(3), -- IQC (Incoming), PQC (In process), FQC (Final)
refDoc NVARCHAR(20), -- GRN (Currently restricted)
refNo NVARCHAR(6),
refDate DATETIME,
mode NVARCHAR(1), -- S (System), M (Manual), X (Mix)
qcStatus NVARCHAR(1), -- O (Open), C (Closed), P (Partial)
checkedBy NVARCHAR(25),
approvedBy NVARCHAR(25)
);
CREATE TABLE QualityControl1
(
Id INT IDENTITY(1,1) PRIMARY KEY,
qcno NVARCHAR(6),
yearqcno NVARCHAR(12),
itemgrpid NVARCHAR(3),
testplancode NVARCHAR(6), -- (0 for Manual)
reportNo NVARCHAR(20),
reportDate DATETIME,
itemQcStatus NVARCHAR(1), -- Pending (N), P (Pass), F (Fail)
remarks NVARCHAR(150)
);
CREATE TABLE QualityControl2
(
Id INT IDENTITY(1,1) PRIMARY KEY,
qcno NVARCHAR(6),
yearqcno NVARCHAR(12),
itemgrpid NVARCHAR(3),
parameterCode NVARCHAR(6),
actualValue DECIMAL(7,3),
result NVARCHAR(1) -- Pending (N), P (Pass), F (Fail)
);QC Main Level
QC Index
Fields
| Column | Property |
|---|---|
| QC No | QcNo |
| QC Date | QcDate |
| QC Stage | QcStageName |
| Ref Doc | RefDoc |
| Mode | QcModeName |
| Status | QcStatusName |
Buttons
- Create
QC Details
Fields
| Column | Property |
|---|---|
| QC No | QcNo |
| QC Date | QcDate |
| QC Stage | QcStageName |
| Ref Doc | RefDoc |
| Ref No | RefNo |
| Ref Date | RefDate |
| Mode | QcModeName |
| Status | QcStatusName |
Buttons
- Create
- Delete
- Back
QC Create
Fields
| Column | Property | Model Class Validation |
|---|---|---|
QC Stage HardCoded Combo |
QcStageCode | QC Stage needs to be selected |
Ref Doc HardCoded Combo |
RefDoc | Ref Doc needs to be selected |
| Ref No | RefNo | 1. Ref No needs to be filled 2. Ref No can be upto 6 digits only |
| Ref Date | RefDate | |
Mode HardCoded Combo |
QcMode | QC Mode needs to be selected |
Hard Coded combo values
QC Stage
- IQC (Incoming)
- PQC (In-Process)
- FQC (Final)
Ref Doc (Currently restricted)
- GRN
Mode
- S (System)
- M (Manual)
- X (Mix)
Validations
| Message | Condition |
|---|---|
| Invalid Ref No / Ref Date | If not found in GRN |
| Duplicate QC Entry | If QC exists for same RefNo |
| No lines found | If GRN has no items |
| QR not generated for selected refdoc | If no records in QrSubTrn |
| Test plan available for all item groups. Mode should be system | If manual or mixed is selected |
| Test plan missing for all item groups. Mode should be Manual | If system or mixed is selected |
| Test plan is available for some item groups and missing for some. Mode should be Mixed | If manual or system is selected |
Points
- QC No & YearQCNo → System generated
- QC Date →
DateTime.Now - Default Status → O (OPEN)
Mode Determination Logic
| Condition | Mode |
|---|---|
| All item groups have test plan | S |
| None have test plan | M |
| Partial availability | X |
Processing Logic
Manual Mode
- QC1 populated with item groups
- testplancode = 0
- User must:
- Upload certificate (per item group)
- Enter Report No & Date
- QC2 → NOT used
System Mode
- QC1 populated with item groups
- testplancode assigned
- QC2 populated with parameters
- Report No → Auto generated
- Report Date →
DateTime.Now
Mix Mode
- Item groups with test plan → System
- Item groups without → Manual
Print Report PDF
Header
- QC No, Date
- QC Stage
- Ref Doc / Ref No
- Mode
- Status
Item Group Section
- Item Group
- Test Plan Code
- Report No / Date
- Status
Parameter Section (System / Mix mode)
- Item Group
- Parameter
- Actual
- Result
QC Line Level 1
- Records will be autofetched and inserted from Reference Document.
- For System model Report Number and date will be generated by System.
- For Manaual mode Report Number and date will be given by user.
- User can also write remarks.
- Initially Item QC Status will be inserted as
Pending
QC 1 Index
Fields
| Column | Property |
|---|---|
| QC No | QcNo |
| Item Group | ItemGroupName |
| Test Plan Code | TestPlanCode |
| Item QC Status | ItemQcStatusName |
QC 1 Details
Fields
| Column | Property |
|---|---|
| QC No | QcNo |
| Item Group | ItemGroupName |
| Test Plan Code | TestPlanCode |
| Test Plan Name | TestPlanName |
| Report No | ReportNo |
| Report Date | ReportDate |
| Item QC Status | ItemQcStatusName |
| Remarks | Remarks |
Buttons
- Parameter Details
- Modify Remarks
Dialog Box - Upload
Show only if manual or Mix mode and test plan not available
QC 1 Upload
Fields
| Column | Property |
|---|---|
QC No Read only |
QcNo |
| Report No | ReportNo |
| Report Date | ReportDate |
Upload File |
QC Line Level 2
- Will be available only for System or Mix mode and test plan exists
- Initially result will be
Pending
QC 2 Index
Header
| Column | Property |
|---|---|
| QC No | QcNo |
| Item Group | ItemGroupName |
Fields
| Column | Property |
|---|---|
| Parameter Code | ParameterCode |
| Parameter Name | ParameterName |
| Actual Value | ActualValue |
| Result | ResultName |
Import |
Link |
QC 2 Import
Download Model
-
Values will be prefilled and only actual Value column will be open
-
Fields
Column Property Id HiddenId Parameter Code ParameterCode Parameter Name ParameterCode Parameter Type Code HiddenParameterTypeCode Parameter Type Name ParameterTypeName Actual Value ActualValue -
Instruction Sheet
Column Validation Actual Value For parameter type System fill numeric value and for Manual fill P(Pass)/F(Fail)
Reading XL Error code
| Column | Validation |
|---|---|
| Z1 | Actual Value needs to be filled |
| Z2 | Actual Value must be in proper number format If parameter type System |
| Z3 | Actual Value must be between 0 to 9999.999 If parameter type System |
| Z4 | Actual Value must be P- Pass, F- Fail If parameter type Manual |
Repository Error code
| Column | Validation |
|---|---|
| A | Model has been altered |
Parameter Execution Logic
System Parameter
- Inititally status will be → Pending
- User fills actual values
- IF actualValue BETWEEN minValue AND maxValue → PASS ELSE → FAIL
Manual Parameter
- User selects: Pass / Fail
Status Logic
QC2 (Parameter)
- N → Pending
- P → Pass
- F → Fail
QC1 (Item Group)
IF Manual → user input
IF System:
IF any FAIL → F
ELSE IF all PASS → P
ELSE → NQC_Main
IF all QC1 = PASS → C
IF all QC1 = Pending → O
ELSE → PQC Locking
- If QC exists → Modify/Delete not allowed for linked refdoc
Edge Case Handling
Multiple Items in Item Group (Critical)
Problem:
- 3 items → 2 good, 1 bad
Solution
👉 Use Worst Case Logic
IF ANY sample fails → Item Group FAILInput Approach
- User must enter: Minimum observed value