External stored procedures: Inspection Tickets

TMWAMSEXT_ORDERS_INSPECTION_CREATE

Turns the DVIR into an Inspection Ticket.
Input Fields:

  • Unit Number, must be a valid Unit Number

  • Inspection Type, must be a valid Inspection Type

  • Driver, must be a valid driver

  • Remarks, text file

    • Could be used to store the following, fields will not be validated

      • Annual Inspection Date

      • Empty/Loaded

      • License Plate #

      • Etc.

  • Meter Readings, optional

Input Parameters

Parameter Name

Parameter Information

Parameter Description

@ERRORID

INTEGER

Error ID supplied if an invalid parameter was entered, such as an invalid Unit Number

@INSPRPTID

INTEGER

Inspection Ticket ID number (not this is not the ticket number but the actual ID) this would be supplied if you were updating an existing inspection ticket. Do not use this if you are creating new inspection tickets (declare the variable but do not have SET @INSPRPTID statement).

@UNITID

VARCHAR, (24), required, validated

This is the unit number that will be on the inspection ticket.

@CUSTID

VARCHAR, (12),optional, validated

This is the customer number that is assigned to the unit. If customer is not assigned to the unit supplied it will not allow the ticket to be created.

@EMPID

VARCHAR (12), required, validated.

This is the employee that performed the inspection ticket.

@DRIVERID

VARCHAR (12),Optional, validated

This is the driver on the inspection ticket.

@INSPECTTYPE

VARCHAR(12)

The type of inspection. Must be a valid inspection type.

@REMARKS

VARCHAR (255),Optional

This is the remarks field from the header.

@ISSUEFAILCATEGORY

VARCHAR (8000)

1) The listing of inspection items to be checked off. Set them up in SysMgr>Repair Order Setup>Inspection Tickets.

2) Items need to be setup for a given unit type & inspection type. Example the unit type of Tractor & inspection type of Standard might have 15 items that need to be checked off.

3) The format for these items is comma-delimited. An example statement with 3 different items to be checked off. SET @ISSUEFAILCATEGORY = ‘PM,HORNS,TIRES’. Of the 15 items only these 3 will be checked.

4) If items do not exist they will be ignored. If HORNS are not valid for this unit/inspection type it will be ignored and only PM & TIRES will be checked.

@ISSUEFAILCOMMET

VARCHAR (8000)

1) This is the listing of the inspection item comments. These comments correspond to the fail categories, or inspection items from the previous parameter.

2) This is also a comma-delimited parameter like @ISSUEFAILCATEGORY.

3) If you supply 3 fail categories like ‘PM,HORNS,TIRES’ and you want comments for each category then the format of this parameter would be the same, with each item corresponding to the previous order: SET @ISSUEFAILCOMMET = ‘PM Comment, Horn Comment, Tires Comment’. If you do not want to supply a comment simply leave the area in the comma blank, make sure you do include the commas to ensure the comments get linked correctly.

Here are examples: ‘PM Comments,,Tires Comment’ or ‘,,Tires Comment’ or ‘PM Comment,,’ or ‘,Horns Comment,’ etc.

@ISSUEFAILCOMPLTID

VARCHAR (8000)

1) This is the complaint code of the inspection item. These complaint codes correspond to the fail categories, or inspection items from the previous parameter.

2) This is also a comma-delimited parameter like @ISSUEFAILCATEGORY.

3) If you supply 3 fail categories like ‘PM,HORNS,TIRES’ and you want complaint codes for each category then the format of this parameter would be the same, with each item corresponding to the previous order: SET @ISSUEFAILCOMPLTID= ‘PM,BROKEN,CUT’. If you do not want to supply a complaint simply leave the area in the comma blank, make sure you do include the commas to ensure the complaint codes get linked correctly.

Here are examples: ‘PM,,CUT’ or ‘,,CUT’ or ‘PM,,’ or ‘,BROKEN,’ etc.

4) These values will be validated with the complaint codes setup in Transman.

Note: There is an OKAY? Flag in Transman, if no values for ISSUEFAILCATEGORY, ISSUEFAILCOMMET, and ISSUEFAILCOMPLTID are supplied then it will be checked Y for OKAY. If any categories are supplied then it will not be checked as OKAY.

TMWAMSEXT_ORDERS_INSPECTION_CREATE Example:
@INSPRPTID INT, @UNITID VARCHAR(24), @CUSTID VARCHAR(12), @EMPID VARCHAR(12), @DRIVERID VARCHAR(12), @INSPECTTYPE VARCHAR(12), @INSPECTDATE DATETIME, @REMARKS VARCHAR(255), @ISSUEFAILCATEGORY VARCHAR(8000), @ISSUEFAILCOMMET VARCHAR(8000), @ISSUEFAILCOMPLTID VARCHAR(8000)

 — SELECT @INSPRPTID = 40 — This is the actual inspection ticket ID from the database
SET @UNITID = 'UNIT1324'
SET @CUSTID = 'CUST-1'
SET @EMPID = 'JOHN231'
SET @DRIVERID = 'JOHNS'
SET @INSPECTTYPE = 'STANDARD'
SET @INSPECTDATE = '01/15/2010'
SET @REMARKS = 'UNIT WAS INSPECTED'
SET @ISSUEFAILCATEGORY = 'PM,HORNS,TIRES'
SET @ISSUEFAILCOMMET = ',NOT WORKING,BAD TIRE'
SET @ISSUEFAILCOMPLTID = 'PM,,CUT'

EXEC TMWAMSEXT_ORDERS_INSPECTION_CREATE @INSPRPTID OUTPUT, @ERRORID OUTPUT, @UNITID, @CUSTID, @EMPID, @DRIVERID, @INSPECTTYPE, @INSPECTDATE, @ISSUEFAILCATEGORY, @ISSUEFAILCOMMET, @ISSUEFAILCOMPLTID

SELECT @ERRORID, @INSPRPTID