| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
| | | 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.glassinfo.service.GlassInfoService;
|
| | | import com.mes.tools.DateUtil;
|
| | | import com.mes.tools.WebSocketServer;
|
| | | import com.mes.utils.RedisUtil;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.apache.commons.lang.StringUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.scheduling.TaskScheduler;
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.InputStreamReader;
|
| | | import java.net.InetSocketAddress;
|
| | | import java.net.Socket;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.concurrent.*;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | @Slf4j
|
| | |
| | | JSONObject jsonObject = new JSONObject();
|
| | |
|
| | | List<DownWorkstation> data = downWorkstationService.list();
|
| | | List<DownGlassTask> downGlassTasks = downGlassTaskService.list(
|
| | | new LambdaQueryWrapper<DownGlassTask>()
|
| | | .eq(DownGlassTask::getEndCell, 7)
|
| | | .eq(DownGlassTask::getTaskType, 3)
|
| | | .lt(DownGlassTask::getTaskStatus, 3)
|
| | | );
|
| | | DownWorkstation downWorkstation = new DownWorkstation();
|
| | | downWorkstation.setWorkstationId(7);
|
| | | downWorkstation.setEnableState(1);
|
| | | downWorkstation.setRacksNumber(downGlassTasks.size());
|
| | | downWorkstation.setTotalQuantity(downGlassTasks.size());
|
| | | data.add(downWorkstation);
|
| | | jsonObject.append("params", data);
|
| | | log.info(jsonObject.toString());
|
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
|
| | |
| | | jsonObject4.append("downGlassInfos", downGlassInfos);
|
| | | jsonObject4.append("engineerIdList", engineerIdList);
|
| | |
|
| | | //钢化开关
|
| | | //打印开关
|
| | | boolean autoPrint = false;
|
| | | if (redisUtil.getCacheObject("autoPrint") == null) {
|
| | | redisUtil.setCacheObject("autoPrint", false);
|
| | |
| | | new QueryWrapper<DownGlassTask>()
|
| | | .select("Top 1 *")
|
| | | .eq("end_cell", Const.G13_WORK_STATION)
|
| | | .eq("task_type", 3)
|
| | | .lt("task_status", Const.UNLOAD_GLASS_DOWN)
|
| | | .orderByAsc("id")
|
| | | );
|
| | | if(takeGlass!=null){
|
| | | if (takeGlass != null) {
|
| | | jsonObject4.append("takeGlass", takeGlass);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | @Scheduled(fixedDelay = Long.MAX_VALUE)
|
| | | public void scanCodeTask() {
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | log.info("扫描任务已启动");
|
| | | while (true) {
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | try (Socket socket = new Socket(scanIp, scanPort);
|
| | | BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()))) {
|
| | | // 接收服务器响应
|
| | |
| | | log.info("按照玻璃id:{},无法找到玻璃信息", glassId);
|
| | | } else {
|
| | | for (WebSocketServer webserver : sendwServer) {
|
| | | jsonObject.append("scanGlass", glassInfo);
|
| | | webserver.sendMessage(jsonObject.toString());
|
| | | jsonObject.append("scanGlass", glassInfo);
|
| | | webserver.sendMessage(jsonObject.toString());
|
| | | }
|
| | | }
|
| | | }
|