zhoushihao
2024-10-11 d5d0d1c7a84b996b9bbcebfaf2c2c95f1a5a3678
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
@@ -137,7 +137,7 @@
            //加笼子里面是否有玻璃,有先出,无玻璃先进
            boolean outFlase = outTo(Integer.parseInt(out08Glassstate),
                    Integer.parseInt(out10Glassstate), confirmationWrodAddress, glassIdeValue, Integer.parseInt(currentSlot));
            log.info("出片任务是否完成:{},失败且玻璃id:{}不为空则执行进片任务", outFlase, glassIdeValue);
            log.info("出片任务是否完成:{},且玻璃id:{}不为空则执行进片任务", outFlase, glassIdeValue);
            if (!outFlase && StringUtils.isNotBlank(glassIdeValue)) {
                inTo(glassIdeValue, confirmationWrodAddress, currentSlot);
            }
@@ -210,7 +210,6 @@
        S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 1);
        log.info("7、发送确认字完成");
    }
@@ -557,7 +556,7 @@
        if (endcell == Const.A10_OUT_TARGET_POSITION) {
            wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
                    "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
                    "on t.glass_id = t1.glass_id and (t1.first_length >= " + minOneFirstLength + " and t1.second_length >= " + minOneSecondLength);
                    "on t.glass_id = t1.glass_id and (t1.first_length >= " + minOneFirstLength + " and t1.second_length >= " + minOneSecondLength + ")");
        } else {
            wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
                    "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
@@ -654,6 +653,13 @@
            log.info("7、添加出片玻璃尺寸信息到磨边前玻璃表是否完成:{}", glassSizeStatus);
            S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 1);
            log.info("8、发送确认字已完成");
            Damage damage=new Damage();
            damage.setGlassId(glassInfo.getGlassId());
            damage.setWorkingProcedure("切割");
            damage.setLine(1001);
            damage.setType(1);
            damage.setRemark("过卧式理片");
            damageService.insertDamage(damage);
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
@@ -680,7 +686,7 @@
    }
    /**
     * 添加理片笼任务
     * 添加磨边队列信息
     *
     * @param glassInfo
     * @param endcell
@@ -726,20 +732,8 @@
    public void CacheGlassTasks() {
        JSONObject jsonObject = new JSONObject();
        List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory();
//        List<Map<String, Object>> currentCutTerritorys=new ArrayList<>();
//        if(engineerId==null||engineerId.isEmpty()){
//            //识别摆片 当前版图数据
//            currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory();
//        }else{
//            //识别摆片 此engineerId 工程版图数据
//            currentCutTerritorys = edgStorageCageDetailsService.selectCurrentCutTerritory(engineerId);
//        }
        jsonObject.append("currentCutTerritory", currentCutTerritorys);
        //log.info("本次识别版图{},++++{}",engineerId,currentCutTerritorys);
        //磨边信息
        List<EdgGlassTaskInfo> edgTasks = edgGlassTaskInfoService.selectEdgInfo();
        jsonObject.append("edgTasks", edgTasks);
        //卧室缓存笼内信息
        List<Map<String, Object>> EdgStorageCageinfos = edgStorageCageService.selectEdgStorageCages();
        jsonObject.append("EdgStorageCageinfos", EdgStorageCageinfos);
@@ -779,4 +773,28 @@
        }
    }
    @Scheduled(fixedDelay = 1000)
    public void CacheGlassTaskss() {
        JSONObject jsonObject = new JSONObject();
        //log.info("本次识别版图{},++++{}",engineerId,currentCutTerritorys);
        //磨边信息
        List<EdgGlassTaskInfo> edgTasks = edgGlassTaskInfoService.selectEdgInfo();
        jsonObject.append("edgTasks", edgTasks);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("edgTasks");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {
                if (webserver != null) {
                    webserver.sendMessage(jsonObject.toString());
                    List<String> messages = webserver.getMessages();
                    if (!messages.isEmpty()) {
                        // // 将最后一个消息转换为整数类型的列表
                        webserver.clearMessages();
                    }
                } else {
                    log.info("edgTasks is closed");
                }
            }
        }
    }
}