廖井涛
2025-06-06 32e8ae44d542d6f6d2dc82896f5ffe58ce695889
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
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
 
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>玻璃识别</title>
<script type="text/javascript" src="${ctx}/static/AdminLTE/bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
    //websocket-------------------------start
    var websocket = null;
    
    if ('WebSocket' in window) {
        websocket = new WebSocket("ws://localhost:8080/gmms2/celiangWebsocket");
    }else {
        alert('Current Browser Not support websocket')
    }
    
    websocket.onerror = function() {
        console.error('websocket error!');
    }
    
    websocket.onopen = function () {
        console.info('websocket connected!');
    }
    
    websocket.onmessage = function (event) {
        console.log(event.data);
        if (event.data=="SENDING_GLASS") {
            window.location.reload();
            var machineId = $(".state").attr("name");
            $.ajax({
                dataType:"json",
                url : '${ctx}/celiangMachine/getReturnHtml/' + machineId,
                type:"GET",
                success : function(returnData){
                    /* var pId =                        returnData.pId;
                       var pActualLength =              returnData.pActualLength;
                       var pActualWidth =               returnData.pActualWidth;
                       var pState =                     returnData.pState;
                       var allCompletePieces =          returnData.allCompletePieces;
                       var totolPieces =                returnData.totolPieces;
                       var process =                    returnData.process;
                       //当processGlass为空时,下面的值都为空
                       var cBatch =                     returnData.cBatch;
                       var cCompletePieces =            returnData.cCompletePieces;
                       var cPieces =                    returnData.cPieces;
                       var pColor =                     returnData.pColor;
                       var pGlassLength =               returnData.pGlassLength;
                       var pGlassWidth =                returnData.pGlassWidth;
                       //每当发送一次刷新请求,这些字段都有可能变化,所以就让他们异步刷新
                       $('#table_td_p').text(pState);
                       $('#pActualLength').text(pActualLength);
                       $('#pActualWidth').text(pActualWidth);
                       $('#pGlassLength').text(pGlassLength);
                       $('#pGlassWidth').text(pGlassWidth);
                       $('#process').attr('style','width:process;');  */
                }
            })
        }
    }
    
    websocket.onclose = function () {
        console.info('websocket closed!')
    }
    
    function closeWebSocket() {
        websocket.close();
    }
    
    window.onbeforeunload = function () {
        closeWebSocket();
    }
 
    //websocket------------------------end
 
 
    /* var interval = setInterval('refreshStatus()', 1500); */
    // 设备页面自动刷新
    function refreshStatus() {
        window.location.reload();
    }
 
    // 停止页面自动刷新
    /* function disableAutoRefresh() {
        clearInterval(interval);
    } */
 
    function setRange() {
        disableAutoRefresh();
        $('#modifyRangeModal').modal('toggle');
    }
 
    function setdata() {
        disableAutoRefresh();
        $('#modifyRangeModal1').modal('toggle');
    }
    
        var $state = $(".state").val();
        var $machineId = $(".state").attr("name");
        if ($state.trim() == "true") {
            $.messager
                    .alert(
                            "警告信息",
                            "当前玻璃长度大于2500mm!",
                            "warning",
                            function() {
                                //发送ajax请求
                                $.ajax({
                                    url : '${ctx}/identifymachine/warn?ajax=true&machineId='
                                            + $machineId,
                                    success : function(data) {
                                    }
                                });
                            });
        }
        
         var tiemer = "";
        var time = 4000;//每次点击四秒后才能再次点击
        var fun = function bClick(){
            $("#finish").unbind("click");
            tiemer = setTimeout(function(){
                $("#finish").click(fun);
            },time);
        };
           $("#finish").click(fun);         
})
</script>
</head>
<body>
<div class="content-wrapper">
    <fieldset>
        <legend>${identifyMachineHtml}</legend>
        ${identifymodifyhtml}
        <input type="hidden" class="state" name="${machineId}">
        <table class="table table-bordered table-hover">
            <tr>
                <td>
                    <table class="table table-bordered table-hover">
                        <tr>
                            <th width="15%">测量进度<br> 
                            <a href="${ctx}/celiangMachine/detail/${machineId}">查看详情</a>
                            </th>
                            <td>
                                <div class="progress progress-striped active">
                                    <div id="process" class="bar" style="width: ${progress};"></div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <table class="table table-bordered table-hover">
                        <tbody>
                            <tr class="info">
                                <th width="15%">批次编号</th>
                                <td width="35%" style="font-size: 25px;">${manufactureBatchNumber}</td>
                                <th width="15%">当前玻璃状态</th>
                                <td width="35%" style="font-size: 40px;" ><p id="table_td_p">${preprocessingGlass.state}</p></td>
                            </tr>
                            <tr class="info">
                                <th width="15%">玻璃颜色</th>
                                <td>${color}</td>
                                <th width="15%">玻璃厚度(mm)</th>
                                <td>${thickness}</td>
                            </tr>
                            <tr class="info">
                                <th width="15%">总数量</th>
                                <td style="font-size: 40px;">${totalPieces}</td>
                                <th colspan="2"></th>
                            </tr>
                            <tr class="info">
                                <th width="15%">已测数量</th>
                                <td style="font-size: 40px;"><p id="cCompletePieces">${completePieces}</p></td>
                                <th width="15%">剩余数量</th>
                                <td style="font-size: 40px;"><p id="cPieces">${leftPieces}</p></td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <table class="table table-bordered table-hover">
                        <tbody>
                            <tr class="info">
                                <th colspan="4">匹配尺寸</th>
                            </tr>
                            <%-- <tr class="info">
                                <th width="15%">相同规格完成数量</th>
                                <td width="35%" style="font-size: 40px;">${sumCompletePieces}</td>
                                <th width="15%">相同规格总数量</th>
                                <td width="35%" style="font-size: 40px;">${sumPieces}</td>
                            </tr> --%>
                            <tr class="info">
                                <th width="15%">长(mm)</th>
                                <td width="35%" style="font-size: 40px;"><p id="pGlassLength">${matchLength}</p></td>
                                <th width="15%">宽(mm)</th>
                                <td width="35%" style="font-size: 40px;"><p id="pGlassWidth">${matchWidth}</p></td>
                            </tr>
                            <tr class="info">
                                <th colspan="4">实测尺寸</th>
                            </tr>
                            <tr class="info">
                                <th width="15%">长(mm)</th>
                                <td style="font-size: 40px;"><p id="pActualWidth">${preprocessingGlass.actualWidth}</p></td>
                                <th width="15%">宽(mm)</th>
                                <td style="font-size: 40px;"><p id="pActualLength">${preprocessingGlass.actualLength}</p></td>
                            </tr>
                            <!--     <tr class="info">
                                <th>误差范围(mm)</th>
                                <td><a href="#" class="btn" onclick="setRange()">设置</a></td>
                                <th colspan="2"></th>
                            </tr> -->
                            <tr class="info">
                                <th width="15%">测量结果</th>
                                <td colspan="3">${identifyResultHtml}</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </table>
    </fieldset>
    </div>
</body>
</html>