Fill Out The Check Sheet
Complete a Receiving Inspection
- Navigate to Quality → Schedule → Active Checks, click Add Check and choose
Receiving Inspection. - Kanoa asks for an item, and only shows
CoreForge\RMitems. ChooseAL6061and click Add. - Open the check and pick or type a supplier.
- Read the Lot Number instructions, then try
ab123. It's rejected. EnterLOT20260515instead. - Pick an expiration date. Leave Product Image blank or upload any image.
- Click Submit. With no sign-off required, the check is Approved.
Optional: Complete a check on a phone or tablet
- Install the Ignition Perspective app on a phone or tablet.
- Add your training gateway, open the Kanoa Mobile project and log in.
- Open the mobile check schedule, add a
Receiving Inspection, and complete it. - For Product Image, take a photo with the device camera.
info
The same check sheet works on desktop and mobile. On a desktop, Image items browse for a file; on mobile they can use the camera, which makes photo evidence practical on the plant floor.
Check your work
Copy this script into the Ignition Designer Script Console (Tools → Script Console) and run it. It checks that a Receiving Inspection for AL6061 is Approved, with a supplier, a lot number that matches the regex, and an expiration date. Each check prints PASS or FAIL with what to fix. It doesn't change anything.
Show the check script
checkLesson-receivingComplete.py
# Kanoa Quality Training - check "Fill Out The Check Sheet" (Receiving Inspection, lesson 3)
#
# 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'
ITEM = 'AL6061'
REGEX = '^[A-Z0-9]{6,20}$'
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 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 millis(v):
return v.getTime() if hasattr(v, 'getTime') else 0
def sheetEvents(versions):
"""Every check event of any version of the sheet, newest first."""
out = []
for s in versions:
out += rows(system.kanoa.quality.event.getChkShtEvents({'chkShtId': field(s, 'chkShtId')}))
out.sort(key=lambda e: millis(field(e, 'scheduledDate', 'takenDate')), reverse=True)
return out
def eventItems(event):
"""The recorded values of a check event, by check item name."""
byName = {}
for r in rows(system.kanoa.quality.event.getChkShtEventItems({'chkShtEventId': field(event, 'chkShtEventId')})):
byName.setdefault(text(field(r, 'chkItemName')), []).append(r)
return byName
def values(itemRows):
return [text(field(r, 'chkItemValue')) for r in itemRows or [] if text(field(r, 'chkItemValue'))]
print '=' * 70
print 'Kanoa Quality Training - Complete a Receiving Inspection check'
print '=' * 70
sheet, versions = findSheet(SHEET)
if sheet is None:
check(False, 'Check sheet %s exists' % SHEET, 'Build it in the previous lesson first.')
else:
print '\n-- Completed inspections'
events = sheetEvents(versions)
approved = [e for e in events if text(field(e, 'chkShtStateName')) == 'Approved']
if not approved:
states = ', '.join(sorted(set(text(field(e, 'chkShtStateName')) for e in events)))
check(False, 'A Receiving Inspection is Approved',
'In Quality > Schedule > Active Checks, add a %s for %s, fill it in and click Submit.%s'
% (SHEET, ITEM, (' Inspections so far: %s.' % states) if states else ''))
else:
check(True, 'A Receiving Inspection is Approved (%d so far)' % len(approved))
forItem = [e for e in approved if text(field(e, 'itemName')) == ITEM]
check(forItem, 'An approved inspection is for item %s' % ITEM,
'Add a %s and choose %s when Kanoa asks for an item. Approved so far: %s.'
% (SHEET, ITEM, ', '.join(sorted(set(text(field(e, 'itemName')) or 'no item' for e in approved)))))
event = (forItem or approved)[0]
byName = eventItems(event)
supplier = values(byName.get('Supplier Name'))
check(supplier, 'It has a supplier (%s)' % (supplier[0] if supplier else 'none'), 'Pick or type a supplier.')
lot = values(byName.get('Lot Number'))
check(lot and re.match(REGEX, lot[0]), 'It has a valid lot number (%s)' % (lot[0] if lot else 'none'),
'Enter a lot number of 6 to 20 uppercase letters and digits, such as LOT20260515.')
check(values(byName.get('Expiration Date')), 'It has an expiration date', 'Pick an expiration date.')
if values(byName.get('Product Image')):
note('It has a product image.')
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 complete.'
else:
print 'Fix the FAIL items above, then run this again.'
print '=' * 70
