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:
@ -1456,15 +1456,7 @@ Service CreateVoidedLotRecord(LotId, LegacyLotId, LegacyLotType, WoMatKey, UserI
|
||||
if LegacyLotType NE '' then
|
||||
if LegacyLotType EQ 'RDS' OR LegacyLotType EQ 'WM_IN' OR LegacyLotType EQ 'WM_OUT' then
|
||||
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
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end
|
||||
end else
|
||||
If Error_Services('HasError') then
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
@ -1475,23 +1467,19 @@ Service CreateVoidedLotRecord(LotId, LegacyLotId, LegacyLotType, WoMatKey, UserI
|
||||
end
|
||||
end
|
||||
|
||||
If ErrorMessage NE '' then
|
||||
If RowExists('LOT', LotId) then
|
||||
NewVoidedLotId = RTI_CreateGUID()
|
||||
NewVoidedLotRec = ''
|
||||
NewVoidedLotRec<VOIDED_LOT_WORK_ORDER_LOG_ID$> = Field(WoMatKey, '*', 1)
|
||||
NewVoidedLotRec<VOIDED_LOT_VOID_BY$> = UserId
|
||||
NewVoidedLotRec<VOIDED_LOT_VOID_DTM$> = Datetime()
|
||||
NewVoidedLotRec<VOIDED_LOT_ENTITY_TYPE$> = LegacyLotType
|
||||
NewVoidedLotRec<VOIDED_LOT_LOT_ID$> = LotId
|
||||
NewVoidedLotRec<VOIDED_LOT_LEGACY_LOT_ID$> = LegacyLotId
|
||||
NewVoidedLotRec<VOIDED_LOT_WO_MAT_KEY$> = WoMatKey
|
||||
Database_Services('WriteDataRow', 'VOIDED_LOT', NewVoidedLotId, NewVoidedLotRec)
|
||||
If Error_Services('HasError') then
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Unable to find lot record.'
|
||||
If (ErrorMessage EQ '') then
|
||||
NewVoidedLotId = RTI_CreateGUID()
|
||||
NewVoidedLotRec = ''
|
||||
NewVoidedLotRec<VOIDED_LOT_WORK_ORDER_LOG_ID$> = Field(WoMatKey, '*', 1)
|
||||
NewVoidedLotRec<VOIDED_LOT_VOID_BY$> = UserId
|
||||
NewVoidedLotRec<VOIDED_LOT_VOID_DTM$> = Datetime()
|
||||
NewVoidedLotRec<VOIDED_LOT_ENTITY_TYPE$> = LegacyLotType
|
||||
NewVoidedLotRec<VOIDED_LOT_LOT_ID$> = LotId
|
||||
NewVoidedLotRec<VOIDED_LOT_LEGACY_LOT_ID$> = LegacyLotId
|
||||
NewVoidedLotRec<VOIDED_LOT_WO_MAT_KEY$> = WoMatKey
|
||||
Database_Services('WriteDataRow', 'VOIDED_LOT', NewVoidedLotId, NewVoidedLotRec)
|
||||
If Error_Services('HasError') then
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end
|
||||
end else
|
||||
@ -1504,6 +1492,7 @@ Service CreateVoidedLotRecord(LotId, LegacyLotId, LegacyLotType, WoMatKey, UserI
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service IsLotVoided(LotId)
|
||||
|
||||
//Todo: Move to Lot_Services
|
||||
@ -1525,6 +1514,7 @@ Service IsLotVoided(LotId)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service SignVoidNonEpp(WOMatKeys, WONo, Username)
|
||||
|
||||
ErrorMessage = ''
|
||||
@ -1545,9 +1535,14 @@ Service SignVoidNonEpp(WOMatKeys, WONo, Username)
|
||||
if Error_Services('NoError') then
|
||||
RDS_Services('DetachRDSFromWO', RDSNo)
|
||||
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)
|
||||
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
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
@ -1610,20 +1605,27 @@ Service SignVoidWMI(WMInKeys, WONo, Username)
|
||||
If Not(IsOnHold) then
|
||||
WM_In_Services('SetVoidFlag', WmInKey, Username)
|
||||
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)
|
||||
if Error_Services('NoError') 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
|
||||
WMOKey = WMInKey; //the paired WMO key is the same as the WMIKey
|
||||
IsWMOVoided = Database_Services('ReadDataColumn', 'WM_OUT', WMOKey, WM_OUT_VOID$)
|
||||
If IsWMOVoided then
|
||||
Locate WoMatKey in WoLogRecord<WO_LOG_WO_MAT_KEY$> using @VM setting CassPos then
|
||||
WoLogRecord<WO_LOG_WO_MAT_KEY$> = Delete(WOLogRecord<WO_LOG_WO_MAT_KEY$>, 1, CassPos, 0)
|
||||
WO_Mat_Services('SetWoMatVoidFlag', WoMatKey, Username)
|
||||
end else
|
||||
ErrorMessage = 'Unable to locate WO_MAT key in WO_LOG record.'
|
||||
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
|
||||
WMOKey = WMInKey; //the paired WMO key is the same as the WMIKey
|
||||
IsWMOVoided = Database_Services('ReadDataColumn', 'WM_OUT', WMOKey, WM_OUT_VOID$)
|
||||
If IsWMOVoided then
|
||||
Locate WoMatKey in WoLogRecord<WO_LOG_WO_MAT_KEY$> using @VM setting CassPos then
|
||||
WoLogRecord<WO_LOG_WO_MAT_KEY$> = Delete(WOLogRecord<WO_LOG_WO_MAT_KEY$>, 1, CassPos, 0)
|
||||
WO_Mat_Services('SetWoMatVoidFlag', WoMatKey, Username)
|
||||
end else
|
||||
ErrorMessage = 'Unable to locate WO_MAT key in WO_LOG record.'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
@ -1683,7 +1685,7 @@ Service SignVoidWMO(WMOutKeys, WONo, Username)
|
||||
ErrorMessage = ''
|
||||
|
||||
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
|
||||
if WmOutKey NE '' then
|
||||
WONo = Field(WmOutKey, '*', 1)
|
||||
@ -1698,34 +1700,31 @@ Service SignVoidWMO(WMOutKeys, WONo, Username)
|
||||
IsOnHold = Hold_Services('CheckForHold', WoMatKey)
|
||||
If Not(IsOnHold) then
|
||||
WM_Out_Services('SetVoidFlag', WmOutKey, Username)
|
||||
|
||||
If Error_Services('NoError') then
|
||||
Work_Order_Services('CreateVoidedLotRecord', '', WmOutKey, 'WM_OUT', WoMatKey, Username)
|
||||
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)
|
||||
if Error_Services('NoError') 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
|
||||
WMIKey = WmOutKey; //the paired WMO key is the same as the WMIKey
|
||||
IsWMIVoided = Database_Services('ReadDataColumn', 'WM_IN', WMOKey, WM_IN_VOID$)
|
||||
If IsWMIVoided then
|
||||
Locate WoMatKey in WoLogRecord<WO_LOG_WO_MAT_KEY$> using @VM setting CassPos then
|
||||
WoLogRecord<WO_LOG_WO_MAT_KEY$> = Delete(WOLogRecord<WO_LOG_WO_MAT_KEY$>, 1, CassPos, 0)
|
||||
WO_Mat_Services('SetWoMatVoidFlag', WoMatKey, Username)
|
||||
end else
|
||||
ErrorMessage = 'Unable to locate WO_MAT key in WO_LOG record.'
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
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
|
||||
WMIKey = WmOutKey; //the paired WMO key is the same as the WMIKey
|
||||
IsWMIVoided = Database_Services('ReadDataColumn', 'WM_IN', WMOKey, WM_IN_VOID$)
|
||||
If IsWMIVoided then
|
||||
Locate WoMatKey in WoLogRecord<WO_LOG_WO_MAT_KEY$> using @VM setting CassPos then
|
||||
WoLogRecord<WO_LOG_WO_MAT_KEY$> = Delete(WOLogRecord<WO_LOG_WO_MAT_KEY$>, 1, CassPos, 0)
|
||||
WO_Mat_Services('SetWoMatVoidFlag', WoMatKey, Username)
|
||||
end else
|
||||
ErrorMessage = 'Unable to locate WO_MAT key in WO_LOG record.'
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
@ -2326,4 +2325,3 @@ ClearCursors:
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user