| | |
| | | import com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.job.OpcCacheGlassTask; |
| | | import com.mes.opctask.entity.EdgStorageDeviceTask; |
| | | import com.mes.opctask.entity.EdgStorageDeviceTaskHistory; |
| | | import com.mes.opctask.mapper.EdgStorageDeviceTaskMapper; |
| | |
| | | .eq(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_NEW) |
| | | .eq(EdgStorageDeviceTaskHistory::getDeviceId, deviceId) |
| | | .orderByDesc(EdgStorageDeviceTaskHistory::getCreateTime).last("limit 1")); |
| | | if (taskHistory == null) { |
| | | return Boolean.FALSE; |
| | | } |
| | | Integer cell = taskHistory.getStartCell(); |
| | | Integer taskType = taskHistory.getTaskType(); |
| | | if (Const.GLASS_CACHE_TYPE_IN_ALL.contains(taskType)) { |
| | | String glassId = taskHistory.getGlassIdIn(); |
| | | edgStorageCageDetailsService.remove(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .eq(EdgStorageCageDetails::getDeviceId, deviceId) |
| | | .eq(EdgStorageCageDetails::getSlot, cell) |
| | | .eq(EdgStorageCageDetails::getGlassId, glassId)); |
| | | } else { |
| | | String glassId = taskHistory.getGlassIdOut(); |
| | | edgStorageCageDetailsService.update(new LambdaUpdateWrapper<EdgStorageCageDetails>() |
| | | .set(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(EdgStorageCageDetails::getDeviceId, deviceId) |
| | | .eq(EdgStorageCageDetails::getSlot, cell) |
| | | .eq(EdgStorageCageDetails::getGlassId, glassId)); |
| | | } |
| | | if (taskHistory != null) { |
| | | Integer cell = taskHistory.getStartCell(); |
| | | Integer taskType = taskHistory.getTaskType(); |
| | | if (Const.GLASS_CACHE_TYPE_IN_ALL.contains(taskType)) { |
| | | String glassId = taskHistory.getGlassIdIn(); |
| | | edgStorageCageDetailsService.remove(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .eq(EdgStorageCageDetails::getDeviceId, deviceId) |
| | | .eq(EdgStorageCageDetails::getSlot, cell) |
| | | .eq(EdgStorageCageDetails::getGlassId, glassId)); |
| | | } else { |
| | | String glassId = taskHistory.getGlassIdOut(); |
| | | edgStorageCageDetailsService.update(new LambdaUpdateWrapper<EdgStorageCageDetails>() |
| | | .set(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(EdgStorageCageDetails::getDeviceId, deviceId) |
| | | .eq(EdgStorageCageDetails::getSlot, cell) |
| | | .eq(EdgStorageCageDetails::getGlassId, glassId)); |
| | | } |
| | | |
| | | edgStorageDeviceTaskHistoryService.update(new LambdaUpdateWrapper<EdgStorageDeviceTaskHistory>() |
| | | .eq(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_NEW) |
| | | .eq(EdgStorageDeviceTaskHistory::getDeviceId, deviceId) |
| | | .set(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_FAILURE) |
| | | ); |
| | | //计算每个各自的剩余尺寸信息 |
| | | resetSlotRemainWidth(); |
| | | edgStorageDeviceTaskHistoryService.update(new LambdaUpdateWrapper<EdgStorageDeviceTaskHistory>() |
| | | .eq(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_NEW) |
| | | .eq(EdgStorageDeviceTaskHistory::getDeviceId, deviceId) |
| | | .set(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_FAILURE) |
| | | ); |
| | | //计算每个各自的剩余尺寸信息 |
| | | resetSlotRemainWidth(); |
| | | } |
| | | //最后更新任务,保证任务前的动作都做完 |
| | | EdgStorageDeviceTask task = new EdgStorageDeviceTask(); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_EMPTY); |