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
<!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;
            }
            .mui-badge1{padding:0px; width:65%; float:right; line-height:42px; font-size:14px;}
        </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" 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;">
                        <option value="">请点击选择工单</option>
                    </select> 
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont icon-navicon-jhslsz" style="color: #FF8C00;"></span>计划</label>
                    <input id="planQty" 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-piliang" style="color: #FF8C00;"></span>批量</label>
                    <input onkeyUp="checkSymbol(this)" id="batchQty" type="search" style="text-align:left " class="mui-input-clear" placeholder="请输入批量">
                </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)%>'><%=(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:;">
                            <span class="mui-media-object mui-pull-right mui-icon mui-icon mui-icon-trash" style="color: red;" data-code='<%=(item.TASK_NO)%>'></span>
                            <div class="mui-media-body">
                                <%=(item.TASK_NO)%>
                                <p class="mui-ellipsis">计划:<%=(item.PLAN_QTY)%>  批量:<%=(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("userCode").addEventListener("keydown", function(e) {
                    if (13 == e.keyCode) { // 
                        document.activeElement.blur(); //隐藏软键盘  
                        afterUserCode();
                    }
                }, false);
                document.getElementById("order").addEventListener("change", function(e) {
                    afterOrder();
                }, false);
                document.getElementById("batchQty").addEventListener("keydown", function(e) {
                    if (13 == e.keyCode) { 
                        doSubmit()
                    }
                }, false);
                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);
                })
            }
            
            function afterDevice() {
                aj.post("/create_pulp/afterDevice", {
                    device: getParam('device')
                }, function(data) {
                    if (data.result) {
                        console.log(JSON.stringify(data))
                        
                        document.getElementById('station').value = data.data.station;
                        document.getElementById('order').innerHTML = template('record-template', {
                            "record": data.data.order
                        });
                        mui.focus(document.getElementById('userCode'));
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                            document.getElementById('device').value = "";
                            mui.focus(document.getElementById('device'));
                        });
                    }
                });
            }
            
            function afterUserCode() {
                aj.post("/create_pulp/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 = "";
                            mui.focus(document.getElementById('userCode'));
                        });
                    }
                });
            }
            
            function afterOrder() {
                if(document.getElementById('order').value.length == 0){
                    return;
                }
                
                aj.post("/create_pulp/afterOrder", {
                    order: getOrderParam('order','station')
                }, function(data) {
                    if (data.result) {
                        document.getElementById('planQty').value = data.data.planQty;
                        document.getElementById('batchQty').value = ""
                        mui.focus(document.getElementById('batchQty'));
                    } else {
                        mui.focus(document.getElementById('userCode'));
                        mui.alert(data.msg, '系统提示', function() {
                        });
                    }
                }); 
            }
            
            function doSubmit() {
                //模块名称[字段名[登录帐号[选择的工单[计划数量[批量数量[设备号[工位号[班次[工号[锅数
                aj.post("/create_pulp/afterBatch", {
                    param: getSubmitParam('order', 'planQty', 'batchQty', 'device', 'station', 'classes', 'userCode')
                }, function(data) {
                    if (data.result) {
                        console.log(JSON.stringify(data))
                        orderList = data.data.list;
                        document.getElementById('list').innerHTML = template('list-template', {
                            "record": orderList
                        });
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                        });
                    }
                });
            }
            
            function deleteOrder(param) {
                //console.log("删除:"+ param);
                aj.post("/create_pulp/delete", {
                    order: getDeleteParam(param, 'device')
                }, function(data) {
                    if (data.result) {
                        plus.ui.toast('操作成功!');
                    } else {
                        mui.alert(data.msg, '系统提示', function() {
                        });
                    }
                });
            }
            
            function getDeleteParam(param, param1) {
                return api_localStorageGet("functionName") + '[field1[' + api_localStorageGet("code") 
                + '[' + param
                + '[' + document.getElementById(param1).value
            }
            
            function getSubmitParam(param, param1, param2, param3, param4, param5, param6) {
                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
                + '[' + document.getElementById(param6).value
                + '[' 
            }
            
            
            function getOrderParam(param, param1) {
                return api_localStorageGet("functionName") + '[field1[' + api_localStorageGet("code") 
                + '[' + document.getElementById(param).value
                + '[' + document.getElementById(param1).value
            }
            
            function getParam(param) {
                return api_localStorageGet("functionName") + '[field1[' + api_localStorageGet("code") + '[' + document.getElementById(
                    param).value
            }
        </script>
    </body>
</html>