Merged PR 14215: Lot Last Event Datetime

Added field to lot table to store most recent event id. Maintained column by writing to it upon successful creation of a lot event. Added the most recent event dtm to the json object for lot records. Added related text view in NDW_VIEW_LOT form and method to read that data and populate the field.

Related work items: #249625
This commit is contained in:
Ouellette Jonathan (CSC FI SPS MESLEO)
2025-04-01 19:27:10 +02:00
parent 999e11b1b8
commit c477b8df58
4 changed files with 1904 additions and 1606 deletions

View File

@ -941,6 +941,13 @@ Service CreateLotEvent(LotId, LotType=LOT_TYPES, EventDatetime, EventType=EVENT_
Case Otherwise$
ErrorMessage = 'Error in Create Lot Event routine, An invalid lot type was passed to routine.'
End Case
If Assigned(NewEventId) AND Assigned(LotId) then
If RowExists('LOT_EVENT', NewEventId) AND RowExists('LOT', LotId) then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId, True$, 0, False$)
LotRec<LOT_MOST_RECENT_LOT_EVENT_ID$> = NewEventId
Database_Services('WriteDataRow', 'LOT', LotId, LotRec)
end
end
end else
ErrorMessage = 'Error in Create Lot Event routine, A null value for Lot Id was passed to routine.'
end
@ -1027,6 +1034,10 @@ Service ConvertLotRecordToJson(LotId, ItemURL, CurrUser, FullObject=BOOLEAN)
CurrOperation = Lot_Services('GetLotCurrOperationId', LotId)
CurrOperation = Field(CurrOperation, '*', 2)
SRP_JSON(objLot, 'SetValue', 'CurrOperation', CurrOperation)
MostRecentEventId = LotRec<LOT_MOST_RECENT_LOT_EVENT_ID$>
MostRecentEventDtmIConv = Xlate('LOT_EVENT', MostRecentEventId, LOT_EVENT_EVENT_DATETIME$, 'X')
MostRecentEventDtmOConv = OConv(MostRecentEventDtmIConv, 'DT')
SRP_JSON(objLot, 'SetValue', 'MostRecentEventDateTime', MostRecentEventDtmOConv)
If FullObject then
//Events Array
EventsArrayJson = ''
@ -1423,3 +1434,4 @@ end service