From b7951bdbb8925131cbc76be4902fcef0e88d0506 Mon Sep 17 00:00:00 2001 From: ytfl <ytfl@qq.com> Date: 星期二, 19 八月 2025 18:22:03 +0800 Subject: [PATCH] #自动获取电视机配置信息 --- src/main/java/com/zy/asrs/controller/ConsoleController.java | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/ConsoleController.java b/src/main/java/com/zy/asrs/controller/ConsoleController.java index 7dbab85..8a0ce35 100644 --- a/src/main/java/com/zy/asrs/controller/ConsoleController.java +++ b/src/main/java/com/zy/asrs/controller/ConsoleController.java @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.annotations.ManagerAuth; import com.core.common.Arith; import com.core.common.Cools; @@ -19,6 +20,8 @@ import com.zy.asrs.service.BasDevpService; import com.zy.asrs.service.WrkMastService; import com.zy.common.CodeRes; +import com.zy.common.service.CommonService; +import com.zy.common.utils.News; import com.zy.core.CrnThread; import com.zy.core.DevpThread; import com.zy.core.Slave; @@ -28,17 +31,21 @@ import com.zy.core.enums.SlaveType; import com.zy.core.model.CrnSlave; import com.zy.core.model.DevpSlave; +import com.zy.core.model.LedSlave; import com.zy.core.model.protocol.CrnProtocol; import com.zy.core.model.protocol.StaProtocol; import com.zy.core.properties.SlaveProperties; import com.zy.core.properties.SystemProperties; import com.zy.core.thread.BarcodeThread; -import com.zy.core.thread.MelsecCrnThread; import com.zy.core.thread.ScaleThread; +import com.zy.core.thread.SiemensCrnThread; +import com.zy.system.entity.Config; +import com.zy.system.service.ConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; import java.util.*; /** @@ -60,6 +67,10 @@ private LocMastMapper locMastMapper; @Autowired private BasCrnErrorMapper basCrnErrorMapper; + @Autowired + private ConfigService configService; + @Autowired + private CommonService commonService; @PostMapping("/system/running/status") @ManagerAuth(memo = "绯荤粺杩愯鐘舵��") @@ -90,6 +101,24 @@ /************************** 瀹炴椂鏁版嵁 ******************************/ /****************************************************************/ + @PostMapping("/devpTaskCount") + @ManagerAuth(memo = "杈撻�佺嚎浠诲姟鏁伴噺") + public R devpTaskCount(){ + int devpTaskStackOver = 20; + Config config = configService.selectOne(new EntityWrapper<Config>() + .eq("code", "devpTaskStackOver")); + if (config != null) { + devpTaskStackOver = Integer.parseInt(config.getValue()); + } + + Integer devpWorkingCount = commonService.queryDevpWorkingCount(); + + HashMap<String, Object> map = new HashMap<>(); + map.put("devpTaskStackOver", devpTaskStackOver); + map.put("devpWorkingCount", devpWorkingCount); + return R.ok().add(map); + } + @PostMapping("/latest/data/site") @ManagerAuth(memo = "绔欑偣瀹炴椂鏁版嵁") public R siteLatestData(){ @@ -107,7 +136,6 @@ vo.setSiteId(String.valueOf(entry.getKey())); // 绔欑偣缂栧彿 vo.setWorkNo(staProtocol.getWorkNo()); // 宸ヤ綔鍙� vo.setSiteStatus(SiteStatusType.process(staProtocol)); // 鐘舵�� - vo.setNearbySta(staProtocol.getNearbySta()); vos.add(vo); } return R.ok().add(vos); @@ -249,7 +277,7 @@ CrnDetailVo vo = new CrnDetailVo(); for (CrnSlave crnSlave : slaveProperties.getCrn()) { if (crnSlave.getId().equals(crnNo)) { - MelsecCrnThread crnThread = (MelsecCrnThread) SlaveConnection.get(SlaveType.Crn, crnSlave.getId()); + SiemensCrnThread crnThread = (SiemensCrnThread) SlaveConnection.get(SlaveType.Crn, crnSlave.getId()); CrnProtocol crnProtocol = crnThread.getCrnProtocol(); vo.setCrnNo(crnNo); vo.setWorkNo(crnProtocol.getTaskNo()); @@ -307,4 +335,15 @@ return R.ok().add(JSON.toJSONString(jsonObjects)); } + @GetMapping("/getLedInfos") + public R getLedInfos(HttpServletRequest request) { + String remoteAddr = request.getRemoteAddr(); + for (LedSlave slave : slaveProperties.getLed()) { + if (slave.getIp().equals(remoteAddr)) { + return R.ok().add(slave); + } + } + return R.ok(); + } + } -- Gitblit v1.9.1