1、新增中空调度开关
2、新增websocket向前端推送每条线正在执行的任务到玻璃信息
2个文件已修改
1个文件已添加
66 ■■■■■ 已修改文件
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application-yw.yml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application-yw.yml
@@ -9,6 +9,11 @@
          username: root
          password: beibo.123/
          driver-class-name: com.mysql.cj.jdbc.Driver
        salve_hangzhoumes:
          url: jdbc:sqlserver://192.168.2.100:1433;databasename=mes
          username: sa
          password: beibo.123/
          driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
        pp:
          url: jdbc:mysql://192.168.2.100:3306/pp?serverTimezone=GMT%2b8
          username: root
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java
@@ -35,5 +35,11 @@
        return Result.success(hollowGlassOutRelationInfoService.forceOutGlass(flowCardId, cell, totalPairQuantity));
    }
    @ApiOperation("是否调度开关")
    @PostMapping("/dispatchHollowSwitch")
    public Result<Boolean> dispatchHollowSwitch(Boolean flag) {
        return Result.build(200, "修改成功",hollowGlassOutRelationInfoService.dispatchHollowSwitch(flag));
    }
}
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java
New file
@@ -0,0 +1,55 @@
package com.mes.job;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mes.common.config.Const;
import com.mes.hollow.entity.HollowGlassOutRelationInfo;
import com.mes.hollow.service.HollowGlassOutRelationInfoService;
import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @Author : zhoush
 * @Date: 2024/12/4 9:41
 * @Description:
 */
@Component
@Slf4j
public class PushMessageToIndex {
    @Resource
    HollowGlassQueueInfoService  hollowGlassQueueInfoService;
    @Resource
    HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
    @Scheduled(fixedDelay = 1000)
    public void CacheGlassTasks() {
        List<HollowGlassOutRelationInfo> taskList = hollowGlassOutRelationInfoService.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
                .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE));
        if (CollectionUtil.isEmpty(taskList)){
            return;
        }
        JSONObject jsonObject = new JSONObject();
        List<String> flowCardIdList = taskList.stream().map(HollowGlassOutRelationInfo::getFlowCardId).collect(Collectors.toList());
        List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>().in(HollowGlassQueueInfo::getFlowCardId, flowCardIdList));
        Map<Integer, List<HollowGlassQueueInfo>> listMap = list.stream().collect(Collectors.groupingBy(HollowGlassQueueInfo::getCell));
        jsonObject.append("HollowGlass",listMap);
        List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("HollowGlass");
        if (CollectionUtil.isNotEmpty(sendwServer)) {
                WebSocketServer socketServer = sendwServer.get(0);
                if (socketServer != null && socketServer.session.isOpen()) {
                    socketServer.sendMessage(jsonObject.toString());
                }
        }
    }
}