From 178a4bc1610e4548c2afe8ad9d162aa47e61d9ea Mon Sep 17 00:00:00 2001 From: lsh <lsh@163.com> Date: 星期六, 14 九月 2024 16:40:25 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/enums/RgvStatusType.java | 31 ++++--- src/main/java/com/zy/core/enums/RgvModeType.java | 25 +++-- src/main/java/com/zy/asrs/controller/RgvController.java | 61 ++++++-------- src/main/java/com/zy/asrs/domain/param/EnergyGatheringRingParam.java | 11 ++ src/main/webapp/views/index.html | 51 +++++++----- src/main/java/com/zy/asrs/domain/param/RingThroughParam.java | 4 + 6 files changed, 101 insertions(+), 82 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/RgvController.java b/src/main/java/com/zy/asrs/controller/RgvController.java index ef49d0b..4cc777b 100644 --- a/src/main/java/com/zy/asrs/controller/RgvController.java +++ b/src/main/java/com/zy/asrs/controller/RgvController.java @@ -5,6 +5,7 @@ import com.core.common.R; import com.core.exception.CoolException; import com.zy.asrs.domain.enums.RgvStatusType; +import com.zy.asrs.domain.param.EnergyGatheringRingParam; import com.zy.asrs.domain.param.RgvOperatorParam; import com.zy.asrs.domain.param.RingThroughParam; import com.zy.asrs.domain.vo.*; @@ -320,58 +321,39 @@ return false; } - @PostMapping("/console/rgv/site/data") - @ManagerAuth(memo = "灏忚溅瀹炴椂浣嶇疆") - public R scaleLatestData(){ - List<Map> result = new ArrayList<>(); - for (RgvSlave rgv : slaveProperties.getRgv()) { - // 鑾峰彇RGV淇℃伅 - RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId()); - if (rgvThread == null) { - throw new CoolException("RGV涓嶅湪绾�"); - } - RgvProtocol rgvProtocol = rgvThread.getRgvProtocol(); - if (rgvProtocol == null) { - throw new CoolException("RGV涓嶅湪绾�"); - } - Map<String, Object> rgvMap = new HashMap<>(); - rgvMap.put("title", rgvProtocol.getRgvPosI()); - rgvMap.put("id", rgvProtocol.getRgvNo()); - result.add(rgvMap); - } - return R.ok().add(result); - } @PostMapping("/ring/through/rgv/position/data") // @ManagerAuth(memo = "鐜┛浣嶇疆淇℃伅") public R ringThroughRgv(){ List<RingThroughParam> result = new ArrayList<>(); -// for (RgvSlave rgv : slaveProperties.getRgv()) { - for (int i = 1;i<2;i++) { + for (RgvSlave rgv : slaveProperties.getRgv()) { +// for (int i = 1;i<2;i++) { // // 鑾峰彇RGV淇℃伅 -// RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId()); -// if (rgvThread == null) { -// continue; -// } -// RgvProtocol rgvProtocol = rgvThread.getRgvProtocol(); -// if (rgvProtocol == null) { -// continue; -// } + RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId()); + if (rgvThread == null) { + continue; + } + RgvProtocol rgvProtocol = rgvThread.getRgvProtocol(); + if (rgvProtocol == null) { + continue; + } RingThroughParam ringThroughParam = new RingThroughParam(); -// ringThroughParam.setIndex(rgv.getId()); - ringThroughParam.setIndex(i); + ringThroughParam.setIndex(rgv.getId()); +// ringThroughParam.setIndex(i); double[] doubles = Utils.RingThroughXY2(183.0, NumUtils.GetRandomIntInRange(183)); // double[] doubles = Utils.RingThroughXY2(183.0, 100*i ); ringThroughParam.setValueX(doubles[0]-2.94); ringThroughParam.setValueY(doubles[1]-2.94); + ringThroughParam.setModeColor(rgvProtocol.modeType.color); + ringThroughParam.setStatusColor(rgvProtocol.statusType.color); result.add(ringThroughParam); } return R.ok().add(result); } @PostMapping("/ring/through/dev/position/data") -// @ManagerAuth(memo = "鐜┛浣嶇疆淇℃伅") +// @ManagerAuth(memo = "绔欑偣淇℃伅") public R ringThroughDev(){ List<RingThroughParam> result = new ArrayList<>(); // for (RgvSlave rgv : slaveProperties.getRgv()) { @@ -397,4 +379,15 @@ return R.ok().add(result); } + @PostMapping("/ring/through/track/position/data") +// @ManagerAuth(memo = "杞ㄩ亾PLC鐘舵�佷俊鎭�") + public R wnergyGatheringRingParamTrack(){ + List<EnergyGatheringRingParam> result = new ArrayList<>(); + EnergyGatheringRingParam energyGatheringRingParam = new EnergyGatheringRingParam(); + energyGatheringRingParam.setTrackColor("rgba(0, 230, 118, 0.5)"); + energyGatheringRingParam.setRadiationColor("rgba(0, 230, 118, 0.5)"); + result.add(energyGatheringRingParam); + return R.ok().add(result); + } + } \ No newline at end of file diff --git a/src/main/java/com/zy/asrs/domain/param/EnergyGatheringRingParam.java b/src/main/java/com/zy/asrs/domain/param/EnergyGatheringRingParam.java new file mode 100644 index 0000000..6537abe --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/param/EnergyGatheringRingParam.java @@ -0,0 +1,11 @@ +package com.zy.asrs.domain.param; + +import lombok.Data; + +@Data +public class EnergyGatheringRingParam { + + private String trackColor; + + private String radiationColor; +} diff --git a/src/main/java/com/zy/asrs/domain/param/RingThroughParam.java b/src/main/java/com/zy/asrs/domain/param/RingThroughParam.java index 016860b..f920c86 100644 --- a/src/main/java/com/zy/asrs/domain/param/RingThroughParam.java +++ b/src/main/java/com/zy/asrs/domain/param/RingThroughParam.java @@ -10,4 +10,8 @@ private Double valueX; private Double valueY; + + private String modeColor; + + private String statusColor; } diff --git a/src/main/java/com/zy/core/enums/RgvModeType.java b/src/main/java/com/zy/core/enums/RgvModeType.java index f1dbe1e..337eaa1 100644 --- a/src/main/java/com/zy/core/enums/RgvModeType.java +++ b/src/main/java/com/zy/core/enums/RgvModeType.java @@ -2,42 +2,45 @@ public enum RgvModeType { - NONE(-1, "绂荤嚎"), - STOP(0, "缁翠慨"), - HAND(1, "鎵嬪姩"), - HALF_AUTO(2, "鍗婅嚜鍔�"), - AUTO(3, "鑷姩"), - AUTO2(100, "鍏跺畠"), + NONE(-1, "绂荤嚎","#4A4035"), + STOP(0, "缁翠慨","#E2C027"), + HAND(1, "鎵嬪姩","#2196F3"), + HALF_AUTO(2, "鍗婅嚜鍔�","#E2C027"), + AUTO(3, "鑷姩","#4B5CC4"), + AUTO2(100, "鍏跺畠","#2196F3"), + SOS(999, "鍏跺畠","#2196F3") ; public Integer id; public String desc; - RgvModeType(Integer id, String desc) { + public String color; + RgvModeType(Integer id, String desc, String color) { this.id = id; this.desc = desc; + this.color = color; } public static RgvModeType get(Short id) { if (null == id) { - return null; + return SOS; } for (RgvModeType type : RgvModeType.values()) { if (type.id.equals(id.intValue())) { return type; } } - return null; + return SOS; } public static RgvModeType get(RgvModeType type) { if (null == type) { - return null; + return SOS; } for (RgvModeType rgvModeType : RgvModeType.values()) { if (rgvModeType == type) { return rgvModeType; } } - return null; + return SOS; } } diff --git a/src/main/java/com/zy/core/enums/RgvStatusType.java b/src/main/java/com/zy/core/enums/RgvStatusType.java index 5361565..583ee82 100644 --- a/src/main/java/com/zy/core/enums/RgvStatusType.java +++ b/src/main/java/com/zy/core/enums/RgvStatusType.java @@ -2,28 +2,31 @@ public enum RgvStatusType { - NONE(-1, "绂荤嚎"), - IDLE(0, "绌洪棽"), - WORKING(1, "浣滀笟涓�"), - SOS(2, "鎶ヨ"), - FETCHING(11, "鍙栬揣涓�"), - PUTTING(12, "鏀捐揣涓�"), - WAITING(90, "浠诲姟瀹屾垚绛夊緟WCS纭"), - FETCHWAITING(91, "鍙栬揣浠诲姟瀹屾垚绛夊緟WCS纭"), - SOS99(99, "鎶ヨ99"), - SOS100(100, "鍏跺畠100") + NONE(-1, "绂荤嚎","#4A4035"), + IDLE(0, "绌洪棽","#1F3696"), + WORKING(1, "浣滀笟涓�","#2196F3"), + SOS(2, "鎶ヨ","#2196F3"), + FETCHING(11, "鍙栬揣涓�","#2196F3"), + PUTTING(12, "鏀捐揣涓�","#2196F3"), + WAITING(90, "浠诲姟瀹屾垚绛夊緟WCS纭","#E2C027"), + FETCHWAITING(91, "鍙栬揣浠诲姟瀹屾垚绛夊緟WCS纭","#2196F3"), + SOS99(99, "鎶ヨ99","#2196F3"), + SOS100(100, "鍏跺畠100","#2196F3"), + SOSSUPER(999, "鍏跺畠","#2196F3") ; public Integer id; public String desc; - RgvStatusType(Integer id, String desc) { + public String color; + RgvStatusType(Integer id, String desc,String color) { this.id = id; this.desc = desc; + this.color = color; } public static RgvStatusType get(Short id) { if (null == id) { - return null; + return SOSSUPER; } for (RgvStatusType type : RgvStatusType.values()) { if (type.id.equals(id.intValue())) { @@ -35,13 +38,13 @@ public static RgvStatusType get(RgvStatusType type) { if (null == type) { - return null; + return SOSSUPER; } for (RgvStatusType rgvStatusType : RgvStatusType.values()) { if (rgvStatusType == type) { return rgvStatusType; } } - return null; + return SOSSUPER; } } diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html index c72cb50..250ddb8 100644 --- a/src/main/webapp/views/index.html +++ b/src/main/webapp/views/index.html @@ -63,13 +63,12 @@ line-height: 24px; font-weight: bold; transition: transform 0.3s ease; - background-color: #FF5722; + background-color: #ab1839; transform: scale(1.2); } .bus { background-color: #2196F3; - border: 20px solid; - border-color: #2196F3; + border: 20px solid #ffffff; position: absolute; width: 24px; height: 24px; @@ -89,36 +88,24 @@ <!-- 鐜舰绌挎杞︽櫤鑳界郴缁�--> <!--</header>--> <div id="app" class="map"> - <div class="inner-ring"></div> - <div class="outer-ring"></div> +<!-- <div class="inner-ring"></div>--> +<!-- <div class="outer-ring"></div>--> + <div v-for="track in energyGatheringRing" class="inner-ring" :style="{ borderColor: track.trackColor , boxShadow : 'inset 0 0 30px '+track.radiationColor+', 0 0 20px '+track.radiationColor}"></div> + <div v-for="track in energyGatheringRing" class="outer-ring" :style="{ borderColor: track.trackColor , boxShadow : 'inset 0 0 30px '+track.radiationColor+', 0 0 20px '+track.radiationColor}"></div> <!-- Stations on outer ring --> -<!-- <div class="station" style="top: 49%; left: 99%;">1</div>--> -<!-- <div class="station" style="top: 30%; left: 100%;">2</div>--> -<!-- <div class="station" style="top: 70%; left: 100%;">3</div>--> -<!-- <div class="station" style="top: 110%; left: 50%;">4</div>--> -<!-- <div class="station" style="top: 70%; left: 0;">5</div>--> -<!-- <div class="station" style="top: 30%; left: 0;">6</div>--> - - <!-- Stations on inner ring --> - <div class="station" style="top: 0%; left: 0%;">500</div> -<!-- <div class="station" style="top: 25%; left: 80%;">8</div>--> -<!-- <div class="station" style="top: 75%; left: 80%;">9</div>--> -<!-- <div class="station" style="top: 95%; left: 50%;">10</div>--> -<!-- <div class="station" style="top: 75%; left: 20%;">11</div>--> -<!-- <div class="station" style="top: 25%; left: 20%;">12</div>--> -<!-- <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueX + '%', left: station.valueY + '%' }">{{ station.index }}</div>--> - + <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueX + '%', left: station.valueY + '%' }">{{ station.index }}</div> <!-- Buses --> - <div v-for="bus in tableDataRgv" class="bus" :style="{ top: bus.valueX + '%', left: bus.valueY + '%' }">{{ bus.index }}</div> + <div v-for="bus in tableDataRgv" class="bus" :style="{ top: bus.valueX + '%', left: bus.valueY + '%' , borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div> </div> <script> var app = new Vue({ el: '#app', data: { tableDataRgv: [], - tableDataDev: [] + tableDataDev: [], + energyGatheringRing: [] }, created(){ this.init(); @@ -130,10 +117,12 @@ init(){ this.getTableDataRgv() this.getTableDataDev() + this.getTableDataTrack() setInterval(() => { this.getTableDataRgv() this.getTableDataDev() + this.getTableDataTrack() }, 1000) }, getTableDataRgv() { @@ -167,6 +156,22 @@ that.tableDataDev = res.data } }); + }, + getTableDataTrack() { + let that = this; + $.ajax({ + url: baseUrl + "/rgv/ring/through/track/position/data", + headers: { + 'token': localStorage.getItem('token') + }, + data: {}, + dataType: 'json', + contentType: 'application/json;charset=UTF-8', + method: 'post', + success: function (res) { + that.energyGatheringRing = res.data + } + }); } } }) -- Gitblit v1.9.1