| | |
| | | floorBtn = '', |
| | | floorBtns = '', |
| | | floorBtnss = '', |
| | | floorInfo=''; // 库区信息 |
| | | floorInfo = ''; // 库区信息 |
| | | let rackss = mapInfo.racks, |
| | | rackDescss = mapInfo.rackDescs, |
| | | crnss = mapInfo.crns, |
| | | areas = mapInfo.areas[0].floors, |
| | | floorId; |
| | | |
| | | function getMap() { |
| | | // 货架 |
| | | for (let i = 0;i < rackss.length;i++) { |
| | | let bay ='' // 单个库位 |
| | | for (let i = 0; i < rackss.length; i++) { |
| | | let bay = '' // 单个库位 |
| | | let bays = '' // 库位集合 |
| | | let maxBayNo = rackss[i].maxBayNo // 最大库位号 |
| | | let minBayNo = rackss[i].minBayNo // 最小库位号 |
| | | let bLen |
| | | let interval // 间隔数 |
| | | |
| | | if (maxBayNo<35) { |
| | | if (maxBayNo < 35) { |
| | | interval = 1 |
| | | bLen = maxBayNo / interval // 库位个数 |
| | | } else { |
| | |
| | | let bNum // 库位号码 |
| | | |
| | | if (minBayNo % 2 == 0) { // 从2开始 |
| | | if(interval == 1) { |
| | | if (interval == 1) { |
| | | bLen = bLen - 1 |
| | | } else if (interval == 2) { |
| | | if (maxBayNo % 2 == 0) { // 偶数 |
| | |
| | | } |
| | | } |
| | | } else { // 从1开始 |
| | | if(interval == 1) { |
| | | if (interval == 1) { |
| | | bLen = bLen |
| | | } else if (interval == 2) { |
| | | if (maxBayNo % 2 == 0) { // 偶数 |
| | |
| | | if (mapInfo.hpPosition == 1) { |
| | | bNum = maxBayNo |
| | | for (let j = bLen; j > 0; j--) { |
| | | bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>" |
| | | bay = "<button class='item' style='width: " + bayWidth + "px'>" + bNum + "</button>" |
| | | bays = bays + bay |
| | | bNum = bNum - interval; |
| | | } |
| | | }else { |
| | | } else { |
| | | bNum = minBayNo |
| | | for (let j = 0; j < bLen; j++) { |
| | | bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>" |
| | | bay = "<button class='item' style='width: " + bayWidth + "px'>" + bNum + "</button>" |
| | | bays = bays + bay |
| | | bNum = bNum + interval; |
| | | } |
| | | } |
| | | |
| | | rack = "<div class='rack' id='" + rackss[i].id + |
| | | "'style='width:"+ rackss[i].width + |
| | | "px;height: "+ rackss[i].height+ |
| | | "px;top: "+ rackss[i].top + |
| | | "px;left: "+ rackss[i].left + |
| | | "'style='width:" + rackss[i].width + |
| | | "px;height: " + rackss[i].height + |
| | | "px;top: " + rackss[i].top + |
| | | "px;left: " + rackss[i].left + |
| | | "px'>" + bays + "</div>" |
| | | racks = racks + rack |
| | | // getCrnInfo(minBayNo); |
| | | } |
| | | // 货架描述 |
| | | for (let i = 0;i < rackDescss.length;i++) { |
| | | for (let i = 0; i < rackDescss.length; i++) { |
| | | rackDesc = "<div class='rackDescs' id='" + rackDescss[i].id + |
| | | "'style='width:"+ rackDescss[i].width + |
| | | "px;height: "+ rackDescss[i].height+ |
| | | "px;line-height: "+ rackDescss[i].height+ |
| | | "px;top: "+ rackDescss[i].top + |
| | | "px;left: "+ rackDescss[i].left + |
| | | "'style='width:" + rackDescss[i].width + |
| | | "px;height: " + rackDescss[i].height + |
| | | "px;line-height: " + rackDescss[i].height + |
| | | "px;top: " + rackDescss[i].top + |
| | | "px;left: " + rackDescss[i].left + |
| | | "px'>" + rackDescss[i].text + "</div>" |
| | | rackDescs = rackDescs + rackDesc |
| | | } |
| | | // 堆垛机和地轨 |
| | | for (let i = 0;i < crnss.length;i++) { |
| | | for (let i = 0; i < crnss.length; i++) { |
| | | if (crnss[i].type == "crane") { |
| | | crn = "<div class='machine' id='" + crnss[i].id + |
| | | "'style='width:"+ crnss[i].width + |
| | | "px;height: "+ crnss[i].height+ |
| | | "px;top: "+ crnss[i].top + |
| | | "px;left: "+ crnss[i].left + |
| | | "'style='width:" + crnss[i].width + |
| | | "px;height: " + crnss[i].height + |
| | | "px;top: " + crnss[i].top + |
| | | "px;left: " + crnss[i].left + |
| | | "px'></div>" |
| | | crns = crns + crn |
| | | } else { |
| | | track = "<div class='track' id='" + crnss[i].id + |
| | | "'style='width:"+ crnss[i].width + |
| | | "px;height: "+ crnss[i].height+ |
| | | "px;top: "+ crnss[i].top + |
| | | "px;left: "+ crnss[i].left + |
| | | "'style='width:" + crnss[i].width + |
| | | "px;height: " + crnss[i].height + |
| | | "px;top: " + crnss[i].top + |
| | | "px;left: " + crnss[i].left + |
| | | "px'>" + crnss[i].text + "</div>" |
| | | tracks = tracks + track |
| | | } |
| | | } |
| | | // 楼层 |
| | | for (let i = 0; i < areas.length;i++) { |
| | | for (let i = 0; i < areas.length; i++) { |
| | | |
| | | let stnss = areas[i].stns |
| | | let floor = areas[i].text |
| | | let barcodes = areas[i].barcode |
| | | floorId = areas[i].id |
| | | var position = (i+1)*100 |
| | | var position = (i + 1) * 100 |
| | | floorBtn = |
| | | "<button class='floorBtn btn-16' onclick='changFloor("+i+")' style='top: "+position+"px;'>" + floor +"</button>" |
| | | "<button class='floorBtn btn-16' onclick='changFloor(" + i + ")' style='top: " + position + "px;'>" + floor + "</button>" |
| | | if (mapInfo.areas[0].floors.length == 1) { |
| | | floorBtnss = '' |
| | | } else { |
| | | floorBtnss = floorBtnss + floorBtn |
| | | floorBtnss = floorBtnss + floorBtn |
| | | } |
| | | // 每层的 输送线站点 |
| | | var index = i |
| | |
| | | for (let j = 0; j < stnss.length; j++) { |
| | | if (stnss[j].type == "stn") { |
| | | stn = "<div class='site' id='" + stnss[j].id + |
| | | "'style='width:"+ stnss[j].width + |
| | | "px;height: "+ stnss[j].height+ |
| | | "px;line-height: "+ stnss[j].height+ |
| | | "px;top: "+ stnss[j].top + |
| | | "px;left: "+ stnss[j].left + |
| | | "'style='width:" + stnss[j].width + |
| | | "px;height: " + stnss[j].height + |
| | | "px;line-height: " + stnss[j].height + |
| | | "px;top: " + stnss[j].top + |
| | | "px;left: " + stnss[j].left + |
| | | "px'>" + stnss[j].text + "</div>" |
| | | stnArr[i] = stnArr[i] + stn |
| | | total[i] = n++ |
| | | } else if(stnss[j].type == "track"){ |
| | | } else if (stnss[j].type == "track") { |
| | | stn = "<div class='track' id='" + stnss[j].id + |
| | | "'style='width:"+ stnss[j].width + |
| | | "px;height: "+ stnss[j].height+ |
| | | "px;line-height: "+ stnss[j].height+ |
| | | "px;top: "+ stnss[j].top + |
| | | "px;left: "+ stnss[j].left + |
| | | "px'>" + stnss[j].text + "</div>" |
| | | "'style='width:" + stnss[j].width + |
| | | "px;height: " + stnss[j].height + |
| | | "px;line-height: " + stnss[j].height + |
| | | "px;top: " + stnss[j].top + |
| | | "px;left: " + stnss[j].left + |
| | | "px'>" + stnss[j].text + "</div>" |
| | | stnArr[i] = stnArr[i] + stn |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | "'style='width:" + barcodes[k].width + |
| | | "px;height: " + barcodes[k].height + |
| | | "px;line-height: " + barcodes[k].height + |
| | | "px;top: "+ barcodes[k].top + |
| | | "px;left: "+ barcodes[k].left + "px'>" + "</div>" |
| | | "px;top: " + barcodes[k].top + |
| | | "px;left: " + barcodes[k].left + "px'>" + "</div>" |
| | | barcodeArr[i] = barcodeArr[i] + barcode |
| | | } |
| | | |
| | | } |
| | | floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss+ barcodeArr[0] |
| | | floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss + barcodeArr[0] |
| | | |
| | | $(".main-part").append(floorInfo) |
| | | $("#line-total").html(total[0]) |
| | | // listenChange(); |
| | | |
| | | } |
| | | |
| | | 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] |
| | | $(".main-part").append(floorInfo) |
| | | $("#line-total").empty() |
| | | $("#line-total").html(total[e]) |