whycq
2022-05-27 4f47d0af9617511e475879eff74e7788a429d9fd
src/main/webapp/views/render.js
@@ -1,4 +1,4 @@
firstFloor = {
newData = {
    "mapName": "克劳斯玛菲WCS",
    "rackCount": 12,
    "crnCount": 3,
@@ -622,7 +622,7 @@
]
}
// 库位图
newData = {
rackData = {
    "mapName": "WCS_test",
    "rackCount": 12,
    "crnCount": 3,
@@ -630,7 +630,6 @@
    "hpPosition": 1,
    "minBayNo": 2,
    "floors": 2,
    "floor": 1,
    "racks": [
        {
        "type": "rack",
@@ -849,7 +848,35 @@
        "width": 35,
        "height": 27
    }],
    "crns": [{
    "crns": [
        {
            "type": "crane",
            "id": "crn-1",
            "text": "1",
            "top": 184,
            "left": 777,
            "width": 93,
            "height": 22
        },
        {
            "type": "crane",
            "id": "crn-2",
            "text": "2",
            "top": 378,
            "left": 777,
            "width": 93,
            "height": 22
        },
        {
            "type": "crane",
            "id": "crn-3",
            "text": "3",
            "top": 572,
            "left": 777,
            "width": 93,
            "height": 22
        },
        {
        "type": "track",
        "id": "lb_track2",
        "text": "",
@@ -857,7 +884,8 @@
        "left": 298,
        "width": 1050,
        "height": 2
    }, {
        },
        {
        "type": "track",
        "id": "lb_track3",
        "text": "",
@@ -865,7 +893,8 @@
        "left": 298,
        "width": 1050,
        "height": 2
    }, {
        },
        {
        "type": "track",
        "id": "lb_track1",
        "text": "",
@@ -873,7 +902,8 @@
        "left": 298,
        "width": 1050,
        "height": 2
    }],
        }
        ],
    "areas": [{
        "type": "Control_floor",
        "id": "tabControl_floor1",
@@ -882,7 +912,8 @@
        "left": 22,
        "width": 302,
        "height": 403,
        "floors": [{
        "floors": [
            {
            "type": "floor",
            "id": "page_floor1",
            "text": "1F",
@@ -890,67 +921,410 @@
            "left": 22,
            "width": 276,
            "height": 395,
            "stns": [{
            "stns": [
                {
                "type": "stn",
                "id": "site-201",
                "text": "201",
                "top": 165,
                "left": 193,
                "width": 77,
                    "id": "site-132",
                    "text": "132",
                    "top": 547,
                    "left": 1399,
                    "width": 60,
                    "height": 63
                },
                {
                    "type": "stn",
                    "id": "site-126",
                    "text": "126",
                    "top": 450,
                    "left": 1461,
                    "width": 60,
                    "height": 63
                },
                {
                    "type": "stn",
                    "id": "site-125",
                    "text": "125",
                    "top": 450,
                    "left": 1399,
                    "width": 60,
                    "height": 63
                },
                {
                    "type": "stn",
                    "id": "site-119",
                    "text": "119",
                    "top": 353,
                    "left": 1461,
                    "width": 60,
                    "height": 63
                },
                {
                    "type": "stn",
                    "id": "site-118",
                    "text": "118",
                    "top": 353,
                    "left": 1399,
                    "width": 60,
                    "height": 63
                },
                {
                    "type": "stn",
                    "id": "site-136",
                    "text": "136",
                    "top": 611,
                    "left": 1461,
                    "width": 120,
                "height": 30
            }, {
                },
                {
                "type": "stn",
                "id": "site-202",
                "text": "202",
                "top": 165,
                "left": 112,
                "width": 77,
                    "id": "site-135",
                    "text": "135",
                    "top": 611,
                    "left": 1399,
                    "width": 60,
                "height": 30
            }, {
                },
                {
                "type": "stn",
                "id": "site-210",
                "text": "210",
                "top": 10,
                "left": 59,
                "width": 51,
                "height": 22
            }, {
                    "id": "site-134",
                    "text": "134",
                    "top": 611,
                    "left": 1337,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-133",
                    "text": "133",
                    "top": 611,
                    "left": 1215,
                    "width": 120,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-130",
                    "text": "130",
                    "top": 515,
                    "left": 1461,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-129",
                    "text": "129",
                    "top": 515,
                    "left": 1399,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-128",
                    "text": "128",
                    "top": 515,
                    "left": 1337,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-127",
                    "text": "127",
                    "top": 515,
                    "left": 1215,
                    "width": 120,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-131",
                    "text": "131",
                    "top": 515,
                    "left": 1522,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-123",
                    "text": "123",
                    "top": 418,
                    "left": 1461,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-122",
                    "text": "122",
                    "top": 418,
                    "left": 1399,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-121",
                    "text": "121",
                    "top": 418,
                    "left": 1337,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-120",
                    "text": "120",
                    "top": 418,
                    "left": 1215,
                    "width": 120,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-124",
                    "text": "124",
                    "top": 418,
                    "left": 1522,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-112",
                    "text": "112",
                    "top": 256,
                    "left": 1461,
                    "width": 60,
                    "height": 63
                },
                {
                    "type": "stn",
                    "id": "site-111",
                    "text": "111",
                    "top": 256,
                    "left": 1399,
                    "width": 60,
                    "height": 63
                },
                {
                    "type": "stn",
                    "id": "site-116",
                    "text": "116",
                    "top": 321,
                    "left": 1461,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-115",
                    "text": "115",
                    "top": 321,
                    "left": 1399,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-114",
                    "text": "114",
                    "top": 321,
                    "left": 1337,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-113",
                    "text": "113",
                    "top": 321,
                    "left": 1215,
                    "width": 120,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-117",
                    "text": "117",
                    "top": 321,
                    "left": 1522,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-105",
                    "text": "105",
                    "top": 159,
                    "left": 1399,
                    "width": 60,
                    "height": 63
                },
                {
                    "type": "stn",
                    "id": "site-109",
                    "text": "109",
                    "top": 224,
                    "left": 1461,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-108",
                    "text": "108",
                    "top": 224,
                    "left": 1399,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-107",
                    "text": "107",
                    "top": 224,
                    "left": 1337,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-106",
                    "text": "106",
                    "top": 224,
                    "left": 1215,
                    "width": 120,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-104",
                    "text": "104",
                    "top": 128,
                    "left": 1461,
                    "width": 120,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-103",
                    "text": "103",
                    "top": 128,
                    "left": 1399,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-102",
                    "text": "102",
                    "top": 128,
                    "left": 1337,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-101",
                    "text": "101",
                    "top": 128,
                    "left": 1215,
                    "width": 120,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-110",
                    "text": "110",
                    "top": 224,
                    "left": 1522,
                    "width": 60,
                    "height": 30
                },
                {
                    "type": "stn",
                    "id": "site-199",
                    "text": "199",
                    "top": 150,
                    "left": 1590,
                    "width": 60,
                    "height": 30
                },
                {
                "type": "track",
                "id": "lb_trCart1",
                "text": "RGV轨道",
                "top": 2,
                "left": 65,
                "top": 140,
                "left": 1600,
                "width": 4,
                "height": 213
            }, {
                "height": 500
            },
                {
                "type": "track",
                "id": "lb_trCart2",
                "text": "RGV轨道",
                "top": 2,
                "left": 100,
                "top": 140,
                "left": 1635,
                "width": 4,
                "height": 213
            }, {
                "type": "stn",
                "id": "site-221",
                "text": "221",
                "top": 6,
                "left": 197,
                "width": 77,
                "height": 30
            }, {
                "type": "stn",
                "id": "site-220",
                "text": "220",
                "top": 6,
                "left": 116,
                "width": 77,
                "height": 30
            }]
        }, {
                "height": 500
            },
            ]
            },
            {
            "type": "floor",
            "id": "page_floor2",
            "text": "2F",
                "top": 4,
                "left": 22,
                "width": 276,
                "height": 395,
                "stns": [
                    {
                        "type": "stn",
                        "id": "site-201",
                        "text": "201",
                        "top": 98,
                        "left": 1212,
                        "width": 77,
                        "height": 30
                    },
                    {
                        "type": "stn",
                        "id": "site-202",
                        "text": "202",
                        "top": 98,
                        "left": 1292,
                        "width": 77,
                        "height": 30
                    },
                    {
                        "type": "stn",
                        "id": "site-221",
                        "text": "221",
                        "top": 290,
                        "left": 1212,
                        "width": 77,
                        "height": 30
                    },
                    {
                        "type": "stn",
                        "id": "site-220",
                        "text": "220",
                        "top": 257,
                        "left": 1212,
                        "width": 77,
                        "height": 30
                    }]
            },
            {
                "type": "floor",
                "id": "page_floor3",
                "text": "3F",
            "top": 4,
            "left": 22,
            "width": 276,
@@ -959,47 +1333,43 @@
                "type": "stn",
                "id": "site-301",
                "text": "301",
                "top": 38,
                "left": 196,
                    "top": 98,
                    "left": 1212,
                "width": 77,
                "height": 30
            }, {
                "type": "stn",
                "id": "site-302",
                "text": "302",
                "top": 38,
                "left": 115,
                    "top": 130,
                    "left": 1212,
                "width": 77,
                "height": 30
            }, {
                "type": "stn",
                "id": "site-321",
                "text": "321",
                "top": 197,
                "left": 196,
                    "top": 225,
                    "left": 1212,
                "width": 77,
                "height": 30
            }, {
                "type": "stn",
                "id": "site-320",
                "text": "320",
                "top": 197,
                "left": 115,
                    "id": "site-999",
                    "text": "999",
                    "top": 323,
                    "left": 1212,
                "width": 77,
                "height": 30
            }]
        }]
    }]
}
let total = [], rack = '', racks = '', rackDesc = '',rackDescs = '', crn = '', crns = '',track = '',tracks = '', stn = '', stns = '',stnArr = [],floorBtn = '',floorBtns = '',floorBtnss = '',whycq='';
let rackss = rackData.racks,rackDescss = rackData.rackDescs,crnss = rackData.crns,areas = rackData.areas[0].floors;
let floorId
function getMap() {
    let mapName = "<div class='mapName'>" + firstFloor.mapName + "</div>"
    let rack = '', racks = '', rackDesc = '',
        rackDescs = '', crn = '', crns = '',track = '',
        tracks = '', stn = '', stns = '';
    let rackss = firstFloor.racks,
        rackDescss = firstFloor.rackDescs,
        crnss = firstFloor.crns,
        stnss = firstFloor.stns;
    let mapName = "<div class='mapName'>" + rackData.mapName + "</div>"
    // 货架
    for (let i = 0;i < rackss.length;i++) {
        let btn =''
@@ -1007,7 +1377,7 @@
        var maxBayNo = rackss[i].maxBayNo
        var minBayNo = rackss[i].minBayNo
        let bLen = maxBayNo / minBayNo
        if (firstFloor.hpPosition == 1) {
        if (rackData.hpPosition == 1) {
            for (let j = bLen;j > 0; j--) {
                btn = "<button class='item' style='width: 34px'>" + maxBayNo + "</button>"
                btns = btns + btn
@@ -1060,19 +1430,57 @@
            tracks = tracks + track
        }
    }
    // 输送线 站点
    for (let i = 0;i < stnss.length;i++) {
        stn = "<div class='site' id='" + stnss[i].id +
            "'style='width:"+ stnss[i].width +
            "px;height: "+ stnss[i].height+
            "px;line-height: "+ stnss[i].height+
            "px;top: "+ stnss[i].top +
            "px;left: "+ stnss[i].left +
            "px'>" + stnss[i].text + "</div>"
        stns = stns + stn
    // 楼层
    for (let i = 0; i < areas.length;i++) {
        let stnss = areas[i].stns
        let floor = areas[i].text
        floorId = areas[i].id
        var position = (i+5)*100
        floorBtn =
            "<button class='floorBtn' onclick='changFloor("+i+")' style='left: "+position+"px;'>" + floor +"</button>"
        floorBtnss =  floorBtnss + floorBtn
        // 每层的 输送线站点
        var index = i
        var n = 1
        stnArr[index] = ''
        total[index] = ''
        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 +
                    "px'>" + stnss[j].text + "</div>"
                stnArr[i] = stnArr[i] + stn
                total[i] = n++
            } 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>"
                stnArr[i] = stnArr[i] + stn
    }
    let whycq = racks + stns + rackDescs + crns + tracks
        }
    }
    whycq = racks  + stnArr[0] +rackDescs + crns + tracks + floorBtnss
    $(".main-part").append(whycq)
    $("#line-total").html(total[0])
};
function changFloor(e) {
    $(".main-part").empty()  // 清空节点
    whycq = racks  + stnArr[e] +rackDescs + crns + tracks + floorBtnss
    $(".main-part").append(whycq)
    $("#line-total").empty()
    $("#line-total").html(total[e])
}