ZengTao
2024-08-27 3fe19c705a4b0e32096b5c39c5489ea111a10e15
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
@@ -6,11 +6,14 @@
import com.mes.common.config.Const;
import com.mes.common.utils.RedisUtil;
import com.mes.downglassinfo.entity.DownGlassInfo;
import com.mes.downglassinfo.entity.DownGlassTask;
import com.mes.downglassinfo.entity.request.DownGlassInfoRequest;
import com.mes.downglassinfo.service.DownGlassInfoService;
import com.mes.downglassinfo.service.DownGlassTaskService;
import com.mes.downstorage.service.DownStorageCageService;
import com.mes.downworkstation.entity.DownWorkstation;
import com.mes.downworkstation.service.DownWorkstationService;
import com.mes.tools.DateUtil;
import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -33,6 +36,9 @@
    private DownStorageCageService downStorageCageService;
    @Autowired
    private DownGlassInfoService downGlassInfoService;
    @Autowired
    private DownGlassTaskService downGlassTaskService;
    @Autowired
    private RedisUtil redisUtil;
@@ -42,7 +48,7 @@
        log.info("发送工位玻璃信息");
        JSONObject jsonObject = new JSONObject();
        List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1, 6);
        List<DownWorkstation> data = downWorkstationService.list();
        jsonObject.append("params", data);
        log.info(jsonObject.toString());
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
@@ -113,6 +119,10 @@
        if (null == request) {
            request = new DownGlassInfoRequest();
        }
        if (request.getBeginDate() == null) {
            request.setBeginDate(DateUtil.getBeginDate());
            request.setEndDate(DateUtil.getEndDate());
        }
        log.info("发送当前正在执行工程已落架的玻璃信息");
        LambdaQueryWrapper<DownGlassInfo> wrapper = new LambdaQueryWrapper<DownGlassInfo>()
                .between(null != request.getBeginDate(), DownGlassInfo::getGmtCreate, request.getBeginDate(), request.getEndDate())
@@ -123,12 +133,32 @@
            wrapper.eq(DownGlassInfo::getWorkStationId, request.getWorkStationId());
        }
        List<DownGlassInfo> downGlassInfos = downGlassInfoService.list(wrapper);
        Map<Integer, List<DownGlassInfo>> listMap = downGlassInfos.stream().collect(Collectors.groupingBy(DownGlassInfo::getWorkStationId));
//        Map<Integer, List<DownGlassInfo>> listMap = downGlassInfos.stream().collect(Collectors.groupingBy(DownGlassInfo::getWorkStationId));
        List<Object> engineerIdListTemp = downGlassInfoService.listObjs(new QueryWrapper<DownGlassInfo>().select("distinct engineer_id"));
        List<String> engineerIdList = engineerIdListTemp.stream().map(String::valueOf).collect(Collectors.toList());
        JSONObject jsonObject4 = new JSONObject();
        jsonObject4.append("downGlassInfos", listMap);
        jsonObject4.append("downGlassInfos", downGlassInfos);
        jsonObject4.append("engineerIdList", engineerIdList);
        //钢化开关
        boolean autoPrint = false;
        if (redisUtil.getCacheObject("autoPrint") == null) {
            redisUtil.setCacheObject("autoPrint", false);
        } else {
            autoPrint = redisUtil.getCacheObject("autoPrint");
        }
        jsonObject4.append("autoPrint", autoPrint);
        //人工下片位置最后一片
        DownGlassTask takeGlass = downGlassTaskService.getOne(
                new QueryWrapper<DownGlassTask>()
                        .select("Top 1 *")
                        .eq("end_cell", Const.G13_WORK_STATION)
                        .orderByDesc("id")
        );
        jsonObject4.append("takeGlass", takeGlass);
        ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("unloadglass");
        if (sendwServer4 != null) {
            for (WebSocketServer webserver : sendwServer4) {
@@ -145,6 +175,8 @@
        //正在进行的任务
        List<DownWorkstation> downWorkstation = downWorkstationService.getoneDownWorkstations(1, 6);
        jsonObject.append("downWorkstation", downWorkstation);
        List<DownGlassTask> downGlassTask = downGlassTaskService.selectOutTaskCache();
        jsonObject.append("downGlassTask", downGlassTask);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unLoadGlassIsRun");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {