Merged PR 13813: Lot void routines enhancement
Lot void routines enhancement Related work items: #110807
This commit is contained in:
parent
507c6bffba
commit
b76db6bc72
@ -45,13 +45,16 @@ $insert LOGICAL
|
||||
$insert RLIST_EQUATES
|
||||
$insert COMPANY_EQUATES
|
||||
$Insert NOTIFICATION_EQUATES
|
||||
$Insert WM_IN_EQUATES
|
||||
$Insert WM_OUT_EQUATES
|
||||
|
||||
Declare subroutine Error_Services, Work_Order_Services, Memory_Services, RList, Database_Services, SRP_JSON
|
||||
Declare subroutine Btree.Extract, Set_Status, obj_WO_Log, obj_Notes, Print_Wo_Mat_In_Labels, Print_Wo_Mat_Out_Labels
|
||||
Declare subroutine Print_Wmi_Labels, Print_Wmo_Labels, ErrMsg, Print_Cass_Labels, Logging_Services
|
||||
Declare subroutine Print_Wmi_Labels, Print_Wmo_Labels, ErrMsg, Print_Cass_Labels, Logging_Services, Service_Services
|
||||
Declare subroutine obj_WO_Mat_Log, WO_MAT_SERVICES
|
||||
Declare function SRP_Array, Work_Order_Services, Memory_Services, Database_Services, SRP_Sort_Array, SRP_JSON
|
||||
Declare function Company_Services, obj_Prod_Spec, Schedule_Services, Datetime, obj_WO_Log, obj_WO_Step, Memberof
|
||||
Declare function Environment_Services, Logging_Services
|
||||
Declare function Environment_Services, Logging_Services, Hold_Services
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
@ -60,6 +63,13 @@ LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Re
|
||||
Headers = 'Logging DTM' : @FM : 'User' : @FM : 'Notes'
|
||||
objReleaseLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$)
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Void Log.csv'
|
||||
Headers = 'Logging DTM' : @FM : 'User' : @FM : 'CassetteId' : @FM : 'Notes'
|
||||
objVoidLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$)
|
||||
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
GoToService else
|
||||
@ -1044,6 +1054,263 @@ Service ConvertRecordToJSON(WONo, Record, ItemURL)
|
||||
Response = jsonRecord
|
||||
end service
|
||||
|
||||
Service RemoveWoMatCassetteFromWO(WoMatKey, Username)
|
||||
ErrorMessage = ''
|
||||
If RowExists('WO_MAT', WoMatKey) then
|
||||
WoNo = Field(WoMatKey, '*', 1)
|
||||
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WoNo, True$, 0, False$)
|
||||
If Error_Services('NoError') then
|
||||
WoMatKeys = WOLogRecord<WO_LOG_WO_MAT_KEY$>
|
||||
Locate WoMatKey in WoMatKeys using @VM setting CassPos then
|
||||
WoLogRecord<WO_LOG_WO_MAT_KEY$> = Delete(WOLogRecord<WO_LOG_WO_MAT_KEY$>, 1, CassPos, 0)
|
||||
Database_Services('WriteDataRow', 'WO_LOG', WoNo, WoLogRecord)
|
||||
If Error_Services('NoError') then
|
||||
Work_Order_Services('UpdateReceivedQty', WONo)
|
||||
Work_Order_Services('UpdateReleasedQty', WONo)
|
||||
Work_Order_Services('UpdateUnscheduledQuantities')
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = "Unable to locate cass no " : WoMatKey : ' in the WO_LOG ' : WoNo : ' Record.'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Invalid WoMat Key ' : WoMatKey : ' passed to RemoveWoMatCassetteFromWO routine.'
|
||||
end
|
||||
If ErrorMessage NE '' then
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
end service
|
||||
|
||||
Service SignVoidNonEpp(WOMatKey, Username)
|
||||
ErrorMessage = ''
|
||||
WONo = Field(WOMatKey, '*', 1)
|
||||
CassNo = Field(WoMatKey, '*', 2)
|
||||
ReactType = XLATE('WO_LOG', WONo, WO_LOG_REACT_TYPE$, 'X')
|
||||
If ReactType EQ 'ASM' OR ReactType EQ 'ASM+' OR ReactType EQ 'HTR' then
|
||||
RDSNo = Database_Services('ReadDataColumn', 'WO_MAT', WoMatKey, WO_MAT_RDS_NO$, True$, 0, False$)
|
||||
If Error_Services('NoError') then
|
||||
WoMatRec = Database_Services('ReadDataRow', 'WO_MAT', WoMatKey, True$, 0, False$)
|
||||
IsVoided = WoMatRec<WO_MAT_VOID$>
|
||||
If Not(IsVoided) then
|
||||
IsOnHold = Hold_Services('CheckForHold', WoMatKey)
|
||||
If Not(IsOnHold) then
|
||||
Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'RemoveWoMatCassetteFromWO':@vm:WOMatKey:@vm:Username)
|
||||
If Error_Services('NoError') then
|
||||
Service_Services('PostProcedure', 'WO_MAT_SERVICES', 'SetWoMatVoidFlag':@vm:WOMatKey:@VM:Username)
|
||||
if Error_Services('NoError') then
|
||||
Service_Services('PostProcedure', 'RDS_SERVICES', 'DetachRDSFromWO':@vm:RDSNo)
|
||||
If Error_Services('NoError') then
|
||||
LotEventParams = ''
|
||||
LotEventParams<1,1> = 'CreateLotEvent'
|
||||
LotEventParams<1,4> = DateTime()
|
||||
LotEventParams<1,5> = 'VOID'
|
||||
LotEventParams<1,6> = 'Lot voided by ' : Username
|
||||
LotEventParams<1,11> = Username
|
||||
If RDSNo NE '' then
|
||||
LotEventParams<1,2> = RDSNo
|
||||
LotEventParams<1,3> = 'RDS'
|
||||
Service_Services('PostProcedure', 'LOT_SERVICES', LotEventParams)
|
||||
end else
|
||||
LotEventParams<1,2> = WoMatKey
|
||||
LotEventParams<1,3> = 'WO_MAT'
|
||||
Service_Services('PostProcedure', 'LOT_SERVICES', LotEventParams)
|
||||
end
|
||||
If Error_Services('NoError') then
|
||||
//Add inventory transaction
|
||||
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Unable to void lot as it is already voided.'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Cannot use this routine to void EpiPro lots.'
|
||||
end
|
||||
|
||||
If ErrorMessage NE '' then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM
|
||||
LogData<2> = Username
|
||||
LogData<3> = WOMatKey
|
||||
LogData<4> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM
|
||||
LogData<2> = Username
|
||||
LogData<3> = WOMatKey
|
||||
LogData<4> = 'Void queued successfully.'
|
||||
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
Service SignVoidWMI(WMInKey, Username)
|
||||
ErrorMessage = ''
|
||||
WONo = Field(WMInKey, '*', 1)
|
||||
CassNo = Field(WMInKey, '*', 3)
|
||||
WoStepKey = Xlate('WO_LOG', WONo, WO_LOG_WO_STEP_KEY$, 'X')
|
||||
WoMatKey = WONo : '*' : CassNo
|
||||
ReactType = XLATE('WO_LOG', WONo, WO_LOG_REACT_TYPE$, 'X')
|
||||
If ReactType EQ 'EPP' then
|
||||
WMInRec = Database_Services('ReadDataRow', 'WM_IN', WMInKey, True$, 0, False$)
|
||||
IsVoided = WMInRec<WM_IN_VOID$>
|
||||
If Not(IsVoided) then
|
||||
IsOnHold = Hold_Services('CheckForHold', WoMatKey)
|
||||
If Not(IsOnHold) then
|
||||
Service_Services('PostProcedure', 'WM_IN_SERVICES', 'SetVoidFlag':@vm:WMInKey:@VM:Username)
|
||||
If Error_Services('NoError') then
|
||||
LotEventParams = ''
|
||||
LotEventParams<1,1> = 'CreateLotEvent'
|
||||
LotEventParams<1,4> = DateTime()
|
||||
LotEventParams<1,5> = 'VOID'
|
||||
LotEventParams<1,6> = 'Lot voided by ' : Username
|
||||
LotEventParams<1,11> = Username
|
||||
LotEventParams<1,2> = WMInKey
|
||||
LotEventParams<1,3> = 'WM_IN'
|
||||
Service_Services('PostProcedure', 'LOT_SERVICES', LotEventParams)
|
||||
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
|
||||
Service_Services('PostProcedure', 'WO_MAT_SERVICES', 'SetWoMatVoidFlag':@VM:WoMatKey:@VM:Username)
|
||||
If Error_Services('NoError') then
|
||||
Service_Services('PostProcedure', 'WORK_ORDER_SERVICES','RemoveWoMatCassetteFromWO':@VM:WoMatKey:@VM:Username)
|
||||
If Error_Services('HasError') then
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Unable to void lot as it is already voided.'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Cannot use this routine to void EpiPro lots.'
|
||||
end
|
||||
|
||||
If ErrorMessage NE '' then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM
|
||||
LogData<2> = Username
|
||||
LogData<3> = WMInKey
|
||||
LogData<4> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM
|
||||
LogData<2> = Username
|
||||
LogData<3> = WMInKey
|
||||
LogData<4> = 'Void queued successfully.'
|
||||
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
Service SignVoidWMO(WMOutKey, Username)
|
||||
ErrorMessage = ''
|
||||
WONo = Field(WMOutKey, '*', 1)
|
||||
CassNo = Field(WMOutKey, '*', 3)
|
||||
WoStepKey = Xlate('WO_LOG', WONo, WO_LOG_WO_STEP_KEY$, 'X')
|
||||
WoMatKey = WONo : '*' : CassNo
|
||||
ReactType = XLATE('WO_LOG', WONo, WO_LOG_REACT_TYPE$, 'X')
|
||||
If ReactType EQ 'EPP' then
|
||||
WMOutRec = Database_Services('ReadDataRow', 'WM_OUT', WMOutKey, True$, 0, False$)
|
||||
IsVoided = WMOutRec<WM_OUT_VOID$>
|
||||
If Not(IsVoided) then
|
||||
IsOnHold = Hold_Services('CheckForHold', WoMatKey)
|
||||
If Not(IsOnHold) then
|
||||
Service_Services('PostProcedure', 'WM_OUT_SERVICES', 'SetVoidFlag':@vm:WMOutKey:@VM:Username)
|
||||
If Error_Services('NoError') then
|
||||
LotEventParams = ''
|
||||
LotEventParams<1,1> = 'CreateLotEvent'
|
||||
LotEventParams<1,4> = DateTime()
|
||||
LotEventParams<1,5> = 'VOID'
|
||||
LotEventParams<1,6> = 'Lot voided by ' : Username
|
||||
LotEventParams<1,11> = Username
|
||||
LotEventParams<1,2> = WMOutKey
|
||||
LotEventParams<1,3> = 'WM_OUT'
|
||||
Service_Services('PostProcedure', 'LOT_SERVICES', LotEventParams)
|
||||
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', WMIKey, WM_IN_VOID$)
|
||||
If IsWMIVoided then
|
||||
Service_Services('PostProcedure', 'WO_MAT_SERVICES', 'SetWoMatVoidFlag':@VM:WoMatKey:@VM:Username)
|
||||
If Error_Services('NoError') then
|
||||
Service_Services('PostProcedure', 'WORK_ORDER_SERVICES','RemoveWoMatCassetteFromWO':@VM:WoMatKey:@VM:Username)
|
||||
If Error_Services('HasError') then
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Unable to void lot as it is already voided.'
|
||||
end
|
||||
end else
|
||||
ErrorMessage = 'Cannot use this routine to void EpiPro lots.'
|
||||
end
|
||||
|
||||
If ErrorMessage NE '' then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM
|
||||
LogData<2> = Username
|
||||
LogData<3> = WMOutKey
|
||||
LogData<4> = ErrorMessage
|
||||
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM
|
||||
LogData<2> = Username
|
||||
LogData<3> = WMOutKey
|
||||
LogData<4> = 'Void queued successfully.'
|
||||
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
|
||||
Error_Services('Add', ErrorMessage)
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal GoSubs
|
||||
@ -1055,3 +1322,5 @@ ClearCursors:
|
||||
Next counter
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user