From b579fe0be3bd02ec39d612a62b23901fb852c173 Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期六, 16 八月 2025 09:02:12 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/ConsoleController.java | 52 +++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/ConsoleController.java b/src/main/java/com/zy/asrs/controller/ConsoleController.java index 168562a..5c51081 100644 --- a/src/main/java/com/zy/asrs/controller/ConsoleController.java +++ b/src/main/java/com/zy/asrs/controller/ConsoleController.java @@ -1,9 +1,12 @@ package com.zy.asrs.controller; 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; +import com.core.common.DateUtils; import com.core.common.R; import com.zy.asrs.domain.enums.CrnStatusType; import com.zy.asrs.domain.enums.SiteStatusType; @@ -17,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; @@ -31,8 +36,10 @@ 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.*; @@ -58,6 +65,10 @@ private LocMastMapper locMastMapper; @Autowired private BasCrnErrorMapper basCrnErrorMapper; + @Autowired + private ConfigService configService; + @Autowired + private CommonService commonService; @PostMapping("/system/running/status") @ManagerAuth(memo = "绯荤粺杩愯鐘舵��") @@ -87,6 +98,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 = "绔欑偣瀹炴椂鏁版嵁") @@ -246,7 +275,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()); @@ -292,15 +321,16 @@ @GetMapping("/barcode/output/site") public R crnOutput(){ -// StringBuilder str = new StringBuilder(); -// String s; -// int i = 0; -// while((s = OutputQueue.CRN.poll()) != null && i <=32) { -// str.append("\n").append(s); -// i++; -// } -// return R.ok().add(str.toString()); - return R.ok().add(JSON.toJSONString(new ArrayList<>(OutputQueue.BARCODE))); + ArrayList<JSONObject> jsonObjects = new ArrayList<>(OutputQueue.BARCODE); + jsonObjects.sort(new Comparator<JSONObject>() { + @Override + public int compare(JSONObject o1, JSONObject o2) { + Date o1Time = DateUtils.convert(o1.getString("time"), DateUtils.yyyyMMddHHmmss_F); + Date o2Time = DateUtils.convert(o2.getString("time"), DateUtils.yyyyMMddHHmmss_F); + return (int) (o2Time.getTime() - o1Time.getTime()); + } + }); + return R.ok().add(JSON.toJSONString(jsonObjects)); } } -- Gitblit v1.9.1