| | |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/latest/data/hoist") |
| | | @ManagerAuth(memo = "提升机实时数据") |
| | | public R hoistLatestData(){ |
| | | List<HoistDataVo> vos = new ArrayList<>(); |
| | | Map<Integer, StaProtocol> stations = new HashMap<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | if (null != devpThread) { |
| | | stations.putAll(devpThread.getStation()); |
| | | } |
| | | } |
| | | for (Map.Entry<Integer, StaProtocol> entry : stations.entrySet()) { |
| | | HoistDataVo vo = new HoistDataVo(); |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | vo.setHoistId(String.valueOf(entry.getKey())); |
| | | vo.setPlace(staProtocol.getPlace()); |
| | | vos.add(vo); |
| | | } |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PostMapping("/latest/data/crn") |
| | | @ManagerAuth(memo = "堆垛机实时数据") |
| | | public R crnLatestData(){ |
New file |
| | |
| | | package com.zy.asrs.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class HoistDataVo { |
| | | private String hoistId; |
| | | private String place; |
| | | } |
| | |
| | | //条码 |
| | | private String barcode = null; |
| | | |
| | | private boolean place1 = false; |
| | | private boolean place2 = false; |
| | | |
| | | public String getPlace(){ |
| | | if (place1 && place2){ |
| | | return "到位信号异常"; |
| | | } |
| | | if (place1){ |
| | | return "一楼到位"; |
| | | } |
| | | if (place2){ |
| | | return "二楼到位"; |
| | | } |
| | | return "不在定位"; |
| | | |
| | | } |
| | | |
| | | // 外形检测 ------------------------------------------------------------------------ |
| | | |
| | | // 前超限 |
| | |
| | | add(400);add(401);add(402);add(403); |
| | | add(404);add(405);add(406);add(407); |
| | | }}; |
| | | public static final ArrayList<Integer> hoist1 = new ArrayList<Integer>() {{ |
| | | add(302);add(303); |
| | | }}; |
| | | public static final ArrayList<Integer> hoist2 = new ArrayList<Integer>() {{ |
| | | add(402);add(403); |
| | | }}; |
| | | |
| | | /** |
| | | * 条码数量 |
| | |
| | | return staNos3; |
| | | case 4: |
| | | return staNos4; |
| | | default: |
| | | throw new CoolException("服务器异常"); |
| | | } |
| | | } |
| | | |
| | | private ArrayList<Integer> getHoist() { |
| | | switch (slave.getId()) { |
| | | case 3: |
| | | return hoist1; |
| | | case 4: |
| | | return hoist2; |
| | | default: |
| | | throw new CoolException("服务器异常"); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | if (slave.getId() == 3 || slave.getId() == 4){ |
| | | ArrayList<Integer> hoist = getHoist(); |
| | | int hoistSize = hoist.size(); |
| | | OperateResultExOne<byte[]> resultHoist = siemensS7Net.Read("DB15.0", (short) 33); |
| | | if (resultHoist.IsSuccess) { |
| | | Integer siteId = hoist.get(0); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultHoist.Content, 32, 1); |
| | | staProtocol.setPlace1(status[0]); |
| | | staProtocol.setPlace2(status[1]); |
| | | |
| | | Integer siteId2 = hoist.get(1); // 站点编号 |
| | | staProtocol = station.get(siteId2); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | boolean[] status2 = siemensS7Net.getByteTransform().TransBool(resultHoist.Content, 32, 1); |
| | | staProtocol.setPlace1(status2[2]); |
| | | staProtocol.setPlace2(status2[3]); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | if (slave.getId() == 1){ |
| | |
| | | background-color: rgb(157, 217, 162); |
| | | font-size: 10px; |
| | | } |
| | | .hoist { |
| | | position: absolute; |
| | | color: #a19c9c; |
| | | border: 1px solid rgb(108,167,168); |
| | | cursor: pointer; |
| | | text-align: center; |
| | | background-color: rgb(157, 217, 162); |
| | | font-size: 10px; |
| | | } |
| | | .barcode1{ |
| | | position: absolute; |
| | | width: 100px; |
| | |
| | | tracks = '', |
| | | stn = '', |
| | | barcode = '', |
| | | hoist = '', |
| | | stns = '', |
| | | stnArr = [], |
| | | barcodeArr = [], |
| | | hoistArr = [], |
| | | floorBtn = '', |
| | | floorBtns = '', |
| | | floorBtnss = '', |
| | |
| | | |
| | | let stnss = areas[i].stns |
| | | let barcodes = areas[i].barcode |
| | | let hoists = areas[i].hoist |
| | | let floor = areas[i].text |
| | | floorId = areas[i].id |
| | | var position = (i+1)*100 |
| | |
| | | var n = 1 |
| | | stnArr[index] = '' |
| | | barcodeArr[index] = '' |
| | | hoistArr[index] = '' |
| | | total[index] = '' |
| | | for (let j = 0; j < stnss.length; j++) { |
| | | if (stnss[j].type == "stn") { |
| | |
| | | "px;left: "+ barcodes[k].left + "px'>" + "</div>" |
| | | barcodeArr[i] = barcodeArr[i] + barcode |
| | | } |
| | | for (let k = 0; k < hoists.length; k++) { |
| | | hoist = "<div class='hoist' id='" + hoists[k].id + |
| | | "'style='width:" + hoists[k].width + |
| | | "px;height: " + hoists[k].height + |
| | | "px;line-height: " + hoists[k].height + |
| | | "px;top: "+ hoists[k].top + |
| | | "px;left: "+ hoists[k].left + "px'>" + "</div>" |
| | | hoistArr[i] = hoistArr[i] + hoist |
| | | } |
| | | } |
| | | floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss + barcodeArr[0] |
| | | floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss + barcodeArr[0]+hoistArr[0] |
| | | |
| | | $(".main-part").append(floorInfo) |
| | | $("#line-total").html(total[0]) |
| | |
| | | } |
| | | function changFloor(e) { |
| | | $(".main-part").empty() // 清空节点 |
| | | floorInfo = racks + stnArr[e] +rackDescs + crns + tracks + floorBtnss + barcodeArr[e] |
| | | floorInfo = racks + stnArr[e] +rackDescs + crns + tracks + floorBtnss + barcodeArr[e]+hoistArr[e] |
| | | $(".main-part").append(floorInfo) |
| | | $("#line-total").empty() |
| | | $("#line-total").html(total[e]) |
| | |
| | | "width": 80, |
| | | "height": 20 |
| | | } |
| | | ], |
| | | "hoist": [ |
| | | { |
| | | "type": "hoist", |
| | | "id": "hoist-302", |
| | | "text": "", |
| | | "top": 640, |
| | | "left": 1500, |
| | | "width": 50, |
| | | "height": 20 |
| | | }, |
| | | { |
| | | "type": "hoist", |
| | | "id": "hoist-303", |
| | | "text": "", |
| | | "top": 595, |
| | | "left": 1500, |
| | | "width": 50, |
| | | "height": 20 |
| | | }, |
| | | { |
| | | "type": "hoist", |
| | | "id": "hoist-402", |
| | | "text": "", |
| | | "top": 480, |
| | | "left": 1500, |
| | | "width": 50, |
| | | "height": 20 |
| | | }, |
| | | { |
| | | "type": "hoist", |
| | | "id": "hoist-403", |
| | | "text": "", |
| | | "top": 527, |
| | | "left": 1500, |
| | | "width": 50, |
| | | "height": 20 |
| | | } |
| | | ] |
| | | }, { |
| | | "type": "floor", |
| | |
| | | "height": 0 |
| | | } |
| | | |
| | | ], |
| | | "hoist": [ |
| | | { |
| | | "type": "hoist", |
| | | "id": "hoist-999", |
| | | "text": "", |
| | | "top": 570, |
| | | "left": 1590, |
| | | "width": 80, |
| | | "height": 0 |
| | | } |
| | | |
| | | ] |
| | | }] |
| | | }] |
| | |
| | | // 初始化 |
| | | getSitesInfo(); |
| | | getCrnInfo(); |
| | | getHoistInfo(); |
| | | getSystemRunningStatus(); |
| | | getBarcodeInfo(); |
| | | getScaleInfo(); |
| | |
| | | }, 1000); |
| | | setInterval(function () { |
| | | getSitesInfo(); |
| | | getHoistInfo(); |
| | | }, 3000); |
| | | |
| | | // 系统运行开关 |
| | |
| | | } |
| | | |
| | | // 扫码器实时数据获取 |
| | | function getHoistInfo() { |
| | | $.ajax({ |
| | | url: baseUrl + "/console/latest/data/hoist", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | var hoists = res.data; |
| | | for (var i = 0; i < hoists.length; i++) { |
| | | $("#hoist-"+hoists[i].hoistId).html(hoists[i].place ? hoists[i].place : "--"); |
| | | } |
| | | } else if (res.code === 403) { |
| | | parent.location.href = baseUrl + "/login"; |
| | | } else { |
| | | console.log(res.msg); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 扫码器实时数据获取 |
| | | function getBarcodeInfo() { |
| | | $.ajax({ |
| | | url: baseUrl + "/console/latest/data/barcode", |