Tuesday 21 January 2020

Item Inspection with Maximo Inpsection Form | Maximo

The new version of Maximo Inspection is based on Work Center, which is built on google polymer.
We create Inspection form and perform Adhoc Inspection for either Asset or Location.

2nd Option is to attach inspection form with Route, Job plan or directly with Work order.

What if we want to inspect something else? let say critical item inspection, can we use inspection module with this.
the answer was NO.

But with this little trick we can use this functionality with almost any application:

1. Create a new application, attach inspection form and result form with it.
2. create a new record, put item number, start the inspection.

below is the step by step instructions to create this.

1. Database Configuration:
create a new object let say (CSPINSPECTION) : add INSPFORMNUM as an addition to your required attributes.



Attribute Description Type Length
CRITIAL Critial YORN 1
CRITICAL_CONTRACT_CODE Critical Contract Code ALN 50
CRITICAL_ITEM_PRICE Critical Item Price AMOUNT 10
CSPINSPECTIONID Cspinspectionid BIGINT 19
DESCRIPTION Description ALN 50
DESCRIPTION_LONGDESCRIPTION Description_longdescription LONGALN 32000
HASLD Hasld YORN 1
INSPECTIONDATE Inspectiondate DATETIME 10
INSPECTIONNUM Inspectionnum ALN 50
INSPFORMNUM Inspection Form UPPER 12
ITEMNUM Itemnum UPPER 40
LOCATION Storeroom UPPER 50
ORGID Organization Identifier UPPER 8
SITEID Identifies the site. UPPER 8


Relationship:

     A. make a relationship with INSPECTIONFORM
        where : inspformnum=:inspformnum and status in (select value from synonymdomain where domainid = 'INSPECTFORMSTATUS' and maxvalue='ACTIVE')

    B. make 2nd relationship with INSPECTIONRESULT
       where : referenceobjectid=to_char(:CSPINSPECTIONID) and referenceobject='CSPINSPECTION' and siteid=:siteid

    C. make 3rd relationship which is based on your requirement. in my case we are using item from inventory. that's why we need a relation with INVENTORY
       where : itemnum = :itemnum and location =:location

2. Application Designer:

Create an application based on the newly created object in database configuration, say CSPINSPECTION

A. create 1 text box and set these properties:
           Attribute: INSPFORMNUM 
           Go to application: INSPECTORSUP
           Menu: Normal

             
B. create 2nd text box and set these properties:
           Attribute: INSPECTIONRESULT.RESULTNUM
           Go to application: INSPECTOR 
           Menu: Normal

Note: You can make lookups for your ease.


3. Automation Script: 
We need an automation script on SAVE to create a RESULTFORM, which will be shown in our application with relationship;


Object Launch Point:
Object: CSPINSPECTION
Event: SAVE, ADD/UPDATE, Before SAVE


Script:
vInspFormNum = mbo.getString("INSPFORMNUM");
vRevision = mbo.getMboSet("$INSPECTIONFORM","INSPECTIONFORM","INSPFORMNUM = " + vInspFormNum + " and status = 'ACTIVE'").getMbo(0).getString("REVISION");

vInspectionResultSet = mbo.getMboSet("INSPECTIONRESULT");

if vInspectionResultSet.count()==0:
    vInspectionResultSet.add();
    vInspectionResultSet.setValue("REFERENCEOBJECT","CSPINSPECTION");
    vInspectionResultSet.setValue("REFERENCEOBJECTID",str(mbo.getInt("CSPINSPECTIONID")));
    vInspectionResultSet.setValue("INSPFORMNUM",vInspFormNum);
    vInspectionResultSet.setValue("REVISION",vRevision);
    vInspectionResultSet.setValue("CREATEDBY",user);
    vInspectionResultSet.setValue("CREATEDATE",mbo.getDate("INSPECTIONDATE"));
    vInspectionResultSet.setValue("STATUS","PENDING");


Notes:
1. One more point, export xml and append below text to maintain the link to open the related result form:
<textbox applink="INSPECTOR" applinkrel="inspectionresult.resultnum" dataattribute="INSPECTIONRESULT.resultnum" id="1579527986109" inputmode="readonly" menutype="NORMAL"/>

2. Also to make search window proper, update  PRIMARYKEYCOLSEQ  for two attributes, siteid, cspinspectionnum as 1 and 2 respectively. 
SELECT PRIMARYKEYCOLSEQ FROM MAXATTRIBUTE --1
--UPDATE MAXATTRIBUTE SET PRIMARYKEYCOLSEQ = NULL
WHERE OBJECTNAME ='CSPINSPECTION' AND ATTRIBUTENAME = 'CSPINSPECTIONID';
SELECT PRIMARYKEYCOLSEQ FROM MAXATTRIBUTECFG --1
--UPDATE MAXATTRIBUTECFG SET PRIMARYKEYCOLSEQ = NULL
WHERE OBJECTNAME ='CSPINSPECTION' AND ATTRIBUTENAME = 'CSPINSPECTIONID';
SELECT PRIMARYKEYCOLSEQ FROM MAXATTRIBUTE --NULL
--UPDATE MAXATTRIBUTE SET PRIMARYKEYCOLSEQ = 1
WHERE OBJECTNAME = 'CSPINSPECTION'AND ATTRIBUTENAME = 'SITEID';
SELECT PRIMARYKEYCOLSEQ FROM MAXATTRIBUTECFG --NULL
--UPDATE MAXATTRIBUTECFG SET PRIMARYKEYCOLSEQ = 1
WHERE OBJECTNAME ='CSPINSPECTION' AND ATTRIBUTENAME = 'SITEID';
SELECT PRIMARYKEYCOLSEQ FROM MAXATTRIBUTE
--UPDATE MAXATTRIBUTE SET PRIMARYKEYCOLSEQ = 2
WHERE OBJECTNAME = 'CSPINSPECTION'AND ATTRIBUTENAME = 'INSPECTIONNUM';
SELECT PRIMARYKEYCOLSEQ FROM MAXATTRIBUTECFG
--UPDATE MAXATTRIBUTECFG SET PRIMARYKEYCOLSEQ = 2
WHERE OBJECTNAME ='CSPINSPECTION' AND ATTRIBUTENAME = 'INSPECTIONNUM';


1 comment:

  1. Do you have any documentation on the use of the applinkrel property? I'm assuming it works similar to the MaxLookupMap object and thinking the OrgID should be included for the InspFormNum attribute since the InspectionForm object is an Organization-level object. It shouldn't make any difference in environments with a single Organization but it could when there are multiple Organizations.

    ReplyDelete