refactored calibration reminders into a service

This commit is contained in:
Infineon\StieberD 2024-12-03 14:07:00 -07:00 committed by Stieber Daniel (CSC FI SPS MESLEO)
parent 7782918afd
commit 7cc861619f
3 changed files with 155 additions and 35 deletions

View File

@ -9,7 +9,7 @@
"<2>": "-2",
"<3>": "-1",
"<4>": "-1",
"<5>": "16777215",
"<5>": "-2",
"<6>": {
"<6,1>": {
"<6,1,1>": "Tahoma",
@ -55,7 +55,7 @@
"<8,5>": {
"<8,5,1>": "ENG",
"<8,5,2>": "Engineering",
"<8,5,3>": "JFUENTE1,JUSTIN_H,JONATHON_S,MARROQUINBRA,TIFFANY_M,JEANNE_M,JONATHAN_O"
"<8,5,3>": "JFUENTE1,JUSTIN_H,JONATHON_S,MARROQUINBRA,TIFFANY_M,JEANNE_M,JONATHAN_O,DANIEL_ST"
}
},
"<9>": {
@ -82,14 +82,6 @@
"<9,3,4>": "C",
"<9,3,5>": "",
"<9,3,6>": "Notify User ID"
},
"<9,4>": {
"<9,4,1>": "",
"<9,4,2>": "",
"<9,4,3>": "",
"<9,4,4>": "",
"<9,4,5>": "",
"<9,4,6>": ""
}
},
"<10>": "L",
@ -117,7 +109,17 @@
"<32>": "0",
"<33>": "1",
"<34>": "16777215",
"<35>": "16777215"
"<35>": "16777215",
"<36>": "",
"<37>": "",
"<38>": "",
"<39>": "",
"<40>": "-2",
"<41>": "1000",
"<42>": "",
"<43>": "",
"<44>": "",
"<45>": ""
}
}
}

View File

@ -1,9 +1,34 @@
Compile function Calibration_Services(@Service, @Params)
/***********************************************************************************************************************
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 Infineon Technologies.
Name : Calibration_Services
Description : Handler program for all Scan services.
Notes :
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)
12/03/2024 djs Added SendReminders service
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
$Insert LOGICAL
$Insert APP_INSERTS
$Insert SERVICE_SETUP
$Insert CALIB_LIST_EQUATES
$Insert POPUP_EQUATES
$Insert RLIST_EQUATES
$Insert NOTIFICATION_EQUATES
EQU COL$CL_NO TO 1
EQU COL$DEPT TO 2
@ -23,6 +48,9 @@ EQU COL$NIST_INT_EXT TO 7
EQU COL$NIST_LAST_CAL TO 8
EQU COL$NIST_NEXT_CAL TO 9
Declare subroutine obj_Notes
Declare function SRP_Array, Database_Services
GoToService
Return Response or ""
@ -45,16 +73,10 @@ Service GetCalibListData(CalibType=CALIB_TYPES, SelectActive=BOOLEAN)
Begin Case
Case CalibType EQ 'Equipment'
OPEN 'CALIB_LIST' TO TableIn then
Open 'CALIB_LIST' TO TableIn then
If SelectActive EQ False$ then
SELECT TableIn
* end else
* Select 'CALIB_LIST' By "" Using Cursor else
* ErrorMsg = 'Error in ':Service:' service. Error selecting CALIB_LIST records.'
* end
end
If SelectActive EQ False$ then Select TableIn
If ErrorMsg EQ '' then
EquipList = ''
@ -114,14 +136,8 @@ Service GetCalibListData(CalibType=CALIB_TYPES, SelectActive=BOOLEAN)
OPEN 'CALIB_LIST' TO TableIn then
If SelectActive EQ False$ then
SELECT TableIn
* end else
* Select 'CALIB_LIST' By "" Using Cursor else
* ErrorMsg = 'Error in ':Service:' service. Error selecting CALIB_LIST records.'
* end
end
If SelectActive EQ False$ then Select TableIn
If ErrorMsg EQ '' then
NISTList = ''
@ -185,3 +201,110 @@ Service GetCalibListData(CalibType=CALIB_TYPES, SelectActive=BOOLEAN)
End Service
Service SendReminders()
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
Lock hSysLists, ServiceKeyID then
ErrorMsg = ''
OPEN 'CALIB_LIST' TO FileIn then
CalDueRecipients = Xlate('NOTIFICATION', 'CALIB_DUE_NOTIFY', NOTIFICATION_USER_ID$, 'X')
CheckDt = OConv(Date() + 15, 'D4/')
SelectSent = 'SELECT CALIB_LIST WITH NEXT_CAL_DT < ':QUOTE(CheckDt):' BY NEXT_CAL_DT'
RList(SelectSent,TARGET_ACTIVELIST$,'','','')
NoteText = ''
Depts = ''
Done = 0
LOOP
READNEXT CLNo ELSE Done = 1
UNTIL Done
READ CLRec FROM FileIn,CLNo THEN
NextCalDt = OCONV(XLATE('CALIB_LIST',CLNo,'NEXT_CAL_DT','X'),'D4/')
IF NextCalDt NE '' THEN
NewLine = ''
CLType = CLRec<CALIB_LIST_CL_TYPE$>
Dept = CLRec<CALIB_LIST_DEPT$>
IF Dept = '' THEN Dept = 'MET'
IF CLType = 'E' THEN
Desc = CLRec<CALIB_LIST_EQ_DESC$>
SN = CLRec<CALIB_LIST_EQ_SN$>
Loc = CLRec<CALIB_LIST_EQ_LOC$
NewLine = Desc:' (S/N: ':SN:') located in the ':Loc:' is due for calibration on ':NextCalDt:CRLF$
END
IF CLType = 'S' THEN
Desc = CLRec<CALIB_LIST_STD_DESC$>
SN = CLRec<CALIB_LIST_STD_SN$>
Loc = CLRec<CALIB_LIST_STD_LOC$>
NewLine = 'The NIST Standard ':Desc:' (S/N: ':SN:') located in the ':Loc:' is due for calibration on ':NextCalDt:CRLF$
END
LOCATE Dept IN Depts USING @FM SETTING Pos ELSE
Depts = INSERT(Depts,Pos,0,0,Dept)
END
NoteText<Pos> = NoteText<Pos>:NewLine
END ;* End of check for NextCalDt
END ;* End of CLRec read
REPEAT
DeptUsers = ''
DeptDescs =''
PopupLiteral = XLATE('SYSREPOSPOPUPS',@APPID<1>:'**DEPT',PDISPLAY$,'X')
CONVERT @VM:@SVM TO @FM:@VM IN PopupLiteral
LiteralCnt = COUNT(PopupLiteral,@FM) + (PopupLiteral NE '')
FOR I = 1 TO LiteralCnt
Dept = PopupLiteral<I,1>
DeptDesc = PopupLiteral<I,2>
UserNames = PopupLiteral<I,3>
LOCATE Dept IN Depts USING @FM SETTING Pos THEN
CONVERT ' ' TO '' IN UserNames
CONVERT ',' TO @VM IN UserNames
DeptUsers<Pos> = UserNames
DeptDescs<Pos> = DeptDesc
END
NEXT I
NoteSubject = "Equipment Calibration Reminder"
DeptCnt = DCount(Depts,@FM)
FOR I = 1 TO DeptCnt
IF NoteText<I> NE '' THEN
Recipients = SRP_Array('Join', CalDueRecipients, DeptUsers<I>, 'AND', @VM)
SentFrom = 'System'
Subject = DeptDescs<I>:" Department - Equipment Calibration Reminder"
Message = NoteText<I>
AttachWindow = 'MASTER_CALIB_LIST'
AttachKeys = ''
SendToGroup = ''
Obj_Notes('Create',Recipients:@RM:'System':@RM:NoteSubject:@RM:NoteText<I>:@RM:'MASTER_CALIB_LIST')
END
NEXT I
end else
ErrorMsg = 'Unable to open "CALIB_LIST" table.'
end
If ErrorMsg NE '' then
Error_Services('Add', ErrorMsg)
end
Unlock hSysLists, ServiceKeyID else Null
end
end service

View File

@ -291,12 +291,6 @@ Event WINDOW.CREATE(CreateParam)
Set_Property(@Window : '.MENU.ADMIN.MASS_TOOL_MODE_CHANGE', 'VISIBLE', 0)
Set_Property(@Window : '.MENU.ADMIN.MASS_REACTOR_MODE_CHANGE', 'VISIBLE', 0)
end
CalDueRecipients = XLATE('NOTIFICATION','CALIB_DUE_NOTIFY',NOTIFICATION_USER_ID$,'X')
LOCATE @USER4 IN CalDueRecipients USING @VM SETTING POS THEN
obj_Calib_List('SendReminders') ;* New system added 3/18/2010 JCH
END
UseFQAMatScan = Database_Services('ReadDataRow', 'APP_INFO', 'USE_FQA_MAT_SCAN')
If UseFQAMatScan EQ 1 OR MemberOf(@User4, 'OI_TEST') then
@ -854,3 +848,4 @@ return