From 7732d4f464f0670349402e47caeec04c17a9a8c7 Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期六, 24 一月 2026 10:25:34 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/controller/OpenController.java | 108 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 94 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index 83f5d5c..7370663 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -1,13 +1,21 @@
package com.zy.asrs.controller;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.R;
-import com.zy.asrs.entity.BasStation;
import com.zy.asrs.entity.BasStationTv;
import com.zy.asrs.entity.TvDevice;
+import com.zy.asrs.entity.dto.TvDataDto;
+import com.zy.asrs.entity.dto.TvLocDataDto;
+import com.zy.asrs.entity.dto.WcsStationDto;
+import com.zy.asrs.enums.RedisKeyType;
+import com.zy.asrs.service.BasStationTvService;
+import com.zy.asrs.service.TvDeviceService;
+import com.zy.asrs.utils.StationUtils;
import com.zy.asrs.utils.Utils;
+import com.zy.common.utils.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
@@ -16,7 +24,6 @@
import javax.servlet.http.HttpServletRequest;
import java.util.*;
-import java.util.stream.Collectors;
@Slf4j
@RestController
@@ -26,11 +33,13 @@
private static final String[] WEEK = {"鏄熸湡鏃�","鏄熸湡涓�","鏄熸湡浜�","鏄熸湡涓�","鏄熸湡鍥�","鏄熸湡浜�","鏄熸湡鍏�"};
@Autowired
- private com.zy.asrs.service.TvDeviceService tvDeviceService;
+ private TvDeviceService tvDeviceService;
@Autowired
- private com.zy.asrs.service.BasStationTvService basStationTvService;
+ private BasStationTvService basStationTvService;
@Autowired
- private com.zy.asrs.service.BasStationService basStationService;
+ private StationUtils stationUtils;
+ @Autowired
+ private RedisUtil redisUtil;
@Value("${app.version:1.0.0}")
private String appVersion;
@@ -53,14 +62,12 @@
@GetMapping("/getLedInfos")
public R getLedInfos(HttpServletRequest request) {
String remoteAddr = request.getRemoteAddr();
- // 1. 鏍规嵁IP鏌ヨ鐢佃鏈�
TvDevice tvDevice = tvDeviceService.selectOne(
new EntityWrapper<TvDevice>().eq("ip", remoteAddr));
if (tvDevice == null) {
return R.error("鏈壘鍒癐P瀵瑰簲鐨勭數瑙嗘満璁惧: " + remoteAddr);
}
- // 2. 鏌ヨ缁戝畾鐨勭珯鍙癐D
List<BasStationTv> relations = basStationTvService
.selectList(new EntityWrapper<BasStationTv>().eq("tv_id", tvDevice.getId()));
if (relations == null || relations.isEmpty()) {
@@ -69,14 +76,46 @@
return r;
}
- // 3. 鑾峰彇绔欏彴璇︽儏
- List<Integer> stationIds = relations.stream().map(BasStationTv::getStationId)
- .collect(Collectors.toList());
- List<BasStation> stations = basStationService.selectBatchIds(stationIds);
- R r = R.ok();
- r.put("data", stations);
- return r;
+ List<TvDataDto> list = new ArrayList<>();
+ for (BasStationTv relation : relations) {
+ WcsStationDto wcsStationDto = stationUtils.stationMap.get(relation.getStationId());
+
+ if (wcsStationDto == null) {
+ continue;
+ }
+
+ if (wcsStationDto.getLoading() != 1) {
+ continue;
+ }
+
+ String errorMsg = "";
+ if (!Cools.isEmpty(wcsStationDto.getErrorMsg())) {
+ errorMsg += wcsStationDto.getErrorMsg();
+ }
+
+ if (!Cools.isEmpty(wcsStationDto.getSystemWarning())) {
+ errorMsg += wcsStationDto.getSystemWarning();
+ }
+
+ TvDataDto tvDataDto = new TvDataDto();
+ tvDataDto.setStationId(wcsStationDto.getStationId());
+ tvDataDto.setTaskNo(wcsStationDto.getTaskNo());
+ tvDataDto.setBarcode(wcsStationDto.getBarcode());
+ tvDataDto.setErrorMsg(errorMsg);
+ tvDataDto.setIoType(wcsStationDto.getIoType());
+ tvDataDto.setWrkDetls(wcsStationDto.getWrkDetls());
+
+ if (Cools.isEmpty(errorMsg)) {
+ tvDataDto.setErrorCode(0);
+ }else {
+ tvDataDto.setErrorCode(1);
+ }
+
+ list.add(tvDataDto);
+ }
+
+ return R.ok().add(list);
}
/**
@@ -98,4 +137,45 @@
);
}
+ /**
+ * 鑾峰彇搴撲綅鏁版嵁
+ */
+ @GetMapping("/queryLoc")
+ public R queryLoc() {
+ TvLocDataDto tvLocDataDto = new TvLocDataDto();
+ Object o = redisUtil.get(RedisKeyType.TV_LOC_DATA_DTO.key);
+ if(o == null){
+ return R.ok().add(tvLocDataDto);
+ }
+
+ tvLocDataDto = JSON.parseObject(o.toString(), TvLocDataDto.class);
+ return R.ok().add(tvLocDataDto);
+ }
+
+ /**
+ * WMS鍏ュ嚭搴撴姌绾垮浘
+ */
+ @GetMapping("/inOutLineCharts")
+ public R inOutLineCharts() {
+ Object o = redisUtil.get(RedisKeyType.TV_LINE_CHARTS.key);
+ if(o == null){
+ return R.error();
+ }
+
+ return R.ok().add(JSON.parseObject(o.toString()));
+ }
+
+ /**
+ * WMS搴撳瓨鏁版嵁缁熻
+ */
+ @GetMapping("/locDetlStatistics")
+ public R locDetlStatistics() {
+ Object o = redisUtil.get(RedisKeyType.TV_LOC_DETL_STATISTICS.key);
+ if(o == null){
+ return R.error();
+ }
+
+ return R.ok().add(JSON.parseArray(o.toString()));
+ }
+
}
--
Gitblit v1.9.1