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
<!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-camera" style="color:#0062CC" id="cameraId"></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" disabled="disabled" style="background-color: #F5F5F5;"   class="mui-input-clear" >
                </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;" onchange="afterOrder(this.options[this.options.selectedIndex].value)" >
                        <option value="">请点击选择工单</option>
                    </select>
                </div>
                <div class="mui-input-row">
                    <label ><span class="mui-icon iconfont icon-piliang" style="color: #FF8C00;" ></span>批量</label>
                    <input id="tqty" onkeyUp="checkSymbol(this)" type="search" style="text-align:left "  class="mui-input-clear" placeholder="请输入批量"  >
                </div>
                <div class="mui-input-row">
                    <label ><span class="mui-icon iconfont icon-navicon-jhslsz" style="color: #FF8C00;"></span>计划</label>
                    <input id="pqty"   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-tiaoma" style="color: #FF8C00;"></span>物料</label>
                    <input  id="barcode"  type="search" style="text-align:left "  class="mui-input-clear" placeholder="请输入物料"  >
                </div>
                <div class="mui-input-row">
                    <label ><span class="mui-icon iconfont icon-miaoshu" style="color: #FF8C00;"></span>描述</label>
                    <input  id="note" 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-shuliang" style="color: #FF8C00;"></span>数量</label>
                    <input  id="qty"  type="search" onkeyUp="checkSymbol(this)" style="text-align:left "  class="mui-input-clear" placeholder="请输入数量" οninput="value=value.replace(/[^\d]/g,'')" >
                </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='select-template' type="text/template">
                <option value="">请点击选择工单</option>
                <% for(var i in record){ var item=record[i]; %>
                   <option value='<%=(item)%>'><%=(item)%></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:;">
                            <div class="mui-media-body">
                                <%=(item.order)%>
                                <p class="mui-ellipsis">计划:<%=(item.qty)%>  批量:<%=(item.pqty)%></p>
                            </div>
                        </a>
                    </li>
                <% } %>
            </script>
<script id='record-template' type="text/template">
                <option value="">请点击选择工单</option>
                <% for(var i in record){ var item=record[i]; %>
                   <option value='<%=(item)%>'><%=(item)%></option>
                <% } %>
            </script>
        </div>
 
        <script type="text/javascript" charset="utf-8">
            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("barcode").addEventListener("keydown", function(e) {
                    if (13 == e.keyCode) { // 
                        document.activeElement.blur(); //隐藏软键盘 
                         afterBarcode()
                    }
                }, false);
                document.getElementById("tqty").addEventListener("keydown", function(e) {
                    
                    if (13 == e.keyCode) { // 
                        document.activeElement.blur(); //隐藏软键盘 
                        document.getElementById('barcode').value = "";
                        mui.focus(document.getElementById('barcode'))
                    }
                }, false);
                document.getElementById("qty").addEventListener("keydown", function(e) {
                    
                    if (13 == e.keyCode) { // 
                        document.activeElement.blur(); //隐藏软键盘 
                         afterQty()
                    }
                }, false);
                /* mui("#submitBtn").on("tap", "a", function(event) {
                    doSubmit();
                }) */
            }
            function afterDevice(){
                aj.post("/out/afterDevice", {
                            device: getParem('device')
                        }, function (data) {
                            console.log(JSON.stringify(data));
                            if (data.result) {
                                /* document.getElementById('station').value=""
                                mui.focus(document.getElementById('station')) */
                                setDou('usercode',data.data.code);
                                setDou('classes',data.data.classes);
                                setDou('station',data.data.station);
                                setDou('tqty',data.data.tqry);
                                setDou('pqty',data.data.pqry);
                                
                                document.getElementById('order').innerHTML = template('select-template', {
                                    "record": data.data.list
                                }); 
                                if(data.data.code){
                                    document.getElementById('barcode').value=""
                                    mui.focus(document.getElementById('barcode'))
                                }else{
                                    document.getElementById('usercode').value=""
                                    mui.focus(document.getElementById('usercode'))
                                }
                            } else {
                                mui.alert(data.msg, '错误', function() {
                                    //关闭回调函数
                                    document.getElementById('device').value=""
                                    mui.focus(document.getElementById('device'))
                                });
                            }
                });
            }
            function afterStation() {
                aj.post("/create/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').value = "";
                        //document.getElementById('userCode').focus();
                        mui.focus(document.getElementById('usercode'))
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                            document.getElementById('station').value = "";
                            mui.focus(document.getElementById('station'));
                        });
                    }
                });
            }
            function afterUsercode(){
                aj.post("/out/afterCode", {
                            param: getParem('usercode')
                        }, function (data) {
                            if (data.result) {
                                console.log(JSON.stringify(data.data));
                                document.getElementById("classes").value=data.data
                                document.getElementById('order').value=""
                                mui.focus(document.getElementById('order'));
                            } else {
                                //plus.ui.toast(data.msg);
                                mui.alert(data.msg, '错误', function() {
                                    //关闭回调函数
                                });
                            }
                });
            }
            function afterOrder(value){
                aj.post("/out/afterOrder", {
                            param: api_localStorageGet("functionName")+'[file1['+api_localStorageGet("code")+'['+value+'['+getDou('station')
                        }, function (data) {
                            if (data.result) {
                                console.log(JSON.stringify(data.data));
                                 document.getElementById("pqty").value=data.data[0]
                                document.getElementById('tqty').value=""
                                mui.focus(document.getElementById('tqty'));
                            } else {
                                mui.alert(data.msg, '错误', function() {
                                    //关闭回调函数
                                });
                            }
                       });
            }
            function afterBarcode(){
                aj.post("/out/afterBarcoe", {
                            barcode: getParem('barcode')
                        }, function (data) {
                            if (data.result) {
                                console.log(JSON.stringify(data.data));
                                document.getElementById("note").value=data.data[0]
                                document.getElementById("qty").value=data.data[1]
                                document.getElementById('qty').value=""
                                mui.focus(document.getElementById('qty'));
                            } else {
                                mui.alert(data.msg, '错误', function() {
                                    //关闭回调函数
                                });
                            }
                });
            }
            function afterQty(){
                if (document.getElementById("qty").value.length == 0) {
                    plus.ui.toast("用量不能为空");
                    return;
                }
                doSubmit();
            }
            function doSubmit(){
                aj.post("/out/afterQty", {
                            param: getSubmitParam()
                        }, function (data) {
                            console.log(JSON.stringify(data.data));
                            document.getElementById('barcode').focus(); //获取焦点
                            if (data.result) {
                                document.getElementById("remark").value=data.data
                                clear()
                            } else {
                                //plus.ui.toast(data.msg);
                                mui.alert(data.msg, '错误', function() {
                                    //关闭回调函数
                                    document.getElementById("barcode").value=''
                                });
                                
                            }
                });
            }
            function clear(){
                setDou("barcode",'')
                setDou("note",'')
                setDou("qty",'') 
            }
            function getParem(param){
                return api_localStorageGet("functionName")+'[file1['+api_localStorageGet("code")+'['+getDou(param)
            }
            function getSubmitParam(){
                //模块名称[字段名[登录帐号[工位[工号[班次[工单号[[批量[设备号[批次条码[用量
                var obj = document.getElementById('order'); //定位id
                var index = obj.selectedIndex; // 选中索引
                var value = obj.options[index].value; // 选中值
                return api_localStorageGet("functionName")+'[file1['+ api_localStorageGet("code")+'['+
                getDou('station')+'['+getDou('usercode')+'['+getDou('classes')+'['+value+'[['+getDou('tqty')+'['+
                getDou('device')+'['+getDou('barcode')+'['+getDou('qty');
            }
            function getDou(p) {
                return document.getElementById(p).value;
            }
            function setDou(p,v){
                document.getElementById(p).value = v;
            }
            function getStationParam(param, param1) {
                return api_localStorageGet("functionName") + '[field1[' + api_localStorageGet("code") 
                + '[' + document.getElementById(param).value
                + '[' + document.getElementById(param1).value
            }
        </script>
    </body>
</html>