restored supplement notifications

This commit is contained in:
Infineon\StieberD 2024-10-10 13:02:36 -07:00 committed by Stieber Daniel (CSC FI SPS MESLEO)
parent 403559fe19
commit ce21313054
3 changed files with 293 additions and 276 deletions

View File

@ -366,8 +366,10 @@ return
SaveSupps:
Instructions = ''
RDSNotifyList = ''
ChangeCount = Dcount(OrigSelPos, @FM)
For I =1 to ChangeCount
For I = 1 to ChangeCount
CurrRowNum = OrigSelPos<I>
CurrRow = RDSList<CurrRowNum>
LotSupps = CurrRow<1,15>
@ -375,13 +377,17 @@ SaveSupps:
SuppCount = Dcount(LotSupps, @FM)
For J = 1 to SuppCount
ThisLot = CurrRow<1,5>
RDSNotifyList<-1> = ThisLot
ThisStage = Field(LotSupps<J>, ':', 1)
ThisSupp = Field(LotSupps<J>, ': ', 2)
ThisSupp = TrimF(ThisSupp)
ret = Supplement_Services('CreateSupplement', 'RDS', ThisLot, ThisStage, ThisSupp, @USER4)
ret = Supplement_Services('CreateSupplement', 'RDS', ThisLot, ThisStage, ThisSupp, @User4)
Instructions = ThisSupp
Next J
Next I
If RDSNotifyList NE '' then Supplement_Services('SendNotifications', RDSNotifyList, 'Created', Instructions, @User4)
return
@ -404,4 +410,3 @@ EnableButtons:
return

View File

@ -50,11 +50,11 @@ If Event EQ 'OLE' then
Transfer Param1 to Event
Transfer Param2 to Param1
Transfer Param3 to Param2
* Transfer Param4 to Param3
* Transfer Param5 to Param4
* Transfer Param6 to Param5
* Transfer Param7 to Param6
* Transfer Param8 to Param7
* Transfer Param4 to Param3
* Transfer Param5 to Param4
* Transfer Param6 to Param5
* Transfer Param7 to Param6
* Transfer Param8 to Param7
end
GoToEvent Event for CtrlEntID
@ -92,6 +92,7 @@ Event WINDOW.CLOSE(CancelFlag)
end event
Event CMB_STAGE.CHANGED(CreateParam)
Gosub CheckForSupplements
@ -99,7 +100,6 @@ Event CMB_STAGE.CHANGED(CreateParam)
end event
Event PUB_OK.CLICK()
Removal = ''
@ -109,10 +109,14 @@ Event PUB_OK.CLICK()
Removal = Supplement_Services('DeleteSupplementByLotStage', @USER4, 'RDS', RDSKey, StageSel)
Next RDSKey
RDSNotifyList = @ReCur1
Swap @VM with @FM in RDSNotifyList
If RDSNotifyList NE '' then Supplement_Services('SendNotifications', RDSNotifyList, 'Deleted', '', @User4)
If Error_Services('NoError') then
Result = True$
End else
Result = ''
End
End_Dialog(@Window, Result)
@ -140,6 +144,7 @@ Setup_OLE_Controls:
return
PopulateStages:
DraftStageList = ''
@ -155,8 +160,8 @@ PopulateStages:
Next RDSKey
Swap @VM with ' -' in DraftStageList
StageList = SRP_Array('Clean', DraftStageList, "TrimAndMakeUnique", @FM)
return
return
CheckForSupplements:
@ -184,6 +189,3 @@ CheckForSupplements:
return

View File

@ -50,13 +50,15 @@ Compile function Supplement_Services(@Service, @Params)
$insert APP_INSERTS
$Insert SERVICE_SETUP
$Insert SUPPLEMENTS_EQUATES
$Insert RDS_EQUATES
$Insert NOTIFICATION_EQUATES
Equ COMMA$ to ','
Declare function Database_Services, Supplement_Services, Rti_Createguid, SRP_Array, Datetime, Signature_Services
Declare function Environment_Services, Logging_Services, Select_Into
Declare subroutine Database_Services, Rds_Services, Supplement_Services, Logging_Services, Set_Status, SRP_Stopwatch
Declare subroutine Btree.Extract
Declare subroutine Btree.Extract, obj_Notes
GoToService else
Error_Services('Add', Service : ' is not a valid service request within the ' : ServiceModule : ' module.')
@ -92,6 +94,7 @@ Options STAGES = 'VER', 'PREC','PREI', 'PRES', 'LOAD', 'FWII', 'FWIS', 'UNLOAD',
//----------------------------------------------------------------------------------------------------------------------
Service CreateSupplement(LotType=LOTTYPES, LotID, Stage=STAGES, SupplText, EntryUser)
EditEvent = ''
WriteNeeded = True$
Stages = Supplement_Services('GetStagesForLot', LotType, LotID)
If Stages NE False$ then
@ -99,14 +102,14 @@ Service CreateSupplement(LotType=LOTTYPES, LotID, Stage=STAGES, SupplText, Entry
If LotType NE '' AND LotID NE '' AND SupplText NE '' AND EntryUser NE '' then
Existing = Supplement_Services('GetSupplementsForLot', LotType, LotID, Stage)
If StageCheck NE 0 Then
If Existing EQ FALSE$ then
If Existing EQ False$ then
SupplID = Rti_Createguid()
end else
SupplID = Existing
OrigText = Xlate("SUPPLEMENTS", SupplID, SUPPLEMENTS_SUPPL_TEXT$, 'X', '')
If OrigText EQ SupplText then
WriteNeeded = FALSE$
Response = FALSE$
WriteNeeded = False$
Response = False$
end
end
end
@ -121,22 +124,23 @@ Service CreateSupplement(LotType=LOTTYPES, LotID, Stage=STAGES, SupplText, Entry
Database_Services('WriteDataRow', 'SUPPLEMENTS', SupplID, NewSupRec, True$, False$, False$)
If Error_Services('NoError') then
Response = SupplID
If Existing EQ FALSE$ then
Supplement_Services('LogSupplementChange', NewSupRec, 'Created', EntryUser)
If Existing EQ False$ then
EditEvent = 'Created'
end else
Supplement_Services('LogSupplementChange', NewSupRec, 'Edited', EntryUser)
EditEvent = 'Edited'
end
Supplement_Services('LogSupplementChange', NewSupRec, EditEvent, EntryUser)
end else
Response = FALSE$
Response = False$
Error_Services('Add', 'Error creating Supplement record.')
end
end
end else
Response = FALSE$
Response = False$
Error_Services('Add', 'LotType, LotID, Stage, SupplText or EntryUser was missing in the ' : Service : ' service.')
end
end else
Response = FALSE$
Response = False$
Error_Services('Add', 'Supplements can only be added to stages associated with the specified lot.')
end
@ -293,43 +297,6 @@ Service GetSupplementsForLot(LotType=LOTTYPES, LotID, Stage=STAGES)
end service
//----------------------------------------------------------------------------------------------------------------------
// UpdateSupplementText
//
// SupplID - [Required]
// NewText - [Required]
// EntryUser - [Required]
//
// Modify the text of an existing Supplement.
//
//----------------------------------------------------------------------------------------------------------------------
Service UpdateSupplementText(SupplID, NewText, EntryUser)
Response = False$
If ( (SupplID NE '') and (NewText NE '') ) then
OldRec = Xlate('SUPPLEMENTS', SupplID, '', 'X', '')
If OldRec NE '' then
NewRec = OldRec
NewRec<SUPPLEMENTS_SUPPL_TEXT$> = NewText
NewRec<SUPPLEMENTS_ENTRY_USER$> = EntryUser
NewRec<SUPPLEMENTS_ENTRY_DATETIME$> = Datetime()
Database_Services('WriteDataRow', 'SUPPLEMENTS', SupplID, NewRec, True$, False$, False$)
If Error_Services('NoError') then
Response = SupplID
Supplement_Services('LogSupplementChange', OldRec, 'Edited', EntryUser)
end else
Error_Services('Add', 'Error editing Supplement record.')
end
end else
Error_Services('Add', 'Record does not exist.')
end
end else
Error_Services('Add', 'SupplID or NewText was missing in the ' : Service : ' service.')
end
end service
//----------------------------------------------------------------------------------------------------------------------
// DeleteSupplementByByLotStage
//
@ -352,7 +319,7 @@ Service DeleteSupplementByLotStage(EntryUser, LotType=LOTTYPES, LotID, Stage=STA
Database_Services('DeleteDataRow', 'SUPPLEMENTS', SupplID, True$, False$)
If Error_Services('NoError') then
Supplement_Services('LogSupplementChange', SupplRec, 'Deleted', EntryUser)
Response = TRUE$
Response = True$
end else
Error_Services('Add', 'Error deleting Supplement record.')
end
@ -367,37 +334,6 @@ Service DeleteSupplementByLotStage(EntryUser, LotType=LOTTYPES, LotID, Stage=STA
end service
//----------------------------------------------------------------------------------------------------------------------
// DeleteSupplementByID
//
// SupplID - [Required]
// EntryUser - [Required]
//
// Delete an existing Supplement.
//
//----------------------------------------------------------------------------------------------------------------------
Service DeleteSupplementByID(SupplID, EntryUser)
Response = False$
If SupplID NE '' then
If RowExists('SUPPLEMENTS', SupplID) then
Database_Services('DeleteDataRow', 'SUPPLEMENTS', SupplID, True$, False$)
If Error_Services('NoError') then
Supplement_Services('LogSupplementChange', TestRec, 'Deleted', EntryUser)
Response = TRUE$
end else
Error_Services('Add', 'Error deleting Supplement record.')
end
end else
Error_Services('Add', 'Record does not exist.')
end
end else
Error_Services('Add', 'SupplID was missing in the ' : Service : ' service.')
end
end service
//----------------------------------------------------------------------------------------------------------------------
// GetStagesForLot
//
@ -603,3 +539,77 @@ Service FileLogSuccessfulSupp(LogText, EntryUser, EditEvent)
end service
Service SendNotifications(RDSList, EditEvent, Instructions, EntryUser)
Response = True$
ErrorMsg = ''
If RowExists('RDS', RDSList) then
Begin Case
Case ( (EditEvent _EQC 'Created') or (EditEvent _EQC 'Edited') )
PSN = Xlate('RDS', RDSList<1>, RDS_PROD_SPEC_ID$, 'X')
WoNo = Xlate('RDS', RDSList<1>, RDS_WO$, 'X')
ReactorNo = Xlate('RDS', RDSList<1>, RDS_REACTOR$, 'X');
Message = 'This Supplement was created or updated by ':OConv( EntryUser, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ):' on ':OConv( Date(), 'D2/' ):' at ':OConv( Time(), 'MTH' ):'.' : CRLF$
Message := 'WO# : ' : WoNo : CRLF$
Message := 'PSN : ' : PSN : CRLF$
Message := 'Reactor No : ' : ReactorNo : CRLF$
Message := CRLF$
Message := 'RDS #s : ' : CRLF$
For each RDSNo in RDSList using @FM
Message := RDSNo : ' - ': Instructions :CRLF$
Next RDSNo
Recipients = XLATE('NOTIFICATION','SUPPLEMENTS',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System'
Subject = 'New or Updated Supplement Created for WO# ': WoNo
AttachWindow = ''
AttachKey = ''
SendToGroup = ''
Parms = Recipients:@RM:SendFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
Case (EditEvent _EQC 'Deleted')
PSN = XLATE('RDS', RDSList<1>, RDS_PROD_SPEC_ID$, 'X')
WoNo = XLATE('RDS', RDSList<1>, RDS_WO$, 'X')
ReactorNo = XLATE('RDS', RDSList<1>, RDS_REACTOR$, 'X');
Message = 'This Supplement was removed by ':OConv( EntryUser, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ):' on ':OConv( Date(), 'D2/' ):' at ':OConv( Time(), 'MTH' ):'.' : CRLF$
Message := 'WO# : ' : WoNo : CRLF$
Message := 'PSN : ' : PSN : CRLF$
Message := 'Reactor No : ' : ReactorNo : CRLF$
Message := CRLF$
Message := 'RDS #s : ' : CRLF$
For each RDSNo in RDSList using @FM
Message := RDSNo :CRLF$
Next RDSNo
Recipients = XLATE('NOTIFICATION','SUPPLEMENTS',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System'
Subject = 'Supplement Removed for WO# ': WoNo
AttachWindow = ''
AttachKey = ''
SendToGroup = ''
Parms = Recipients:@RM:SendFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
Case Otherwise$
ErrorMsg = 'Error in ':Service:' service. Invalid EditEvent "':EditEvent:'" passed in.'
End Case
end else
ErrorMsg = 'Error in ':Service:' service. Invalid RDS record passed in.'
end
If ErrorMsg NE '' then
Error_Services('Add', ErrorMsg)
Response = False$
end
end service