Build the Check Sheet
Build the Receiving Inspection
The Receiving Inspection checks a delivery of raw material: who supplied it, which lot it is, when it expires and,
optionally, what it looked like. It's started by hand when a delivery arrives, needs no sign-off, and requires an item, so
every inspection is tied to the material received.
Configure the Check Sheet
- Navigate to Configuration → Quality → Check Sheets and add a check sheet named
Receiving Inspection. - On the Settings tab, click the folder button to open folder management.
- Create
WarehouseandOperationsfolders underCoreForge. - Put the check sheet in
CoreForge\Warehouse. - Select Item Required and choose the item class
CoreForge\RM.
- Folders keep check sheets organized as the list grows. Group them by whatever your users look for: department, process area, check type, quality program, customer or site.
- Item Required makes the user pick an item when they start the check. Limiting the choice to an item class keeps the list short and reuses the plant's item master, so nobody retypes material names.
- The item gives each inspection its context and restricts what can be picked. A check sheet can also use the item to look up a different tolerance for each part family.
Add Check Items
The data type of a check item decides what the user sees when they fill it in: a pick list, a text box, a date picker or an image upload. Validation rules make sure the value is usable before it's saved.
-
Open
Receiving Inspectionand add these check items on the Checks tab. All are TypeCheckand Enabled.Check item Data type Required Settings Supplier NameString Yes Entry Options Textwith the Neutral responsesAlloySource Materials,Summit BlendChemandKeystone Industrial IngredientsLot NumberString Yes Instructions: Must be between 6 and 20 characters and all letters must be capitalized.Specification: Regex^[A-Z0-9]{6,20}$Expiration DateDatetime Yes Product ImageImage No Show the check items

-
Close the editor and release the check sheet.
- The supplier responses are Neutral: they record information but don't pass or fail the check. Users can also type a supplier that isn't in the list.
- Enabled decides whether an item appears at all. Required decides whether the check can be submitted with it blank.
- The regex only accepts 6 to 20 uppercase letters and digits, so
LOT20260515is accepted andab123isn't.
Check Your Work
Copy this script into the Ignition Designer Script Console (Tools → Script Console) and run it. It checks the Warehouse and Operations folders, that Receiving Inspection is released in CoreForge\Warehouse and requires a CoreForge\RM item, and the data type, Required setting, supplier responses, regex and instructions of each check item. Each check prints PASS or FAIL with what to fix. It doesn't change anything.
Show the check script
# Kanoa Quality Training - check "Build the Check Sheet" (Receiving Inspection, lesson 2)
#
# Run in the Ignition Designer Script Console (Tools > Script Console), in the
# project that inherits KANOA_SCRIPTS. It only reads; it changes nothing.
# Every check prints PASS or FAIL with what to fix, then a summary.
import re
SHEET = 'Receiving Inspection'
FOLDER = 'CoreForge\\Warehouse'
FOLDERS = ['CoreForge\\Warehouse', 'CoreForge\\Operations']
ITEM_CLASS = 'CoreForge\\RM'
SUPPLIERS = ['AlloySource Materials', 'Keystone Industrial Ingredients', 'Summit BlendChem']
REGEX = '^[A-Z0-9]{6,20}$'
ITEMS = [
# name, data type, required
('Supplier Name', 'String', True),
('Lot Number', 'String', True),
('Expiration Date', 'Datetime', True),
('Product Image', 'Image', False),
]
results = []
def check(ok, what, fix=None):
results.append(bool(ok))
if ok:
print 'PASS %s' % what
else:
print 'FAIL %s' % what
if fix:
print ' -> %s' % fix
def note(what):
print 'NOTE %s' % what
def field(row, *names):
for n in names:
if n in row and row[n] is not None:
return row[n]
return None
def text(v):
return '' if v is None else unicode(v).strip()
def key(v):
return ' '.join(text(v).lower().split())
def truthy(v):
return str(v).lower() in ('true', '1', 'yes')
def num(v):
try:
return float(v)
except:
return None
def rows(data):
# Kanoa returns a dataset, a list of dictionaries, or None
if data is None:
return []
if hasattr(data, 'getRowCount'):
cols = list(data.getColumnNames())
return [dict((c, data.getValueAt(i, c)) for c in cols) for i in range(data.getRowCount())]
return [dict(r) for r in data]
def findSheet(name):
"""All versions of a check sheet, and the one to check: the Released version, or else the newest.
A revision renames the archived version '<name> - N' and the open one '<name> - In Revision',
so the other versions are found by their master sheet, not by name."""
sheets = rows(system.kanoa.quality.sheet.getSheets({}))
named = [s for s in sheets if text(field(s, 'chkShtName')) == name] or \
[s for s in sheets if key(field(s, 'chkShtName')) == key(name)]
if not named:
return None, []
masters = set(text(field(s, 'masterChkShtId', 'chkShtId')) for s in named)
versions = [s for s in sheets if text(field(s, 'masterChkShtId', 'chkShtId')) in masters]
versions.sort(key=lambda s: num(field(s, 'chkShtVersionNumber')) or 0)
released = [s for s in versions if text(field(s, 'chkShtVersionStateName')) == 'Released']
return (released or versions)[-1], versions
def findItem(items, name):
exact = [i for i in items if text(field(i, 'chkItemName')) == name]
close = [i for i in items if key(field(i, 'chkItemName')) == key(name)]
return (exact or close or [None])[0]
def pickList(value):
"""The responses in each result category of a Text pick list."""
out = {}
for cat in ('PASS', 'WARNING', 'FAIL', 'NEUTRAL'):
m = re.search(r"""['"]%s['"]\s*:\s*\[(.*?)\]""" % cat, text(value))
found = re.findall(r"""'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)\"""", m.group(1)) if m else []
out[cat] = sorted(a or b for a, b in found)
return out
def spec(item):
try:
return dict(system.util.jsonDecode(text(field(item, 'specification')))) if text(field(item, 'specification')) else {}
except:
return {}
print '=' * 70
print 'Kanoa Quality Training - Build the Receiving Inspection check'
print '=' * 70
# 1. Folders
print '\n-- Folders'
folders = set(text(field(r, 'path')) for r in rows(system.kanoa.quality.sheet.getSheetTypes({})))
for path in FOLDERS:
check(path in folders, 'Folder %s exists' % path,
'On the Settings tab of a check sheet, click the folder button and add %s under CoreForge.' % path.split('\\')[-1])
# 2. The check sheet and its settings
print '\n-- Check sheet'
sheet, versions = findSheet(SHEET)
if sheet is None:
check(False, 'Check sheet %s exists' % SHEET,
'In Configuration > Quality > Check Sheets, add a check sheet named %s.' % SHEET)
else:
actual = text(field(sheet, 'chkShtName'))
check(actual == SHEET, 'Check sheet %s exists' % SHEET, "Found '%s'. Rename it to %s." % (actual, SHEET))
folder = text(field(sheet, 'chkShtTypePath'))
check(folder == FOLDER, 'It is in the %s folder' % FOLDER,
"It's in '%s'. On the Settings tab, set the folder to %s." % (folder or 'no folder', FOLDER))
check(truthy(field(sheet, 'itemReqd')), 'Item Required is selected', 'On the Settings tab, select Item Required.')
classes = [text(field(r, 'itemClassPath')) for r in rows(system.kanoa.quality.sheet.getItemClasses(field(sheet, 'chkShtId')))
if truthy(field(r, 'enabled')) or field(r, 'enabled') is None]
check(ITEM_CLASS in classes, 'Items are limited to the %s class' % ITEM_CLASS,
'On the Settings tab, under Item Required, choose the item class %s.%s'
% (ITEM_CLASS, (' Now: %s.' % ', '.join(classes)) if classes else ''))
state = text(field(sheet, 'chkShtVersionStateName'))
check(state == 'Released', 'It is Released',
"It's %s. Close the editor and change its status to Released." % (state or 'not set'))
# 3. Check items
if sheet is not None:
print '\n-- Check items'
items = rows(system.kanoa.quality.config.getChecks({'chkShtId': field(sheet, 'chkShtId')}))
for name, dataType, required in ITEMS:
item = findItem(items, name)
if item is None:
check(False, '%s exists' % name, 'On the Checks tab, add a check item named %s.' % name)
continue
problems = []
actual = text(field(item, 'chkItemName'))
if actual != name:
problems.append("rename '%s' to %s" % (actual, name))
if text(field(item, 'chkItemTypeName')) != 'Check':
problems.append('set Type to Check')
if text(field(item, 'dataTypeName')) != dataType:
problems.append("set Data Type to %s (it's %s)" % (dataType, text(field(item, 'dataTypeName')) or 'blank'))
if not truthy(field(item, 'enabled')):
problems.append('select Enabled')
if truthy(field(item, 'required')) != required:
problems.append('select Required' if required else 'clear Required')
check(not problems, '%s is an enabled %s %s check' % (name, 'required' if required else 'optional', dataType),
'; '.join(problems).capitalize() + '.')
if name == 'Supplier Name':
responses = pickList(field(item, 'pickListValues'))
ok = text(field(item, 'pickListName')) == 'Text' and responses['NEUTRAL'] == SUPPLIERS \
and not (responses['PASS'] or responses['WARNING'] or responses['FAIL'])
check(ok, 'Supplier Name has the three suppliers as Neutral responses',
'Under Entry Options, choose Text and add %s, each as Neutral.' % ', '.join(SUPPLIERS))
elif name == 'Lot Number':
s = spec(item)
regex = text(dict(s.get('regex') or {}).get('value'))
check(text(s.get('specType')).lower() == 'regex' and regex == REGEX, 'Lot Number is validated with the regex %s' % REGEX,
"Its specification is '%s'. Under Specification, choose Regex and enter %s." % (regex or text(s.get('specType')) or 'none', REGEX))
check(text(field(item, 'instructions')), 'Lot Number has instructions',
'Enter the instructions: Must be between 6 and 20 characters and all letters must be capitalized.')
passed = results.count(True)
print '\n' + '=' * 70
print 'Result: %d of %d checks passed' % (passed, len(results))
if passed == len(results):
print 'All good. Your Receiving Inspection is built and released.'
else:
print 'Fix the FAIL items above, then run this again.'
print '=' * 70
check-sheet-receiving-inspection.json: The finished Receiving Inspection Check


