From 83f738105416c9b11e3b7c5246a0980e41b6650e Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 13 十月 2025 16:59:48 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/job/RawGlassPushMessage.java | 72 ++++++++++++++++++++++++------------
1 files changed, 48 insertions(+), 24 deletions(-)
diff --git a/hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/job/RawGlassPushMessage.java b/hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/job/RawGlassPushMessage.java
index 6e7d874..9d23890 100644
--- a/hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/job/RawGlassPushMessage.java
+++ b/hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/job/RawGlassPushMessage.java
@@ -2,11 +2,21 @@
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.mes.common.config.Const;
+import com.mes.order.entity.dto.OrderDTO;
+import com.mes.order.service.OrdersService;
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.rawglasstask.entity.RawGlassStorageTask;
import com.mes.rawglasstask.service.RawGlassStorageTaskService;
import com.mes.tools.WebSocketServer;
+import com.mes.tools.WebSocketUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -21,34 +31,48 @@
@Component
public class RawGlassPushMessage {
- @Resource private RawGlassStorageStationService rawGlassStorageStationService;
+ @Resource
+ private RawGlassStorageStationService rawGlassStorageStationService;
- @Resource private RawGlassStorageTaskService rawGlassStorageTaskService;
+ @Resource
+ private RawGlassStorageTaskService rawGlassStorageTaskService;
- @Scheduled(fixedDelay = 2000)
- public void sendRawGlassMessage() {
- log.info("鍙戦�佷换鍔′俊鎭拰鏋跺瓙淇℃伅");
- JSONObject jsonObject = new JSONObject();
- List<RawGlassStorageDetails> rawStationDetailsList =
- rawGlassStorageStationService.listRawGlassDetails();
- List<RawGlassStorageTask> tasks = rawGlassStorageTaskService.listRawGlassTask();
- jsonObject.append("rawStationDetailsList", rawStationDetailsList);
- jsonObject.append("tasks", tasks);
-// log.info("鑾峰彇鍒扮殑宸ヤ綅璇︽儏鍙婁换鍔′俊鎭负锛歿}", jsonObject);
+ @Resource
+ private RawGlassStorageDetailsService rawGlassStorageDetailsService;
- List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("rawGlass");
- if (CollectionUtil.isNotEmpty(sendwServer)) {
- sendwServer.stream().forEach(e->{
- e.sendMessage(String.valueOf(jsonObject));
- });
+ @Resource
+ private OrdersService ordersService;
+
+ @Resource
+ private WebSocketUtils webSocketUtils;
+
+ @Scheduled(fixedDelay = 2000)
+ public void sendRawGlassMessage() {
+ log.info("鍙戦�佷换鍔′俊鎭拰鏋跺瓙淇℃伅");
+ JSONObject jsonObject = new JSONObject();
+ List<RawGlassStorageDetails> rawStationDetailsList =
+ rawGlassStorageStationService.listRawGlassDetails();
+ List<RawGlassStorageTask> tasks = rawGlassStorageTaskService.listRawGlassTask();
+ jsonObject.append("rawStationDetailsList", rawStationDetailsList);
+ jsonObject.append("tasks", tasks);
+ webSocketUtils.sendToWeb("rawGlass", jsonObject);
}
+ @Scheduled(fixedDelay = 1000)
+ public void largenScreen() {
+ log.info("鍙戦�佷换鍔′俊鎭拰鏋跺瓙淇℃伅");
+ JSONObject jsonObject = new JSONObject();
+ MPJLambdaWrapper<RawGlassStorageDetails> wrapper = new MPJLambdaWrapper<>();
+ wrapper.select(RawGlassStorageStation::getSlot)
+ .select("ifnull(remain_quantity, 0) as remain_quantity")
+ .rightJoin(RawGlassStorageStation.class, on -> on.eq(RawGlassStorageStation::getSlot, RawGlassStorageDetails::getSlot)
+ .eq(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_IN))
+ .orderByAsc(RawGlassStorageStation::getSlot);
+ List<RawGlassStorageDetails> rawGlassStorageDetailList = rawGlassStorageDetailsService.list(wrapper);
+ jsonObject.append("rawGlassStorageDetailList", rawGlassStorageDetailList);
- }
-
- /** todo:鍏ュ簱浠诲姟锛氬悐瑁呬綅鏈夌幓鐠冿紝鍏堝幓宸ヤ綅琛ㄦ煡璇㈢┖鏍煎瓙锛岀敓鎴愬叆搴撲换鍔′粠鍚婅浣嶅埌鐩爣鏍煎瓙 */
-
- /** todo:鍑哄簱浠诲姟锛�1銆佺偣鍑哄簱锛岀珛椹敓鎴愬嚭鐗囦换鍔� 2銆佺偣鍑哄簱淇敼宸ヤ綅璇︽儏鍐呯殑鐘舵�佷负寰呭嚭搴擄紝瀹氭椂浠诲姟鎵弿鐢熸垚鍑哄簱浠诲姟 */
-
- /** todo:鍘熺墖璋冨害锛�1銆佹煡璇㈠伐绋嬪師鐗囪〃锛屾寜鐓ч『搴忓皢鍘熺墖鏀惧叆涓婄墖1鍙蜂綅锛屽悗缁師鐗囨斁涓婄墖2鍙蜂綅锛屽嚭鐜板昂瀵告浛鎹紝鍒ゆ柇鍘熶笂鐗囦綅鏄惁鏈夌幓鐠冿紝鏈� 鍏堝嚭鍚庤繘锛屾棤 鐩存帴杩涚墖 */
+ List<OrderDTO> orderDTOS = ordersService.selectOrderPercent();
+ jsonObject.append("orderDTOS", orderDTOS);
+ webSocketUtils.sendToWeb("largenScreen", jsonObject);
+ }
}
--
Gitblit v1.8.0