From ea8859c58b8fd24a54f7a838d6f8eaa98d57fb65 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 18 十二月 2024 11:44:07 +0800
Subject: [PATCH] 1、大理片笼进出片任务新增限制:进片玻璃数大于可用格子时,不允许进片 2、超过最大尺寸且直通通道有玻璃时 不能进片 3、大理片超过最大高度走直通通道 4、fixbug:笼子厚度限制
---
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java | 82 +++++++++++++++++-----------------------
1 files changed, 35 insertions(+), 47 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 b210c53..baa53ca 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
@@ -5,7 +5,6 @@
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;
@@ -18,12 +17,11 @@
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;
@@ -33,7 +31,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.*;
import java.util.stream.Collectors;
@Slf4j
@@ -50,13 +47,6 @@
private DownGlassTaskService downGlassTaskService;
@Autowired
private GlassInfoService glassInfoService;
- private final ExecutorService scanCodeThreadPool = new ThreadPoolExecutor(
- 10, // core pool size
- 20, // maximum pool size
- 60L, TimeUnit.SECONDS,
- new LinkedBlockingQueue<>()
- );
- private final ExecutorService isRunThreadPool = Executors.newFixedThreadPool(5);
@Value("${mes.scan.ip}")
private String scanIp;
@@ -164,7 +154,7 @@
jsonObject4.append("downGlassInfos", downGlassInfos);
jsonObject4.append("engineerIdList", engineerIdList);
- //閽㈠寲寮�鍏�
+ //鎵撳嵃寮�鍏�
boolean autoPrint = false;
if (redisUtil.getCacheObject("autoPrint") == null) {
redisUtil.setCacheObject("autoPrint", false);
@@ -178,10 +168,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) {
@@ -195,52 +186,49 @@
@Scheduled(fixedDelay = 1000)
public void isRun() {
- isRunThreadPool.execute(() -> {
- JSONObject jsonObject = new JSONObject();
- //姝e湪杩涜鐨勪换鍔�
- List<DownWorkstation> downWorkstation = downWorkstationService.getoneDownWorkstations(1, 6);
- jsonObject.append("downWorkstation", downWorkstation);
- List<DownGlassTask> downGlassTask = downGlassTaskService.selectOutTaskCache();
- jsonObject.append("downGlassTask", downGlassTask);
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unLoadGlassIsRun");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- if (webserver != null) {
- webserver.sendMessage(jsonObject.toString());
- } else {
- log.info("unLoadGlassIsRun is closed");
- }
+ JSONObject jsonObject = new JSONObject();
+ //姝e湪杩涜鐨勪换鍔�
+ List<DownWorkstation> downWorkstation = downWorkstationService.getoneDownWorkstations(1, 6);
+ jsonObject.append("downWorkstation", downWorkstation);
+ List<DownGlassTask> downGlassTask = downGlassTaskService.selectOutTaskCache();
+ jsonObject.append("downGlassTask", downGlassTask);
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unLoadGlassIsRun");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ if (webserver != null) {
+ webserver.sendMessage(jsonObject.toString());
+ } else {
+ log.info("unLoadGlassIsRun is closed");
}
}
- });
-
+ }
}
- @Async
@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()))) {
// 鎺ユ敹鏈嶅姟鍣ㄥ搷搴�
-// socket.setSoTimeout(1000);
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 {
- jsonObject.append("scanGlass",glassInfo);
- sendwServer.get(0).sendMessage(jsonObject.toString());
+ 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());
}
--
Gitblit v1.8.0