Adding basic backend functionality to prod.
This commit is contained in:
parent
0eac3839ea
commit
860cab9f68
@ -1,16 +1,27 @@
|
||||
Compile function RETURN_TO_FAB_Services(@Service, @Params)
|
||||
#pragma precomp SRP_PreCompiler
|
||||
|
||||
Declare subroutine Error_Services, Database_Services, Btree.Extract
|
||||
Declare subroutine Error_Services, Database_Services, Btree.Extract, Logging_Services
|
||||
|
||||
Declare function Rti_Createguid, Database_Services, Return_To_Fab_Services, Datetime, Error_Services
|
||||
Declare function Logging_Services, Environment_Services
|
||||
|
||||
$insert LOGICAL
|
||||
$Insert APP_INSERTS
|
||||
$Insert RETURN_TO_FAB_LOTS_EQUATES
|
||||
$Insert RETURN_TO_FAB_RESULT_OPTION_EQUATES
|
||||
$Insert WO_MAT_EQUATES
|
||||
$Insert RDS_EQUATES
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\Return_To_Fab_Services'; //Define the directory where the log will be saved to. This happens the first time of the day that the log is written to.
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' ReturnToFabServicesLog.csv'
|
||||
Headers = 'Logging DTM' : @FM : 'Cass Id' : @FM: 'User' : @FM : 'ReturnToFabId' : @FM : 'Message'; //Define the column names in the log file, delimited by a Field Mark.
|
||||
objReturnToFabLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$); //Actually creates the log.
|
||||
|
||||
GoToService
|
||||
|
||||
Return Response or ""
|
||||
@ -73,9 +84,23 @@ Service CreateReturnToFabRecord(CassId, UserId)
|
||||
ErrorMessage = 'Error creating return to fab record, Cassette ID was null'
|
||||
end
|
||||
If ErrorMessage EQ '' AND NewRTFId NE '' then
|
||||
Response = NewRTFId
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = CassId
|
||||
LogData<3> = UserId
|
||||
LogData<4> = NewRTFId
|
||||
LogData<5> = 'Successfully created new RETURN_TO_FAB_LOTS record'
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
Response = NewRTFId
|
||||
end else
|
||||
//Todo Log error message
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = CassId
|
||||
LogData<3> = UserId
|
||||
LogData<4> = NewRTFId
|
||||
LogData<5> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
Response = NewRTFId
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
End Service
|
||||
@ -103,7 +128,6 @@ Service GetReturnToFabReasonOptions()
|
||||
If ErrorMessage EQ '' then
|
||||
Response = RTFReasons
|
||||
end else
|
||||
//Todo Log error message
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
end service
|
||||
@ -164,7 +188,6 @@ Service GetReturnToFabRecordIdByCassId(CassId)
|
||||
If ErrorMessage EQ '' then
|
||||
Response = RTFRecords
|
||||
end else
|
||||
//Todo Log error message
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
End Service
|
||||
@ -189,27 +212,35 @@ Service GetOpenReturnToFabRecordIdByCassId(CassId)
|
||||
If ErrorMessage EQ '' then
|
||||
Response = OpenRTFRecords
|
||||
end else
|
||||
//Todo Log error message
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
End Service
|
||||
|
||||
Service SetReasonForReturn(RTFId, Reason)
|
||||
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 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
|
||||
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. User not found in openinsight.'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Error setting return to fab reason. Reason was null.'
|
||||
ErrorMessage = 'Error setting return to fab reason. User ID was null.'
|
||||
end
|
||||
|
||||
end else
|
||||
ErrorMessage = 'Error setting return to fab reason. Return to fab record has already been completed.'
|
||||
end
|
||||
@ -219,9 +250,23 @@ Service SetReasonForReturn(RTFId, Reason)
|
||||
end else
|
||||
ErrorMessage = 'Error setting return to fab reason. Return to fab record id was null'
|
||||
end
|
||||
if ErrorMessage NE '' then
|
||||
//Todo Add loggging
|
||||
Error_Services('Add', ErrorMessage)
|
||||
if ErrorMessage EQ '' then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = UserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = 'Successfully set reason for return on RETURN_TO_FAB_LOTS record'
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = UserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
end service
|
||||
|
||||
@ -256,10 +301,24 @@ Service SetBinToBin(RTFId, MHUserId)
|
||||
end else
|
||||
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Return to fab record id was null'
|
||||
end
|
||||
if ErrorMessage NE '' then
|
||||
//Todo Add loggging
|
||||
If ErrorMessage EQ '' then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = MHUserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = 'Successfully set bin to bin complete on RETURN_TO_FAB_LOTS record'
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = MHUserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
end
|
||||
end service
|
||||
|
||||
Service SetEvalInfo(RTFId, EvalUserId, ResultId)
|
||||
@ -303,14 +362,28 @@ Service SetEvalInfo(RTFId, EvalUserId, ResultId)
|
||||
end else
|
||||
ErrorMessage = 'Error setting Eval. info. Return to fab id was null.'
|
||||
end
|
||||
If ErrorMessage NE '' then
|
||||
//Todo add logging
|
||||
If ErrorMessage EQ '' then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = EvalUserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = 'Successfully set evaluation result on RETURN_TO_FAB_LOTS record'
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = EvalUserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
end service
|
||||
|
||||
Service SetFinalBinToBin(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$)
|
||||
@ -342,14 +415,75 @@ Service SetFinalBinToBin(RTFId, MHUserId)
|
||||
end else
|
||||
ErrorMessage = 'Error setting Initial SAP Bin-to-Bin. Return to fab record id was null'
|
||||
end
|
||||
if ErrorMessage NE '' then
|
||||
//Todo Add loggging
|
||||
If ErrorMessage EQ '' then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = MHUserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = 'Successfully set final bin to bin on RETURN_TO_FAB_LOTS record'
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = MHUserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
end
|
||||
end service
|
||||
|
||||
Service AddMiscNote(RTFId, Note)
|
||||
|
||||
Service AddMiscNote(RTFId, Note, UserId)
|
||||
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
|
||||
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.'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Error adding note to RTF Record. Return to fab record has already been completed.'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Error adding note to RTF Record. Return to fab record did not exists'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Error adding note to RTF Record. Return to fab record id was null'
|
||||
end
|
||||
If ErrorMessage EQ '' then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = UserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = 'Successfully added note to RETURN_TO_FAB_LOTS record'
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||
LogData<2> = ''
|
||||
LogData<3> = UserId
|
||||
LogData<4> = RTFId
|
||||
LogData<5> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReturnToFabLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
end service
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
compile insert RETURN_TO_FAB_LOTS_EQUATES
|
||||
/*----------------------------------------
|
||||
Author : Table Create Insert Routine
|
||||
Written : 10/01/2025
|
||||
Written : 13/01/2025
|
||||
Description : Insert for Table RETURN_TO_FAB_LOTS
|
||||
----------------------------------------*/
|
||||
#ifndef __RETURN_TO_FAB_LOTS_EQUATES__
|
||||
@ -22,5 +22,6 @@ compile insert RETURN_TO_FAB_LOTS_EQUATES
|
||||
equ RETURN_TO_FAB_LOTS_COMPLETED_DTM$ to 14
|
||||
equ RETURN_TO_FAB_LOTS_REASON$ to 15
|
||||
equ RETURN_TO_FAB_LOTS_NOTES$ to 16
|
||||
equ RETURN_TO_FAB_LOTS_NOTES_USER$ to 17
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user