1
yhj
2025-03-31 9003044073373185511f1e2c901285a3287e7fa4
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
<!doctype html>
<html>
 
    <head>
        <meta charset="utf-8">
        <title></title>
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <link href="css/mui.css" rel="stylesheet" />
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <title></title>
        <script src="../../js/mui.min.js"></script>
        <script src="../../js/common.js"></script>
        <script src="../../js/template-web.js"></script>
        <script src="../../js/api.js"></script>
        <link href="../../css/mui.min.css" rel="stylesheet" />
        <link rel="stylesheet" type="text/css" href="../../css/iconfont.css" />
        <link rel="stylesheet" type="text/css" href="../../css/personal.css" />
        <link rel="stylesheet" type="text/css" href="../../css/comment.css" />
        <link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_783714_7tht2ujc04k.css" />
        <script src="js/main.js"></script>
        <style type="text/css">
            /* body{
                background: linear-gradient(to left, #6495ED, #B0E0E6);
            } */
            /*导航栏背景颜色*/
            /* .mui-bar {
               background-color: #FFFFCC;
            } */
            /*返回按钮图标*/
            .mui-bar .mui-icon {
                font-size: 30px;
                padding-top: 7px;
                padding-bottom: 13px;
                color: #000000;
            }
 
            /*标题*/
            .mui-bar .mui-title {
                font-weight: 400;
                color: #000000;
            }
 
            /*导航栏底部阴影*/
            .mui-bar-nav {
                box-shadow: 0px 1px 0px 0px #999999;
            }
 
            /*导航栏背景颜色*/
            header.mui-bar {
                background-color: #99CCFF;
            }
 
            .mui-content {
                margin-top: 2px;
 
            }
 
            .mui-btn {
                width: 80px;
            }
 
            .mui-badge1 {
                padding: 0px;
                width: 65%;
                float: right;
                line-height: 42px;
                font-size: 14px;
            }
 
            input[readonly] {
                background-color: #f1f1f5
            }
 
            .ulcss {
                margin-top: 0.625rem;
            }
 
            .acss a {
                text-align: center;
                color: #fff;
                text-decoration: none;
                /* background-color: rgb(100,149,237); */
            }
            
            /*header 用户名居于右侧*/
            .title-right {
                float: right;
                line-height: 44px !important;
                font-size: 16px;
            }
        </style>
    </head>
 
    <body>
        <header class="mui-bar mui-bar-nav" id="header">
            <button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">
                <span class="mui-icon mui-icon-left-nav"></span>
            </button>
            <h1 class="mui-title" id="title">MES移动终端</h1>
            <a class="mui-pull-right"><span class="title-right" id="usr"></span></a>
        </header>
        <div class="mui-content">
            <div id="divid">
                <div style="height: 12.75rem;overflow-y: auto;overflow-x:auto;">
                    <table width="100%" class="table">
                        <thead>
                            <tr>
                                <th width="30%">列1</th>
                                <th width="20%">列2</th>
                            </tr>
                        </thead>
                        <tbody id="table_list">
                        </tbody>
                        <script id='tr-template' type="text/template">
                            <% for(var i in record){ var item=record[i]; %>
                            <tr>
                            <td width="40%"><%=(item.col1)%></td>
                            <td width="60%"><%=(item.col2)%></td>
                            </tr>
                            <% } %>
                        </script>
                    </table>
                </div>
                <form class="mui-input-group" id="form">
                    <div class="mui-input-row">
                        <label>线体</label>
                        <input class="mui-input-clear" type="text" id="line" onkeyup="enterSearch(event,'line')"/>
                    </div>
                    <div class="mui-input-row">
                        <label>换料站位</label>
                        <input class="mui-input-clear" type="text" id="position" onkeyup="enterSearch(event,'position')"/>
                    </div>
                    <div class="mui-input-row">
                        <label>新条码</label>
                        <input class="mui-input-clear" type="text" id="barcode" onkeyup="enterSearch(event,'barcode')"/>
                    </div>
                    <div class="mui-input-row">
                        <label>备注</label>
                        <input class="mui-input-clear" type="text" id="remarks"/>
                    </div>
                </form>
            </div>
            <ul class="mui-table-view ulcss" >
                <li class="mui-table-view-cell acss" style="background-color: rgb(153,204,153);" id="cancel">
                    <a >取消</a>
                </li>
            </ul>
            <ul class="mui-table-view ulcss" >
                <li class="mui-table-view-cell acss" style="background-color: rgb(255,153,102);" id="tuichu">
                    <a >退出</a>
                </li>
            </ul>
        </div>
    </body>
    <script type="text/javascript" charset="utf-8">
        var YES_VOICE;
        var NO_VOICE;
        mui.init({
                beforeback: function() {
                    YES_VOICE.close()
                    NO_VOICE.close() //释放音频资源
                    return true; //返回true,继续页面关闭逻辑
                }
            });
        mui.plusReady(function() {
            document.getElementById("title").innerHTML = api_localStorageGet("functionName");
            document.getElementById("usr").innerHTML = setUsrCode();
            YES_VOICE = plus.audio.createPlayer("wav/YES.WAV");
            NO_VOICE = plus.audio.createPlayer("wav/NO.WAV");
            //document.getElementById("divid").innerHTML = "";
            var param = "换料QC核对[FILED1[" + api_localStorageGet("name")
            getData(param,"name");
            tuichuBtn();
        })
        
        function enterSearch(event,str) {
            if (event.keyCode == "13") {
                if(str=="line"){
                    var line=document.getElementById('line').value
                    var param = "换料QC核对[FILED2[" + api_localStorageGet("name")+"["+line
                    getData(param,"line");
                    document.getElementById('position').focus()
                }else if(str=="position"){
                    var line=document.getElementById('line').value
                    var position=document.getElementById('position').value
                    var param = "换料QC核对[FILED3[" + api_localStorageGet("name")+"["+line+"["+position
                    console.log(param)
                    getData(param,"position");
                    document.getElementById('barcode').focus()
                }else if(str=="barcode"){
                    var line=document.getElementById('line').value
                    var position=document.getElementById('position').value
                    var barcode=document.getElementById('barcode').value
                    var param = "换料QC核对[FILED3[" + api_localStorageGet("name")+"["+line+"["+position+"["+barcode
                    getMacData(param,"barcode");
                    
                }
                
            }
        }
        
        function getData(param,type) {
            mui.ajax(API.webPath + '/zrt/getMemo?pstr=' + param, {
                data: {},
                dataType: 'json',
                type: 'POST',
                timeout: 10000,
                headers: {
                    'Content-Type': 'application/json'
                },
                success: function(data) {
                    console.log(JSON.stringify(data))
                    if (data.result) {
                        //console.log(JSON.stringify(data))
                        playerYes()
                        if(type=="position"){
                            console.log(data.data)
                             document.getElementById('remarks').value=data.data;
                        }else{
                            var list = dealData(data.data,type)
                            document.getElementById('table_list').innerHTML = template('tr-template', {
                                "record": list
                            });
                        }
                        
                    } else {
                        plus.ui.toast(data.msg);
                        playerNo()
                    }
                },
                error: function(xhr, type, errorThrown) {
                    //console.log(errorThrown)
                    plus.ui.toast("error:" + type);
                    playerNo()
                }
            })
        }
        
        function getMacData(param,type) {
            
            var t=encodeURIComponent(param)
            mui.ajax(API.webPath + '/zrt/getMemoByBarcode?pstr=' + t, {
                data: {},
                dataType: 'json',
                type: 'POST',
                timeout: 10000,
                headers: {
                    'Content-Type': 'application/json'
                },
                success: function(data) {
                    //console.log(JSON.stringify(data))
                    if (data.result) {
                        playerYes()
                        //console.log(JSON.stringify(data))
                        document.getElementById('position').value='';
                        document.getElementById('barcode').value='';
                        document.getElementById('position').focus();
                        //var param = "换料QC核对[FILED1[" + api_localStorageGet("name")
                        //getData(param,"name");//lst-2021-3-24 delete
                        //显示线体下的菜单
                        var line=document.getElementById('line').value
                        var param = "换料QC核对[FILED2[" + api_localStorageGet("name")+"["+line
                        getData(param,"line");
                    } else {
                        document.getElementById('barcode').value='';
                        plus.ui.toast(data.msg);
                        playerNo()
                    }
                },
                error: function(xhr, type, errorThrown) {
                    plus.ui.toast("error:" + type);
                    playerNo()
                }
            })
        }
        
        function dealData(params,type) {
            var s = params.toString()
            var list = []
            list = s.split(",")
            var result = [];
            console.log(list)
            for (var o = 0; o < list.length; o++) {
                var arr1 = {}
                var arr = {}
                
                //arr1 = list[o].split("   ")
                if(type=="name"){
                    arr1 = list[o].split("   ")
                }else if(type=="line"){
                    arr1 = list[o].split("  ")
                }                
                arr["col1"] = arr1[0]
                arr["col2"] = arr1[1]
    
                result.push(arr)
            }
            //console.log(JSON.stringify(result))
            return result;
        }
        
        //播放声音-成功音效
        function playerYes() { //播放音乐
            var num = YES_VOICE.getDuration(); //获取音频总长度number
            YES_VOICE.play(function() {
                //console.log( "Audio play success!" );
            }, function(e) {
                //console.log( "Audio play error: " + e.message );
            });
        }
        
        //播放声音-失败音效
        function playerNo() { //播放音乐
            var num = NO_VOICE.getDuration(); //获取音频总长度number
            NO_VOICE.play(function() {
                // console.log( "Audio play success!" );
            }, function(e) {
                //console.log( "Audio play error: " + e.message );
            });
        }
        
        //退出按钮
        function tuichuBtn(){
            mui("#tuichu").on("tap", "a", function() {
                mui.back();
            });
        }
    </script>
</html>