Added more core functionality
This commit is contained in:
parent
b73aa6b578
commit
9f3dfbfe12
@ -206,3 +206,32 @@ CreateHALItem:
|
||||
end
|
||||
|
||||
return
|
||||
|
||||
API oiwizard.checkidleoisessionvalid.HEAD
|
||||
API oiwizard.checkidleoisessionvalid.GET
|
||||
|
||||
OIWizardID = ''
|
||||
Cookies = HTTP_Services('GetHTTPCookie')
|
||||
For each Cookie in Cookies using ';'
|
||||
Key = Field(Cookie, '=', 1)
|
||||
If Key EQ 'sessionID' then
|
||||
OIWizardID = Field(Cookie, '=', 2)
|
||||
end
|
||||
Next Cookie
|
||||
|
||||
ValidSession = OI_Wizard_Services('ValidateSessionIdle', OIWizardID)
|
||||
|
||||
If ValidSession EQ True$ then
|
||||
Expiry = Xlate('OI_WIZARD', OIWizardID, 'EXPIRY_UTC', 'X')
|
||||
LSLUserID = Xlate('OI_WIZARD', OIWizardID, 'EMPLOYEE_ID', 'X')
|
||||
HTTP_Services('SetResponseHeaderField', 'Set-Cookie', 'sessionID=':OIWizardID:' ;Expires=':Expiry)
|
||||
HTTP_Services('SetResponseHeaderField', 'Set-Cookie', 'userID=':LSLUserID:' ;Expires=':Expiry, True$)
|
||||
HTTP_Services('SetResponseHeaderField', 'Expires', Expiry)
|
||||
Message = 'Valid session. Expiry updated'
|
||||
StatusCode = 200
|
||||
GoSub CreateHALItem
|
||||
end else
|
||||
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
|
||||
end
|
||||
|
||||
end api
|
||||
|
@ -184,7 +184,6 @@ end service
|
||||
|
||||
|
||||
Service ValidateSession(OIWizardID)
|
||||
|
||||
ErrorMsg = ''
|
||||
If OIWizardID NE '' then
|
||||
OIWizardRec = Database_Services('ReadDataRow', 'OI_WIZARD', OIWizardID)
|
||||
@ -214,6 +213,32 @@ Service ValidateSession(OIWizardID)
|
||||
end
|
||||
|
||||
end service
|
||||
/*
|
||||
This routine validates a users session without extending it. Used for OI Wizard sessions that are awaiting input.
|
||||
*/
|
||||
Service ValidateSessionIdle(OIWizardID)
|
||||
ErrorMsg = ''
|
||||
If OIWizardID NE '' then
|
||||
OIWizardRec = Database_Services('ReadDataRow', 'OI_WIZARD', OIWizardID, True$, 0, False$)
|
||||
If Error_Services('NoError') then
|
||||
SessionTerminated = OIWizardRec<OI_WIZARD.TERMINATED$>
|
||||
If SessionTerminated then
|
||||
ErrorMsg = 'Expired session.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Null OIWizardID passed in.'
|
||||
end
|
||||
|
||||
If ErrorMsg EQ '' then
|
||||
Response = True$
|
||||
end else
|
||||
Error_Services('Add', ErrorMsg)
|
||||
Response = False$
|
||||
end
|
||||
end service
|
||||
|
||||
|
||||
Service TerminateSession(OIWizardID)
|
||||
@ -452,3 +477,4 @@ end service
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -152,7 +152,6 @@ end api
|
||||
|
||||
|
||||
API returntofab.ID.PATCH
|
||||
debug
|
||||
// Update reactor reactor and return updated reactor object
|
||||
RTFId = EndpointSegment
|
||||
If RTFId then
|
||||
@ -184,6 +183,16 @@ debug
|
||||
Return_To_Fab_Services('SetReasonForReturn', RTFId, LSLUser, Value)
|
||||
Case Field EQ 'EvalResultId'
|
||||
Return_To_Fab_Services('SetEvalInfo', RTFId, LSLUser, Value)
|
||||
Case Field EQ 'MhInitDtm'
|
||||
Return_To_Fab_Services('SetBinToBin', RTFId, LSLUser)
|
||||
Case Field EQ 'CompletedDtm'
|
||||
Return_To_Fab_Services('SetFinalBinToBin', RTFId, LSLUser)
|
||||
if Error_Services('NoError') then
|
||||
Return_To_Fab_Services('SetRTFCompleted', RTFId, LSLUser)
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
Case Otherwise$
|
||||
Error_Services('Add', 'Error Updating ' : Field : 'field in RTF Record.')
|
||||
End Case
|
||||
@ -234,6 +243,87 @@ API returntofab.evaluationresultoptions.GET
|
||||
end
|
||||
end api
|
||||
|
||||
API returntofab.reportopenforms.HEAD
|
||||
API returntofab.reportopenforms.GET
|
||||
|
||||
OIWizardID = ''
|
||||
Cookies = HTTP_Services('GetHTTPCookie')
|
||||
For each Cookie in Cookies using ';'
|
||||
Key = Field(Cookie, '=', 1)
|
||||
If Key EQ 'sessionID' then
|
||||
OIWizardID = Field(Cookie, '=', 2)
|
||||
end
|
||||
Next Cookie
|
||||
|
||||
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
|
||||
|
||||
If ValidSession then
|
||||
UserId = Xlate('OI_WIZARD', OIWizardID, 'EMPLOYEE_ID', 'X')
|
||||
RTFId = EndpointSegment
|
||||
If Error_Services('NoError') AND RTFId NE '' then
|
||||
RTFJson = Return_To_Fab_Services('CreateReturnToFabReportJson', True$)
|
||||
If Error_Services('NoError') then
|
||||
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
|
||||
HTTP_Services('SetResponseBody', RTFJson, False$, 'application/hal+json')
|
||||
If Assigned(Message) then
|
||||
HTTP_Services('SetResponseStatus', 201, Message)
|
||||
end else
|
||||
HTTP_Services('SetResponseStatus', 201)
|
||||
end
|
||||
end else
|
||||
|
||||
end
|
||||
|
||||
end else
|
||||
HTTP_Services('SetResponseStatus', 400, Error_Services('GetMessage'))
|
||||
end
|
||||
end else
|
||||
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
|
||||
end
|
||||
|
||||
end api
|
||||
|
||||
|
||||
API returntofab.reportallforms.HEAD
|
||||
API returntofab.reportallforms.GET
|
||||
|
||||
OIWizardID = ''
|
||||
Cookies = HTTP_Services('GetHTTPCookie')
|
||||
For each Cookie in Cookies using ';'
|
||||
Key = Field(Cookie, '=', 1)
|
||||
If Key EQ 'sessionID' then
|
||||
OIWizardID = Field(Cookie, '=', 2)
|
||||
end
|
||||
Next Cookie
|
||||
|
||||
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
|
||||
|
||||
If ValidSession then
|
||||
UserId = Xlate('OI_WIZARD', OIWizardID, 'EMPLOYEE_ID', 'X')
|
||||
RTFId = EndpointSegment
|
||||
If Error_Services('NoError') AND RTFId NE '' then
|
||||
RTFJson = Return_To_Fab_Services('CreateReturnToFabReportJson', False$)
|
||||
If Error_Services('NoError') then
|
||||
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
|
||||
HTTP_Services('SetResponseBody', RTFJson, False$, 'application/hal+json')
|
||||
If Assigned(Message) then
|
||||
HTTP_Services('SetResponseStatus', 201, Message)
|
||||
end else
|
||||
HTTP_Services('SetResponseStatus', 201)
|
||||
end
|
||||
end else
|
||||
|
||||
end
|
||||
|
||||
end else
|
||||
HTTP_Services('SetResponseStatus', 400, Error_Services('GetMessage'))
|
||||
end
|
||||
end else
|
||||
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
|
||||
end
|
||||
|
||||
end api
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// CreateResultOptionCollection
|
||||
//
|
||||
|
@ -179,7 +179,7 @@ Service ConvertReturnToFabRecordToJSON(RTFId)
|
||||
SRP_JSON(objRTF, 'SetValue', 'RequestorUserId', RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>)
|
||||
SRP_JSON(objRTF, 'SetValue', 'StartDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_START_DTM$>, 'DT'))
|
||||
SRP_JSON(objRTF, 'SetValue', 'MHInitUserId', RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_USER_ID$>)
|
||||
SRP_JSON(objRTF, 'SetValue', 'MHInitDtm', RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_DTM$>)
|
||||
SRP_JSON(objRTF, 'SetValue', 'MHInitDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_DTM$>, 'DT'))
|
||||
SRP_JSON(objRTF, 'SetValue', 'EvalUserId', RTFRecord<RETURN_TO_FAB_LOTS_EVAL_USER_ID$>)
|
||||
SRP_JSON(objRTF, 'SetValue', 'EvalResultId', RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$>, 'Number')
|
||||
if RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$> NE '' then
|
||||
@ -190,9 +190,9 @@ Service ConvertReturnToFabRecordToJSON(RTFId)
|
||||
SRP_JSON(objRTF, 'SetValue', 'EvalDesc', EvaluationDescription)
|
||||
SRP_JSON(objRTF, 'SetValue', 'EvalDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_EVAL_DTM$>, 'DT'))
|
||||
SRP_JSON(objRTF, 'SetValue', 'FinalCompleteUserId', RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_USER_ID$>)
|
||||
SRP_JSON(objRTF, 'SetValue', 'FinalCompleteDtm', RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_DTM$>)
|
||||
SRP_JSON(objRTF, 'SetValue', 'FinalCompleteDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_DTM$>, 'DT'))
|
||||
SRP_JSON(objRTF, 'SetValue', 'Completed', RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>, 'Boolean')
|
||||
SRP_JSON(objRTF, 'SetValue', 'CompletedDtm', RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$>)
|
||||
SRP_JSON(objRTF, 'SetValue', 'CompletedDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$>,'DT'))
|
||||
SRP_JSON(objRTF, 'SetValue', 'Reason', RTFRecord<RETURN_TO_FAB_LOTS_REASON$>)
|
||||
Notes = RTFRecord<RETURN_TO_FAB_LOTS_NOTES$>
|
||||
NotesUser = RTFRecord<RETURN_TO_FAB_LOTS_NOTES_USER$>
|
||||
@ -228,6 +228,55 @@ Service ConvertReturnToFabRecordToJSON(RTFId)
|
||||
Response = JsonString
|
||||
end service
|
||||
|
||||
Service CreateReturnToFabReportJson(ShowOpenReport)
|
||||
ErrorMessage = ''
|
||||
JsonString = ''
|
||||
objJSON = ''
|
||||
Begin Case
|
||||
Case ShowOpenReport
|
||||
RTFIdList = Return_To_Fab_Services('GetAllReturnToFabRecords', True$)
|
||||
Case Otherwise$
|
||||
RTFIdList = Return_To_Fab_Services('GetAllReturnToFabRecords', False$)
|
||||
End Case
|
||||
If SRP_JSON(objJSON, 'New', 'Object') then
|
||||
If SRP_Json(objReturnToFabReport, 'New', 'Array') then
|
||||
for each RTFId in RTFIdList using @VM
|
||||
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
|
||||
If Error_Services('NoError') and RTFRecord NE '' then
|
||||
hRTFJsonSingle = ''
|
||||
if SRP_Json(hRTFJsonSingle, 'New', 'Object') then
|
||||
SRP_JSON(hRTFJsonSingle, 'SetValue', 'ReturnToFabLotsId', RTFId)
|
||||
SRP_JSON(hRTFJsonSingle, 'SetValue', 'CassId', RTFRecord<RETURN_TO_FAB_LOTS_CASS_ID$>)
|
||||
SRP_JSON(hRTFJsonSingle, 'SetValue', 'LotType', RTFRecord<RETURN_TO_FAB_LOTS_LOT_TYPE$>)
|
||||
SRP_JSON(hRTFJsonSingle, 'SetValue', 'RequestorUserId', RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>)
|
||||
SRP_JSON(hRTFJsonSingle, 'SetValue', 'StartDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_START_DTM$>, 'DT'))
|
||||
if RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$> NE '' then
|
||||
EvaluationDescription = Database_Services('ReadDataColumn', 'RETURN_TO_FAB_RESULT_OPTION', RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$>, RETURN_TO_FAB_RESULT_OPTION_RESULT$, True$, 0, False$)
|
||||
end else
|
||||
EvaluationDescription = ''
|
||||
end
|
||||
SRP_JSON(hRTFJsonSingle, 'SetValue', 'EvalDesc', EvaluationDescription)
|
||||
SRP_JSON(hRTFJsonSingle, 'SetValue', 'FinalCompleteDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_DTM$>, 'DT'))
|
||||
SRP_JSON(hRTFJsonSingle, 'SetValue', 'Completed', RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>, 'Boolean')
|
||||
SRP_JSON(hRTFJsonSingle, 'SetValue', 'CompletedDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$>,'DT'))
|
||||
SRP_Json(objReturnToFabReport, 'Add', hRTFJsonSingle)
|
||||
SRP_Json(hRTFJsonSingle, 'Release')
|
||||
end
|
||||
end else
|
||||
Error_Services('Clear')
|
||||
end
|
||||
Next RTFId
|
||||
SRP_JSON(objJSON, 'Set', 'ReturnToFabReport', objReturnToFabReport)
|
||||
SRP_JSON(objReturnToFabReport, 'Release')
|
||||
end
|
||||
JsonString = SRP_JSON(objJSON, 'Stringify', 'Styled')
|
||||
SRP_JSON(objJSON, 'Release')
|
||||
end else
|
||||
ErrorMessage = 'Error creating root JSON object.'
|
||||
end
|
||||
Response = JsonString
|
||||
end service
|
||||
|
||||
Service GetReturnToFabRecordIdByCassId(CassId)
|
||||
ErrorMessage = ''
|
||||
RTFRecords = ''
|
||||
@ -252,6 +301,29 @@ Service GetReturnToFabRecordIdByCassId(CassId)
|
||||
end
|
||||
End Service
|
||||
|
||||
Service GetAllReturnToFabRecords(ShowOnlyOpen)
|
||||
ErrorMessage = ''
|
||||
RTFRecords = ''
|
||||
table = "RETURN_TO_FAB_LOTS"
|
||||
Open "DICT ":table To @DICT Else
|
||||
ErrorMessage = 'Error opening RETURN_TO_FAB_LOTS dictionary'
|
||||
End
|
||||
If ErrorMessage EQ '' then
|
||||
srch_strng = "CASS_ID":@VM:"#NULL":@FM
|
||||
if ShowOnlyOpen then
|
||||
srch_strng := "COMPLETED":@VM:"#1":@FM
|
||||
end
|
||||
option = ""
|
||||
flag = ""
|
||||
Btree.Extract(srch_strng, table, @DICT, RTFRecords, option, flag)
|
||||
end
|
||||
If ErrorMessage EQ '' then
|
||||
Response = RTFRecords
|
||||
end else
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
end service
|
||||
|
||||
Service GetOpenReturnToFabRecordIdByCassId(CassId)
|
||||
ErrorMessage = ''
|
||||
OpenRTFRecords = ''
|
||||
@ -381,6 +453,57 @@ Service SetBinToBin(RTFId, MHUserId)
|
||||
end
|
||||
end service
|
||||
|
||||
Service SetRTFCompleted(RTFId, CompleteUserId)
|
||||
ErrorMessage = ''
|
||||
If RTFId NE '' then
|
||||
If RowExists('RETURN_TO_FAB_LOTS', RTFId) then
|
||||
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
|
||||
RTFRecordComplete = RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>
|
||||
If RTFRecordComplete NE True$ then
|
||||
If CompleteUserId NE '' then
|
||||
If RowExists('LSL_USERS', CompleteUserId) then
|
||||
RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$> = True$
|
||||
RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$> = Datetime()
|
||||
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
|
||||
If Error_Services('HasError') then
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Error setting Return To Fab form as complete. User ID was not found in OpenInsight.'
|
||||
end
|
||||
|
||||
end else
|
||||
ErrorMessage = 'Error setting Return To Fab form as complete. User ID was null.'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Error setting Return To Fab form as complete. Return to fab record has already been completed.'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Error setting Return To Fab form as complete. Return to fab record did not exists'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Error setting Return To Fab form as complete. Return to fab record id was null'
|
||||
end
|
||||
If ErrorMessage EQ '' then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = CompleteUserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = 'Successfully set bin to bin complete on RETURN_TO_FAB_LOTS record'
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = CompleteUserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
end service
|
||||
|
||||
Service SetEvalInfo(RTFId, EvalUserId, ResultId)
|
||||
ErrorMessage = ''
|
||||
If RTFId NE '' then
|
||||
@ -453,8 +576,8 @@ Service SetFinalBinToBin(RTFId, MHUserId)
|
||||
If RowExists('LSL_USERS', MHUserId) then
|
||||
RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_USER_ID$> = MHUserId
|
||||
RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_DTM$> = Datetime()
|
||||
RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$> = True$
|
||||
RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$> = Datetime()
|
||||
* RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$> = True$
|
||||
* RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$> = Datetime()
|
||||
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
|
||||
If Error_Services('HasError') then
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
|
Loading…
x
Reference in New Issue
Block a user