Class BTWarehouseMaterialInsertFromScheduling
java.lang.Object
overit.geocall.bl.BusinessTask<WarehouseMaterialInsertFromSchedulingEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<WarehouseMaterialInsertFromSchedulingEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<WarehouseMaterialInsertFromSchedulingEvent>
overit.geocallapp.wfm.inventory.bl.task.BTInventoryManagement<WarehouseMaterialInsertFromSchedulingEvent>
overit.geocallapp.wfm.inventory.bl.warehouse.material.scheduling.task.BTWarehouseMaterialInsertFromScheduling
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(WarehouseMaterialInsertFromSchedulingEvent.class)
public class BTWarehouseMaterialInsertFromScheduling
extends BTInventoryManagement<WarehouseMaterialInsertFromSchedulingEvent>
Business task in order to insert the missing
When the
BOWarehouseMaterial relations
for all the materials that are scheduled in a Codes.WorkOrderOperation. When the
WarehouseMaterialInsertFromSchedulingEvent is launched
the BT notices the call and performs the following actions:
- loads all the scheduled materials associated to any
Codes.WorkOrderOperationthat isBOWorkOrderOperationState.Values.SCHEDULEDorBOWorkOrderOperationState.Values.FIXED - starting from the intervention user, checks if the material is managed in stock and if it is associated to a valid central warehouse
- checks whether is necessary to insert a new
BOWarehouseMaterialrelation for every scheduled material
- Since:
- 14.0
- See Also:
- GCApi:
- task
-
Field Summary
Fields inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckWarehouseMaterialInsertion(List<BOWorkOrderOperation> workOrderOperations, PoolKit poolKit) Checks whether is necessary to insert a newBOWarehouseMaterialrelation for every material that was scheduled in one of the givenBOWorkOrderOperation.protected voidexecute(WarehouseMaterialInsertFromSchedulingEvent event, PoolKit poolKit) Loads all the scheduled materials associated to anyCodes.WorkOrderOperationthat isBOWorkOrderOperationState.Values.SCHEDULEDorBOWorkOrderOperationState.Values.FIXEDand that was scheduled during the indicated interval.protected LonggetInterventionUser(BOWorkOrderOperation operation, PoolKit poolKit) Returns theInterventionscheduling user starting from the givenBOWorkOrderOperation.protected LogHelperprotected LogMessageHelperprotected LonggetSchedulingUserCentralWarehouse(BOWorkOrderOperation woOperation, PoolKit poolKit) Returns the id of the preferredBOCentralWarehouseassociated to the scheduling user of the givenBOWorkOrderOperation.protected BOWarehouseMaterialinsertWarehouseMaterialRelation(BOMaterial material, Long centralWarehouse, PoolKit poolKit) Inserts a newBOWarehouseMaterialstarting from theBOMaterialid and the givenBOCentralWarehouseid.booleanChecks if the execution is valid.protected BOMaterialloadMaterial(Long materialId, PoolKit poolKit) Loads the material by the given id.protected LongloadPreferredCentralWarehouse(BOMobileWarehouse mobileWarehouse, PoolKit poolKit) Loads the id of the preferredBOCentralWarehousefor the givenBOMobileWarehouse.protected BOMobileWarehouseloadUserMobileWarehouse(Long schedulingUser, PoolKit poolKit) Loads theBOMobileWarehouseassociated to the given scheduling user id.protected BOWarehouseMaterialloadWarehouseMaterialRelation(Long materialId, Long centralWarehouse, PoolKit poolKit) Loads theBOWarehouseMaterialrelation starting from theBOMaterialid and the givenBOCentralWarehouseid.protected List<BOWorkOrderOperationMaterial> loadWorkOrderOperationMaterials(Long workOrderOperationId, PoolKit poolKit) Loads theBOWorkOrderOperationMaterialrelations.protected List<BOWorkOrderOperation> loadWorkOrderOperationsByState(int schedulingDaysFrom, int schedulingDaysTo, PoolKit poolKit) Loads theBOWorkOrderOperationby the given state, filtering them with the scheduling time interval defined in the configuration.protected voidopenLog()Methods inherited from class overit.geocallapp.wfm.inventory.bl.task.BTInventoryManagement
checkValidExecutionMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
getException, throwExceptionIfInvalidMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask
body, getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTWarehouseMaterialInsertFromScheduling
public BTWarehouseMaterialInsertFromScheduling()
-
-
Method Details
-
execute
protected void execute(WarehouseMaterialInsertFromSchedulingEvent event, PoolKit poolKit) throws DAException, DAValidateException Loads all the scheduled materials associated to anyCodes.WorkOrderOperationthat isBOWorkOrderOperationState.Values.SCHEDULEDorBOWorkOrderOperationState.Values.FIXEDand that was scheduled during the indicated interval. After that, it checks whether all the related scheduled materials have aBOWarehouseMaterialrelation. If the relation is not present, it inserts it.- Specified by:
executein classValidExecutionBusinessTask<WarehouseMaterialInsertFromSchedulingEvent>- Parameters:
event- theWarehouseMaterialInsertFromSchedulingEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
checkWarehouseMaterialInsertion
protected void checkWarehouseMaterialInsertion(List<BOWorkOrderOperation> workOrderOperations, PoolKit poolKit) throws DAValidateException, DAException Checks whether is necessary to insert a newBOWarehouseMaterialrelation for every material that was scheduled in one of the givenBOWorkOrderOperation.- Parameters:
workOrderOperations- list ofBOWorkOrderOperationpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadWorkOrderOperationsByState
protected List<BOWorkOrderOperation> loadWorkOrderOperationsByState(int schedulingDaysFrom, int schedulingDaysTo, PoolKit poolKit) throws DAValidateException, DAException Loads theBOWorkOrderOperationby the given state, filtering them with the scheduling time interval defined in the configuration.- Parameters:
schedulingDaysFrom- the number of days preceding the scheduling dateschedulingDaysTo- the number of days following the scheduling datepoolKit- thePoolKit- Returns:
- a list of loaded
BOWorkOrderOperation - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadWorkOrderOperationMaterials
protected List<BOWorkOrderOperationMaterial> loadWorkOrderOperationMaterials(Long workOrderOperationId, PoolKit poolKit) throws DAValidateException, DAException Loads theBOWorkOrderOperationMaterialrelations.- Parameters:
workOrderOperationId- theBOWorkOrderOperationidpoolKit- thePoolKit- Returns:
- a list of loaded
BOWorkOrderOperationMaterialrelations - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getInterventionUser
protected Long getInterventionUser(BOWorkOrderOperation operation, PoolKit poolKit) throws DAValidateException, DAException Returns theInterventionscheduling user starting from the givenBOWorkOrderOperation.- Parameters:
operation- the operationpoolKit- the pool kit- Returns:
- the intervention user
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadUserMobileWarehouse
protected BOMobileWarehouse loadUserMobileWarehouse(Long schedulingUser, PoolKit poolKit) throws DAValidateException, DAException Loads theBOMobileWarehouseassociated to the given scheduling user id.- Parameters:
schedulingUser- the scheduling user idpoolKit- thePoolKit- Returns:
- the loaded
BOMobileWarehouse - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadPreferredCentralWarehouse
protected Long loadPreferredCentralWarehouse(BOMobileWarehouse mobileWarehouse, PoolKit poolKit) throws DAValidateException, DAException Loads the id of the preferredBOCentralWarehousefor the givenBOMobileWarehouse.- Parameters:
mobileWarehouse- theBOMobileWarehousepoolKit- thePoolKit- Returns:
- the id of the preferred
BOCentralWarehouse - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getSchedulingUserCentralWarehouse
protected Long getSchedulingUserCentralWarehouse(BOWorkOrderOperation woOperation, PoolKit poolKit) throws DAValidateException, DAException Returns the id of the preferredBOCentralWarehouseassociated to the scheduling user of the givenBOWorkOrderOperation.- Parameters:
woOperation- theBOWorkOrderOperationpoolKit- thePoolKit- Returns:
- the scheduling user's central warehouse id
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadMaterial
protected BOMaterial loadMaterial(Long materialId, PoolKit poolKit) throws DAValidateException, DAException Loads the material by the given id.- Parameters:
materialId- theBOMaterialidpoolKit- thePoolKit- Returns:
- the loaded
BOMaterial - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadWarehouseMaterialRelation
protected BOWarehouseMaterial loadWarehouseMaterialRelation(Long materialId, Long centralWarehouse, PoolKit poolKit) throws DAValidateException, DAException Loads theBOWarehouseMaterialrelation starting from theBOMaterialid and the givenBOCentralWarehouseid.- Parameters:
materialId- theBOMaterialidcentralWarehouse- theBOCentralWarehouseidpoolKit- thePoolKit- Returns:
- the loaded
BOWarehouseMaterialrelation - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
insertWarehouseMaterialRelation
protected BOWarehouseMaterial insertWarehouseMaterialRelation(BOMaterial material, Long centralWarehouse, PoolKit poolKit) throws DAValidateException, DAException Inserts a newBOWarehouseMaterialstarting from theBOMaterialid and the givenBOCentralWarehouseid.- Parameters:
material- theBOMaterialidcentralWarehouse- theBOCentralWarehouseidpoolKit- thePoolKit- Returns:
- the inserted
BOWarehouseMaterialrelation - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
isValidExecution
public boolean isValidExecution()Checks if the execution is valid.- Returns:
- true, if successful
-
openLog
- Throws:
DAValidateExceptionDAException
-
getLogHelper
-
getLogMessage
-