| | |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | //2、1号上片位是否有原片,原片尺寸是否和上片待上片的尺寸一致 |
| | | //3、1号无原片,且没有架子,2号上片位尺寸是否和带上片尺寸一致 |
| | | //4、不一致可能出现玻璃破损导致的上一架原片数量不够 |
| | | @Scheduled(fixedDelay = 300) |
| | | public void opcLoadGlassOne() { |
| | | opcLoadGlassChild(LOAD_GLASS_DEVICE_ONE_TASK, LOAD_GLASS_ONE_DEVICE); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | public void opcLoadGlassTwo() { |
| | | opcLoadGlassChild(LOAD_GLASS_DEVICE_TWO_TASK, LOAD_GLASS_TWO_DEVICE); |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | public void opcLoadGlassOneFinish() { |
| | | opcLoadGlassFinishChid(LOAD_GLASS_DEVICE_ONE_TASK, LOAD_GLASS_ONE_DEVICE); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | public void opcLoadGlassTwoFinish() { |
| | | opcLoadGlassFinishChid(LOAD_GLASS_DEVICE_TWO_TASK, LOAD_GLASS_TWO_DEVICE); |
| | | } |
| | |
| | | .eq(Engineering::getState, Const.ENGINEERING_RUNNING).eq(Engineering::getStationCell, deviceId)); |
| | | if (null == engineering) { |
| | | log.info("{}上片线,没有工程任务", deviceId); |
| | | return; |
| | | } |
| | | //任务暂停 |
| | | LoadGlassDeviceTask task = loadGlassDeviceTaskService.queryTaskMessage(tableName); |
| | | if ("1".equals(task.getTaskState())) { |
| | | log.info("有正在执行的上片任务,结束本地上片请求"); |
| | | if (task.getTaskRunning().equals(Const.ENGINEERING_RUNNING)) { |
| | | log.info("{}上片线,有正在执行的任务,结束本地上片请求", deviceId); |
| | | return; |
| | | } |
| | | List<UpPattenUsageVO> pattenUsageList = upPattenUsageMapper.queryRawGlassByEngineeringId(engineering.getEngineerId()); |
| | |
| | | Map<String, List<UpPattenUsageVO>> upListMap = pattenUsageList.stream() |
| | | .collect(Collectors.groupingBy(UpPattenUsageVO::getGroupNumber)); |
| | | log.info("获取当前需要上片的原片数据"); |
| | | List<UpPattenUsageVO> usageVOS = upListMap.get(0); |
| | | List<UpPattenUsageVO> usageVOS = upListMap.get("1"); |
| | | // 获取1号上片位是有架子且有玻璃 |
| | | List<Integer> loadStation = LOAD_GLASS_DEVICE_ONE_TASK.equals(tableName) ? LOAD_STATION_01 : LOAD_STATION_02; |
| | | List<RawGlassStorageDetails> loadStationList = rawGlassStorageDetailsService.list(new LambdaQueryWrapper<RawGlassStorageDetails>() |
| | |
| | | RawGlassStorageDetails oneLoadStation = loadStationList.stream().filter(e -> e.getSlot().equals(loadStation.get(0))).findFirst().orElse(null); |
| | | if (null == oneLoadStation) { |
| | | RawGlassStorageDetails twoLoadStation = loadStationList.stream().filter(e -> e.getSlot().equals(loadStation.get(1))).findFirst().orElse(null); |
| | | if (!compareRawSize(usageVOS.get(0), oneLoadStation)) { |
| | | if (!compareRawSize(usageVOS.get(0), twoLoadStation)) { |
| | | log.info("二号上片位有架子,原片数量为0或者原片信息与待上片尺寸不一致,结束本次上片任务,等待仓储调度任务"); |
| | | return; |
| | | } |
| | |
| | | |
| | | private void opcLoadGlassFinishChid(String tableName, Integer deviceId) { |
| | | LoadGlassDeviceTask task = loadGlassDeviceTaskService.queryTaskMessage(tableName); |
| | | if (task.getTaskRunning().equals(Const.ENGINEERING_NEW)) { |
| | | log.info("无任务,结束"); |
| | | return; |
| | | } |
| | | if (task.getTaskState() <= 1) { |
| | | log.info("无任务或任务正在执行中"); |
| | | log.info("任务正在执行,结束"); |
| | | return; |
| | | } |
| | | //获取任务完成情况 |
| | |
| | | .inSql("slot", "select slot from raw_glass_storage_station where enable_state = 1") |
| | | .eq("slot", task.getSlot()) |
| | | .eq("state", Const.RAW_GLASS_STATE_IN) |
| | | .set("remain_quantity", "remain_quantity - " + (finishCount + damageCount))); |
| | | .setSql("remain_quantity = remain_quantity - " + (finishCount + damageCount))); |
| | | //更新工程下的原片数量 todo:sql待优化 |
| | | |
| | | List<Integer> ids = upPattenUsageMapper.queryFinishByEngineering(deviceId, finishCount); |
| | | upPattenUsageMapper.update(null, new LambdaUpdateWrapper<UpPattenUsage>() |
| | | .inSql(UpPattenUsage::getId, " SELECT id FROM up_patten_usage ORDER BY id ASC LIMIT 10") |
| | | .in(UpPattenUsage::getId, ids) |
| | | .set(UpPattenUsage::getState, Const.LOAD_RAW_GLASS_SUCCESS)); |
| | | |
| | | //todo:任务表数据情况 |
| | | task.setTaskRunning(0); |
| | | task.setTotalCount(0); |