Changed VOID and PACKAGING LOT_EVENTS to COMMENT type events. Modified code to only add them if lot is in new LOT table.

This commit is contained in:
Infineon\StieberD
2025-08-20 16:27:11 -07:00
parent 1f2777cd18
commit 722bc63bdb
2 changed files with 62 additions and 66 deletions

View File

@ -712,7 +712,7 @@ Service CreatePackagingRecord(LotId, UserId, EqpId)
NewPackagingRec<PACKAGING_COMPLETE_DTM$> = TransDtm NewPackagingRec<PACKAGING_COMPLETE_DTM$> = TransDtm
Database_Services('WriteDataRow', 'PACKAGING', NewRecId, NewPackagingRec, True$, 0, False$) Database_Services('WriteDataRow', 'PACKAGING', NewRecId, NewPackagingRec, True$, 0, False$)
If Error_Services('NoError') then If Error_Services('NoError') then
Lot_Event_Services('CreateLotEvent', LotId, TransDtm, 'PACKAGING', 'Lot Packaged.', EqpId, UserId) Lot_Event_Services('CreateLotEvent', LotId, TransDtm, 'COMMENT', 'Lot Packaged.', EqpId, UserId)
end else end else
ErrorMessage = Error_Services('GetMessage') ErrorMessage = Error_Services('GetMessage')
end end
@ -765,5 +765,3 @@ Service AddPackToLotOperation(LotOperationId, PackagingId, UserId)
end service end service

View File

@ -1456,17 +1456,9 @@ Service CreateVoidedLotRecord(LotId, LegacyLotId, LegacyLotType, WoMatKey, UserI
if LegacyLotType NE '' then if LegacyLotType NE '' then
if LegacyLotType EQ 'RDS' OR LegacyLotType EQ 'WM_IN' OR LegacyLotType EQ 'WM_OUT' then if LegacyLotType EQ 'RDS' OR LegacyLotType EQ 'WM_IN' OR LegacyLotType EQ 'WM_OUT' then
LotId = Lot_Services('GetLotIdByLegacyLotIdAndType', LegacyLotId, LegacyLotType) LotId = Lot_Services('GetLotIdByLegacyLotIdAndType', LegacyLotId, LegacyLotType)
If Error_Services('NoError') then
If LotID EQ '' then
//No Lot ID was found, lets create one.
LotId = Lot_Services('CreateNewLot', 'RDS', '', '', '', '', '', UserId, '', LegacyLotId)
If Error_Services('HasError') then If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage') ErrorMessage = Error_Services('GetMessage')
end end
end
end else
ErrorMessage = Error_Services('GetMessage')
end
end else end else
ErrorMessage = 'Invalid Legacy Lot Type passed to routine.' ErrorMessage = 'Invalid Legacy Lot Type passed to routine.'
end end
@ -1475,8 +1467,7 @@ Service CreateVoidedLotRecord(LotId, LegacyLotId, LegacyLotType, WoMatKey, UserI
end end
end end
If ErrorMessage NE '' then If (ErrorMessage EQ '') then
If RowExists('LOT', LotId) then
NewVoidedLotId = RTI_CreateGUID() NewVoidedLotId = RTI_CreateGUID()
NewVoidedLotRec = '' NewVoidedLotRec = ''
NewVoidedLotRec<VOIDED_LOT_WORK_ORDER_LOG_ID$> = Field(WoMatKey, '*', 1) NewVoidedLotRec<VOIDED_LOT_WORK_ORDER_LOG_ID$> = Field(WoMatKey, '*', 1)
@ -1490,9 +1481,6 @@ Service CreateVoidedLotRecord(LotId, LegacyLotId, LegacyLotType, WoMatKey, UserI
If Error_Services('HasError') then If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage') ErrorMessage = Error_Services('GetMessage')
end end
end else
ErrorMessage = 'Unable to find lot record.'
end
end end
end else end else
ErrorMessage = 'Both the lot id and the legacy lot id were null.' ErrorMessage = 'Both the lot id and the legacy lot id were null.'
@ -1504,6 +1492,7 @@ Service CreateVoidedLotRecord(LotId, LegacyLotId, LegacyLotType, WoMatKey, UserI
end service end service
Service IsLotVoided(LotId) Service IsLotVoided(LotId)
//Todo: Move to Lot_Services //Todo: Move to Lot_Services
@ -1525,6 +1514,7 @@ Service IsLotVoided(LotId)
end service end service
Service SignVoidNonEpp(WOMatKeys, WONo, Username) Service SignVoidNonEpp(WOMatKeys, WONo, Username)
ErrorMessage = '' ErrorMessage = ''
@ -1545,9 +1535,14 @@ Service SignVoidNonEpp(WOMatKeys, WONo, Username)
if Error_Services('NoError') then if Error_Services('NoError') then
RDS_Services('DetachRDSFromWO', RDSNo) RDS_Services('DetachRDSFromWO', RDSNo)
If Error_Services('NoError') then If Error_Services('NoError') then
//Create a voided LOT record then record an event. // Create a voided LOT record.
Work_Order_Services('CreateVoidedLotRecord', '', RDSNo, 'RDS', WoMatKey, Username) Work_Order_Services('CreateVoidedLotRecord', '', RDSNo, 'RDS', WoMatKey, Username)
Lot_Event_Services('CreateLotEvent', RDSNo, Datetime(), 'VOID', 'Lot voided by ' : Username, '', Username, True$, 'RDS') LotId = Lot_Services('GetLotIdByLegacyLotIdAndType', RDSNo, 'RDS')
// Create a LOT_EVENT record if this lot is in the new LOT system.
If LotId NE '' then
Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'COMMENT', 'Lot voided by ' : Username, '', Username, True$, 'RDS')
If Error_Services('HasError') then ErrorMessage = Error_Services('GetMessage')
end
end else end else
ErrorMessage = Error_Services('GetMessage') ErrorMessage = Error_Services('GetMessage')
end end
@ -1610,9 +1605,15 @@ Service SignVoidWMI(WMInKeys, WONo, Username)
If Not(IsOnHold) then If Not(IsOnHold) then
WM_In_Services('SetVoidFlag', WmInKey, Username) WM_In_Services('SetVoidFlag', WmInKey, Username)
If Error_Services('NoError') then If Error_Services('NoError') then
Lot_Event_Services('CreateLotEvent', WmInKey, DateTime(), 'VOID', 'Lot voided by ' : Username, '', Username, True$, 'WM_IN')
Work_Order_Services('CreateVoidedLotRecord', '', WmInKey, 'WM_IN', WoMatKey, Username) Work_Order_Services('CreateVoidedLotRecord', '', WmInKey, 'WM_IN', WoMatKey, Username)
if Error_Services('NoError') then If Error_Services('NoError') then
LotId = Lot_Services('GetLotIdByLegacyLotIdAndType', WmInKey, 'WM_IN')
// Create a LOT_EVENT record if this lot is in the new LOT system.
If LotId NE '' then
Lot_Event_Services('CreateLotEvent', WmInKey, DateTime(), 'COMMENT', 'Lot voided by ' : Username, '', Username, True$, 'WM_IN')
If Error_Services('HasError') then ErrorMessage = Error_Services('GetMessage')
end
If ErrorMessage EQ '' then
//Check if WMO is also voided. If it is, remove it from the WO_MAT_KEY field in WO_LOG, and void the WO_MAT record //Check if WMO is also voided. If it is, remove it from the WO_MAT_KEY field in WO_LOG, and void the WO_MAT record
WMOKey = WMInKey; //the paired WMO key is the same as the WMIKey WMOKey = WMInKey; //the paired WMO key is the same as the WMIKey
IsWMOVoided = Database_Services('ReadDataColumn', 'WM_OUT', WMOKey, WM_OUT_VOID$) IsWMOVoided = Database_Services('ReadDataColumn', 'WM_OUT', WMOKey, WM_OUT_VOID$)
@ -1624,6 +1625,7 @@ Service SignVoidWMI(WMInKeys, WONo, Username)
ErrorMessage = 'Unable to locate WO_MAT key in WO_LOG record.' ErrorMessage = 'Unable to locate WO_MAT key in WO_LOG record.'
end end
end end
end
end else end else
ErrorMessage = Error_Services('GetMessage') ErrorMessage = Error_Services('GetMessage')
end end
@ -1683,7 +1685,7 @@ Service SignVoidWMO(WMOutKeys, WONo, Username)
ErrorMessage = '' ErrorMessage = ''
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WONo, True$, 0, False$) WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WONo, True$, 0, False$)
if Error_Services('NoError') then If Error_Services('NoError') then
for each WmOutKey in WMOutKeys using @VM for each WmOutKey in WMOutKeys using @VM
if WmOutKey NE '' then if WmOutKey NE '' then
WONo = Field(WmOutKey, '*', 1) WONo = Field(WmOutKey, '*', 1)
@ -1698,13 +1700,16 @@ Service SignVoidWMO(WMOutKeys, WONo, Username)
IsOnHold = Hold_Services('CheckForHold', WoMatKey) IsOnHold = Hold_Services('CheckForHold', WoMatKey)
If Not(IsOnHold) then If Not(IsOnHold) then
WM_Out_Services('SetVoidFlag', WmOutKey, Username) WM_Out_Services('SetVoidFlag', WmOutKey, Username)
If Error_Services('NoError') then If Error_Services('NoError') then
If Error_Services('NoError') then
If Error_Services('NoError') then
Lot_Event_Services('CreateLotEvent', WmOutKey, DateTime(), 'VOID', 'Lot voided by ' : Username, '', Username, True$, 'WM_OUT')
Work_Order_Services('CreateVoidedLotRecord', '', WmOutKey, 'WM_OUT', WoMatKey, Username) Work_Order_Services('CreateVoidedLotRecord', '', WmOutKey, 'WM_OUT', WoMatKey, Username)
if Error_Services('NoError') then If Error_Services('NoError') then
LotId = Lot_Services('GetLotIdByLegacyLotIdAndType', WmOutKey, 'WM_OUT')
// Create a LOT_EVENT record if this lot is in the new LOT system.
If LotId NE '' then
Lot_Event_Services('CreateLotEvent', WmOutKey, DateTime(), 'COMMENT', 'Lot voided by ' : Username, '', Username, True$, 'WM_OUT')
If Error_Services('HasError') then ErrorMessage = Error_Services('GetMessage')
end
If ErrorMessage EQ '' then
//Check if WMI is also voided. If it is, remove it from the WO_MAT_KEY field in WO_LOG, and void the WO_MAT record //Check if WMI is also voided. If it is, remove it from the WO_MAT_KEY field in WO_LOG, and void the WO_MAT record
WMIKey = WmOutKey; //the paired WMO key is the same as the WMIKey WMIKey = WmOutKey; //the paired WMO key is the same as the WMIKey
IsWMIVoided = Database_Services('ReadDataColumn', 'WM_IN', WMOKey, WM_IN_VOID$) IsWMIVoided = Database_Services('ReadDataColumn', 'WM_IN', WMOKey, WM_IN_VOID$)
@ -1716,8 +1721,6 @@ Service SignVoidWMO(WMOutKeys, WONo, Username)
ErrorMessage = 'Unable to locate WO_MAT key in WO_LOG record.' ErrorMessage = 'Unable to locate WO_MAT key in WO_LOG record.'
end end
end end
end else
ErrorMessage = Error_Services('GetMessage')
end end
end else end else
ErrorMessage = Error_Services('GetMessage') ErrorMessage = Error_Services('GetMessage')
@ -1725,10 +1728,6 @@ Service SignVoidWMO(WMOutKeys, WONo, Username)
end else end else
ErrorMessage = Error_Services('GetMessage') ErrorMessage = Error_Services('GetMessage')
end end
end else
ErrorMessage = Error_Services('GetMessage')
end
end end
end else end else
ErrorMessage = 'Unable to void lot as it is already voided.' ErrorMessage = 'Unable to void lot as it is already voided.'
@ -2326,4 +2325,3 @@ ClearCursors:
return return