自动化立体仓库 - WCS系统
#
whycq
2023-03-27 b0d2ceeb7ddf65fd5a1bf9ce99ff012e1e3c7ade
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
var year = '2020';
var month = '05';
var day = '01';
var hour = '08';
var minute = '00';
var second = '00';
var week = '星期一';
 
setInterval(function () {
    setDate();
    initlineChart();
    initPieChart();
}, 1000);
 
//setInterval(function () {
//    getOther();
//}, 500);
 
function setDate() {
    getDate();
    $('#bar-year').text(year);
    $('#bar-month').text(month);
    $('#bar-day').text(day);
    $('#bar-hour').text(hour);
    $('#bar-minute').text(minute);
    $('#bar-second').text(second);
    $('#bar-week').text(week);
}
 
/**
 * 获取时间
 */
function getDate() {
    http.get(baseUrl+"/monitor/date", null, function (res) {
        if (res.code === 200){
            year = res.data.year;
            month = res.data.month;
            day = res.data.day;
            hour = res.data.hour;
            minute = res.data.minute;
            second = res.data.second;
            week = res.data.week;
        } else if (res.code === 403){
            parent.location.href = baseUrl+"/login";
        }  else {
            layer.msg("连接服务器失败", {icon: 2});
        }
    })
 
}
 
/**
 * 获取其他数据
 */
function getOther() {
    http.get(baseUrl+"/monitor/other", {crnId: getUrlVal("crnId"), ledId: getUrlVal("ledId")}, function (res) {
        if (res.code === 200){
 
            // 左
            $('#xDistance').text(res.data.xDistance);
            $('#yDistance').text(res.data.yDistance);
            $('#xDuration').text(res.data.xDuration);
            $('#yDuration').text(res.data.yDuration);
 
            // 中上
            crnChartOption.series[0].data[0].value = res.data.xSpeed - 0; // 走行
            crnChartOption.series[1].data[0].value = res.data.ySpeed - 0; // 升降
            crnChartOption.series[2].data[0].value = res.data.zSpeed - 0; // 叉牙
            crnChartOption.series[3].data[0].value = res.data.forkPos - 0; // 货叉位置
            // crnChartOption.series[0].data[0].value = (Math.random()*100).toFixed(2) - 0;
            // crnChartOption.series[1].data[0].value = (Math.random()*7).toFixed(2) - 0;
            // crnChartOption.series[2].data[0].value = (Math.random()*2).toFixed(2) - 0;
            // crnChartOption.series[3].data[0].value = (Math.random()*2).toFixed(2) - 0;
            crnChart.setOption(crnChartOption);
 
            // 中下
            if (res.data.isShow) {
                $('#banner').hide();
                $('#led-content').show();
                $('#led-p-content').text(res.data.content);
            } else {
                $('#led-content').hide();
                $('#banner').show();
                $('#led-p-content').text("");
            }
 
        } else if (res.code === 403){
            parent.location.href = baseUrl+"/login";
        }  else {
            layer.msg("连接服务器失败", {icon: 2});
        }
    })
 
}
 
function getOther2(crnId,ledId) {
    http.get(baseUrl+"/monitor/other", {crnId: crnId, ledId: ledId}, function (res) {
        if (res.code === 200){
 
            // 左
            $('#xDistance').text(res.data.xDistance);
            $('#yDistance').text(res.data.yDistance);
            $('#xDuration').text(res.data.xDuration);
            $('#yDuration').text(res.data.yDuration);
 
            // 中上
            crnChartOption.series[0].data[0].value = res.data.xSpeed - 0; // 走行
            crnChartOption.series[1].data[0].value = res.data.ySpeed - 0; // 升降
            crnChartOption.series[2].data[0].value = res.data.zSpeed - 0; // 叉牙
            crnChartOption.series[3].data[0].value = res.data.forkPos - 0; // 货叉位置
            // crnChartOption.series[0].data[0].value = (Math.random()*100).toFixed(2) - 0;
            // crnChartOption.series[1].data[0].value = (Math.random()*7).toFixed(2) - 0;
            // crnChartOption.series[2].data[0].value = (Math.random()*2).toFixed(2) - 0;
            // crnChartOption.series[3].data[0].value = (Math.random()*2).toFixed(2) - 0;
            crnChart.setOption(crnChartOption);
 
            // 中下
            if (res.data.isShow) {
                $('#banner').hide();
                $('#led-content').show();
                $('#led-p-content').text(res.data.content);
            } else {
                $('#led-content').hide();
                $('#banner').show();
                $('#led-p-content').text("");
            }
 
        } else if (res.code === 403){
            parent.location.href = baseUrl+"/login";
        }  else {
            layer.msg("连接服务器失败", {icon: 2});
        }
    })
 
}
 
// 全屏 -----------------------------------------------------------------------
 
//开始全屏
function full() {
    var docElm = document.documentElement;
    //W3C
    if (docElm.requestFullscreen) {
        docElm.requestFullscreen();
    }
    //FireFox
    else if (docElm.mozRequestFullScreen) {
        docElm.mozRequestFullScreen();
    }
    //Chrome等
    else if (docElm.webkitRequestFullScreen) {
        docElm.webkitRequestFullScreen();
    }
    //IE11
    else if (elem.msRequestFullscreen) {
        elem.msRequestFullscreen();
    }
}
 
//退出全屏
function exitFull() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    }
    else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
    }
    else if (document.webkitCancelFullScreen) {
        document.webkitCancelFullScreen();
    }
    else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    }
}
 
//事件监听
document.addEventListener("fullscreenchange", function () {
    try {
        fullscreenState.innerHTML = (document.fullscreen) ? "" : "not ";
    } catch (e) {}
}, false);
document.addEventListener("mozfullscreenchange", function () {
    fullscreenState.innerHTML = (document.mozFullScreen) ? "" : "not ";
}, false);
document.addEventListener("webkitfullscreenchange", function () {
    fullscreenState.innerHTML = (document.webkitIsFullScreen) ? "" : "not ";
}, false);
document.addEventListener("msfullscreenchange", function () {
    fullscreenState.innerHTML = (document.msFullscreenElement) ? "" : "not ";
}, false);
document.onkeyup = function (e) {
    if (window.event)//如果window.event对象存在,就以此事件对象为准
        e = window.event;
    var key = e.charCode || e.keyCode;
    if (key === 13 || key === 49 || key === 97) {
        full();
    } else if (key === 50 || key === 98) {
        exitFull();
    }
}