严智鑫
2024-05-29 62c74409a587d9921df1a2248ce23b3b0375fbd1
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
@@ -44,19 +44,19 @@
     * fixedDelay : 上一个调用结束后再次调用的延时
     */
    @Scheduled(fixedDelay = 300)
    @Scheduled(fixedDelay = 3000000)
    public void plcLoadGlassTask() throws InterruptedException {
        try {
            //获取联机状态
            String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue();
            if("1".equals(inkageStatus)) {
                //获取是否有上片请求
                String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue();
                String mesToPlc = plcParameterObject.getPlcParameter("MesToPlc").getValue();
            //获取是否有上片请求
            String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue();
            //mes状态
            String mesToPlc = plcParameterObject.getPlcParameter("MesToPlc").getValue();
            if("1".equals(inkageStatus)&&"1".equals(loadRequest)) {
                //判断开始上片的工程号
                Engineering engineering = engineeringService.selectInitiate(1);
                if ("1".equals(loadRequest) && engineering != null) {
                if (engineering != null) {
                    log.info("开始上片任务");
                    UpPattenUsage upPattenUsage = upWorkstationService.selectPriority(engineering);
                    log.info("当有请求时查询当前上片顺序的玻璃信息{}", upPattenUsage);
@@ -75,10 +75,11 @@
                    }
                }
                if ("1".equals(mesToPlc) && "0".equals(loadRequest)) {
                    //请求字为零时,任务字清零
                    S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0);
                }
            }
            if ("1".equals(mesToPlc) && "0".equals(loadRequest)) {
                //请求字为零时,任务字清零
                S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0);
            }
            //执行后休眠300毫秒
            //Thread.sleep(300);
@@ -87,7 +88,7 @@
        }
    }
    @Scheduled(fixedDelay = 300)
    @Scheduled(fixedDelay = 30000000)
    public void plcLoadGlassReport(){
        //获取是否有汇报
        String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue();
@@ -115,7 +116,7 @@
        }
    }
    @Scheduled(fixedDelay = 300)
    @Scheduled(fixedDelay = 1000)
    public void loadGlassHome(){
        JSONObject jsonObject = new JSONObject();
        //正在进行的任务