zhoushihao
2025-03-11 0762328022924dcb72d51c7099b85abb714a18b3
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
@@ -1,13 +1,19 @@
package com.mes.job;
import cn.hutool.json.JSONObject;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
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.entity.LoadGlassDeviceTask;
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;
import com.mes.uppattenusage.entity.UpPattenUsage;
@@ -24,6 +30,7 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
 * @author SNG-010
@@ -44,6 +51,8 @@
    RedisUtil redisUtil;
    @Resource
    private LoadGlassDeviceTaskService loadGlassDeviceTaskService;
    @Resource
    private RawGlassStorageStationService rawGlassStorageStationService;
    PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
@@ -100,7 +109,7 @@
        }
    }
//    @Scheduled(fixedDelay = 300)
    //    @Scheduled(fixedDelay = 300)
    public void plcLoadGlassReport() {
        //获取是否有汇报
        String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue();
@@ -134,7 +143,7 @@
            JSONObject jsonObject = new JSONObject();
            //正在进行的任务
            List<UpPattenUsage> upPattenUsages = upPattenUsageService.prioritylist();
            if(upPattenUsages!=null){
            if (upPattenUsages != null) {
                jsonObject.append("prioritylist", upPattenUsages);
            }
            //查询1号线的任务
@@ -161,9 +170,11 @@
            jsonObject.append("LoadTwoervice", LoadTwoState.getInkageState());
            //工位信息
            List<UpWorkstation> upWorkstations = upWorkstationService.list();
            jsonObject.append("list", upWorkstations);
            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);
            ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass");
            if (sendwServer != null) {
@@ -200,11 +211,11 @@
        }
    }
//    @Scheduled(fixedDelay = 5000)
    //    @Scheduled(fixedDelay = 5000)
    public void loadGlassStatus() {
        JSONObject jsonObject = new JSONObject();
        //正在进行的任务
        String inkageStatus =plcParameterObject.getPlcParameter("InkageStatus").getValue();
        String inkageStatus = plcParameterObject.getPlcParameter("InkageStatus").getValue();
//        String inkageStatus ="1";
        jsonObject.append("InkageStatus", inkageStatus);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass");
@@ -218,12 +229,13 @@
            }
        }
    }
    @Scheduled(fixedDelay = 1000)
    public void loadGlassIsRun() {
        JSONObject jsonObject = new JSONObject();
        //是否开始工程
        Engineering engineering = engineeringService.selectInitiate(1);
            jsonObject.append("engineering", engineering);
        jsonObject.append("engineering", engineering);
        //工位信息
        List<UpWorkstation> upWorkstations = upWorkstationService.list();
        jsonObject.append("list", upWorkstations);