hwh
2025-03-05 37adc87d3ca42242424ac8e1b83cc86ab00a666c
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<!DOCTYPE html>
<html>
 
<head>
    <meta charset="utf-8">
    <title>储位图例</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <style type="text/css">
        .layouts {
            display: flex;
        }
        .layui-card-header {
            border-bottom: 1px solid #C9C5C5;
        }
        /* ******************************************** */
        
        #tab{
            border: 1px solid black ;
            border-collapse: separate;
            border-spacing: 2;
            padding: 3px;
        }
        table td{
            border: 3px solid white;
            /* width: 35px;
            height: 45px;
            
            background-color: red;
            text-align: center; */
            
        }
        .btncls{
            width: 30px;
            height: 40px;
            line-height: 20px;
        }
        .divcls{
            box-shadow: 2px 2px 1px #888888;
            border-radius: 2px;
        }
        .textSty{
            color: black;
            text-align: center;
            word-break: break-all; word-wrap:break-word;
        }
        .zero{
            background-color:#5470c6;
            Opacity:.8;
        }
        .one{
            background-color:#91cc75;
            Opacity:.8;
        }
        .two{
            background-color:#ffdc60;
        }
        .three{
            background-color:#ee6666;
            Opacity:.8;
        }
        .four{
            background-color:#ffff7f;/*#ffff7f*/
            Opacity:.8;
        }
        .five{
            background-color:#ee23ee; 
            /* background-color:#9dee77; */
            Opacity:.8;
        }
        /* .six{
            background-color:#ee23ee;
            Opacity:.8;
        }
        .seven{
            background-color:#eea6c0;
            Opacity:.8;
        } */
        .eight{
            background-color:#adacac;
        }
        .btnShow{
            width: 20px;
            height: 15px;
        }
    </style>
</head>
 
<body>
    <div class="layui-fluid" style="padding-bottom: 0;">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">层</label>
                        <div class="layui-input-inline">
                            <select name="SlotLayer" id="SlotLayer"  lay-filter="SelectLayer">
                                <option value="1">一层</option>
                                <option value="2">二层</option>
                                
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-card-body">
                
                <div class="layouts">
                    <!-- 左边图 -->
                    <div id="chartMap1" style="width:66%;height:86vh; display: flex; justify-content: space-around;">
                        <div>
                            <table id="tab"></table>
                        </div>
                        <div>
                            <table>
                                <tr>
                                    <td><button class="btnShow" disabled></button></td>
                                    <td>跑道</td>
                                </tr>
                                <tr>
                                    <td><button class="btnShow eight" disabled></button></td>
                                    <td>已屏蔽</td>
                                </tr>
                                <!-- <tr>
                                    <td><button class="btnShow six" disabled></button></td>
                                    <td>空托跺</td>
                                </tr> -->
                                <tr>
                                    <td><button class="btnShow five" disabled></button></td>
                                    <td>移出中</td>
                                </tr>
                                <tr>
                                    <td><button class="btnShow four" disabled></button></td>
                                    <td>移入中</td>
                                </tr>
                                <tr>
                                    <td><button class="btnShow three" disabled></button></td>
                                    <td>出库中</td>
                                </tr>
                                <tr>
                                    <td><button class="btnShow two" disabled></button></td>
                                    <td>入库中</td>
                                </tr>
                                <tr>
                                    <td><button class="btnShow one" disabled></button></td>
                                    <td>有物品</td>
                                </tr>
                                <tr>
                                    <td><button class="btnShow zero" disabled></button></td>
                                    <td>空库位</td>
                                </tr>
                            </table>
                        </div>
 
                    </div>
                    <!-- 右边图 -->
                    <div id="chartMap2" style="width:34%;height:87vh; border-left: 1px solid #C9C5C5;"></div>
                </div>
 
            </div>
        </div>
    </div>        
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../../js/public.js"></script>
    <script src="../../js/jquery-3.5.1.min.js"></script>
    <script src="../../js/jquery.cookie.js"></script>
    <script src="../../js/echarts.min.js"></script>
    <script>
        var uid = $.cookie('userId');
        if (uid == null) {
            alert('请登录后操作');
            window.parent.location.href = '../Login.html'
        }
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'table', 'laypage', 'layer'], function () {
            var table = layui.table,
                form = layui.form,
                laypage = layui.laypage,
                layer = layui.layer,
                $ = layui.$;
 
            var cengShu = "1"; 
            var dom = $('#LAY_app_tabsheader', parent.document).children()//.find(s=>s.s.nodeType == 1 && className == "layui-this")
             
            setInterval(() => { 
                for (let i = 0; i < dom.length; i++) {
                const e = dom[i]; 
                if (e.getAttribute("class") == "layui-this" && e.getAttribute("lay-id") == "EquipmentManage/Roadway.html") {
                    GetSlotVm(cengShu);
                    // GetSlotChart(cengShu);
                }
            }
            }, 5000);
            
            
 
            // 查询事件
            GetSlotVm(cengShu);
            // GetSlotChart(cengShu);
            form.on('select(SelectLayer)', function(data){
                // console.log(data.elem); //得到select原始DOM对象
                // console.log(data.value); //得到被选中的值
                // console.log(data.othis); //得到美化后的DOM对象
                cengShu = data.value;
                GetSlotVm(data.value);
                // GetSlotChart(data.value);
            });  
            //获取数据渲染库位图
            function GetSlotVm(ceng) {
                console.log(ceng);
                var item = {
                    layer:ceng
                };
                sendData(IP + "/Bord/GetSlotVm", item, 'get', function (res) {
 
                    if (res.code == 0) {
                        $("#tab").html("");
                        var html = '';
                        var list = res.data;
                        var slots = list.SlotsVm;
                        for (let i = list.Col; i > 0; i--) {
                            html += '<tr >';
                            for (let k = 1; k <= list.Row; k++) {
                                var statu = slots.find(r=> r.SlotColumn==i && r.SlotRow == k);
                                
                                var d = "";
                                var s ="eight";
                                if (statu != undefined) {
                                    s= statu.SlotStatusCls;
                                    d = statu.SlotCode;
                                    if (statu.Make =="02") {
                                        html +='<td><button val='+d+' class="btncls " disabled></button></td>'
                                    } else {
                                        var lie=d.substr(2,2);
                                        var hang=d.substr(0,2);
                                        console.log(lie);
                                        console.log(hang);
                                        html +='<td><div val='+d+' class="btncls divcls textSty '+ s +'" >'+lie+'<br/>'+hang+'</div></td>'
                                    }
                                    
 
                                }else{
                                    html +='<td></td>'
                                }
                            }
                            html +='</tr>';
                            
                        }
                        $("#tab").append(html);
                        $(".btncls").mouseover(function () {
                            var codes = $(this).attr("val")
                             console.log(codes);
                            var params={
                                code:codes
                            }
                            var ss = this;
                            // sendData(IP + "/Bord/GetStockMsgBySlot", params, 'post', function (res) {
                            //     if (res.code == 1) {
                            //          console.log(res.data);
                            //         if (res.data != "") {
                            //             //  layer.tips(res.data, ss);
                            //             layer.msg(res.data, {
                            //                 // icon: 1,
                            //                 time: 3000
                            //             })
                            //         }
                                    
                            //     }
                            // });
 
                        });
                    } else {
                        layer.msg(res.msg, {
                            icon: 2,
                            time: 2000
                        }, function () { })
                    }
                });
            }
 
            // 加载仓库图例
            function GetSlotChart(warehouseId) {
                var items = {
                    slotLayer: warehouseId,
                };
                var index = document.getElementById("SlotLayer").selectedIndex;//获取当前选择项的索引.
                var LayerName = document.getElementById("SlotLayer").options[index].text;
                sendData(IP + "/Bord/GetSlotList", items, 'post', function (res) {
 
                    if (res.code == 1) {
                        var list = res.data;
                        var key = [];
                        var value = [];
                        for (var i in list) {
                            key.push(i)
                            value.push(list[i])
                        }
                        this.chartLine2 = echarts.init(document.getElementById("chartMap2"));
                        var option2 = {
                            title: {
                                text: LayerName,
                                left: 'center',
                                // top: '15.5%'
                            },
                            tooltip: {
                                trigger: 'item',
                                formatter: '{a} <br/>{b} : {c}  ({d}%)'
                                //formatter: '{a} <br/>{b} ({d}%)'
                            },
                            legend: {
                                orient: 'vertical',
                                left: 'left'
                            },
                            series: [{
                                name: '储位数量及占比',
                                type: 'pie',
                                radius: '85%',
                                data: [{ value: value[0], name: key[0] },
                                { value: value[1], name: key[1] },
                                { value: value[2], name: key[2] },
                                { value: value[3], name: key[3] },
                                { value: value[4], name: key[4] },
                                { value: value[5], name: key[5] },
                                { value: value[6], name: key[6] },
                                { value: value[7], name: key[7] },
                                { value: value[8], name: key[8] },
                                ],
                                emphasis: {
                                    itemStyle: {
                                        shadowBlur: 10,
                                        shadowOffsetX: 0,
                                        shadowColor: 'rgba(255, 0, 0, 0.5)'
                                    }
                                }
                            }],
 
 
                        };
                        this.chartLine2.setOption(option2);
 
                    } else {
                        layer.msg(res.msg, {
                            icon: 2,
                            time: 2000
                        }, function () { })
                    }
                });
 
            };
 
        });
    </script>
</body>
 
</html>