1、卧式理片重置任务调整,避免无任务情况下无法将任务交互表的数据清掉
2、中空领取任务界面新增产品名称,便于识别产品
3、调整部分定时任务间隔时间
4、定时任务分隔开,按照两个/多个界面的websocket由一个分为多个
5、取消钢化功能开发中z
| | |
| | | */ |
| | | @ApiModelProperty(value = "高") |
| | | private double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | @ApiModelProperty(value = "厚度") |
| | | private double thickness; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | @ApiModelProperty(value = "厚度", position = 8) |
| | | private double thickness; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | @ApiModelProperty(value = "钢化是否接受横放", position = 10) |
| | |
| | | @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 glassInIdTwo = ""; |
| | | 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) |
| | | public void startOneOpcTask() { |
| | |
| | | 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; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | * @author makejava |
| | | * @since 2024-10-27 21:04:33 |
| | | */ |
| | | @ApiModel(description = "(EdgStorageDeviceTaskHistory)表实体类") |
| | | @SuppressWarnings("serial") |
| | | @Data |
| | | public class EdgStorageDeviceTaskHistory extends Model<EdgStorageDeviceTaskHistory> { |
| | | /** |
| | | * 工程表id |
| | | */ |
| | | @ApiModelProperty(value = "工程表id", position = 1) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 进片玻璃id |
| | | */ |
| | | @ApiModelProperty(value = "进片玻璃id", position = 2) |
| | | private String glassIdIn; |
| | | /** |
| | | * 出片玻璃id |
| | | */ |
| | | @ApiModelProperty(value = "出片玻璃id", position = 3) |
| | | private String glassIdOut; |
| | | /** |
| | | * 当前层号 |
| | | */ |
| | | @ApiModelProperty(value = "当前层号", position = 4) |
| | | private Integer currentCell; |
| | | /** |
| | | * 层号 |
| | | */ |
| | | @ApiModelProperty(value = "目标层号", position = 5) |
| | | private Integer startCell; |
| | | /** |
| | | * 预留层号 |
| | | */ |
| | | @ApiModelProperty(value = "预留层号", position = 6) |
| | | private Integer endCell; |
| | | /** |
| | | * 任务状态 0默认空任务 1 进片 2出片 3 直通 4执行中 5结束任务 6其他 |
| | | */ |
| | | @ApiModelProperty(value = "任务状态 0默认空任务 1 进片 2出片 3 直通 4执行中 5结束任务 6其他", position = 7) |
| | | private Integer taskState; |
| | | /** |
| | | * 任务状态 0默认空任务 1 进片 2出片 3 直通 4执行中 5结束任务 6其他 |
| | | */ |
| | | @ApiModelProperty(value = "任务状态 0默认空任务 1 进片 2出片 3 直通 4执行中 5结束任务 6其他", position = 8) |
| | | private Integer taskType; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value = "创建时间", position = 9) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @ApiModelProperty(value = "更新时间", position = 10) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | |
| | | /** |
| | | * 设备信息 |
| | | */ |
| | | @ApiModelProperty(value = "设备信息", position = 11) |
| | | private Integer deviceId; |
| | | |
| | | |
| | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("取消当前钢化") |
| | | @PostMapping("/cancelTemperingTask") |
| | | public Result<Boolean> cancelTemperingTask() { |
| | | boolean result = bigStorageCageDetailsService.cancelTemperingTask(); |
| | | if (result == true) { |
| | | return Result.build(200, "指定钢化成功", result); |
| | | } else { |
| | | return Result.build(200, "已存在钢化任务,请等待钢化完成再指定钢化", result); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("钢化/非钢化查询:0 非钢化 1:钢化") |
| | | @PostMapping("/selectTemperingGlass") |
| | | public Result<List<TemperingGlassCountDTO>> selectTemperingGlass(int isTempering) { |
| | |
| | | @ApiModelProperty(value = "玻璃类型", position = 8) |
| | | private Integer glassType; |
| | | |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | @ApiModelProperty(value = "厚度", position = 11) |
| | | private double thickness; |
| | | |
| | | @ApiModelProperty(value = "旋转角度", position = 12) |
| | | private Integer angle; |
| | | |
| | |
| | | List<BigStorageCageDetails> queryRealGlassInfo(BigStorageQueryVO bigStorageQueryVO); |
| | | |
| | | Map<Integer, List<BigStorageVO>> querybigStorageCageDetail(); |
| | | |
| | | /** |
| | | * 取消钢化任务 |
| | | * |
| | | * @return |
| | | */ |
| | | boolean cancelTemperingTask(); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Map<Integer, List<BigStorageVO>> querybigStorageCageDetail() { |
| | | List<BigStorageVO> bigStorageCages= baseMapper.querybigStorageCageDetail(); |
| | | List<BigStorageVO> bigStorageCages = baseMapper.querybigStorageCageDetail(); |
| | | return bigStorageCages.stream().collect(Collectors.groupingBy(item -> item.getDeviceId())); |
| | | } |
| | | |
| | | @Override |
| | | public boolean cancelTemperingTask() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public String temperingSwitch(Boolean flag) { |
| | | redisUtil.setCacheObject("temperingSwitch", flag); |
| | | return "success"; |
| | |
| | | public List<Map<String, Object>> selectBigStorageCageUsage() { |
| | | QueryWrapper<BigStorageCage> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("device_id,ROUND(1 - SUM(CASE WHEN remain_width = " + slotWidth + " THEN 1 ELSE 0 END) / COUNT(device_id), 2)*100 AS percentage,SUM(CASE WHEN remain_width = " + slotWidth + " THEN 1 ELSE 0 END) AS count") |
| | | .eq("enable_state", Const.SLOT_ON) |
| | | .groupBy("device_id"); |
| | | List<Map<String, Object>> bigStorageCageUsages = baseMapper.selectMaps(wrapper); |
| | | |
| | |
| | | .in(CollectionUtil.isNotEmpty(request.getTaskStateList()), BigStorageCageHistoryTask::getTaskState, request.getTaskStateList()) |
| | | .in(CollectionUtil.isNotEmpty(request.getTaskTypeList()), BigStorageCageHistoryTask::getTaskType, request.getTaskTypeList()) |
| | | .between(BigStorageCageHistoryTask::getCreateTime, request.getBeginDate(), request.getEndDate()) |
| | | .orderByDesc(BigStorageCageHistoryTask::getCreateTime); |
| | | .orderByAsc(BigStorageCageHistoryTask::getId); |
| | | return this.page(page, wrapper); |
| | | } |
| | | |
| | |
| | | } |
| | | //按照玻璃厚度分组,判断剩余格子是否可以存放 |
| | | Map<Double, Long> thickCountMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getThickness, Collectors.counting())); |
| | | if(glassInfoList.get(0).getThickness() < slotMaxthickness){ |
| | | if (glassInfoList.get(0).getThickness() < slotMaxthickness) { |
| | | for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) { |
| | | int count = bigStorageCageService.count(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth) |
| | |
| | | //任务数据:获取车子存放玻璃最大数量,玻璃间隔 |
| | | List<T> outGlassList = list; |
| | | if (!THROUGH_SLOT.equals(list.get(0).getSlot())) { |
| | | List<String> glassIdList = bigStorageGlassRelationInfoService.queryNeedOutGlassId( |
| | | list.get(0).getEngineerId(), list.get(0).getTemperingLayoutId(), list.get(0).getTemperingFeedSequence()); |
| | | outGlassList = list.stream().filter(e -> glassIdList.contains(e.getGlassId())).collect(Collectors.toList()); |
| | | //todo:临时解决方案:出片时考虑玻璃碰撞,改为一片一出 |
| | | // 界面关闭调度开关 !Const.BIG_STORAGE_BEFORE_DISPATCH.equals(taskType) |
| | | if (list.get(0).getThickness() >= 8) { |
| | | outGlassList = list.subList(0, 1); |
| | | } else { |
| | | List<String> glassIdList = bigStorageGlassRelationInfoService.queryNeedOutGlassId( |
| | | list.get(0).getEngineerId(), list.get(0).getTemperingLayoutId(), list.get(0).getTemperingFeedSequence()); |
| | | outGlassList = list.stream().filter(e -> glassIdList.contains(e.getGlassId())).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | Assert.isFalse(CollectionUtil.isEmpty(outGlassList), "未获取出片数据,结束出片任务"); |
| | | log.info("获取出片任务数据{}条,执行保存", outGlassList.size()); |
| | |
| | | //2、1号上片位是否有原片,原片尺寸是否和上片待上片的尺寸一致 |
| | | //3、1号无原片,且没有架子,2号上片位尺寸是否和带上片尺寸一致 |
| | | //4、不一致可能出现玻璃破损导致的上一架原片数量不够 |
| | | @Scheduled(fixedDelay = 300) |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void opcLoadGlassOne() { |
| | | opcLoadGlassChild(LOAD_GLASS_DEVICE_ONE_TASK, LOAD_GLASS_ONE_DEVICE); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void opcLoadGlassTwo() { |
| | | opcLoadGlassChild(LOAD_GLASS_DEVICE_TWO_TASK, LOAD_GLASS_TWO_DEVICE); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void opcLoadGlassOneFinish() { |
| | | opcLoadGlassFinishChid(LOAD_GLASS_DEVICE_ONE_TASK, LOAD_GLASS_ONE_DEVICE); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void opcLoadGlassTwoFinish() { |
| | | opcLoadGlassFinishChid(LOAD_GLASS_DEVICE_TWO_TASK, LOAD_GLASS_TWO_DEVICE); |
| | | } |
| | |
| | | /** |
| | | * 定时任务扫码已完成上片的工程,将工程状态改为已完成,同步pp表的工程表,状态改为300 |
| | | */ |
| | | @Scheduled(fixedDelay = 3000) |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void updateEngineerState() { |
| | | log.info("修改已完成工程状态任务开始执行"); |
| | | List<Engineering> engineerings = engineeringMapper.selectList(new LambdaQueryWrapper<Engineering>().eq(Engineering::getState, Const.ENGINEERING_RUNNING)); |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | |
| | | import com.mes.opctask.service.LoadGlassDeviceTaskService; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.rawglassdetails.entity.RawGlassStorageDetails; |
| | | import com.mes.rawglassdetails.service.RawGlassStorageDetailsService; |
| | | import com.mes.rawglassstation.entity.RawGlassStorageStation; |
| | | import com.mes.rawglassstation.service.RawGlassStorageStationService; |
| | | import com.mes.tools.DateUtil; |
| | | import com.mes.tools.WebSocketServer; |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void loadGlassHome() { |
| | | @Scheduled(fixedDelay = 10000) |
| | | public void loadOneGlass() { |
| | | loadGlassChild("loadGlassRequestOne", 5, LOAD_GLASS_DEVICE_ONE_TASK, "loadGlassOne"); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 10) |
| | | public void loadTwoGlass() { |
| | | loadGlassChild("loadGlassRequestTwo", 6, LOAD_GLASS_DEVICE_TWO_TASK, "loadGlassTwo"); |
| | | } |
| | | |
| | | |
| | | private void loadGlassChild(String redisRequest, int stationCell, String tableName, String webSocketName) { |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.prioritylist(); |
| | | if (upPattenUsages != null) { |
| | | jsonObject.append("prioritylist", upPattenUsages); |
| | | //当前线路正在执行的工程 |
| | | Engineering engineering = engineeringService.getOne(new LambdaQueryWrapper<Engineering>().eq(Engineering::getStationCell, stationCell) |
| | | .eq(Engineering::getState, 1).last("limit 1")); |
| | | if (null != engineering) { |
| | | jsonObject.append("engineering", engineering); |
| | | } |
| | | //查询1号线的任务 |
| | | Engineering request = redisUtil.getCacheObject("loadGlassRequest"); |
| | | //获取当前线路正在执行的工程原片信息 |
| | | Engineering request = redisUtil.getCacheObject(redisRequest); |
| | | if (request == null) { |
| | | request = new Engineering(); |
| | | request.setStationCell(5); |
| | | request.setStationCell(stationCell); |
| | | } |
| | | List<UpPattenUsage> upPattenUsages1 = upPattenUsageService.selectLoadTask(request); |
| | | jsonObject.append("loadTask1", upPattenUsages1); |
| | | //查询2号线的任务 |
| | | Engineering request2 = redisUtil.getCacheObject("loadGlassRequest2"); |
| | | if (request2 == null) { |
| | | request2 = new Engineering(); |
| | | request2.setStationCell(6); |
| | | } |
| | | List<UpPattenUsage> upPattenUsages2 = upPattenUsageService.selectLoadTask(request2); |
| | | jsonObject.append("loadTask2", upPattenUsages2); |
| | | // 查询工位任务 |
| | | //联机状态 |
| | | LoadGlassDeviceTask LoadOneState = loadGlassDeviceTaskService.queryTaskMessage(LOAD_GLASS_DEVICE_ONE_TASK); |
| | | LoadGlassDeviceTask LoadTwoState = loadGlassDeviceTaskService.queryTaskMessage(LOAD_GLASS_DEVICE_TWO_TASK); |
| | | jsonObject.append("LoadOneState", LoadOneState.getInkageState()); |
| | | jsonObject.append("LoadTwoervice", LoadTwoState.getInkageState()); |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectLoadTask(request); |
| | | jsonObject.append("upPattenUsages", upPattenUsages); |
| | | |
| | | //联机状态 |
| | | LoadGlassDeviceTask LoadTask = loadGlassDeviceTaskService.queryTaskMessage(tableName); |
| | | jsonObject.append("inkageState", LoadTask.getInkageState()); |
| | | //工位信息 |
| | | List<RawGlassStorageDetails> rawGlassStorageDetailList = rawGlassStorageStationService.listRawGlassDetails(); |
| | | List<RawGlassStorageDetails> stationOneList = rawGlassStorageDetailList.stream().filter(item -> item.getDeviceId() == 5).collect(Collectors.toList()); |
| | | List<RawGlassStorageDetails> stationTwoList = rawGlassStorageDetailList.stream().filter(item -> item.getDeviceId() == 6).collect(Collectors.toList()); |
| | | jsonObject.append("stationOne", stationOneList); |
| | | jsonObject.append("stationTwo", stationTwoList); |
| | | //是否开始工程 |
| | | Engineering engineering = engineeringService.selectInitiate(1); |
| | | jsonObject.append("engineering", engineering); |
| | | //工位信息 |
| | | List<UpWorkstation> upWorkstations = upWorkstationService.list(); |
| | | jsonObject.append("list", upWorkstations); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | List<RawGlassStorageDetails> stationList = rawGlassStorageDetailList.stream().filter(item -> item.getDeviceId() == stationCell).collect(Collectors.toList()); |
| | | jsonObject.append("stationList", stationList); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get(webSocketName); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | // } |
| | | } else { |
| | | log.info("loadGlass is closed"); |
| | | } |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | @Scheduled(fixedDelay = 216000000) |
| | | public void send() { |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("mainMes"); |
| | | if (sendwServer != null) { |
| | |
| | | } |
| | | } |
| | | |
| | | // @Scheduled(fixedDelay = 1000) |
| | | // public void loadGlassIsRun() { |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // |
| | | // ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlassIsRun"); |
| | | // if (sendwServer != null) { |
| | | // for (WebSocketServer webserver : sendwServer) { |
| | | // if (webserver != null) { |
| | | // webserver.sendMessage(jsonObject.toString()); |
| | | // } else { |
| | | // log.info("loadGlassIsRun is closed"); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | public void overTask(String loadStatus, int state) { |
| | | |
| | |
| | | public String setRawGlassTaskRequest(Engineering request) { |
| | | // 调用 RedisUtil 保存 loadGlass |
| | | if (request == null) { |
| | | redisUtil.deleteObject("loadGlassRequest"); |
| | | redisUtil.deleteObject("loadGlassRequestOne"); |
| | | } else { |
| | | redisUtil.setCacheObject("loadGlassRequest", request); |
| | | redisUtil.setCacheObject("loadGlassRequestOne", request); |
| | | } |
| | | return "success"; |
| | | } |
| | |
| | | public String setRawGlassTaskRequest2(Engineering request) { |
| | | // 调用 RedisUtil 保存 loadGlass |
| | | if (request == null) { |
| | | redisUtil.deleteObject("loadGlassRequest2"); |
| | | redisUtil.deleteObject("loadGlassRequestTwo"); |
| | | } else { |
| | | redisUtil.setCacheObject("loadGlassRequest2", request); |
| | | redisUtil.setCacheObject("loadGlassRequestTwo", request); |
| | | } |
| | | return "success"; |
| | | } |
| | |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * 产品名称 |
| | | */ |
| | | private String productName; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsId; |
| | |
| | | |
| | | int queryLayerByFlowCardId(@Param("flowCardId") String flowCardId); |
| | | |
| | | void clearDirtyFlowCardData(@Param("flowCardId")String flowCardId, @Param("layer")int layer); |
| | | void clearDirtyFlowCardData(@Param("flowCardId") String flowCardId, @Param("layer") int layer); |
| | | |
| | | /** |
| | | * 按照流程卡获取产品名称 |
| | | * |
| | | * @param flowCardId |
| | | * @return |
| | | */ |
| | | String queryProductNameByFlowCardId(@Param("flowCardId") String flowCardId); |
| | | } |
| | | |
| | |
| | | List<FlowCardGlassInfoDTO> dtos = new ArrayList<>(); |
| | | listMap.forEach((e, v) -> { |
| | | HollowBigStorageCageDetails cageDetails = v.get(0); |
| | | dtos.addAll(hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE)); |
| | | //按照流程卡获取对应的产品名称 |
| | | String productName = baseMapper.queryProductNameByFlowCardId(cageDetails.getFlowCardId()); |
| | | List<FlowCardGlassInfoDTO> flowCardInfoList = hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE); |
| | | for (FlowCardGlassInfoDTO item : flowCardInfoList) { |
| | | item.setProductName(productName); |
| | | dtos.add(item); |
| | | } |
| | | }); |
| | | Map<String, FlowCardGlassInfoDTO> result = dtos.stream() |
| | | .collect(Collectors.toMap( |
| | |
| | | }, |
| | | (dto1, dto2) -> { |
| | | dto1.setRealCount(dto1.getRealCount() + dto2.getRealCount()); // 累加 realCount |
| | | dto1.setLayer(Math.max(dto1.getLayer(),dto2.getLayer())); // 累加 最大层数 |
| | | dto1.setLayer(Math.max(dto1.getLayer(), dto2.getLayer())); // 累加 最大层数 |
| | | return dto1; // 返回合并后的对象 |
| | | } |
| | | )); |
| | | return dtos.stream().collect(Collectors.groupingBy(FlowCardGlassInfoDTO::getFlowCardId)); |
| | | return dtos.stream().collect(Collectors.groupingBy(e -> e.getFlowCardId() + ":" + e.getProductName())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | }, |
| | | (dto1, dto2) -> { |
| | | dto1.setRealCount(dto1.getRealCount() + dto2.getRealCount()); // 累加 realCount |
| | | dto1.setLayer(Math.max(dto1.getLayer(),dto2.getLayer())); // 累加 最大层数 |
| | | dto1.setLayer(Math.max(dto1.getLayer(), dto2.getLayer())); // 累加 最大层数 |
| | | dto1.setSlotCount(dto1.getSlotCount() + dto2.getSlotCount()); |
| | | return dto1; // 返回合并后的对象 |
| | | } |
| | |
| | | .in(CollectionUtil.isNotEmpty(request.getTaskStateList()), HollowBigStorageCageHistoryTask::getTaskState, request.getTaskStateList()) |
| | | .in(CollectionUtil.isNotEmpty(request.getTaskTypeList()), HollowBigStorageCageHistoryTask::getTaskType, request.getTaskTypeList()) |
| | | .between(HollowBigStorageCageHistoryTask::getCreateTime, request.getBeginDate(), request.getEndDate()) |
| | | .orderByDesc(HollowBigStorageCageHistoryTask::getCreateTime); |
| | | .orderByAsc(HollowBigStorageCageHistoryTask::getId); |
| | | return this.page(page, wrapper); |
| | | } |
| | | |
| | |
| | | .ge(HollowBigStorageCage::getMaxThickness, list.get(0).getThickness()) |
| | | .eq(HollowBigStorageCage::getRemainWidth, slotWidth) |
| | | .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1")); |
| | | Assert.isFalse(storageCage == null, "任务调度没有多余格子,结束调度任务"); |
| | | targetSlot = storageCage.getSlot(); |
| | | hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>() |
| | | .set(HollowBigStorageCage::getRemainWidth, 0).eq(HollowBigStorageCage::getSlot, targetSlot)); |
| | |
| | | @Resource |
| | | RedisUtil redisUtil; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void hollowGlassTask() { |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void hollowGlassTaskOne() { |
| | | hollowGlassTaskChild(930, "CMJ1.CMJ1.isFree", "HollowGlassOne"); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void hollowGlassTaskTwo() { |
| | | hollowGlassTaskChild(931, "ZKQ2.ZKQ2.isFree", "HollowGlassTwo"); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void hollowGlassTaskThree() { |
| | | //todo:暂无三线的空闲状态信号,临时标签空闲状态 |
| | | hollowGlassTaskChild(932, "ZKQ3.ZKQ3.isFree", "HollowGlassThree"); |
| | | } |
| | | |
| | | public void hollowGlassTaskChild(int cell, String isFreeTag, String websocketName) { |
| | | List<HollowGlassOutRelationInfo> taskList = hollowGlassOutRelationInfoService.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)); |
| | | .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START).eq(HollowGlassOutRelationInfo::getCell, cell)); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | if (CollectionUtil.isNotEmpty(taskList)) { |
| | | List<Long> taskIdList = taskList.stream().map(HollowGlassOutRelationInfo::getId).collect(Collectors.toList()); |
| | | List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>().in(HollowGlassQueueInfo::getRelationId, taskIdList)); |
| | | Map<Integer, List<HollowGlassQueueInfo>> listMap = list.stream().collect(Collectors.groupingBy(HollowGlassQueueInfo::getCell)); |
| | | jsonObject.append("930", listMap.get(930)); |
| | | jsonObject.append("931", listMap.get(931)); |
| | | jsonObject.append("932", listMap.get(932)); |
| | | jsonObject.append("queueInfo", list); |
| | | } |
| | | try { |
| | | //930空闲信号 |
| | | ReadWriteEntity freeOneRequestEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree"); |
| | | jsonObject.append("freeOneRequestEntity", freeOneRequestEntity.getValue()); |
| | | //931空闲信号 |
| | | ReadWriteEntity freeTwoRequestEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree"); |
| | | jsonObject.append("freeTwoRequestEntity", freeTwoRequestEntity.getValue()); |
| | | ReadWriteEntity freeOneRequestEntity = miloService.readFromOpcUa(isFreeTag); |
| | | jsonObject.append("freeRequest", freeOneRequestEntity.getValue()); |
| | | } catch (Exception e) { |
| | | log.error("opc存在异常", e); |
| | | } |
| | | |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("HollowGlass"); |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get(websocketName); |
| | | if (CollectionUtil.isNotEmpty(sendwServer)) { |
| | | for (WebSocketServer socketServer : sendwServer) { |
| | | if (socketServer != null && socketServer.session.isOpen()) { |
| | |
| | | //931空闲信号 |
| | | ReadWriteEntity freeTwoRequestEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree"); |
| | | jsonObject.append("freeTwoRequestEntity", freeTwoRequestEntity.getValue()); |
| | | //932空闲信号 |
| | | ReadWriteEntity freeThreeRequestEntity = miloService.readFromOpcUa("ZKQ3.ZKQ3.isFree"); |
| | | jsonObject.append("freeThreeRequestEntity", freeThreeRequestEntity.getValue()); |
| | | } catch (Exception e) { |
| | | //todo:不做任务处理 |
| | | } |
| | |
| | | from hollow_glass_relation_info |
| | | where flow_card_id = #{flowCardId} |
| | | </select> |
| | | <select id="queryProductNameByFlowCardId" resultType="java.lang.String"> |
| | | select product_name |
| | | from sd.order_detail |
| | | where (order_id, order_number) = ( |
| | | select min(order_id) as order_id, min(order_number) as order_number |
| | | from pp.flow_card |
| | | where process_id = #{flowCardId} |
| | | ) |
| | | limit 1 |
| | | </select> |
| | | |
| | | <update id="clearDirtyFlowCardData"> |
| | | update hollow_glass_relation_info |