added services and triggers to manually add index transactions to keep indexes up-to-date
This commit is contained in:
committed by
Stieber Daniel (CSC FI SPS MESLEO)
parent
71daf317f0
commit
c89bb6b3d4
@ -903,6 +903,10 @@ WRITE_RECORD:
|
||||
Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateScrappedQty':SD$:WONo)
|
||||
end
|
||||
|
||||
If {WO} NE '' then Service_Services('PostProcedure', 'RDS_SERVICES', 'VerifyWOLogRDSKeyIndex':SD$:Name)
|
||||
If {WO_MAT_KEY} NE '' then Service_Services('PostProcedure', 'RDS_SERVICES', 'VerifyWOMatRDSNoIndex':SD$:Name)
|
||||
If {WO_STEP_KEY} NE '' then Service_Services('PostProcedure', 'RDS_SERVICES', 'VerifyWOStepRDSKeyIndex':SD$:Name)
|
||||
|
||||
EndTick = GetTickCount()
|
||||
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
|
||||
|
||||
|
@ -2064,6 +2064,219 @@ Service GetRDSKeys(WONo)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service VerifyWOMatRDSNoIndex(RDSNo)
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\RDS'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS WO_MAT{RDS_NO} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOMatKey':@FM:'Result'
|
||||
objVerifyRDSNoLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = RDSNo
|
||||
LogData<4> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
|
||||
ErrorMsg = ''
|
||||
If RDSNo NE '' then
|
||||
If RowExists('RDS', RDSNo) then
|
||||
WOMatKey = Xlate('RDS', RDSNo, 'WO_MAT_KEY', 'X')
|
||||
If WOMatKey NE '' then
|
||||
WOMatRDSNo = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
|
||||
LogData<3> = WOMatKey
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
If WOMatRDSNo EQ '' then
|
||||
LogData<4> = 'RDSNo missing from WO_MAT record. Generating index transaction.'
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
// Add index transaction to update RDS_NO relational index (target WO_MAT table)
|
||||
IndexTransactionRow = 'WO_MAT*RDS_NO*AR':@FM:RDSNo:@FM:"":@FM:WOMatKey:@FM
|
||||
Open "!RDS" to BangTable then
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
end else
|
||||
ErrorMsg = 'Unable to write index transaction to !RDS. ':RDSNo
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end else
|
||||
ErrorMsg = 'Unable to Lock !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end else
|
||||
LogData<4> = 'Index ok. RDSNo not missing from WO_MAT record.'
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
end
|
||||
end else
|
||||
LogData<4> = 'WO_MAT key for RDS ':RDSNo:' is null. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<4> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
LogData<4> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
|
||||
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service VerifyWOStepRDSKeyIndex(RDSNo)
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\RDS'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS WO_STEP{RDS_KEY} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOStep':@FM:'Result'
|
||||
objVerifyRDSKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = RDSNo
|
||||
LogData<4> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
|
||||
ErrorMsg = ''
|
||||
If RDSNo NE '' then
|
||||
If RowExists('RDS', RDSNo) then
|
||||
WOStepKey = Xlate('RDS', RDSNo, 'WO_STEP_KEY', 'X')
|
||||
If WOStepKey NE '' then
|
||||
WOStepRDSKeys = Xlate('WO_STEP', WOStepKey, 'RDS_KEY', 'X')
|
||||
LogData<3> = WOStepKey
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
Locate RDSNo in WOStepRDSKeys using @VM setting vPos then
|
||||
LogData<4> = 'Index ok. RDSNo not missing from WO_STEP record.'
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
end else
|
||||
LogData<4> = 'RDSNo missing from WO_STEP record. Generating index transaction.'
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
// Add index transaction to update RDS_KEY relational index (target WO_STEP table)
|
||||
IndexTransactionRow = 'WO_STEP*RDS_KEY*AR':@FM:RDSNo:@FM:"":@FM:WOStepKey:@FM
|
||||
Open "!RDS" to BangTable then
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
end else
|
||||
ErrorMsg = 'Unable to write index transaction to !RDS. ':RDSNo
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end else
|
||||
ErrorMsg = 'Unable to Lock !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end
|
||||
end else
|
||||
LogData<4> = 'WO_STEP key for RDS ':RDSNo:' is null. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<4> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
LogData<4> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
|
||||
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service VerifyWOLogRDSKeyIndex(RDSNo)
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\RDS'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS RDS{WO} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOStep':@FM:'Result'
|
||||
objVerifyRDSWoIndexLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = RDSNo
|
||||
LogData<4> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
|
||||
ErrorMsg = ''
|
||||
If RDSNo NE '' then
|
||||
If RowExists('RDS', RDSNo) then
|
||||
WONo = Xlate('RDS', RDSNo, 'WO', 'X')
|
||||
If WONo NE '' then
|
||||
WOLogRDSKeys = ''
|
||||
Extract_Si_Keys('RDS', 'WO', WONo, WOLogRDSKeys)
|
||||
LogData<3> = WONo
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
Locate RDSNo in WOLogRDSKeys using @VM setting vPos then
|
||||
LogData<4> = 'Index ok. RDSNo not missing from Btree index.'
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
end else
|
||||
LogData<4> = 'RDSNo missing from Btree index. Generating index transaction.'
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
// Add index transaction to update RDS_KEY relational index (target WO_STEP table)
|
||||
IndexTransactionRow = 'WO':@FM:RDSNo:@FM:"":@FM:WONo:@FM
|
||||
Open "!RDS" to BangTable then
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !RDS. ':RDSNo
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to Lock !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end
|
||||
end else
|
||||
LogData<4> = 'WONo for RDS ':RDSNo:' is null. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Null RDSNo passed in.'
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<4> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
LogData<4> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
|
||||
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
||||
|
||||
end service
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal GoSubs
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -279,55 +279,61 @@ Event PUB_SIGN.CLICK()
|
||||
ReactorType = XLATE('RDS',RDSNo,'REACTOR_TYPE','X')
|
||||
ErrMsg = ''
|
||||
If Len(ReactorType) GE 3 and ReactorType[1, 3] _EQC 'HTR' then
|
||||
WoMatKey = WONo:'*':CassNo
|
||||
IsLastCassetteInWo = WO_MAT_Services('CassetteIsLastInWo', WoMatKey)
|
||||
If Error_Services('NoError') then
|
||||
If IsLastCassetteInWo then
|
||||
NextEventScheduled = False$
|
||||
NextEventHasSamePsn = True$
|
||||
NextEventIsBlock = False$
|
||||
|
||||
NextScheduledEvent = Schedule_Services('GetNextEvent', Reactor)
|
||||
If Error_Services('NoError') then
|
||||
NextEventScheduled = True$
|
||||
|
||||
NextEventHasSamePsn = Schedule_Services('NextEventIsSamePsn', Reactor)
|
||||
NextEventIsBlock = Schedule_Services('NextEventIsBlock', Reactor)
|
||||
end
|
||||
|
||||
If NextEventScheduled EQ False$ or NextEventHasSamePsn EQ False$ or NextEventIsBlock EQ True$ then
|
||||
WoMatRecord = Database_Services('ReadDataRow', 'WO_MAT', WoMatKey)
|
||||
WoMatRecord<WO_MAT_LAST_CASSETTE_TEST_WAFER_ACK_REQ$> = True$
|
||||
|
||||
TestWaferRanSinceLoad = WoMatRecord<WO_MAT_LAST_CASSETTE_TEST_WAFER_RAN$>
|
||||
|
||||
If TestWaferRanSinceLoad NE True$ then
|
||||
TestWaferRanSinceLoad = Rds_Services('TestWaferRanAfterLoad', RDSNo)
|
||||
WoMatRecord<WO_MAT_LAST_CASSETTE_TEST_WAFER_RAN$> = TestWaferRanSinceLoad
|
||||
|
||||
If TestWaferRanSinceLoad NE True$ then
|
||||
Message = ''
|
||||
If NextEventScheduled EQ False$ or NextEventIsBlock EQ True$ then
|
||||
Message = 'No material scheduled. Test wafer required.'
|
||||
end else if NextEventHasSamePsn EQ False$ then
|
||||
Message = 'Next work order is a NEW PSN number. Test wafer required.'
|
||||
end
|
||||
|
||||
Message_Box(@Window, Message, "Test Wafer Required", MSG_BTN_OK$ + MSG_ICON_EXCLAM$)
|
||||
|
||||
TWLogResult = Dialog_Box('NDW_LOG_TEST_WAFER_USAGE', @Window, RDSNo : @VM : '' : @VM : 'REACTOR' : @VM : Reactor)
|
||||
|
||||
WoMatRecord<WO_MAT_LAST_CASSETTE_TEST_WAFER_RAN$> = TWLogResult
|
||||
|
||||
If TWLogResult NE True$ then
|
||||
ErrMsg = 'Unload blocked! You must run a test wafer before signing the unload'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Database_Services('WriteDataRow', 'WO_MAT', WoMatKey, WoMatRecord, True$, False$, False$)
|
||||
end
|
||||
end
|
||||
If ( (WONo NE '') and (CassNo NE '') ) then
|
||||
WoMatKey = WONo:'*':CassNo
|
||||
If RowExists('WO_MAT', WOMatKey) then
|
||||
IsLastCassetteInWo = WO_MAT_Services('CassetteIsLastInWo', WoMatKey)
|
||||
If Error_Services('NoError') then
|
||||
If IsLastCassetteInWo then
|
||||
NextEventScheduled = False$
|
||||
NextEventHasSamePsn = True$
|
||||
NextEventIsBlock = False$
|
||||
NextScheduledEvent = Schedule_Services('GetNextEvent', Reactor)
|
||||
If Error_Services('NoError') then
|
||||
NextEventScheduled = True$
|
||||
NextEventHasSamePsn = Schedule_Services('NextEventIsSamePsn', Reactor)
|
||||
NextEventIsBlock = Schedule_Services('NextEventIsBlock', Reactor)
|
||||
end
|
||||
If NextEventScheduled EQ False$ or NextEventHasSamePsn EQ False$ or NextEventIsBlock EQ True$ then
|
||||
WoMatRecord = Database_Services('ReadDataRow', 'WO_MAT', WoMatKey)
|
||||
If Error_Services('NoError') then
|
||||
If WOMatRecord NE '' then
|
||||
WoMatRecord<WO_MAT_LAST_CASSETTE_TEST_WAFER_ACK_REQ$> = True$
|
||||
TestWaferRanSinceLoad = WoMatRecord<WO_MAT_LAST_CASSETTE_TEST_WAFER_RAN$>
|
||||
If TestWaferRanSinceLoad NE True$ then
|
||||
TestWaferRanSinceLoad = Rds_Services('TestWaferRanAfterLoad', RDSNo)
|
||||
WoMatRecord<WO_MAT_LAST_CASSETTE_TEST_WAFER_RAN$> = TestWaferRanSinceLoad
|
||||
If TestWaferRanSinceLoad NE True$ then
|
||||
Message = ''
|
||||
If NextEventScheduled EQ False$ or NextEventIsBlock EQ True$ then
|
||||
Message = 'No material scheduled. Test wafer required.'
|
||||
end else if NextEventHasSamePsn EQ False$ then
|
||||
Message = 'Next work order is a NEW PSN number. Test wafer required.'
|
||||
end
|
||||
Message_Box(@Window, Message, "Test Wafer Required", MSG_BTN_OK$ + MSG_ICON_EXCLAM$)
|
||||
TWLogResult = Dialog_Box('NDW_LOG_TEST_WAFER_USAGE', @Window, RDSNo : @VM : '' : @VM : 'REACTOR' : @VM : Reactor)
|
||||
WoMatRecord<WO_MAT_LAST_CASSETTE_TEST_WAFER_RAN$> = TWLogResult
|
||||
If TWLogResult NE True$ then
|
||||
ErrMsg = 'Unload blocked! You must run a test wafer before signing the unload'
|
||||
end
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrMsg = 'WO_MAT record for ':WOMatKey:' is null!'
|
||||
end
|
||||
end else
|
||||
ErrMsg = Error_Services('GetMessage')
|
||||
end
|
||||
end
|
||||
Database_Services('WriteDataRow', 'WO_MAT', WoMatKey, WoMatRecord, True$, False$, False$)
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrMsg = 'WO_MAT ':WOMatKey:' does not exist!'
|
||||
end
|
||||
end else
|
||||
ErrMsg = 'Null WONo or null CassNo!'
|
||||
end
|
||||
end
|
||||
|
||||
If ErrMsg NE '' then
|
||||
@ -462,7 +468,3 @@ Setup_OLE_Controls:
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -285,16 +285,15 @@ WRITE_RECORD_PRE:
|
||||
end else
|
||||
CriticalFieldName = 'Error determining field name'
|
||||
end
|
||||
Record<CriticalField> = OrigRecord<CriticalField>
|
||||
|
||||
Recipients = ''
|
||||
SentFrom = 'SYSTEM'
|
||||
Subject = 'WO_MAT_ACTIONS - Critical Field Erase Attempt'
|
||||
Subject = 'WO_MAT_ACTIONS - Critical Field Erased'
|
||||
Message = OConv(Datetime(), 'DT2/^H')
|
||||
Message<2> = 'Computer: ':@Station
|
||||
Message<3> = 'User: ':@User4
|
||||
Message<4> = 'WO_MAT key: ':Name
|
||||
NoteMessage = 'Readonly field ':CriticalField:' (':CriticalFieldName:') restored.'
|
||||
NoteMessage = 'Readonly field ':CriticalField:' (':CriticalFieldName:') erased. Value erased ':Quote(OrigRecord<CriticalField>)
|
||||
Message<5> = NoteMessage
|
||||
Message<6> = 'Call Stack:':CRLF$:RetStack()
|
||||
Swap @FM with \0D0A\ in Message
|
||||
@ -869,6 +868,8 @@ WRITE_RECORD:
|
||||
// This should catch cases where the entire cassette is "peeled off", NCR'ed, or used for destructive testing.
|
||||
Service_Services('PostProcedure', 'SCHEDULE_SERVICES', 'MarkCassProcessed':SD$:WONo:SD$:CassNo:SD$:Datetime())
|
||||
end
|
||||
|
||||
Service_Services('PostProcedure', 'WO_MAT_SERVICES', 'VerifyWOLogWOMatKeyColumn':SD$:Name)
|
||||
|
||||
return
|
||||
|
||||
|
@ -1,4 +1,50 @@
|
||||
Compile function WO_MAT_Services(@Service, @Params)
|
||||
/***********************************************************************************************************************
|
||||
|
||||
Name : WO_MAT_Services
|
||||
|
||||
Description : Handler program for all WO_MAT services.
|
||||
|
||||
Notes : Application errors should be logged using the Error Services module. There are a few methodological
|
||||
assumptions built into way errors are managed which are important to understand in order to properly
|
||||
work with Error Services:
|
||||
|
||||
- The term 'top' refers to the originating procedure of a call stack and the term 'bottom' refers to
|
||||
the last routine (or the current routine) within a call stack. Within the OpenInsight Debugger
|
||||
this will appear backwards since the originating procedure always appears at the bottom of the
|
||||
list and the current routine appears at the top of the list. We are using this orientation because
|
||||
it is common to refer to the process of calling other procedures as 'drilling down'.
|
||||
|
||||
- The reason for defining the orientation of the call stack is because Error_Services allows for
|
||||
multiple error conditions to be appended to an original error. In most cases this will happen when
|
||||
a procedure at the bottom of the stack generates an error condition and then returns to its
|
||||
calling procedure. This higher level procedure can optionally add more information relevant to
|
||||
itself. This continues as the call stack 'bubbles' its way back to the top to where the
|
||||
originating procedure is waiting.
|
||||
|
||||
- Native OpenInsight commands that handle errors (e.g., Set_Status, Set_FSError, Set_EventStatus)
|
||||
preserve their error state until explicitly cleared. This can hinder the normal execution of code
|
||||
since subsequent procedures (usually SSPs) will fail if a pre-existing error condition exists.
|
||||
Our philosophy is that error conditions should automatically be cleared before a new procedure
|
||||
is executed to avoid this problem. However, the nature of Basic+ does not make this easy to
|
||||
automate for any given stored procedure. Therefore, if a stored procedure wants to conform to our
|
||||
philosophy then it should include a call into the 'Clear' service request at the top of the
|
||||
program. Alternatively this can be done through a common insert (see SERVICE_SETUP for example.)
|
||||
|
||||
- Service modules will use the SERVICE_SETUP insert and therefore automatically clear out any
|
||||
error conditions that were set before.
|
||||
|
||||
Parameters :
|
||||
Service [in] -- Name of the service being requested
|
||||
Param1-10 [in/out] -- Additional request parameter holders
|
||||
Response [out] -- Response to be sent back to the Controller (MCP) or requesting procedure
|
||||
|
||||
Metadata :
|
||||
|
||||
History : (Date, Initials, Notes)
|
||||
05/14/18 djs Added VerifyWOLogWOMatKeyColumn service.
|
||||
|
||||
***********************************************************************************************************************/
|
||||
#pragma precomp SRP_PreCompiler
|
||||
|
||||
$insert LOGICAL
|
||||
@ -12,6 +58,7 @@ Declare function Database_Services, Error_Services, SRP_Json, SRP_Com, Environ
|
||||
Declare function Datetime, Rds_Services, GetTickCount, SRP_Array
|
||||
Declare subroutine Error_Services, SRP_Json, SRP_Com, Wo_Mat_Services, Database_Services, Logging_Services
|
||||
Declare subroutine obj_wo_mat_log, Set_Status, Rds_Services, Signature_Services, Mona_Services, Btree.Extract
|
||||
Declare subroutine Transaction_Services
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_Mat\InvActionsSyncUp'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
@ -584,3 +631,67 @@ Service GetWOMatKeys(WONo)
|
||||
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service VerifyWOLogWOMatKeyColumn(WOMatKey)
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_MAT'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' WO_MAT WO_LOG{WO_MAT_KEY} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'WOMatKey':@FM:'Result'
|
||||
objVerifyWOMatKeysLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = WOMatKey
|
||||
LogData<3> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
|
||||
|
||||
ErrorMsg = ''
|
||||
If WOMatKey NE '' then
|
||||
If RowExists('WO_MAT', WOMatKey) then
|
||||
WONo = Field(WOMatKey, '*', 1, 1)
|
||||
If WONo NE '' then
|
||||
If RowExists('WO_LOG', WONo) then
|
||||
WOLogWOMatKeys = Database_Services('ReadDataColumn', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, True$, 0)
|
||||
If Error_Services('NoError') then
|
||||
Locate WOMatKey in WOLogWOMatKeys using @VM setting vPos then
|
||||
LogData<3> = 'WOMatKey found in WO_LOG record. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
|
||||
end else
|
||||
LogData<3> = 'WOMatKey not found in WO_LOG record. Posting transaction to update column.'
|
||||
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
|
||||
WOLogWOMatKeys<0, -1> = WOMatKey
|
||||
WOLogWOMatKeys = SRP_Array('SortRows', WOLogWOMatKeys, 'AR2', 'LIST', @VM, '*')
|
||||
Transaction_Services('PostWriteFieldTransaction', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, WOLogWOMatKeys)
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. ':Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. WO_LOG ':WONo:' does not exist.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. WO_NO is null.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. WO_MAT ':WOMatKey:' does not exist.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Null WOMatKey passed into service.'
|
||||
end
|
||||
|
||||
LogData<3> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<3> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
||||
|
||||
end service
|
||||
|
||||
|
Reference in New Issue
Block a user