ready for UAT

final commit

added PSN to reactor maintenance report query dialog
This commit is contained in:
Infineon\StieberD
2025-04-04 17:19:10 -07:00
committed by Stieber Daniel (CSC FI SPS MESLEO)
parent 8b0eb3e468
commit 333cf0b8e2
25 changed files with 36334 additions and 15275 deletions

View File

@ -55,8 +55,12 @@ $Insert IQS_VIOL_DATA_EQUATES
$Insert FEATURE_FLAGS_EQUATES
$Insert REACT_PROB_CAT_EQUATES
$Insert NICA_ORDERS_EQUATES
$Insert REACTOR_INJECTOR_SETTINGS_EQUATES
$Insert REACTOR_RATIOS_EQUATES
$Insert REACT_STATE_EQUATES
Equ WOCust$ to 2
Equ WOCust$ to 2
Equ SECONDS_IN_DAY$ to 86400
// Uptime Percentage Equates
Equ PRODUCTIVE$ to 1
@ -68,13 +72,13 @@ Equ ENG$ to 5
Declare subroutine Error_Services, Reactor_Services, Memory_Services, RList, Database_Services, SRP_JSON
Declare subroutine Excel_Services, Schedule_Services, Logging_Services, Set_Status, obj_React_Status, Errmsg
Declare subroutine Obj_Notes, Btree.Extract, SRP_Fastarray, Delay, Mona_Services, SRP_List, Msg, Rds_Services
Declare subroutine React_Assign_Conv, Nica_Orders_Services, obj_React_Mode, Reactor_Log_Services
Declare subroutine React_Assign_Conv, Nica_Orders_Services, obj_React_Mode, Reactor_Log_Services, obj_Post_Log
Declare function SRP_Array, Reactor_Services, Memory_Services, Database_Services, SRP_Sort_Array, Excel_Services
Declare function SRP_Math, SRP_Hash, SRP_JSON, Epi_Part_Services, Schedule_Services, Date_Services, Environment_Services
Declare function Logging_Services, GetCommandLine, NextKey, Reactor_Log_Services, SRP_DateTime, ole_getwebpage
Declare function Datetime, Reactor_Modes_Services, Work_Order_Services, React_Mode_NG_Services, Lsl_Users_Services
Declare function SRP_Time, Rds_Services, SRP_Fastarray, Httpclient_Services, SRP_List, Utility, Memberof, Error_Services
Declare function Nica_Orders_Services, Max
Declare function Nica_Orders_Services, Max, RTI_CreateGUID
// Report paths for various performance report services.
TemplatesFolder = Environment_Services('GetApplicationRootPath') : '\Reports\Scheduler\Templates\'
@ -2116,6 +2120,15 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
RLRec<reactor_log_react_util_id$> = NewRUKey
RLRec<reactor_log_react_prob_cat_id$> = ModeSubCatID
CurrWoNo = Xlate('CONFIG', 'WO_DAILY_SCHED':ReactNo, 'F2', 'X')
CurrWoNo = CurrWoNo[1, 'F ']
If CurrWoNo NE '' then
CurrPSNo = Xlate('WO_LOG', CurrWoNo, 'PS_NO', 'X')
end else
CurrPSNo = ''
end
RLRec<REACTOR_LOG_PROD_SPEC_NO$> = CurrPSNo
Database_Services('WriteDataRow', 'REACTOR_LOG', NewRLKey, RLRec)
If Error_Services('NoError') then
Database_Services('WriteDataRow', 'REACT_UTIL', NewRUKey, RUtilRec)
@ -3738,6 +3751,7 @@ Service GetActiveProveInProgresses(ReactNo)
end service
Service GetActiveProveInOrderIds(ReactNo)
If ReactNo NE '' then
@ -3760,6 +3774,495 @@ Service GetIdleStartupRequired(ReactNo)
end service
Service GetCurrentInjectorSettings(ReactorNo)
ErrorMsg = ''
CurrInjSettings = ''
If ReactorNo NE '' then
If RowExists('REACTOR', ReactorNo) then
Open 'DICT.REACTOR_INJECTOR_SETTINGS' to hDict then
Query = 'REACTOR_NO':@VM:ReactorNo:@FM
Query := 'ACTIVE':@VM:True$:@FM
KeyList = ''
Option = 'E'
Flag = ''
Btree.Extract(Query, 'REACTOR_INJECTOR_SETTINGS', hDict, KeyList, Option, Flag)
If Flag EQ 0 then
Begin Case
Case DCount(KeyList, @VM) EQ 0
CurrInjSettings<0, 1> = ''
CurrInjSettings<0, 2> = ''
CurrInjSettings<0, 3> = ''
CurrInjSettings<0, 4> = ''
CurrInjSettings<0, 5> = ''
Case DCount(KeyList, @VM) EQ 1
SettingsRec = Database_Services('ReadDataRow', 'REACTOR_INJECTOR_SETTINGS', KeyList)
If Error_Services('NoError') then
CurrInjSettings<0, 1> = SettingsRec<REACTOR_INJECTOR_SETTINGS.INJECTOR_1$>
CurrInjSettings<0, 2> = SettingsRec<REACTOR_INJECTOR_SETTINGS.INJECTOR_2$>
CurrInjSettings<0, 3> = SettingsRec<REACTOR_INJECTOR_SETTINGS.INJECTOR_3$>
CurrInjSettings<0, 4> = SettingsRec<REACTOR_INJECTOR_SETTINGS.INJECTOR_4$>
CurrInjSettings<0, 5> = SettingsRec<REACTOR_INJECTOR_SETTINGS.INJECTOR_5$>
end
Case DCount(KeyList, @VM) GT 1
ErrorMsg = 'Error in ':Service:' service. Multiple active REACTOR_INJECTOR_SETTINGS records returned.'
End Case
end else
ErrorMsg = 'Error in ':Service:' service. Error calling Btree.Extract.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Error opening DICT.REACTOR_INJECTOR_SETTINGS.'
end
end else
ErrorMsg = 'Error in ':Service:' service. REACTOR, ':ReactorNo:', does not exist.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null ReactorNo passed into service.'
end
If ErrorMsg EQ '' then
Response = CurrInjSettings
end else
Error_Services('Add', ErrorMsg)
end
end service
Service GetCurrentRatios(ReactorNo)
ErrorMsg = ''
CurrRatios = ''
If ReactorNo NE '' then
If RowExists('REACTOR', ReactorNo) then
Open 'DICT.REACTOR_RATIOS' to hDict then
Query = 'REACTOR_NO':@VM:ReactorNo:@FM
Query := 'ACTIVE':@VM:True$:@FM
KeyList = ''
Option = 'E'
Flag = ''
Btree.Extract(Query, 'REACTOR_RATIOS', hDict, KeyList, Option, Flag)
If Flag EQ 0 then
NumRatios = ''
ReactorType = Xlate('REACTOR', ReactorNo, REACTOR_REACT_TYPE$, 'X')
Begin Case
Case ReactorNo EQ 73
// OpenInsight needs to be updated to support reactor type HTR+, which requires 16 ratios.
NumRatios = 16
Case ReactorType EQ 'ASM' or ReactorType EQ 'ASM+'
NumRatios = 10
Case ReactorType EQ 'HTR'
NumRatios = 12
Case Otherwise$
ErrorMsg = 'Error in ':Service:' service. Error determining number '
ErrorMsg := 'of Ratios required for reactor ':ReactorNo:'.'
End Case
If ErrorMsg EQ '' then
Begin Case
Case DCount(KeyList, @VM) EQ 0
For RatioIndex = 1 to NumRatios
CurrRatios<0, RatioIndex> = ''
Next RatioIndex
Case DCount(KeyList, @VM) EQ 1
SettingsRec = Database_Services('ReadDataRow', 'REACTOR_RATIOS', KeyList)
If Error_Services('NoError') then
For RatioIndex = 0 to (NumRatios - 1)
CurrRatios<0, RatioIndex + 1> = SettingsRec<REACTOR_RATIOS.RATIO_1$ + RatioIndex>
Next RatioIndex
end
Case DCount(KeyList, @VM) GT 1
ErrorMsg = 'Error in ':Service:' service. Multiple active REACTOR_RATIOS records returned.'
End Case
end
end else
ErrorMsg = 'Error in ':Service:' service. Error calling Btree.Extract.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Error opening DICT.REACTOR_RATIOS.'
end
end else
ErrorMsg = 'Error in ':Service:' service. REACTOR, ':ReactorNo:', does not exist.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null ReactorNo passed into service.'
end
If ErrorMsg EQ '' then
Response = CurrRatios
end else
Error_Services('Add', ErrorMsg)
end
end service
Service GetRatiosByReactorLog(ReactorLogId)
RatiosKey = ''
Ratios = ''
ErrorMsg = ''
ReactorNo = ''
If ReactorLogId NE '' then
If RowExists('REACTOR_LOG', ReactorLogId) then
Query = 'SELECT REACTOR_RATIOS WITH REACTOR_LOG_ID EQ ':Quote(ReactorLogId)
Query := ' BY-DSND RATIO_SET_DTM'
RList(Query, TARGET_ACTIVELIST$)
ErrCode = ''
If Not(Get_Status(ErrCode)) then
If @RecCount GT 0 then
ReadNext RatiosKey else
ErrorMsg = 'Error in ':Service:' service. Error looking up reactor '
ErrorMsg := 'ratios associated with REACTOR_LOG ':ReactorLogId:'.'
end
ClearSelect TARGET_ACTIVELIST$
end
end else
ErrorMsg = 'Error in ':Service:' service. Error looking up reactor '
ErrorMsg := 'ratios associated with REACTOR_LOG ':ReactorLogId:'.'
end
end else
ErrorMsg = 'Error in ':Service:' service. REACTOR_LOG ':ReactorLogId:' does not exist.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null ReactorLogId passed into service.'
end
If ErrorMsg EQ '' then
If RatiosKey NE '' then
RatiosRec = Database_Services('ReadDataRow', 'REACTOR_RATIOS', RatiosKey)
If Error_Services('NoError') then
If ReactorNo EQ '' then ReactorNo = Xlate('REACTOR_LOG', ReactorLogId, 'REACTOR', 'X')
If ReactorNo NE '' then
NumRatios = Reactor_Services('GetNumRatios', ReactorNo)
For RatioIndex = 0 to (NumRatios - 1)
Ratios<0, RatioIndex + 1> = RatiosRec<REACTOR_RATIOS.RATIO_1$ + RatioIndex>
Next RatioIndex
end else
ErrorMsg = 'Error in ':Service:' service. Null Reactor in REACTOR_LOG ':ReactorLogId:'.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Error reading REACTOR_RATIOS record ':RatiosKey:'.'
end
end
end
If ErrorMsg EQ '' then
Response = Ratios
end else
Error_Services('Add', ErrorMsg)
end
end service
Service GetInjectorSettingsByReactorLog(ReactorLogId)
ReactInjSetKey = ''
InjSettings = ''
ErrorMsg = ''
If ReactorLogId NE '' then
If RowExists('REACTOR_LOG', ReactorLogId) then
Query = 'SELECT REACTOR_INJECTOR_SETTINGS WITH REACTOR_LOG_ID EQ ':Quote(ReactorLogId)
Query := ' BY-DSND INJ_SET_DTM'
RList(Query, TARGET_ACTIVELIST$)
ErrCode = ''
If Not(Get_Status(ErrCode)) then
If @RecCount GT 0 then
ReadNext ReactInjSetKey else
ErrorMsg = 'Error in ':Service:' service. Error looking up reactor injector '
ErrorMsg := 'settings associated with REACTOR_LOG ':ReactorLogId:'.'
end
ClearSelect TARGET_ACTIVELIST$
end
end else
ErrorMsg = 'Error in ':Service:' service. Error looking up reactor injector '
ErrorMsg := 'settings associated with REACTOR_LOG ':ReactorLogId:'.'
end
end else
ErrorMsg = 'Error in ':Service:' service. REACTOR_LOG ':ReactorLogId:' does not exist.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null ReactorLogId passed into service.'
end
If ErrorMsg EQ '' then
If ReactInjSetKey NE '' then
ReactInjSetRec = Database_Services('ReadDataRow', 'REACTOR_INJECTOR_SETTINGS', ReactInjSetKey)
If Error_Services('NoError') then
For InjIndex = 0 to 4
InjSettings<0, InjIndex + 1> = ReactInjSetRec<REACTOR_INJECTOR_SETTINGS.INJECTOR_1$ + InjIndex>
Next InjIndex
end else
ErrorMsg = 'Error in ':Service:' service. Error reading REACTOR_INJECTOR_SETTINGS record ':ReactInjSetKey:'.'
end
end
end
If ErrorMsg EQ '' then
Response = InjSettings
end else
Error_Services('Add', ErrorMsg)
end
end service
Service SetNewInjectorSettings(ReactorNo, InjSettings)
// Injector settings should be passed in internal format (MD3)
ErrorMsg = ''
If ReactorNo NE '' then
If RowExists('REACTOR', ReactorNo) then
If InjSettings NE '' then
If DCount(InjSettings, @VM) EQ 5 then
For each InjSetting in InjSettings using @VM setting vPos
If InjSettings EQ '' then ErrorMsg = 'Error in ':Service:' service. Injector setting ':vPos:' is missing.'
Until ErrorMsg NE ''
Next InjSetting
If ErrorMsg EQ '' then
CurrInjSettings = Reactor_Services('GetCurrentInjectorSettings', ReactorNo)
If (CurrInjSettings NE InjSettings) then
CurrRlId = Xlate('CONFIG', 'REACT_MODE':ReactorNo, 8, 'X')
If CurrRlId NE '' then
Query = 'REACTOR_NO':@VM:ReactorNo:@FM:'ACTIVE':@VM:True$:@FM
Open 'DICT.REACTOR_INJECTOR_SETTINGS' to hDict then
Option = 'E'
ActiveInjSettingsKeys = ''
Flag = ''
Btree.Extract(Query, 'REACTOR_INJECTOR_SETTINGS', hDict, ActiveInjSettingsKeys, Option, Flag)
If Flag EQ 0 then
If ActiveInjSettingsKeys NE '' then
Open 'REACTOR_INJECTOR_SETTINGS' to hTable then
For each ActiveInjSettingsKey in ActiveInjSettingsKeys using @VM
WriteV False$ on hTable, ActiveInjSettingsKey, REACTOR_INJECTOR_SETTINGS.ACTIVE$ else
ErrorMsg = 'Error in ':Service:' service. Error setting previous injector '
ErrorMsg := 'settings to inactive. File error: ':@File_Error
end
Until ErrorMsg NE ''
Next ActiveInjSettingsKey
end else
ErrorMsg = 'Error in ':Service:' service. Error opening REACTOR_INJECTOR_SETTINGS to '
ErrorMsg := 'invalidate previous settings.'
end
end
If ErrorMsg EQ '' then
NewInjSettingsKey = RTI_CreateGUID()
If NewInjSettingsKey NE '' then
NewInjSettingsRec = ''
NewInjSettingsRec<REACTOR_INJECTOR_SETTINGS.REACTOR_LOG_ID$> = CurrRlId
NewInjSettingsRec<REACTOR_INJECTOR_SETTINGS.REACTOR_NO$> = ReactorNo
NewInjSettingsRec<REACTOR_INJECTOR_SETTINGS.INJ_SET_DTM$> = Datetime()
NewInjSettingsRec<REACTOR_INJECTOR_SETTINGS.ACTIVE$> = True$
For InjIndex = 0 to 4
NewInjSettingsRec<REACTOR_INJECTOR_SETTINGS.INJECTOR_1$ + InjIndex> = InjSettings<0, InjIndex + 1>
Next InjIndex
Database_Services('WriteDataRow', 'REACTOR_INJECTOR_SETTINGS', NewInjSettingsKey, NewInjSettingsRec)
If Error_Services('NoError') then
plParms = 'REACT_STATE':@RM
plParms := ReactorNo:@RM
plParms := REACT_STATE_CURR_INJ_RL_ID$:@RM
plParms := CurrRlId:@RM
obj_Post_Log('Create',plParms)
If Get_Status(ErrCode) then
ErrorMsg = 'Error in ':Service:' service. Error calling obj_Post_Log("Create"). '
ErrorMsg := 'Error code: ':ErrCode:'.'
end
end else
ErrorMsg = Error_Services('GetMessage')
end
end else
ErrorMsg = 'Error in ':Service:' service. Error creating new REACTOR_INJECTOR_SETTINGS record.'
end
end
end else
ErrorMsg = 'Error in ':Service:' service. Error calling Btree.Extract.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Error opening DICT.REACTOR_INJECTOR_SETTINGS'
end
end else
ErrorMsg = 'Error in ':Service:' service. Error reading current REACTOR_LOG Id.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Input InjSettings are the same as the current InjSettings.'
end
end
end else
ErrorMsg = 'Error in ':Service:' service. All five injector settings are required.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null InjSettings passed into service.'
end
end else
ErrorMsg = 'Error in ':Service:' service. REACTOR, ':ReactorNo:', does not exist.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null ReactorNo passed into service.'
end
If ErrorMsg EQ '' then
Response = True$
end else
Error_Services('Add', ErrorMsg)
Response = False$
end
end service
Service SetNewRatios(ReactorNo, Ratios)
// Ratios should be passed in internal format (MD3)
ErrorMsg = ''
If ReactorNo NE '' then
If RowExists('REACTOR', ReactorNo) then
If Ratios NE '' then
Ratios = SRP_Array('Clean', Ratios, 'Trim', @VM)
NumRatios = Reactor_Services('GetNumRatios', ReactorNo)
If Error_Services('NoError') then
If DCount(Ratios, @VM) EQ NumRatios then
For each Ratio in Ratios using @VM setting vPos
Begin Case
Case Ratio EQ ''
ErrorMsg = 'Error in ':Service:' service. Ratio ':vPos:' is missing.'
Case OConv(Ratio, 'MD3') LT 30
ErrorMsg = 'Error in ':Service:' service. Invalid Ratio value. Ratio ':vPos:' is less than 30.'
Case OConv(Ratio, 'MD3') GT 100
ErrorMsg = 'Error in ':Service:' service. Invalid Ratio value. Ratio ':vPos:' is greater than 100.'
End Case
Until ErrorMsg NE ''
Next Ratio
If ErrorMsg EQ '' then
CurrRatios = Reactor_Services('GetCurrentRatios', ReactorNo)
If (CurrRatios NE Ratios) then
CurrRlId = Xlate('CONFIG', 'REACT_MODE':ReactorNo, 8, 'X')
If CurrRlId NE '' then
Query = 'REACTOR_NO':@VM:ReactorNo:@FM:'ACTIVE':@VM:True$:@FM
Open 'DICT.REACTOR_RATIOS' to hDict then
Option = 'E'
ActiveRatiosKeys = ''
Flag = ''
Btree.Extract(Query, 'REACTOR_RATIOS', hDict, ActiveRatiosKeys, Option, Flag)
If Flag EQ 0 then
If ActiveRatiosKeys NE '' then
Open 'REACTOR_RATIOS' to hTable then
For each ActiveRatiosKey in ActiveRatiosKeys using @VM
WriteV False$ on hTable, ActiveRatiosKey, REACTOR_RATIOS.ACTIVE$ else
ErrorMsg = 'Error in ':Service:' service. Error setting previous ratios '
ErrorMsg := 'record to inactive. File error: ':@File_Error
end
Until ErrorMsg NE ''
Next ActiveRatiosKey
end else
ErrorMsg = 'Error in ':Service:' service. Error opening REACTOR_RATIOS table to '
ErrorMsg := 'invalidate previous ratios.'
end
end
If ErrorMsg EQ '' then
NewRatiosKey = RTI_CreateGUID()
If NewRatiosKey NE '' then
NewRatiosRec = ''
NewRatiosRec<REACTOR_RATIOS.REACTOR_LOG_ID$> = CurrRlId
NewRatiosRec<REACTOR_RATIOS.REACTOR_NO$> = ReactorNo
NewRatiosRec<REACTOR_RATIOS.RATIO_SET_DTM$> = Datetime()
NewRatiosRec<REACTOR_RATIOS.ACTIVE$> = True$
For RatioIndex = 0 to (NumRatios - 1)
NewRatiosRec<REACTOR_RATIOS.RATIO_1$ + RatioIndex> = Ratios<0, RatioIndex + 1>
Next RatioIndex
Database_Services('WriteDataRow', 'REACTOR_RATIOS', NewRatiosKey, NewRatiosRec)
If Error_Services('NoError') then
plParms = 'REACT_STATE':@RM
plParms := ReactorNo:@RM
plParms := REACT_STATE_CURR_RATIO_RL_ID$:@RM
plParms := CurrRlId:@RM
obj_Post_Log('Create',plParms)
If Get_Status(ErrCode) then
ErrorMsg = 'Error in ':Service:' service. Error calling obj_Post_Log("Create"). '
ErrorMsg = 'Error code: ':ErrCode:'.'
end
end else
ErrorMsg = Error_Services('GetMessage')
end
end else
ErrorMsg = 'Error in ':Service:' service. Error creating new REACTOR_RATIOS record.'
end
end
end else
ErrorMsg = 'Error in ':Service:' service. Error calling Btree.Extract.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Error opening DICT.REACTOR_RATIOS'
end
end else
ErrorMsg = 'Error in ':Service:' service. Error reading current REACTOR_LOG Id.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Input Ratios are the same as the current Ratios.'
end
end
end else
ErrorMsg = 'Error in ':Service:' service. Reactor ':ReactorNo:' requires ':NumRatios:' values '
ErrorMsg := 'for ratios. Only ':DCount(Ratios, @VM):' were supplied.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Error determining number of required ratios '
ErrorMsg := 'for reactor ':ReactorNo:'. Error message: ':Error_Services("GetMessage")
end
end else
ErrorMsg = 'Error in ':Service:' service. Null Ratios passed into service.'
end
end else
ErrorMsg = 'Error in ':Service:' service. REACTOR, ':ReactorNo:', does not exist.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null ReactorNo passed into service.'
end
If ErrorMsg EQ '' then
Response = True$
end else
Error_Services('Add', ErrorMsg)
Response = False$
end
end service
Service GetNumRatios(ReactorNo)
ErrorMsg = ''
NumRatios = ''
If (ReactorNo NE '') then
If RowExists('REACTOR', ReactorNo) then
ReactorType = Xlate('REACTOR', ReactorNo, REACTOR_REACT_TYPE$, 'X')
Begin Case
Case ReactorNo EQ 73
// OpenInsight needs to be updated to support reactor type HTR+, which requires 16 ratios.
NumRatios = 16
Case ReactorType EQ 'ASM' or ReactorType EQ 'ASM+'
NumRatios = 10
Case ReactorType EQ 'HTR'
NumRatios = 12
Case Otherwise$
ErrorMsg = 'Error in ':Service:' service. Error determining number '
ErrorMsg := 'of Ratios required for reactor ':ReactorNo:'.'
End Case
end else
ErrorMsg = 'Error in ':Service:' service. REACTOR, ':ReactorNo:', does not exist.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null ReactorNo passed into service.'
end
If ErrorMsg EQ '' then
Response = NumRatios
end else
Error_Services('Add', ErrorMsg)
end
end service
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////