refactored quantity update services to not lock the work order record
This commit is contained in:
parent
c477b8df58
commit
72df0cbe37
@ -51,7 +51,7 @@ $Insert WM_OUT_EQUATES
|
|||||||
Declare subroutine Error_Services, Work_Order_Services, Memory_Services, RList, Database_Services, SRP_JSON
|
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 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, Service_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 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 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 Company_Services, obj_Prod_Spec, Schedule_Services, Datetime, obj_WO_Log, obj_WO_Step, Memberof
|
||||||
Declare function Environment_Services, Logging_Services, Hold_Services
|
Declare function Environment_Services, Logging_Services, Hold_Services
|
||||||
@ -631,8 +631,6 @@ Service ReleaseCassettes(WONo)
|
|||||||
|
|
||||||
CassCnt = DCount(CassList, @VM)
|
CassCnt = DCount(CassList, @VM)
|
||||||
|
|
||||||
//(SAPCassIDs<0, I> = '')
|
|
||||||
|
|
||||||
UnReleasedCassNos = ''
|
UnReleasedCassNos = ''
|
||||||
For I = 1 to CassCnt
|
For I = 1 to CassCnt
|
||||||
If ( (RelDTMs<0, I> = '') and (CassStatus<0, I> EQ '') ) then
|
If ( (RelDTMs<0, I> = '') and (CassStatus<0, I> EQ '') ) then
|
||||||
@ -705,7 +703,7 @@ Service ReleaseCassettes(WONo)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Work_Order_Services('UpdateReleasedQty', WONo)
|
Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateReleasedQty':@VM:WONo)
|
||||||
|
|
||||||
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
||||||
Response = DCount(UnReleasedCassNos, @VM)
|
Response = DCount(UnReleasedCassNos, @VM)
|
||||||
@ -831,8 +829,6 @@ Service UpdateWOStepStatus(WONo)
|
|||||||
WOStepKey = WONo:'*':1
|
WOStepKey = WONo:'*':1
|
||||||
WOStepRec = Database_Services('ReadDataRow', 'WO_STEP', WOStepKey)
|
WOStepRec = Database_Services('ReadDataRow', 'WO_STEP', WOStepKey)
|
||||||
WOStepCurrStatus = obj_WO_Step('CurrStatus', WOStepKey:@RM:WOStepRec)
|
WOStepCurrStatus = obj_WO_Step('CurrStatus', WOStepKey:@RM:WOStepRec)
|
||||||
* HaveLock = Database_Services('GetKeyIDLock', 'WO_STEP', WOStepKey)
|
|
||||||
* If HaveLock then
|
|
||||||
// Get a fresh copy of the record
|
// Get a fresh copy of the record
|
||||||
WOStepRec = Database_Services('ReadDataRow', 'WO_STEP', WOStepKey)
|
WOStepRec = Database_Services('ReadDataRow', 'WO_STEP', WOStepKey)
|
||||||
WOStepCurrStatusStatic = WOStepRec<WO_STEP_CURR_STATUS_STATIC$>
|
WOStepCurrStatusStatic = WOStepRec<WO_STEP_CURR_STATUS_STATIC$>
|
||||||
@ -841,10 +837,6 @@ Service UpdateWOStepStatus(WONo)
|
|||||||
Database_Services('WriteDataRow', 'WO_STEP', WOStepKey, WOStepRec, True$, False$, True$)
|
Database_Services('WriteDataRow', 'WO_STEP', WOStepKey, WOStepRec, True$, False$, True$)
|
||||||
end
|
end
|
||||||
Database_Services('ReleaseKeyIDLock', 'WO_STEP', WOStepKey)
|
Database_Services('ReleaseKeyIDLock', 'WO_STEP', WOStepKey)
|
||||||
* end else
|
|
||||||
* // Failed to lock record for update. Throw an error to keep the request in the queue.
|
|
||||||
* Error_Services('Add', 'Failed to lock WO_STEP record ':WOStepKey:' in ':Service:' service.')
|
|
||||||
* end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end service
|
end service
|
||||||
@ -933,18 +925,66 @@ end service
|
|||||||
|
|
||||||
Service UpdateReleasedQty(WONo)
|
Service UpdateReleasedQty(WONo)
|
||||||
|
|
||||||
|
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] : ' Update Released Qty Log.csv'
|
||||||
|
Headers = 'Logging DTM' : @FM : 'WONo' : @FM : 'Notes'
|
||||||
|
objUpRelLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$)
|
||||||
|
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||||
|
|
||||||
|
ErrorMsg = ''
|
||||||
|
If WONo NE '' then
|
||||||
|
If RowExists('WO_LOG', WONo) then
|
||||||
WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo)
|
WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo)
|
||||||
If Error_Services('NoError') then
|
If Error_Services('NoError') then
|
||||||
RelQty = obj_WO_Log('RelQty', WONo:@RM:WORec)
|
RelQty = obj_WO_Log('RelQty', WONo:@RM:WORec)
|
||||||
WORec<WO_LOG_REL_QTY_STATIC$> = RelQty
|
|
||||||
WOQty = WORec<WO_LOG_QTY$>
|
WOQty = WORec<WO_LOG_QTY$>
|
||||||
If RelQty GT WOQty then
|
If RelQty GT WOQty then
|
||||||
UnRelQty = 0
|
UnRelQty = 0
|
||||||
end else
|
end else
|
||||||
UnRelQty = WOQty - RelQty
|
UnRelQty = WOQty - RelQty
|
||||||
end
|
end
|
||||||
WORec<WO_LOG_UNREL_QTY_STATIC$> = UnRelQty
|
Open 'WO_LOG' to hTable then
|
||||||
Database_Services('WriteDataRow', 'WO_LOG', WONo, WORec, True$, False$, False$)
|
WriteV RelQty on hTable, WONo, WO_LOG_REL_QTY_STATIC$ then
|
||||||
|
WriteV UnRelQty on hTable, WONo, WO_LOG_UNREL_QTY_STATIC$ else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to write unreleased quantity ':UnRelQty
|
||||||
|
ErrorMsg := ' to the UNREL_QTY_STATIC field of WO_LOG record ':WONo:'.'
|
||||||
|
ErrorMsg := '@FILE_ERROR: ':@FILE_ERROR
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to write released quantity ':RelQty
|
||||||
|
ErrorMsg := ' to the REL_QTY_STATIC field of WO_LOG record ':WONo:'.'
|
||||||
|
ErrorMsg := '@FILE_ERROR: ':@FILE_ERROR
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to open the WO_LOG table.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. '
|
||||||
|
ErrorMsg := 'Error message: ':Error_Services('GetMessage')
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. ':WONo:' does not exist in the WO_LOG table.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Null WONo passed into service'
|
||||||
|
end
|
||||||
|
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = LoggingDtm
|
||||||
|
LogData<2> = WONo
|
||||||
|
If ErrorMsg EQ '' then
|
||||||
|
LogResult = 'Successfully updated WO_LOG record ':WONo:' field REL_QTY_STATIC with released quantity ':RelQty
|
||||||
|
LogResult := ' and field UNREL_QTY_STATIC with unreleased quantity ':UnRelQty:'.'
|
||||||
|
LogData<3> = LogResult
|
||||||
|
Logging_Services('AppendLog', objUpRelLog, LogData, @RM, @FM)
|
||||||
|
end else
|
||||||
|
LogResult = 'Failed to update WO_LOG record ':WONo:' field REL_QTY_STATIC with released quantity ':RelQty
|
||||||
|
LogResult := ' or field UNREL_QTY_STATIC with unreleased quantity ':UnRelQty:'. Error message: ':ErrorMsg
|
||||||
|
LogData<3> = LogResult
|
||||||
|
Logging_Services('AppendLog', objUpRelLog, LogData, @RM, @FM)
|
||||||
|
Error_Services('Add', ErrorMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
end service
|
end service
|
||||||
@ -952,11 +992,52 @@ end service
|
|||||||
|
|
||||||
Service UpdateReceivedQty(WONo)
|
Service UpdateReceivedQty(WONo)
|
||||||
|
|
||||||
|
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] : ' Update Received Qty Log.csv'
|
||||||
|
Headers = 'Logging DTM' : @FM : 'WONo' : @FM : 'Notes'
|
||||||
|
objUpRecLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$)
|
||||||
|
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||||
|
|
||||||
|
ErrorMsg = ''
|
||||||
|
If WONo NE '' then
|
||||||
|
If RowExists('WO_LOG', WONo) then
|
||||||
WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo)
|
WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo)
|
||||||
If Error_Services('NoError') then
|
If Error_Services('NoError') then
|
||||||
RXQty = obj_WO_Log('RxQty', WONo:@RM:WORec)
|
RXQty = obj_WO_Log('RxQty', WONo:@RM:WORec)
|
||||||
WORec<WO_LOG_RX_QTY_STATIC$> = RXQty
|
Open 'WO_LOG' to hTable then
|
||||||
Database_Services('WriteDataRow', 'WO_LOG', WONo, WORec, True$, False$, False$)
|
WriteV RXQty on hTable, WONo, WO_LOG_RX_QTY_STATIC$ else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to write received quantity ':RXQty
|
||||||
|
ErrorMsg := ' to the RX_QTY_STATIC field of WO_LOG record ':WONo:'.'
|
||||||
|
ErrorMsg := '@FILE_ERROR: ':@FILE_ERROR
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to open the WO_LOG table.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. '
|
||||||
|
ErrorMsg := 'Error message: ':Error_Services('GetMessage')
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. ':WONo:' does not exist in the WO_LOG table.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Null WONo passed into service'
|
||||||
|
end
|
||||||
|
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = LoggingDtm
|
||||||
|
LogData<2> = WONo
|
||||||
|
If ErrorMsg EQ '' then
|
||||||
|
LogData<3> = 'Successfully updated WO_LOG record ':WONo:' field RX_QTY_STATIC with received quantity ':RXQty:'.'
|
||||||
|
Logging_Services('AppendLog', objUpRecLog, LogData, @RM, @FM)
|
||||||
|
end else
|
||||||
|
LogResult = 'Failed to update WO_LOG record ':WONo:' field RX_QTY_STATIC with received quantity ':RXQty
|
||||||
|
LogResult := '. Error message: ':ErrorMsg
|
||||||
|
LogData<3> = LogResult
|
||||||
|
Logging_Services('AppendLog', objUpRecLog, LogData, @RM, @FM)
|
||||||
|
Error_Services('Add', ErrorMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
end service
|
end service
|
||||||
@ -964,16 +1045,61 @@ end service
|
|||||||
|
|
||||||
Service UpdateShippedQty(WONo)
|
Service UpdateShippedQty(WONo)
|
||||||
|
|
||||||
|
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] : ' Update Shipped Qty Log.csv'
|
||||||
|
Headers = 'Logging DTM' : @FM : 'WONo' : @FM : 'Notes'
|
||||||
|
objUpShipLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$)
|
||||||
|
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||||
|
|
||||||
|
ErrorMsg = ''
|
||||||
|
If WONo NE '' then
|
||||||
|
If RowExists('WO_LOG', WONo) then
|
||||||
WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo)
|
WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo)
|
||||||
If Error_Services('NoError') then
|
If Error_Services('NoError') then
|
||||||
ShipQty = obj_WO_Log('ShipQty', WONo:@RM:WORec)
|
ShipQty = obj_WO_Log('ShipQty', WONo:@RM:WORec)
|
||||||
WORec<WO_LOG_SHIP_QTY_STATIC$> = ShipQty
|
Open 'WO_LOG' to hTable then
|
||||||
Database_Services('WriteDataRow', 'WO_LOG', WONo, WORec)
|
WriteV ShipQty on hTable, WONo, WO_LOG_SHIP_QTY_STATIC$ else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to write ':ShipQty
|
||||||
|
ErrorMsg := ' to the SHIP_QTY_STATIC field of WO_LOG record ':WONo:'.'
|
||||||
|
ErrorMsg := '@FILE_ERROR: ':@FILE_ERROR
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to open the WO_LOG table.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. '
|
||||||
|
ErrorMsg := 'Error message: ':Error_Services('GetMessage')
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. ':WONo:' does not exist in the WO_LOG table.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error in ':Service:' service. Null WONo passed into service'
|
||||||
|
end
|
||||||
|
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = LoggingDtm
|
||||||
|
LogData<2> = WONo
|
||||||
|
If ErrorMsg EQ '' then
|
||||||
|
LogResult = 'Successfully updated WO_LOG record ':WONo:' field SHIP_QTY_STATIC '
|
||||||
|
LogResult := 'with shipped quantity ':ShipQty:'.'
|
||||||
|
LogData<3> = LogResult
|
||||||
|
Logging_Services('AppendLog', objUpShipLog, LogData, @RM, @FM)
|
||||||
|
end else
|
||||||
|
LogResult = 'Failed to update WO_LOG record ':WONo:' field SHIP_QTY_STATIC with shipped quantity '
|
||||||
|
LogResult := ShipQty:'. Error message: ':ErrorMsg
|
||||||
|
LogData<3> = LogResult
|
||||||
|
Logging_Services('AppendLog', objUpShipLog, LogData, @RM, @FM)
|
||||||
|
Error_Services('Add', ErrorMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
end service
|
end service
|
||||||
|
|
||||||
|
|
||||||
Service ConvertRecordToJSON(WONo, Record, ItemURL)
|
Service ConvertRecordToJSON(WONo, Record, ItemURL)
|
||||||
|
|
||||||
jsonRecord = ''
|
jsonRecord = ''
|
||||||
IF WONo NE '' then
|
IF WONo NE '' then
|
||||||
If Record EQ '' then Record = Database_Services('ReadDataRow', 'WO_LOG', WONo)
|
If Record EQ '' then Record = Database_Services('ReadDataRow', 'WO_LOG', WONo)
|
||||||
@ -1052,9 +1178,12 @@ Service ConvertRecordToJSON(WONo, Record, ItemURL)
|
|||||||
Error_Services('Add', 'KeyID argument was missing in the ' : Service : ' service.')
|
Error_Services('Add', 'KeyID argument was missing in the ' : Service : ' service.')
|
||||||
end
|
end
|
||||||
Response = jsonRecord
|
Response = jsonRecord
|
||||||
|
|
||||||
end service
|
end service
|
||||||
|
|
||||||
|
|
||||||
Service RemoveWoMatCassetteFromWO(WoMatKey, Username)
|
Service RemoveWoMatCassetteFromWO(WoMatKey, Username)
|
||||||
|
|
||||||
ErrorMessage = ''
|
ErrorMessage = ''
|
||||||
If RowExists('WO_MAT', WoMatKey) then
|
If RowExists('WO_MAT', WoMatKey) then
|
||||||
WoNo = Field(WoMatKey, '*', 1)
|
WoNo = Field(WoMatKey, '*', 1)
|
||||||
@ -1083,9 +1212,12 @@ Service RemoveWoMatCassetteFromWO(WoMatKey, Username)
|
|||||||
If ErrorMessage NE '' then
|
If ErrorMessage NE '' then
|
||||||
Error_Services('Add', ErrorMessage)
|
Error_Services('Add', ErrorMessage)
|
||||||
end
|
end
|
||||||
|
|
||||||
end service
|
end service
|
||||||
|
|
||||||
|
|
||||||
Service SignVoidNonEpp(WOMatKey, Username)
|
Service SignVoidNonEpp(WOMatKey, Username)
|
||||||
|
|
||||||
ErrorMessage = ''
|
ErrorMessage = ''
|
||||||
WONo = Field(WOMatKey, '*', 1)
|
WONo = Field(WOMatKey, '*', 1)
|
||||||
CassNo = Field(WoMatKey, '*', 2)
|
CassNo = Field(WoMatKey, '*', 2)
|
||||||
@ -1166,7 +1298,9 @@ Service SignVoidNonEpp(WOMatKey, Username)
|
|||||||
|
|
||||||
end service
|
end service
|
||||||
|
|
||||||
|
|
||||||
Service SignVoidWMI(WMInKey, Username)
|
Service SignVoidWMI(WMInKey, Username)
|
||||||
|
|
||||||
ErrorMessage = ''
|
ErrorMessage = ''
|
||||||
WONo = Field(WMInKey, '*', 1)
|
WONo = Field(WMInKey, '*', 1)
|
||||||
CassNo = Field(WMInKey, '*', 3)
|
CassNo = Field(WMInKey, '*', 3)
|
||||||
@ -1239,7 +1373,9 @@ Service SignVoidWMI(WMInKey, Username)
|
|||||||
|
|
||||||
end service
|
end service
|
||||||
|
|
||||||
|
|
||||||
Service SignVoidWMO(WMOutKey, Username)
|
Service SignVoidWMO(WMOutKey, Username)
|
||||||
|
|
||||||
ErrorMessage = ''
|
ErrorMessage = ''
|
||||||
WONo = Field(WMOutKey, '*', 1)
|
WONo = Field(WMOutKey, '*', 1)
|
||||||
CassNo = Field(WMOutKey, '*', 3)
|
CassNo = Field(WMOutKey, '*', 3)
|
||||||
@ -1312,15 +1448,16 @@ Service SignVoidWMO(WMOutKey, Username)
|
|||||||
|
|
||||||
end service
|
end service
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Internal GoSubs
|
// Internal GoSubs
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ClearCursors:
|
ClearCursors:
|
||||||
|
|
||||||
For counter = 0 to 8
|
For counter = 0 to 8
|
||||||
ClearSelect counter
|
ClearSelect counter
|
||||||
Next counter
|
Next counter
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user