Added in Current Step Calculation, Current Step Action Validation, User Permission validation, additional TODO logging, code cleanup

This commit is contained in:
Infineon\Ouellette 2025-01-22 10:55:40 -07:00 committed by Ouellette Jonathan (CSC FI SPS MESLEO)
parent 29f0cb1c10
commit 8f4048a68a

View File

@ -4,7 +4,7 @@ Compile function RETURN_TO_FAB_Services(@Service, @Params)
Declare subroutine Error_Services, Database_Services, Btree.Extract, Logging_Services, SRP_JSON
Declare function Rti_Createguid, Database_Services, Return_To_Fab_Services, Datetime, Error_Services
Declare function Logging_Services, Environment_Services, SRP_JSON
Declare function Logging_Services, Environment_Services, SRP_JSON, MemberOf
Declare subroutine obj_notes, SRP_Run_Command
$insert LOGICAL
@ -123,38 +123,10 @@ Service CreateReturnToFabRecord(CassId, UserId)
end
End Service
Service GetReturnToFabReasonOptions()
ErrorMessage = ''
RTFReasons = ''
RTFReasonKeys = ''
table = "RETURN_TO_FAB_REASON"
Open "DICT ":table To @DICT Else
ErrorMessage = 'Error opening RETURN_TO_FAB_REASON dictionary'
End
If ErrorMessage EQ '' then
srch_strng = "ACTIVE":@VM:True$:@FM
option = ""
flag = ""
Btree.Extract(srch_strng, table, @DICT, RTFReasonKeys, option, flag)
for each RTFReasonID in RTFReasonKeys using @VM setting rPos
RTFReasons<1, rPos> = RTFReasonId
ReasonDesc = Database_Services('ReadDataColumn', table, RTFReasonID, RETURN_TO_FAB_REASON_REASON_DESCRIPTION$, True$, 0, False$)
RTFReasons<2, rPos> = ReasonDesc
Next RTFReasonID
end
If ErrorMessage EQ '' then
Response = RTFReasons
end else
Error_Services('Add', ErrorMessage)
end
end service
Service GetReturnToFabResultOptions()
ErrorMessage = ''
RTFResultOptions = ''
RTFResultOptionKeys = ''
table = "RETURN_TO_FAB_RESULT_OPTION"
Open "DICT ":table To @DICT Else
ErrorMessage = 'Error opening RETURN_TO_FAB_RESULT_OPTION dictionary'
@ -173,15 +145,17 @@ Service GetReturnToFabResultOptions()
If ErrorMessage EQ '' then
Response = RTFResultOptions
end else
//Todo Log error message
LogData = ''
LogData<1> = LoggingDTM;//Defined at entry of subroutine
LogData<2> = ''
LogData<3> = ''
LogData<4> = ''
LogData<5> = ErrorMessage
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
end service
Service GetReturnToFabRecordById(RTFId)
end service
Service ConvertReturnToFabRecordToJSON(RTFId)
ErrorMessage = ''
JsonString = ''
@ -201,7 +175,7 @@ Service ConvertReturnToFabRecordToJSON(RTFId)
SRP_JSON(objRTF, 'SetValue', 'EvalUserId', RTFRecord<RETURN_TO_FAB_LOTS_EVAL_USER_ID$>)
SRP_JSON(objRTF, 'SetValue', 'EvalResultId', RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$>, 'Number')
if RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$> NE '' then
EvaluationDescription = Database_Services('ReadDataColumn', 'RETURN_TO_FAB_RESULT_OPTION', RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$>, RETURN_TO_FAB_RESULT_OPTION_RESULT$, True$, 0, False$)
EvaluationDescription = Database_Services('ReadDataColumn', 'RETURN_TO_FAB_RESULT_OPTION', RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$>, RETURN_TO_FAB_RESULT_OPTION_RESULT$, True$, 0, False$)
end else
EvaluationDescription = ''
end
@ -212,8 +186,10 @@ Service ConvertReturnToFabRecordToJSON(RTFId)
SRP_JSON(objRTF, 'SetValue', 'Completed', RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>, 'Boolean')
SRP_JSON(objRTF, 'SetValue', 'CompletedDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$>,'DT'))
SRP_JSON(objRTF, 'SetValue', 'Reason', RTFRecord<RETURN_TO_FAB_LOTS_REASON$>)
Notes = RTFRecord<RETURN_TO_FAB_LOTS_NOTES$>
NotesUser = RTFRecord<RETURN_TO_FAB_LOTS_NOTES_USER$>
CurrStepId = Return_To_Fab_Services('GetRTFCurrStep', RTFId)
SRP_Json(objRTF, 'SetValue', 'CurrStepId', CurrStepId, 'Number')
Notes = RTFRecord<RETURN_TO_FAB_LOTS_NOTES$>
NotesUser = RTFRecord<RETURN_TO_FAB_LOTS_NOTES_USER$>
If Notes NE '' then
JsonArrayNotes = ''
If SRP_JSON(JsonArrayNotes, 'New', 'Array') then
@ -238,7 +214,7 @@ Service ConvertReturnToFabRecordToJSON(RTFId)
ErrorMessage = 'Error creating new Json Object'
end
end else
ErrorMessage = 'Error reading RTFRecord from database...'
ErrorMessage = 'Error reading RTFRecord from database...'
end
JsonString = SRP_JSON(objJSON, 'Stringify', 'Styled')
SRP_JSON(objJSON, 'Release')
@ -248,6 +224,16 @@ Service ConvertReturnToFabRecordToJSON(RTFId)
end else
ErrorMessage = 'Error Converting RTF record to JSON. RTFId not found in database.'
end
If ErrorMessage NE '' then
LogData = ''
LogData<1> = LoggingDTM;//Defined at entry of subroutine
LogData<2> = ''
LogData<3> = ''
LogData<4> = ''
LogData<5> = ErrorMessage
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
Response = JsonString
end service
@ -274,14 +260,16 @@ Service CreateReturnToFabReportJson(ShowOpenReport)
SRP_JSON(hRTFJsonSingle, 'SetValue', 'RequestorUserId', RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>)
SRP_JSON(hRTFJsonSingle, 'SetValue', 'StartDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_START_DTM$>, 'DT'))
if RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$> NE '' then
EvaluationDescription = Database_Services('ReadDataColumn', 'RETURN_TO_FAB_RESULT_OPTION', RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$>, RETURN_TO_FAB_RESULT_OPTION_RESULT$, True$, 0, False$)
EvaluationDescription = Database_Services('ReadDataColumn', 'RETURN_TO_FAB_RESULT_OPTION', RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$>, RETURN_TO_FAB_RESULT_OPTION_RESULT$, True$, 0, False$)
end else
EvaluationDescription = ''
EvaluationDescription = ''
end
SRP_JSON(hRTFJsonSingle, 'SetValue', 'EvalDesc', EvaluationDescription)
SRP_JSON(hRTFJsonSingle, 'SetValue', 'FinalCompleteDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_DTM$>, 'DT'))
SRP_JSON(hRTFJsonSingle, 'SetValue', 'Completed', RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>, 'Boolean')
SRP_JSON(hRTFJsonSingle, 'SetValue', 'CompletedDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$>,'DT'))
CurrStepId = Return_To_Fab_Services('GetRTFCurrStep', RTFId)
SRP_Json(hRTFJsonSingle, 'SetValue', 'CurrStepId', CurrStepId, 'Number')
SRP_Json(objReturnToFabReport, 'Add', hRTFJsonSingle)
SRP_Json(hRTFJsonSingle, 'Release')
end
@ -297,6 +285,16 @@ Service CreateReturnToFabReportJson(ShowOpenReport)
end else
ErrorMessage = 'Error creating root JSON object.'
end
If ErrorMessage NE '' then
LogData = ''
LogData<1> = LoggingDTM;//Defined at entry of subroutine
LogData<2> = ''
LogData<3> = ''
LogData<4> = ''
LogData<5> = ErrorMessage
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
Response = JsonString
end service
@ -320,6 +318,13 @@ Service GetReturnToFabRecordIdByCassId(CassId)
If ErrorMessage EQ '' then
Response = RTFRecords
end else
LogData = ''
LogData<1> = LoggingDTM;//Defined at entry of subroutine
LogData<2> = CassId
LogData<3> = ''
LogData<4> = ''
LogData<5> = ErrorMessage
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
End Service
@ -343,6 +348,13 @@ Service GetAllReturnToFabRecords(ShowOnlyOpen)
If ErrorMessage EQ '' then
Response = RTFRecords
end else
LogData = ''
LogData<1> = LoggingDTM;//Defined at entry of subroutine
LogData<2> = ''
LogData<3> = ''
LogData<4> = ''
LogData<5> = ErrorMessage
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
end service
@ -367,6 +379,13 @@ Service GetOpenReturnToFabRecordIdByCassId(CassId)
If ErrorMessage EQ '' then
Response = OpenRTFRecords
end else
LogData = ''
LogData<1> = LoggingDTM;//Defined at entry of subroutine
LogData<2> = ''
LogData<3> = ''
LogData<4> = ''
LogData<5> = ErrorMessage
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
End Service
@ -375,29 +394,33 @@ Service SetReasonForReturn(RTFId, UserId, Reason)
ErrorMessage = ''
If RTFId NE '' then
If RowExists('RETURN_TO_FAB_LOTS', RTFId) then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
RTFRecordComplete = RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>
If RTFRecordComplete NE True$ then
If UserId NE '' then
if RowExists('LSL_USERS', UserId) then
If Reason NE '' then
RTFRecord<RETURN_TO_FAB_LOTS_REASON$> = Reason
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage')
end
RTFCurrStep = Return_To_Fab_Services('GetRTFCurrStep', RTFId)
If RTFCurrStep EQ LE 3 AND RTFCurrStep GE 1 then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
RTFRecordComplete = RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>
If RTFRecordComplete NE True$ then
If UserId NE '' then
if RowExists('LSL_USERS', UserId) then
If Reason NE '' then
RTFRecord<RETURN_TO_FAB_LOTS_REASON$> = Reason
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error setting return to fab reason. Reason was null.'
end
end else
ErrorMessage = 'Error setting return to fab reason. Reason was null.'
ErrorMessage = 'Error setting return to fab reason. User not found in openinsight.'
end
end else
ErrorMessage = 'Error setting return to fab reason. User not found in openinsight.'
ErrorMessage = 'Error setting return to fab reason. User ID was null.'
end
end else
ErrorMessage = 'Error setting return to fab reason. User ID was null.'
ErrorMessage = 'Error setting return to fab reason. Return to fab record has already been completed.'
end
end else
ErrorMessage = 'Error setting return to fab reason. Return to fab record has already been completed.'
ErrorMessage = 'Error setting Return To Fab reason. Form is currently at step ': RTFCurrStep :'.'
end
end else
ErrorMessage = 'Error setting return to fab reason. Return to fab record did not exists'
@ -426,46 +449,53 @@ Service SetReasonForReturn(RTFId, UserId, Reason)
end service
Service SetBinToBin(RTFId, MHUserId)
ErrorMessage = ''
ErrorMessage = ''
If RTFId NE '' then
If RowExists('RETURN_TO_FAB_LOTS', RTFId) then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
RTFRecordComplete = RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>
If RTFRecordComplete NE True$ then
If MHUserId NE '' then
If RowExists('LSL_USERS', MHUserId) then
RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_USER_ID$> = MHUserId
RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_DTM$> = Datetime()
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('NoError') then
//Send notification that a return to fab record was created.
CassId = RTFRecord<RETURN_TO_FAB_LOTS_CASS_ID$>
RTFOrigUser = RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>
Message = 'Return to fab form updated for ' : CassId : ' by ' : RTFOrigUser : '.' : CRLF$
Message := 'Initial Bin to Bin has been marked as completed.' : CRLF$
Message := 'Link to Return To Fab form: https://goto.infineon.com/oiwizard/ReturnToFab'
Recipients = XLATE('NOTIFICATION','SHIPPING',NOTIFICATION_USER_ID$,'X')
Recipients<1, -1> = RTFOrigUser
SentFrom = 'OI_ADMIN'
Subject = 'Return To Fab Form Updated'
SendToGroup = ''
AttachWindow = ''
AttachKey = ''
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
RTFCurrStep = Return_To_Fab_Services('GetRTFCurrStep', RTFId)
If RTFCurrStep EQ 3 then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
RTFRecordComplete = RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>
If RTFRecordComplete NE True$ then
If MHUserId NE '' then
If RowExists('LSL_USERS', MHUserId) then
If MemberOf(MHUserId, 'MATERIAL HANDLER') then
RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_USER_ID$> = MHUserId
RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_DTM$> = Datetime()
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('NoError') then
//Send notification that a return to fab record was created.
CassId = RTFRecord<RETURN_TO_FAB_LOTS_CASS_ID$>
RTFOrigUser = RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>
Message = 'Return to fab form updated for ' : CassId : ' by ' : RTFOrigUser : '.' : CRLF$
Message := 'Initial Bin to Bin has been marked as completed.' : CRLF$
Message := 'Link to Return To Fab form: https://goto.infineon.com/oiwizard/ReturnToFab'
Recipients = XLATE('NOTIFICATION','SHIPPING',NOTIFICATION_USER_ID$,'X')
Recipients<1, -1> = RTFOrigUser
SentFrom = 'OI_ADMIN'
Subject = 'Return To Fab Form Updated'
SendToGroup = ''
AttachWindow = ''
AttachKey = ''
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
end else
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. User does not have permissions to perform this function. User must be apart of OI Security Group "MATERIAL HANDLER"'
end
end else
ErrorMessage = Error_Services('GetMessage')
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Material Handler User ID was not found in OpenInsight.'
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Material Handler User ID was not found in OpenInsight.'
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Material Handler User ID was null.'
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Material Handler User ID was null.'
end
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Return to fab record has already been completed.'
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Return to fab record has already been completed.'
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Form is currently at step ': RTFCurrStep :'.'
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Return to fab record did not exists'
@ -494,7 +524,7 @@ Service SetBinToBin(RTFId, MHUserId)
end service
Service SetRTFCompleted(RTFId, CompleteUserId)
ErrorMessage = ''
ErrorMessage = ''
If RTFId NE '' then
If RowExists('RETURN_TO_FAB_LOTS', RTFId) then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
@ -502,10 +532,10 @@ Service SetRTFCompleted(RTFId, CompleteUserId)
If RTFRecordComplete NE True$ then
If CompleteUserId NE '' then
If RowExists('LSL_USERS', CompleteUserId) then
RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$> = True$
RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$> = Datetime()
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('NoError') then
RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$> = True$
RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$> = Datetime()
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('NoError') then
//Send notification that a return to fab record was created.
CassId = RTFRecord<RETURN_TO_FAB_LOTS_CASS_ID$>
RTFOrigUser = RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>
@ -527,9 +557,8 @@ Service SetRTFCompleted(RTFId, CompleteUserId)
end else
ErrorMessage = 'Error setting Return To Fab form as complete. User ID was not found in OpenInsight.'
end
end else
ErrorMessage = 'Error setting Return To Fab form as complete. User ID was null.'
ErrorMessage = 'Error setting Return To Fab form as complete. User ID was null.'
end
end else
ErrorMessage = 'Error setting Return To Fab form as complete. Return to fab record has already been completed.'
@ -564,53 +593,58 @@ Service SetEvalInfo(RTFId, EvalUserId, ResultId)
ErrorMessage = ''
If RTFId NE '' then
if RowExists('RETURN_TO_FAB_LOTS', RTFId) then
If EvalUserId NE '' then
if RowExists('LSL_USERS', EvalUserId) then
If ResultId NE '' then
If RowExists('RETURN_TO_FAB_RESULT_OPTION', ResultId) then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
RTFRecordComplete = RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>
If RTFRecordComplete NE True$ then
RTFRecord<RETURN_TO_FAB_LOTS_EVAL_USER_ID$> = EvalUserId
RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$> = ResultId
RTFRecord<RETURN_TO_FAB_LOTS_EVAL_DTM$> = Datetime()
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('NoError') then
ResultDescription = XLate('RETURN_TO_FAB_RESULT_OPTION', ResultId, RETURN_TO_FAB_RESULT_OPTION_RESULT$, 'X')
//Send notification that a return to fab record was created.
CassId = RTFRecord<RETURN_TO_FAB_LOTS_CASS_ID$>
RTFOrigUser = RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>
Message = 'Return to fab form updated for ' : CassId : ' by ' : RTFOrigUser : '.' : CRLF$
Message := 'Result has been set to ' : ResultDescription : '.' : CRLF$
Message := 'Link to Return To Fab form: https://goto.infineon.com/oiwizard/ReturnToFab'
Recipients = XLATE('NOTIFICATION','SHIPPING',NOTIFICATION_USER_ID$,'X')
Recipients<1, -1> = RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>
SentFrom = 'OI_ADMIN'
Subject = 'Return To Fab Form Updated'
SendToGroup = ''
AttachWindow = ''
AttachKey = ''
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
RTFCurrStep = Return_To_Fab_Services('GetRTFCurrStep', RTFId)
If RTFCurrStep EQ 4 AND RTFCurrStep LE 5 then
If EvalUserId NE '' then
if RowExists('LSL_USERS', EvalUserId) then
If ResultId NE '' then
If RowExists('RETURN_TO_FAB_RESULT_OPTION', ResultId) then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
RTFRecordComplete = RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>
If RTFRecordComplete NE True$ then
RTFRecord<RETURN_TO_FAB_LOTS_EVAL_USER_ID$> = EvalUserId
RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$> = ResultId
RTFRecord<RETURN_TO_FAB_LOTS_EVAL_DTM$> = Datetime()
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('NoError') then
ResultDescription = XLate('RETURN_TO_FAB_RESULT_OPTION', ResultId, RETURN_TO_FAB_RESULT_OPTION_RESULT$, 'X')
//Send notification that a return to fab record was created.
CassId = RTFRecord<RETURN_TO_FAB_LOTS_CASS_ID$>
RTFOrigUser = RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>
Message = 'Return to fab form updated for ' : CassId : ' by ' : RTFOrigUser : '.' : CRLF$
Message := 'Result has been set to ' : ResultDescription : '.' : CRLF$
Message := 'Link to Return To Fab form: https://goto.infineon.com/oiwizard/ReturnToFab'
Recipients = XLATE('NOTIFICATION','SHIPPING',NOTIFICATION_USER_ID$,'X')
Recipients<1, -1> = RTFRecord<RETURN_TO_FAB_LOTS_REQUESTOR_USER_ID$>
SentFrom = 'OI_ADMIN'
Subject = 'Return To Fab Form Updated'
SendToGroup = ''
AttachWindow = ''
AttachKey = ''
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
end else
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = Error_Services('GetMessage')
ErrorMessage = 'Error setting Eval. info. Return to fab record has already been completed.'
end
//Possbile to add auto-closing logic here.
end else
ErrorMessage = 'Error setting Eval. info. Return to fab record has already been completed.'
ErrorMessage = 'Error setting Eval. info. Result was an invalid result option.'
end
//Possbile to add auto-closing logic here.
end else
ErrorMessage = 'Error setting Eval. info. Result was an invalid result option.'
end
end else
ErrorMessage = 'Error setting Eval. info. Result was null.'
end
end else
ErrorMessage = 'Error setting Eval. info. Result was null.'
end
end else
ErrorMessage = 'Error setting Eval. info. Evaluation user is not a valid OpenInsight user.'
end
end else
ErrorMessage = 'Error setting Eval. info. Evaluation user is not a valid OpenInsight user.'
ErrorMessage = 'Error setting Eval. info. Evaluation user id was null.'
end
end else
ErrorMessage = 'Error setting Eval. info. Evaluation user id was null.'
ErrorMessage = 'Error setting Eval. info. Form is currently at step ': RTFCurrStep :'.'
end
end else
ErrorMessage = 'Error setting Eval. info. Return to fab record was not found.'
@ -642,34 +676,41 @@ Service SetFinalBinToBin(RTFId, MHUserId)
ErrorMessage = ''
If RTFId NE '' then
If RowExists('RETURN_TO_FAB_LOTS', RTFId) then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
RTFRecordComplete = RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>
If RTFRecordComplete NE True$ then
If MHUserId NE '' then
If RowExists('LSL_USERS', MHUserId) then
RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_USER_ID$> = MHUserId
RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_DTM$> = Datetime()
* RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$> = True$
* RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED_DTM$> = Datetime()
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage')
end
RTFCurrStep = Return_To_Fab_Services('GetRTFCurrStep', RTFId)
If RTFCurrStep EQ 5 then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
RTFRecordComplete = RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>
If RTFRecordComplete NE True$ then
If MHUserId NE '' then
If RowExists('LSL_USERS', MHUserId) then
If MemberOf(MHUserId, 'MATERIAL HANDLER') then
RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_USER_ID$> = MHUserId
RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_DTM$> = Datetime()
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error setting Final SAP Bin-to-Bin. User does not have permissions to perform this function. User must be apart of OI Security Group "MATERIAL HANDLER"'
end
end else
ErrorMessage = 'Error setting Final SAP Bin-to-Bin. Material Handler User ID was not found in OpenInsight.'
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Material Handler User ID was not found in OpenInsight.'
ErrorMessage = 'Error setting Final SAP Bin-to-Bin. Material Handler User ID was null.'
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Material Handler User ID was null.'
ErrorMessage = 'Error setting Final SAP Bin-to-Bin. Return to fab record has already been completed.'
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Return to fab record has already been completed.'
ErrorMessage = 'Error setting Final SAP Bin-to-Bin. Form is currently at step ': RTFCurrStep :'.'
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Return to fab record did not exists'
ErrorMessage = 'Error setting Final SAP Bin-to-Bin. Return to fab record did not exists'
end
end else
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Return to fab record id was null'
ErrorMessage = 'Error setting Final SAP Bin-to-Bin. Return to fab record id was null'
end
If ErrorMessage EQ '' then
LogData = ''
@ -700,18 +741,17 @@ Service AddMiscNote(RTFId, Note, UserId)
If RTFRecordComplete NE True$ then
If UserId NE '' then
If RowExists('LSL_USERS', UserId) then
RTFRecord<RETURN_TO_FAB_LOTS_NOTES$> = Insert(RTFRecord<RETURN_TO_FAB_LOTS_NOTES$>, 1, -1, 0, Note)
RTFRecord<RETURN_TO_FAB_LOTS_NOTES_USER$> = Insert(RTFRecord<RETURN_TO_FAB_LOTS_NOTES_USER$>, 1, -1, 0, UserId)
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage')
end
RTFRecord<RETURN_TO_FAB_LOTS_NOTES$> = Insert(RTFRecord<RETURN_TO_FAB_LOTS_NOTES$>, 1, -1, 0, Note)
RTFRecord<RETURN_TO_FAB_LOTS_NOTES_USER$> = Insert(RTFRecord<RETURN_TO_FAB_LOTS_NOTES_USER$>, 1, -1, 0, UserId)
Database_Services('WriteDataRow', 'RETURN_TO_FAB_LOTS', RTFId, RTFRecord, True$, False$, False$)
If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error adding note to RTF Record. User ID was not found in OpenInsight.'
end
end else
ErrorMessage = 'Error adding note to RTF Record. User ID was null.'
ErrorMessage = 'Error adding note to RTF Record. User ID was null.'
end
end else
ErrorMessage = 'Error adding note to RTF Record. Return to fab record has already been completed.'
@ -742,6 +782,28 @@ Service AddMiscNote(RTFId, Note, UserId)
end
end service
Service GetRTFCurrStep(RTFId)
CurrStep = 0
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId, True$, 0, False$)
If RTFRecord NE '' then
CurrStep = 1
If RTFRecord<RETURN_TO_FAB_LOTS_REASON$> NE '' then
//Skip 2 because step 2 is an adhoc step(printing a label)
CurrStep = 3
If RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_USER_ID$> NE '' then
CurrStep = 4
If RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$> NE '' AND RTFRecord<RETURN_TO_FAB_LOTS_EVAL_RESULT_ID$> NE 0 then
CurrStep = 5
If RTFRecord<RETURN_TO_FAB_LOTS_FINAL_COMPLETE_USER_ID$> NE '' then
CurrStep = 6
end
end
end
end
end
Response = CurrStep
end service
Service OpenOIWizardReturnToFabInBrowser(RTFId)
Command = 'explorer https://goto.infineon.com/oiwizard/returntofab/' : RTFId
SRP_Run_Command(Command)
@ -750,3 +812,4 @@ end service