lch
2024-08-26 bfb2037536523e61cc1cf4ae050181d89daffcae
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
/**
 * 
 */
 
// 全局变量
var billNo = '';
var i = 0; //计算扫描条码数量
var WLBM = "";//物料编码
var matterTable = null;
var PopPicker = new mui.PopPicker();
 
//初始化,默认焦点
mui.plusReady(function(){    
    app.init();
    mui("#txtBillNo")[0].focus();
    //SetBillNo();
    $('#info').height($(window).height()- $("#row001").height() - $("#div001").height()- $("#div002").height() - 70);
});        
// $(function(){
 //    billNo= GetMaxBillNO("1201",GetSysDateTime());//调拨单号,只要不离开界面,单号不变
//      $('#info').height($(window).height()- $("#row001").height() - $("#div001").height()- $("#div002").height() - 70);
// })
 
// $(function() {    
// SetBillNo();
// });
 
 
//数字拖动之后调整数字小图标位置
function onStopDrag(e) {
    var d = e.data;
    if(d.left < 0) {
        d.left = 0
    }
    if(d.top < 0) {
        d.top = 0
    }
    if(d.top + $(d.target).outerHeight() > $(d.parent).height()) {
        $("#dgWOMDAG-sum")[0].innerHTML = "0";
        $("#dgWOMDAG-sum").css("top", d.startTop + "px");
        $("#dgWOMDAG-sum").css("left", d.startLeft + "px");
        $("#dgWOMDAG-sum").css("position", "initial");
        i = 0;
    }
}
 
//获取高冲日工单信息
function GetBarInfoGD(){
    if(event.keyCode == 13) {
             //如果未输入条码,跳出方法
             
            if($("#txtGD").val() == "") {
                $("#txtGD").focus();
                playerAudio("NG");
                mui.toast("请先扫描日工单!");            
                return;
            }        
             //用户ID
            //var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
               //var user_id =currentSession.user_id;          
    //        var user_id = "admin";
             $.ajax({
                 url: app.API_URL_HEADER + "/WOMGCA/GetInfoHBGD",
                     
                 data: {
                     GCA001: $("#txtGD").val(),    //条码号            
                     //logID:user_id,//Admin //先写死,便于调试
                     
                 },
                 DataType: "json",
                 type: "post",
                 async: false,
                 //timeout: 15000,
                 success: function(data) {
                     //console.log(JSON.stringify(data));
                     if(data.status != 0) {
                        playerAudio("NG");
                         mui.alert(data.message,"","",function(){ 
                             mui("#txtGD")[0].focus();
                            $("#txtGD").val("");
                         });            
                         return;
                     } else {
                         matterTable = data.data.matterTable;
                        $("#info").val("");//先清空一下数据源
                        $("#info").val(data.data.infos);//填入条码明细信息
                        if($("#txtMG").val() != '' )
                        {
                            if($("#DAB001").val() != '')
                            {
                                mui("#txtSL")[0].focus();
                            }
                            else
                            {
                            mui("#DAB001")[0].focus();                                
                            }
                        }
                        else 
                        {
                            mui("#txtMG")[0].focus();
                        }
                        
                        //$("#txtMG").val("");
                     }
                 },
                 error: function(xhr, type, errorThrown) {
                     alert("获取数据异常:" + JSON.stringify(errorThrown));
                 }
             });
         }
}
 
//获取模具信息
function GetMGInfo(){
    if(event.keyCode == 13) {
             //如果未输入条码,跳出方法
             
            if($("#txtMG").val() == "") {
                $("#txtMG").focus();
                playerAudio("NG");
                mui.toast("请先扫描模具!");            
                return;
            }        
             //用户ID
            //var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
               //var user_id =currentSession.user_id;          
    //        var user_id = "admin";
             $.ajax({
                 url: app.API_URL_HEADER + "/WOMGCA/GetMGInfo",
                     
                 data: {
                     MG001: $("#txtMG").val(),    //条码号            
                     //logID:user_id,//Admin //先写死,便于调试
                     
                 },
                 DataType: "json",
                 type: "post",
                 async: false,
                 //timeout: 15000,
                 success: function(data) {
                     //console.log(JSON.stringify(data));
                     if(data.status != 0) {
                        playerAudio("NG");
                         mui.alert(data.message,"","",function(){ 
                             mui("#txtMG")[0].focus();
                            $("#txtMG").val("");
                            $("#txtMGXH").val("");
                         });            
                         return;
                     } else {
                         matterTable = data.data.matterTable;
                        $("#txtMGXH").val("");//先清空一下数据源
                        $("#txtMGXH").val(data.data.MGInfo);//填入条码明细信息
                        mui("#DAB001")[0].focus();
                        $("#DAB001").val("");
                     }
                 },
                 error: function(xhr, type, errorThrown) {
                     alert("获取数据异常:" + JSON.stringify(errorThrown));
                 }
             });
         }
}
 
 
 
 //获取条码信息
 function GetBarInfo() {
     
     
     if(event.keyCode == 13) {
         //如果未输入条码,跳出方法
         
        if($("#DAB001").val() == "") {
            $("#DAB001").focus();
            playerAudio("NG");
            mui.toast("请先扫描工单条码!");            
            return;
        }        
         //用户ID
        var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
           var user_id =currentSession.user_id;          
//        var user_id = "admin";
         $.ajax({
             url: app.API_URL_HEADER + "/WOMGCA/GetBarInfo",
                 
             data: {
                 DAB001: $("#DAB001").val(),    //条码号            
                 
             },
             DataType: "json",
             type: "post",
             async: false,
             //timeout: 15000,
             success: function(data) {
                 //console.log(JSON.stringify(data));
                 if(data.status != 0) {
                    playerAudio("NG");
                     mui.alert(data.message,"","",function(){ 
                         mui("#DAB001")[0].focus();
                        $("#DAB001").val("");
                        $("#DAB020").val("");
                     });            
                     return;
                 } else {
                    
 
                    
                    $("#DAB020").val("");//先清空一下数据源
                    
                    $("#DAB020").val(data.data.DAB020);//填入条码明细信息
                    $("#txtSL").val(data.data.DAB005);//填入条码明细信息
                    mui("#txtSL")[0].focus();
                    
                   
                    
                 }
             },
             error: function(xhr, type, errorThrown) {
                 alert("获取数据异常:" + JSON.stringify(errorThrown));
             }
         });
     }
 };
 
 
//合模
function HMHL() {                
        //用户ID
        var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
        var user_id = currentSession.user_id;
                
            if($("#txtGD").val() == "") {
                $("#txtGD").focus();
                playerAudio("NG");
                mui.toast("请先扫描日工单!");            
                return;
            }        
            
            if($("#txtMG").val() == "") 
            {
                $("#txtMG").focus();
                playerAudio("NG");
                mui.toast("请先扫描模具!");            
                return;
            }        
                        
            if($("#DAB001").val() == "") {
                $("#DAB001").focus();
                playerAudio("NG");
                mui.toast("请先扫描工单条码!");            
                return;
            }        
                
                
        $.ajax({
            url: app.API_URL_HEADER + "/WOMGCA/HMHL",
           // url: "http://localhost:27611/api/WARBAB/GetStore",
            data:{
                GD:$("#txtGD").val(),
                MG:$("#txtMGXH").val(),
                DAB020: $("#DAB020").val(),//'admin', //先写死,便于调试
                SL:$("#txtSL").val(),
                UserId:user_id,
            },
            DataType:"json",
            type:"post",
            async:false,
            //timeout:15000,
            success:function(data){
                //console.log(JSON.stringify(data));
                 if(data.status != 0){
                     mui.alert(data.message);//错误信息弹框
                     $("#txtSL")[0].focus();
                     return;
                 }
                 if(data.status == 0){
                    console.log(1);
                    playerAudio("OK");
                    //mui.alert(data.message);
                    mui.toast(data.message);
                    
                    $("#txtGD").val("");
                    mui("#txtGD")[0].focus();
                     return;
                 }else{
                    // console.log(2);
                 //     $("#txtGD").val("");
                    // //$("#txtMG").val("");
                    // //$("#txtMGXH").val("");
                    // //$("#DAB001").val("");
                    // //$("#DAB020").val("");
                    // //$("#txtSL").val("");
                    // $("#info").val("");
                 //     //$("#checkdefault").prop("checked", true);
                 // //     if(WLBM == matterTable[0]["DAB020"].toString())
                    // //     $("#dgWOMDAG-sum")[0].innerHTML = ++i;
                    // // else{
                    // //     WLBM = matterTable[0]["DAB020"].toString();
                    // //     i = 1;
                    // //     $("#dgWOMDAG-sum")[0].innerHTML = i;
                    // // }
                 //     playerAudio("OK");
                    // mui.alert(data.message);
                 //     mui.toast("合模成功!");
                    // mui("#txtGD")[0].focus();
                    // $("#txtGD").val("");
                    // playerAudio("OK");
               }
             },
            error: function(xhr, type, errorThrown) {
                mui.toast("报工异常!");
                 alert("获取数据异常:" + JSON.stringify(errorThrown));
                 return;
             }
        });
    
}
 
function clearinfo()
{
    console.log(233);
    $("#txtGD").val("");
    $("#txtMG").val("");
    $("#txtMGXH").val("");
    $("#DAB001").val("");
    $("#DAB020").val("");
    $("#txtSL").val("");
    $("#info").val("");
    mui("#txtGD")[0].focus();
}
 
 
/* 当页面的文本失去焦点时,让其再次获取焦点 */
 
 
/**
 *  @param {出发DOM控件:this} e
 */
//function SetInputFoucs(codeID) {
//    var itemTag = document.activeElement.tagName; //获取元素的标签名
//    var name = document.activeElement.name; //获取元素的名称    
//    //如果控件不是文本
//    //如果控件是文本,Name非空时(如checkbox)
//    //条码获取焦点
//    if ((itemTag != 'INPUT') ||
//        (itemTag == 'INPUT' && name != '')) {
//        $(codeID).focus();
//    }
//}