| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Autowired(required = false) |
| | | MiloService miloService; |
| | | |
| | | |
| | | // @Resource(name = "cacheGlassStartCallback") |
| | | // SubscriptionCallback cacheGlassStartCallback; |
| | | // |
| | | // @Resource(name = "cacheGlassTestCallback") |
| | | // SubscriptionCallback cacheGlassTestCallback; |
| | | |
| | | @Resource |
| | | EdgStorageDeviceTaskService edgStorageDeviceTaskService; |
| | | // @Resource |
| | | // EdgGlassTaskQueueInfoService edgGlassTaskQueueInfoService; |
| | | @Autowired |
| | | EdgGlassTaskInfoService edgGlassTaskInfoService; |
| | | |
| | | @Resource |
| | | GlassInfoService glassInfoService; |
| | | @Resource |
| | |
| | | private String glassIdOne = ""; |
| | | private String glassIdTwo = ""; |
| | | |
| | | // @Scheduled(fixedDelay = Long.MAX_VALUE) |
| | | // public void startOneOpcTask() throws Exception { |
| | | // miloService.subscriptionFromOpcUa(Arrays.asList("mes.WL1.edg_storage_device_one_task[1].task_state"), cacheGlassStartCallback); |
| | | // } |
| | | // |
| | | // @Scheduled(fixedDelay = Long.MAX_VALUE) |
| | | // public void startTwoOpcTask() throws Exception { |
| | | // miloService.subscriptionFromOpcUa(Arrays.asList("mes.WL2.edg_storage_device_two_task[1].task_state"), cacheGlassStartCallback); |
| | | // } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void startOneOpcTask() { |
| | | startOneOpcTaskChild(EDG_STORAGE_DEVICE_ONE_TASK, 1); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void startTwoOpcTask() { |
| | | startOneOpcTaskChild(EDG_STORAGE_DEVICE_TWO_TASK, 2); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void edgOneOpcTask() throws Exception { |
| | | EdgStorageDeviceTask task = edgStorageDeviceTaskService.queryTaskMessage(EDG_STORAGE_DEVICE_ONE_TASK); |
| | | String glassId = task.getGlassId(); |
| | |
| | | edgTaskChild(glassId, 1); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void edgTwoOpcTask() throws Exception { |
| | | EdgStorageDeviceTask task = edgStorageDeviceTaskService.queryTaskMessage(EDG_STORAGE_DEVICE_TWO_TASK); |
| | | String glassId = task.getGlassId(); |
| | |
| | | if (null != edgeData) { |
| | | GlassInfo glassOutInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, edgeData.getGlassIdOut())); |
| | | //笼内的玻璃的尺寸是否和上一次任务一致 |
| | | edgStorageCageDetails = edgStorageCageDetailsService.queryEdgStorageDetailsBySize(deviceId, task.getCurrentCell(), glassOutInfo.getWidth(), glassOutInfo.getHeight()); |
| | | edgStorageCageDetails = edgStorageCageDetailsService.queryEdgStorageDetailsBySize(deviceId, task.getCurrentCell(), glassOutInfo.getWidth(), glassOutInfo.getHeight(), 0, 0); |
| | | if (null == edgStorageCageDetails && StringUtils.isNotBlank(task.getGlassIdIn())) { |
| | | GlassInfo glassInInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getGlassId, task.getGlassIdIn()) |
| | |
| | | } |
| | | } |
| | | if (null == edgStorageCageDetails) { |
| | | edgStorageCageDetails = edgStorageCageDetailsService.queryEdgStorageDetailsBySize(deviceId, task.getCurrentCell(), 0, 0); |
| | | edgStorageCageDetails = edgStorageCageDetailsService.queryEdgStorageDetailsBySize(deviceId, task.getCurrentCell(), 0, 0, 0, 0); |
| | | } |
| | | if (edgStorageCageDetails == null && StringUtils.isNotBlank(task.getGlassIdIn())) { |
| | | //和上次任务不存在相同尺寸 |
| | |
| | | if (2 == taskHistory.getTaskType()) { |
| | | remainWidth = 0; |
| | | } else { |
| | | EdgStorageCage storageCage = edgStorageCageService.getOne(new LambdaQueryWrapper<EdgStorageCage>() |
| | | .eq(EdgStorageCage::getDeviceId, device).eq(EdgStorageCage::getSlot, slot)); |
| | | EdgStorageCageDetails bigDetails = list.stream().filter(e -> e.getGlassId().equals(taskHistory.getGlassIdIn())).findFirst().orElse(null); |
| | | remainWidth = storageCage.getRemainWidth() - glassGap - (int) Math.max(bigDetails.getWidth(), bigDetails.getHeight()); |
| | | for (EdgStorageCageDetails item : list) { |
| | | remainWidth = remainWidth - glassGap - (int) Math.max(item.getWidth(), item.getHeight()); |
| | | } |
| | | if (remainWidth <= 0) { |
| | | remainWidth = 0; |
| | | } |