1
hao
2025-04-16 2f1fef7743ec7230d0c7e13d96bb9c9c9cc3a8e3
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
<!DOCTYPE html>
<html>
    <head>
        <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/api.js"></script>
        <script src="../../js/common.js"></script>
        <script src="../../js/template-web.js"></script>
        <link href="../../css/mui.min.css" rel="stylesheet" />
        <link href="../../css/mui.picker.min.css" rel="stylesheet" />
        <link rel="stylesheet" type="text/css" href="../../css/iconfont.css" />
        <script src="../../js/mui.picker.min.js"></script>
        <style type="text/css">
            .mui-content {
                margin-top: 2px;
            }
 
            .mui-content input {
                text-align: left
            }
 
            /*标题中图标居右侧的css样式*/
            .title-right {
                float: right;
                line-height: 44px !important;
                position: absolute;
                display: block;
                width: 100%;
                margin: 0 0px !important;
                padding: 0 !important;
                text-align: center;
                white-space: nowrap;
                color: #000;
                display: inline-block;
                overflow: hidden;
                width: auto;
                margin: 0;
                text-overflow: ellipsis;
                --color: #de1312;
            }
        </style>
    </head>
    <body class="mui-fullscreen">
        <header class="mui-bar mui-bar-nav">
            <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">创建制胶作业</h1>
            <span class="title-right mui-icon mui-icon-list" style="color:#0062CC" id="more"></span>
        </header>
        <div class="mui-content">
            <div class="mui-input-group">
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont icon-shebei" style="color: #FF8C00;"></span>设备</label>
                    <input id="device" type="search" style="text-align:left " class="mui-input-clear" placeholder="请输入设备">
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont icon-gongwei" style="color: #FF8C00;"></span>工位</label>
                    <input id="station" type="text" class="mui-input-clear" placeholder="请输入工位">
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont icon-gonghao" style="color: #FF8C00;"></span>工号</label>
                    <input id="userCode" type="text" class="mui-input-clear" placeholder="请输入工号">
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont icon-banci" style="color: #FF8C00;"></span>班次</label>
                    <input id="classes" type="text" disabled="disabled" style="background-color: #F5F5F5;" class="mui-input-clear">
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont icon-gongdanxinxi" style="color:#FF8C00"></span>配方</label>
                    <select id="order" class="mui-h5" style="margin:auto; color:#000;">
                        <option value="">请点击选择配方</option>
                    </select>
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont icon-piliang" style="color: #FF8C00;"></span>批量</label>
                    <input onkeyUp="checkSymbol(this)" id="batchQty" type="search" style="text-align:left " class="mui-input-clear" placeholder="请输入批量">
                </div>
                <div class="mui-input-row" style="height: 6.25rem;">
                    <label ><span class="mui-icon iconfont icon-beizhu" style="color: #FF8C00;"></span>备注</label>
                    <textarea id="remark" class="form" rows="5" disabled="disabled" style="background-color: #F5F5F5;"></textarea>
                </div>
 
                <!-- <div class="mui-input-row" align="center">
                    <ul class="mui-table-view" id="submitBtn">
                        <li class="mui-table-view-cell" style="background-color: rgb(153,204,153)">
                            <a>提交</a>
                        </li>
                    </ul>
                </div> -->
                
                <ul class="mui-table-view" id="list"> 
                </ul>
 
            </div>
            <script id='record-template' type="text/template">
                <option value="">请点击选择配方</option>
                <% for(var i in record){ var item=record[i]; %>
                   <option value='<%=(item.key)%>'><%=(item.name)%></option>
                <% } %>
            </script>
            <script id='list-template' type="text/template">
                <% for(var i in record){ var item=record[i]; %>
                   <li class="mui-table-view-cell mui-media">
                        <a href="javascript:;">
                            <span class="mui-media-object mui-pull-right mui-icon mui-icon mui-icon-trash" style="color: red;" data-code='<%=(item.MID)%>'></span>
                            <div class="mui-media-body">
                                批次:<%=(item.LOT_NO)%>
                                <p class="mui-ellipsis">配方代号:<%=(item.FPEIFANG)%>  配料数量:<%=(item.FPUT_QTY)%></p>
                            </div>
                        </a>
                    </li>
                <% } %>
            </script>
 
        </div>
 
        <script type="text/javascript" charset="utf-8">
            var orderList = new Array();;
            mui.init();
            mui.plusReady(function() {
                onListen();
                mui.focus(document.getElementById('device'));
            })
 
            function onListen() {
                document.getElementById("device").addEventListener("keydown", function(e) {
                    if (13 == e.keyCode) { // 
                        document.activeElement.blur(); //隐藏软键盘  
                        afterDevice();
                    }
                }, false);
                document.getElementById("station").addEventListener("keydown", function(e) {
                    if (13 == e.keyCode) { // 
                        document.activeElement.blur(); //隐藏软键盘 
                        afterStation();
                    }
                }, false);
                document.getElementById("userCode").addEventListener("keydown", function(e) {
                    if (13 == e.keyCode) { // 
                        document.activeElement.blur(); //隐藏软键盘  
                        afterUserCode();
                    }
                }, false);
                document.getElementById("classes").addEventListener("keydown", function(e) {
                    if (13 == e.keyCode) { // 
                        //document.getElementById('potQty').focus();
                    }
                }, false);
                document.getElementById("order").addEventListener("change", function(e) {
                    afterOrder();
                }, false);
                document.getElementById("batchQty").addEventListener("keydown", function(e) {
                    if (13 == e.keyCode) { // 
                        document.activeElement.blur(); //隐藏软键盘  
                        afterBatch();
                    }
                }, false);
                /* mui("#submitBtn").on("tap", "a", function(event) {
                    doSubmit();
                }) */
                mui("#list").on("tap", "span", function(event) {
                    var order = this.getAttribute('data-code');
                    //console.log(order);
                    var elem = this;
                    var li = elem.parentNode.parentNode;
                    li.parentNode.removeChild(li);
                    deleteOrder(order);
                })
                document.getElementById('more').addEventListener('tap', function(event) {
                    if(getDou('device').length == 0){
                        plus.ui.toast('设备号不能为空');
                        return false;
                    }
                    mui.openWindow({
                        id: 'glue_list',
                        url: 'glue_list.html',
                        waiting: { // 控制 弹出转圈框的信息
                            autoShow: true, //自动显示等待框,默认为true 
                            title: '加载中' //等待对话框上显示的提示内容 
                        }, 
                        extras: {device: getParam('device')}
                     });
                });
            }
 
            function afterDevice() {
                 aj.post("/glue/afterDevice", {
                    device: getParam('device')
                }, function(data) {
                    if (data.result) {
                        console.log(JSON.stringify(data))
                        //document.getElementById('station').value = data.data.device;
                        document.getElementById('station').value = "";
                        mui.focus(document.getElementById('station'));
                        document.getElementById('list').innerHTML = template('list-template', {
                            "record": data.data.list
                        });
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                            document.getElementById('device').value = "";
                            mui.focus(document.getElementById('device'))
                        });
                    }
                }); 
            }
            function afterStation() {
                aj.post("/glue/afterStation", {
                    station: getStationParam('device','station')
                }, function(data) {
                    if (data.result) {
                        //var html = document.getElementById("order").innerHTML;
                        document.getElementById('order').innerHTML = template('record-template', {
                            "record": data.data.list
                        });
                        document.getElementById('userCode').focus();
                        document.getElementById('userCode').value='';
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                            document.getElementById('station').value = "";
                            document.getElementById('station').focus();
                        });
                    }
                });
            }
            function afterUserCode() {
                aj.post("/glue/afterJob", {
                    userCode: getParam('userCode')
                }, function(data) {
                    if (data.result) {
                        document.getElementById('classes').value = data.data.classes;
                        //document.getElementById('potQty').focus();
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                            document.getElementById('userCode').value = "";
                            document.getElementById('userCode').focus();
                        });
                    }
                });
            }
            function afterOrder() {
                if(document.getElementById('order').value.length == 0){
                    return;
                }
                
                aj.post("/glue/afterOrder", {
                    order: getOrderParam('order','station')
                }, function(data) {
                    if (data.result) {
                        document.getElementById('batchQty').value = "";
                        document.getElementById('batchQty').focus();
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                        });
                    }
                });
            }
            function afterBatch(){
                if (document.getElementById("batchQty").value.length == 0) {
                    plus.ui.toast("批量不能为空");
                    return;
                }
                doSubmit();
            } 
            function doSubmit() {
                //模块名称[字段名[登录帐号[设备号[工位号[工号[班次[配方[批量数量
                aj.post("/glue/afterBatch", {
                    param: getSubmitParam('device', 'station', 'userCode', 'classes', 'order', 'batchQty')
                }, function(data) {
                    if (data.result) {
                        getDelList();
                        document.getElementById('remark').value = data.data.remark;
                        
                        
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                            document.getElementById('remark').value = "";
                            document.getElementById('batchQty').value = "";
                            document.getElementById('batchQty').focus();
                        });
                    }
                });
            }
            
            function deleteOrder(param) {
                //console.log("删除:"+ param);
                aj.post("/glue/delete", {
                    order: getDeleteParam(param)
                }, function(data) {
                    if (data.result) {
                        plus.ui.toast('操作成功!');
                        //重新渲染列表
                        /* orderList = data.data.list;
                        document.getElementById('list').innerHTML = template('list-template', {
                            "record": orderList
                        }); */
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                        });
                    }
                });
            }
            function getDelList() {
                aj.post("/glue/getDelList", {
                    device: getParam('device')
                }, function(data) {
                    if (data.result) {
                        console.log(JSON.stringify(data))
                        plus.ui.toast('操作成功!');
                        document.getElementById('device').value = "";
                        document.getElementById('device').focus();
                        //重新渲染列表
                        document.getElementById('list').innerHTML = template('list-template', {
                            "record": data.data.list
                        });
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                            document.getElementById('list').innerHTML = "";
                        });
                    }
                });
            }
 
            function getParam(param) {
                return api_localStorageGet("functionName") + '[field1[' + api_localStorageGet("code") + '[' + document.getElementById(
                    param).value
            }
            function getStationParam(param, param1) {
                return api_localStorageGet("functionName") + '[field1[' + api_localStorageGet("code") 
                + '[' + document.getElementById(param).value
                + '[' + document.getElementById(param1).value
            }
            //模块名称[字段名[登录帐号[设备号[工位号[工号[班次[配方[批量数量
            function getSubmitParam(param, param1, param2, param3, param4, param5) {
                return api_localStorageGet("functionName") + '[field1[' + api_localStorageGet("code") 
                + '[' + document.getElementById(param).value
                + '[' + document.getElementById(param1).value
                + '[' + document.getElementById(param2).value
                + '[' + document.getElementById(param3).value
                + '[' + document.getElementById(param4).value
                + '[' + document.getElementById(param5).value
            }
            function getOrderParam(param, param1) {
                return api_localStorageGet("functionName") + '[field1[' + api_localStorageGet("code") 
                + '[' + document.getElementById(param).value
                + '[' + document.getElementById(param1).value
            }
            function getDeleteParam(param) {
                return api_localStorageGet("functionName") + '[field1[' + api_localStorageGet("code") 
                + '[' + param
            }
            function getDou(p) {
                return document.getElementById(p).value;
            }
        </script>
    </body>
</html>