diff --git a/LSL2/STPROC/PACKAGING_SERVICES.txt b/LSL2/STPROC/PACKAGING_SERVICES.txt index 650c2a0..96a2e0d 100644 --- a/LSL2/STPROC/PACKAGING_SERVICES.txt +++ b/LSL2/STPROC/PACKAGING_SERVICES.txt @@ -712,7 +712,7 @@ Service CreatePackagingRecord(LotId, UserId, EqpId) NewPackagingRec = TransDtm Database_Services('WriteDataRow', 'PACKAGING', NewRecId, NewPackagingRec, True$, 0, False$) 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 ErrorMessage = Error_Services('GetMessage') end @@ -765,5 +765,3 @@ Service AddPackToLotOperation(LotOperationId, PackagingId, UserId) end service - - diff --git a/LSL2/STPROC/WORK_ORDER_SERVICES.txt b/LSL2/STPROC/WORK_ORDER_SERVICES.txt index 85b7854..1477ebf 100644 --- a/LSL2/STPROC/WORK_ORDER_SERVICES.txt +++ b/LSL2/STPROC/WORK_ORDER_SERVICES.txt @@ -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 = Field(WoMatKey, '*', 1) - NewVoidedLotRec = UserId - NewVoidedLotRec = Datetime() - NewVoidedLotRec = LegacyLotType - NewVoidedLotRec = LotId - NewVoidedLotRec = LegacyLotId - NewVoidedLotRec = 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 = Field(WoMatKey, '*', 1) + NewVoidedLotRec = UserId + NewVoidedLotRec = Datetime() + NewVoidedLotRec = LegacyLotType + NewVoidedLotRec = LotId + NewVoidedLotRec = LegacyLotId + NewVoidedLotRec = 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 using @VM setting CassPos then - WoLogRecord = Delete(WOLogRecord, 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 using @VM setting CassPos then + WoLogRecord = Delete(WOLogRecord, 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 using @VM setting CassPos then - WoLogRecord = Delete(WOLogRecord, 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 using @VM setting CassPos then + WoLogRecord = Delete(WOLogRecord, 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 -