Main N4 Entity
Unit
Functionality
N4 Custom RDT Validations
Rail Inspection
Yard Inspection
Hatch Clerk - N4 Mobile and Crane Team UI (CTUI)
ReeferMonitoring
Rail Inventory
Yard Inventory
Description
Pre-update inspection data validations and an opportunity to register overridable errors. Unit entity is supplied to the groovy plugin when it is called from any of these programs.
The hook is called after in memory Unit object is updaed. This way computed fields like PlacardsMismatch are available to the hook without duplicating the logic.
Pre--update validations (e.g before load operation). Here Unit may be NULL for cases where it doesn't need to be created. Example if the rail car slot has the same unit ID before and after the commit then Unit will not be instantiated. This hook is called before Unit's position is updated. So reading the position of the unit will give the current position.
Hatch Clerk validation in N4 Mobile - in N4 2.5+.
Hatch Clerk validation in CTUI - in N4 3.1, 3.3+.
Interface Method(s) and Injected Data
Method:
validateChanges(Map)
Injected Data:
(key="InventoryBizMetafield.RDT_FORM_CHANGES", value= FieldChanges)
(key="InventoryBizMetafield.RDT_ENTITY", value=Unit) / (key="InventoryBizMetafield.MOBILE_OPERATION_NAME", value=DISCHARGE, LOAD, SHIFT, FORM_MANUAL_OPS_DISCHARGE, FORM_MANUAL_OPS_LOAD, FORM_MANUAL_OPS_SHIFT, YINVWheeledPos, YINVGroundedPos, YINVUnit)
(key="InventoryBizMetafield.RDT_APPLICATION_NAME", value = "railInventoryProgram" | "reeferMonitoringProgram" | "hatchClerkProgram" | "RailOrYardInspectionProgram" | "yardInventoryProgram")
Note:
1. Posting logic for rail and yard inspections are same however, unit's methods e.g. isUnitInYard() can be used to differentiate the two programs.
2. FieldChanges object contains inspection data.
3. As of 2.1 release , in case of Hatch Clerk, the groovy is called for both Load and Discharge. A new field called InventoryBizMetafield.MOBILE_OPERATION_NAME is now part of the field changes and has 'L' for load or 'D' for discharge to differentiate.
4. This hook is also called for Rail Discharge. As of 2.2 release new field InventoryBizMetafield.MOBILE_OPERATION_NAME is now part of the field changes and has '"DISCHARGE" for Discharge operation.
5. As of 2.1.2, 2.2.E releases (for Rail Inspection and Hatch Clerk): Now, N4 passes more information to the groovy hook "Rail Inspection," such as POW, CHE, and other fields. For load and discharge, N4 calls the groovy hook after saving the unit information and sending the bento message to XPS. For inspection, N4 calls the groovy hook after saving the inspection data. It is part of the same transaction for saving inspection data.
6. Unit entity can be null for pre-update validations.
7. Program specific field changes for pre-update validations, include the following:
Rail car position components:
InventoryField.POS_NAME
InventoryField.POS_SLOT
InventoryField.POS_LOC_TYPE
InventoryField.POS_LOC_ID
New and old Unit ID Strings
InventoryField.UNIT_ID
Parameters
mobileFormButtonId (ArgoBizMetafield.MOBILE_FORM_BUTTON_ID) provides the ID of the button you click when you click a button in N4 Mobile.
Availability
1.8.1+
8. In N4 2.5+, this groovy hook can be used for hatch clerk validations in N4 Mobile.
9. In N4 3.1, 3.3+, this groovy hook can be used for hatch clerk validations in CTUI.
Exception/Transaction Handling
Unchecked or registered exception leads to transaction rollback. Groovy can register overridable errors. User gets a chance to FORCE the transaction.
*Note*:
This hook also used by Hatch Clerk to collect rePlan boolean from the groovy code