From d5d652d23a0bdf64ce527a6b592713a849abac7d Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 17 十月 2024 15:22:37 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/HangZhouMes
---
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java | 55 ++++++++++++++++++++++++++++++-------------------------
1 files changed, 30 insertions(+), 25 deletions(-)
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
index 6a17f8a..9096c98 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
@@ -22,15 +22,19 @@
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
@@ -154,7 +158,7 @@
jsonObject4.append("downGlassInfos", downGlassInfos);
jsonObject4.append("engineerIdList", engineerIdList);
- //閽㈠寲寮�鍏�
+ //鎵撳嵃寮�鍏�
boolean autoPrint = false;
if (redisUtil.getCacheObject("autoPrint") == null) {
redisUtil.setCacheObject("autoPrint", false);
@@ -168,10 +172,11 @@
.select("Top 1 *")
.eq("end_cell", Const.G13_WORK_STATION)
.lt("task_status", Const.UNLOAD_GLASS_DOWN)
- .orderByDesc("id")
+ .orderByAsc("id")
);
- jsonObject4.append("takeGlass", takeGlass);
-
+ if(takeGlass!=null){
+ jsonObject4.append("takeGlass", takeGlass);
+ }
ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("unloadglass");
if (sendwServer4 != null) {
@@ -207,30 +212,30 @@
public void scanCodeTask() {
log.info("鎵弿浠诲姟宸插惎鍔�");
while (true) {
- new Thread(() -> {
- try (Socket socket = new Socket(scanIp, scanPort);
- BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()))) {
- // 鎺ユ敹鏈嶅姟鍣ㄥ搷搴�
- String response;
- log.info("绛夊緟鎵爜涓�......");
- while ((response = in.readLine()) != null) {
- log.info("鎵弿鍒扮殑鐜荤拑id锛歿}", response);
- List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("scanCode");
- if (CollectionUtils.isNotEmpty(sendwServer)) {
- //鎸夌収鐜荤拑id鑾峰彇鐜荤拑淇℃伅杩斿洖缁欏墠绔晫闈紝鍏蜂綋闇�瑕佸摢浜涙暟鎹緟纭
- GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>()
- .eq(GlassInfo::getGlassId, response).last("limit 1"));
- if (null == glassInfo) {
- log.info("鎸夌収鐜荤拑id锛歿}锛屾棤娉曟壘鍒扮幓鐠冧俊鎭�", response);
- } else {
- sendwServer.get(0).sendMessage(glassInfo.toString());
- }
+ JSONObject jsonObject = new JSONObject();
+ try (Socket socket = new Socket(scanIp, scanPort);
+ BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()))) {
+ // 鎺ユ敹鏈嶅姟鍣ㄥ搷搴�
+ log.info("绛夊緟鎵爜涓�......");
+ String glassId = in.readLine();
+ log.info("鎵弿鍒扮殑鐜荤拑id锛歿}", glassId);
+ List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
+ if (CollectionUtils.isNotEmpty(sendwServer)) {
+ //鎸夌収鐜荤拑id鑾峰彇鐜荤拑淇℃伅杩斿洖缁欏墠绔晫闈紝鍏蜂綋闇�瑕佸摢浜涙暟鎹緟纭
+ GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>()
+ .eq(GlassInfo::getGlassId, glassId).last("limit 1"));
+ if (null == glassInfo) {
+ log.info("鎸夌収鐜荤拑id锛歿}锛屾棤娉曟壘鍒扮幓鐠冧俊鎭�", glassId);
+ } else {
+ for (WebSocketServer webserver : sendwServer) {
+ jsonObject.append("scanGlass", glassInfo);
+ webserver.sendMessage(jsonObject.toString());
}
}
- } catch (Exception exception) {
- log.info("璇诲彇寮傚父锛屽師鍥犱负{}", exception.getMessage());
}
- }).start();
+ } catch (Exception exception) {
+ log.info("璇诲彇寮傚父锛屽師鍥犱负{}", exception.getMessage());
+ }
}
}
}
--
Gitblit v1.8.0