Merged PR 21598: Refactored receive and release codebase.
Refactored receive and release codebase. bug fixes and performance improvements modified WO_REC form to use the same receive and same release dtm for all cassettes released in a given batch Related work items: #259878
This commit is contained in:
@ -174,36 +174,40 @@ Service ProcessProcedureQueue()
|
||||
ServerPort = Environment_Services('GetServiceManagerPort')
|
||||
Convert '\' to '' in ServerIP
|
||||
|
||||
Open 'PROC_QUEUE2' to hProcQueue then
|
||||
Select hProcQueue
|
||||
EOF = False$
|
||||
Loop
|
||||
ReadNext RequestKeyID else EOF = True$
|
||||
Until EOF
|
||||
SendRequest = True$
|
||||
Read RequestRec from hProcQueue, RequestKeyID then
|
||||
InQueue = RequestRec<PROC_QUEUE.IN_QUEUE$>
|
||||
If InQueue then
|
||||
QueuedDtm = RequestRec<PROC_QUEUE.QUEUED_DTM$>
|
||||
If QueuedDtm GT SRP_Datetime('AddMinutes', Datetime(), -10) then
|
||||
SendRequest = False$
|
||||
end
|
||||
end
|
||||
end
|
||||
If SendRequest then
|
||||
TcpClientHandle = 0
|
||||
If SRP_TcpClient(TcpClientHandle, 'CONNECT', ServerIP, ServerPort) then
|
||||
RequestRec<PROC_QUEUE.IN_QUEUE$> = True$
|
||||
RequestRec<PROC_QUEUE.QUEUED_DTM$> = Datetime()
|
||||
Write RequestRec on hProcQueue, RequestKeyID then
|
||||
Command = 'RUN SERVICE_SERVICES "ProcessRequest", ':Quote(RequestKeyID)
|
||||
SRP_TcpClient(TcpClientHandle, 'SEND_SES', Command)
|
||||
end
|
||||
SRP_TcpClient(TcpClientHandle, 'CLOSE_SES')
|
||||
end
|
||||
end
|
||||
Repeat
|
||||
ErrCode = ''
|
||||
RList('SELECT PROC_QUEUE2 BY ENTRY_DTM', TARGET_ACTIVELIST$, '', '', '')
|
||||
If Not(Get_Status(ErrCode)) then
|
||||
Open 'PROC_QUEUE2' to hProcQueue then
|
||||
EOF = False$
|
||||
Loop
|
||||
ReadNext RequestKeyID else EOF = True$
|
||||
Until EOF
|
||||
SendRequest = True$
|
||||
Read RequestRec from hProcQueue, RequestKeyID then
|
||||
InQueue = RequestRec<PROC_QUEUE.IN_QUEUE$>
|
||||
If InQueue then
|
||||
QueuedDtm = RequestRec<PROC_QUEUE.QUEUED_DTM$>
|
||||
If QueuedDtm GT SRP_Datetime('AddMinutes', Datetime(), -10) then
|
||||
SendRequest = False$
|
||||
end
|
||||
end
|
||||
end
|
||||
If SendRequest then
|
||||
TcpClientHandle = 0
|
||||
If SRP_TcpClient(TcpClientHandle, 'CONNECT', ServerIP, ServerPort) then
|
||||
RequestRec<PROC_QUEUE.IN_QUEUE$> = True$
|
||||
RequestRec<PROC_QUEUE.QUEUED_DTM$> = Datetime()
|
||||
Write RequestRec on hProcQueue, RequestKeyID then
|
||||
Command = 'RUN SERVICE_SERVICES "ProcessRequest", ':Quote(RequestKeyID)
|
||||
SRP_TcpClient(TcpClientHandle, 'SEND_SES', Command)
|
||||
end
|
||||
SRP_TcpClient(TcpClientHandle, 'CLOSE_SES')
|
||||
end
|
||||
end
|
||||
Repeat
|
||||
end
|
||||
end
|
||||
|
||||
Unlock hSysLists, ServiceKeyID else Null
|
||||
end
|
||||
|
||||
@ -338,10 +342,9 @@ Service ProcessRequest(RequestKeyID)
|
||||
end service
|
||||
|
||||
|
||||
Service PostProcedure(ProcedureName, Params, Critical=BOOLEAN)
|
||||
Service PostProcedure(ProcedureName, Params)
|
||||
|
||||
If Critical EQ '' then Critical = True$
|
||||
PostToQueue = True$
|
||||
ErrorMsg = ''
|
||||
If (ProcedureName NE '') then
|
||||
RequestKeyID = RTI_CreateGUID()
|
||||
RequestRow = ''
|
||||
@ -350,8 +353,18 @@ Service PostProcedure(ProcedureName, Params, Critical=BOOLEAN)
|
||||
RequestRow<PROC_QUEUE.ENTRY_DTM$> = Datetime()
|
||||
RequestRow<PROC_QUEUE.IN_QUEUE$> = False$
|
||||
Database_Services('WriteDataRow', 'PROC_QUEUE2', RequestKeyID, RequestRow, True$, False$, False$)
|
||||
If Error_Services('NoError') then
|
||||
Response = RequestKeyId
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Error message: ':Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Null ProcedureName passed in.')
|
||||
ErrorMsg = 'Error in ':Service:' service. Null ProcedureName passed in.'
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
Error_Services('Add', ErrorMsg)
|
||||
Response = False$
|
||||
end
|
||||
|
||||
return
|
||||
|
Reference in New Issue
Block a user