fixed material track report, Mona_Services HTTP call, and COC file generation
This commit is contained in:
committed by
Infineon\StieberD
parent
7762b129af
commit
a8a9e91d04
@ -1,106 +1,106 @@
|
||||
Function Reactorloadings_API(@API)
|
||||
/***********************************************************************************************************************
|
||||
|
||||
This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
|
||||
permission from SRP Computer Solutions, Inc.
|
||||
|
||||
Name : Reactorloadings_API
|
||||
|
||||
Description : API logic for the Reactorloadings resource.
|
||||
|
||||
Notes : All web APIs should include the API_SETUP insert. This will provide several useful variables:
|
||||
|
||||
HTTPMethod - The HTTP Method (Verb) submitted by the client (e.g., GET, POST, etc.)
|
||||
APIURL - The URL for the API entry point (e.g., api.mysite.com/v1).
|
||||
FullEndpointURL - The URL submitted by the client, including query params.
|
||||
FullEndpointURLNoQuery - The URL submitted by the client, excluding query params.
|
||||
EndpointSegment - The URL endpoint segment.
|
||||
ParentURL - The URL path preceeding the current endpoint.
|
||||
CurrentAPI - The name of this stored procedure.
|
||||
|
||||
Parameters :
|
||||
API [in] -- Web API to process. Format is [APIPattern].[HTTPMethod]:
|
||||
- APIPattern must follow this structure Reactorloadings[.ID.[<Property>]]
|
||||
- HTTPMethod can be any valid HTTP method, e.g., GET, POST, PUT, DELETE, etc.
|
||||
Examples:
|
||||
- Reactorloadings.POST
|
||||
- Reactorloadings.ID.PUT
|
||||
- Reactorloadings.ID.firstName.GET
|
||||
Response [out] -- Response to be sent back to the Controller (HTTP_MCP) or requesting procedure. Web API
|
||||
services do not rely upon anything being returned in the response. This is what the
|
||||
various services like SetResponseBody and SetResponseStatus services are for. A response
|
||||
value is only helpful if the developers want to use it for debug purposes.
|
||||
|
||||
History : (Date, Initials, Notes)
|
||||
05/22/24 xxx Original programmer.
|
||||
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#pragma precomp SRP_PreCompiler
|
||||
|
||||
Declare function Oi_Wizard_Services, Memberof, Oi_Wizard_Services
|
||||
Declare subroutine Reactor_Services, Oi_Wizard_Services
|
||||
|
||||
$insert APP_INSERTS
|
||||
$insert API_SETUP
|
||||
$insert HTTP_INSERTS
|
||||
|
||||
GoToAPI else
|
||||
// The specific resource endpoint doesn't have a API handler yet.
|
||||
HTTP_Services('SetResponseStatus', 204, 'This is a valid endpoint but a web API handler has not yet been created.')
|
||||
end
|
||||
|
||||
Return Response OR ''
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Endpoint Handlers
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
API reactorloadings.POST
|
||||
OIWizardID = ''
|
||||
CurrUser = ''
|
||||
Cookies = HTTP_Services('GetHTTPCookie')
|
||||
For each Cookie in Cookies using ';'
|
||||
Key = Trim(Field(Cookie, '=', 1))
|
||||
If Key EQ 'sessionID' then
|
||||
OIWizardID = Field(Cookie, '=', 2)
|
||||
end
|
||||
Next Cookie
|
||||
|
||||
If OIWizardID NE '' then
|
||||
// Call validate session to extend session expiry
|
||||
OI_Wizard_Services('ValidateSession', OIWizardID)
|
||||
CurrUser = Xlate('OI_WIZARD', OIWizardID, 'EMPLOYEE_ID', 'X')
|
||||
end
|
||||
|
||||
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
|
||||
|
||||
If ValidSession then
|
||||
If Memberof(CurrUser, 'OI_ADMIN') OR Memberof(CurrUser, 'LEAD') OR Memberof(CurrUser, 'SUPERVISOR') then
|
||||
Body = HTTP_Services('GetHTTPPostString', True$)
|
||||
// The POST string will have been encoded so use percent (URL) decoding.
|
||||
DecodedJSON = HTTP_Services('DecodePercentString', Body)
|
||||
If SRP_JSON(objBody, 'Parse', Body) EQ '' then
|
||||
rdsNo = SRP_JSON(objBody, 'GetValue', 'rdsNo')
|
||||
reactorNo = SRP_JSON(objBody, 'GetValue', 'reactorNo')
|
||||
SRP_JSON(objBody, 'Release')
|
||||
end
|
||||
|
||||
Reactor_Services('RemoveRDSFromReactorLoad', rdsNo, reactorNo, CurrUser)
|
||||
If Error_Services('NoError') then
|
||||
HTTP_Services('SetResponseStatus', 200, 'RDS Successfully removed.')
|
||||
end else
|
||||
ErrCode = Error_Services('GetMessage')
|
||||
HTTP_Services('SetResponseStatus', 500, ErrCode)
|
||||
end
|
||||
end else
|
||||
HTTP_Services('SetResponseStatus', 503, 'User is not authorized!')
|
||||
end
|
||||
End else
|
||||
HTTP_Services('SetResponseStatus', 401, 'User must be signed in to access this resource.')
|
||||
end
|
||||
|
||||
end api
|
||||
|
||||
Function Reactorloadings_API(@API)
|
||||
/***********************************************************************************************************************
|
||||
|
||||
This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
|
||||
permission from SRP Computer Solutions, Inc.
|
||||
|
||||
Name : Reactorloadings_API
|
||||
|
||||
Description : API logic for the Reactorloadings resource.
|
||||
|
||||
Notes : All web APIs should include the API_SETUP insert. This will provide several useful variables:
|
||||
|
||||
HTTPMethod - The HTTP Method (Verb) submitted by the client (e.g., GET, POST, etc.)
|
||||
APIURL - The URL for the API entry point (e.g., api.mysite.com/v1).
|
||||
FullEndpointURL - The URL submitted by the client, including query params.
|
||||
FullEndpointURLNoQuery - The URL submitted by the client, excluding query params.
|
||||
EndpointSegment - The URL endpoint segment.
|
||||
ParentURL - The URL path preceeding the current endpoint.
|
||||
CurrentAPI - The name of this stored procedure.
|
||||
|
||||
Parameters :
|
||||
API [in] -- Web API to process. Format is [APIPattern].[HTTPMethod]:
|
||||
- APIPattern must follow this structure Reactorloadings[.ID.[<Property>]]
|
||||
- HTTPMethod can be any valid HTTP method, e.g., GET, POST, PUT, DELETE, etc.
|
||||
Examples:
|
||||
- Reactorloadings.POST
|
||||
- Reactorloadings.ID.PUT
|
||||
- Reactorloadings.ID.firstName.GET
|
||||
Response [out] -- Response to be sent back to the Controller (HTTP_MCP) or requesting procedure. Web API
|
||||
services do not rely upon anything being returned in the response. This is what the
|
||||
various services like SetResponseBody and SetResponseStatus services are for. A response
|
||||
value is only helpful if the developers want to use it for debug purposes.
|
||||
|
||||
History : (Date, Initials, Notes)
|
||||
05/22/24 xxx Original programmer.
|
||||
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#pragma precomp SRP_PreCompiler
|
||||
|
||||
Declare function Oi_Wizard_Services, Memberof, Oi_Wizard_Services
|
||||
Declare subroutine Reactor_Services, Oi_Wizard_Services
|
||||
|
||||
$insert APP_INSERTS
|
||||
$insert API_SETUP
|
||||
$insert HTTP_INSERTS
|
||||
|
||||
GoToAPI else
|
||||
// The specific resource endpoint doesn't have a API handler yet.
|
||||
HTTP_Services('SetResponseStatus', 204, 'This is a valid endpoint but a web API handler has not yet been created.')
|
||||
end
|
||||
|
||||
Return Response OR ''
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Endpoint Handlers
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
API reactorloadings.POST
|
||||
OIWizardID = ''
|
||||
CurrUser = ''
|
||||
Cookies = HTTP_Services('GetHTTPCookie')
|
||||
For each Cookie in Cookies using ';'
|
||||
Key = Trim(Field(Cookie, '=', 1))
|
||||
If Key EQ 'sessionID' then
|
||||
OIWizardID = Field(Cookie, '=', 2)
|
||||
end
|
||||
Next Cookie
|
||||
|
||||
If OIWizardID NE '' then
|
||||
// Call validate session to extend session expiry
|
||||
OI_Wizard_Services('ValidateSession', OIWizardID)
|
||||
CurrUser = Xlate('OI_WIZARD', OIWizardID, 'EMPLOYEE_ID', 'X')
|
||||
end
|
||||
|
||||
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
|
||||
|
||||
If ValidSession then
|
||||
If Memberof(CurrUser, 'OI_ADMIN') OR Memberof(CurrUser, 'LEAD') OR Memberof(CurrUser, 'SUPERVISOR') then
|
||||
Body = HTTP_Services('GetHTTPPostString', True$)
|
||||
// The POST string will have been encoded so use percent (URL) decoding.
|
||||
DecodedJSON = HTTP_Services('DecodePercentString', Body)
|
||||
If SRP_JSON(objBody, 'Parse', Body) EQ '' then
|
||||
rdsNo = SRP_JSON(objBody, 'GetValue', 'rdsNo')
|
||||
reactorNo = SRP_JSON(objBody, 'GetValue', 'reactorNo')
|
||||
SRP_JSON(objBody, 'Release')
|
||||
end
|
||||
|
||||
Reactor_Services('RemoveRDSFromReactorLoad', rdsNo, reactorNo, CurrUser)
|
||||
If Error_Services('NoError') then
|
||||
HTTP_Services('SetResponseStatus', 200, 'RDS Successfully removed.')
|
||||
end else
|
||||
ErrCode = Error_Services('GetMessage')
|
||||
HTTP_Services('SetResponseStatus', 500, ErrCode)
|
||||
end
|
||||
end else
|
||||
HTTP_Services('SetResponseStatus', 503, 'User is not authorized!')
|
||||
end
|
||||
End else
|
||||
HTTP_Services('SetResponseStatus', 401, 'User must be signed in to access this resource.')
|
||||
end
|
||||
|
||||
end api
|
||||
|
||||
|
Reference in New Issue
Block a user