cdk
2025-06-16 d27cd18610ef82671bc57151e86158d16877b5a3
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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
<!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" />
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <!-- <link rel="stylesheet" href="../../lib/base_js/css/common.css" /> -->
 
        <script type="text/javascript" src="../../lib/easyui/js/jquery.easyui.min.js" ></script>
        <script src="../../lib/mui/js/mui.min.js"></script>
        <link href="../../lib/mui/css/mui.min.css" rel="stylesheet" />
        <link href="../../lib/mui/css/mui.picker.min.css" rel="stylesheet" />
        <link href="../../lib/mui/css/mui.poppicker.css" rel="stylesheet" />
        <script src="../../lib/mui/js/mui.picker.min.js"></script>
        <script src="../../lib/mui/js/mui.poppicker.js"></script>
        <!--<script type="text/SetInputFoucsjavascript" src="../../lib/base_js/js/common.js" ></script>-->
        <script type="text/javascript" src="../../lib/base_js/js/app.js"></script>
        
        <script type="text/javascript" src="../../lib/base_js/js/common.js" ></script>
        
        <link rel="stylesheet" href="../../lib/base_js/css/common.css" />
        <style>
            #info {
                /*查询信息属性*/
                background-color: #FFE48D;
            }
        </style>
        
        <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link href="../../lib/mui/css/mui.min.css" rel="stylesheet">
        
        <script src="../../lib/mui/js/mui.min.js"></script>
        
        
 
    </head>
 
    <body>
        <div class="mui-input-group mui-content" onclick="SetInputFoucs('#DAB001')">
            <!-- <div class="mui-input-row  ">
                <div style=" float: left; ">
                    <label class="row-title">人员</label>
                    <input class="row-content-split" type="text" name="txtBillNo" id="txtBillNo" placeholder="请选择报工人员"readonly="readonly">
                </div>            
            </div> -->
 
            <div class="mui-input-row" id="row001">
                <label>发货通知单</label>
                <select id="order" class="mui-h5 " style="margin:auto; color:#000;" >
                    <option value="">请点击选择工单</option>
                </select>
            </div>
            <div class=" mui-input-row" id="row002">
                <label>条码</label>
                <input id="DAB001" type="text" value="" class="mui-input-clear text-color" placeholder="请扫描条码"
                    onkeypress="GetBarInfo()" />
            </div>
            <div id="txtInfo"><!--<div class="mui-input-row" style="height: 350px; margin-top: 10px;">-->
                <div class="link-area" id="div001">
                    <h4 style="color: #008000; text-align: center;">
                        待出库单据明细
                        <span id="dgWOMDAG-sum" class="mui-badge mui-badge-success easyui-draggable"
                            style="font-size: 15px;" data-options="onStopDrag:onStopDrag">0</span>
                    </h4>
                </div>
            </div>
            <div class="data-table-container" style="height: 100%; width: 100%;">
              <table class="data-table" id="myTable" style="height: 100%; width: 100%;">
                <!-- 表格代码 -->
                <table class="data-table" id="myTable" style="height:100% width: 100%;;">
                  <thead>
                    <tr>
                      <th style="width: 100px;">物料名称</th>
                      <th>物料代码</th>
                      <th>待发数量</th>
                      <th>已发数量</th>
                      <th>推荐仓位</th>
                      <th>规格型号</th>
                      <th>图号</th>
                    </tr>
                  </thead>
                  <tbody>
                    <!-- 表格内容将通过 JS 动态生成 -->
                  </tbody>
                </table>
              </table>
            </div>
            
 
        </div>
        
    </body>
 
</html>
 
<script>
            
            mui.init(); // 初始化 MUI
            //初始化
            mui.ready(function() {
                fetchData();
            });
            
            //获取发货通知单
            function fetchData() {
              mui.ajax({
                url: app.API_URL_HEADER + "/WARBABChag/GetCOMDFA",
                type: "GET",
                dataType: "json",
                success: function(response) {
                  if (response.status === 0) {
                    var selectElement = document.getElementById('order');
                    selectElement.innerHTML = "";
                    var options = response.data.DFA001;
 
                    for (var i = 0; i < options.length; i++) {
                      var option = document.createElement("option");
                      option.value = options[i]+'--'+response.data.DFB002[i];
                      option.text = options[i]+'--'+response.data.DFB002[i];
                      selectElement.appendChild(option);
                    }
                    
                  } else {
                    alert("获取数据异常:" + response.message);
                  }
                },
                error: function(xhr, type, errorThrown) {
                  mui.toast("获取数据异常:" + JSON.stringify(errorThrown));
                  alert("获取数据异常:");
                }
              });
            }
            
            document.getElementById('order').addEventListener('change', function() {
              // 获取选中的值
              var selectedValue = this.value;
              console.log(selectedValue);
              var splitValues = selectedValue.split("--");
              
              if (splitValues.length === 2) {
                  var DFA001 = splitValues[0]; // 第一个值存入 DFA001
                  var DFB002 = splitValues[1]; // 第二个值存入 DFB002
                  }
 
              // 发起 AJAX 请求
              mui.ajax({
                url: app.API_URL_HEADER + "/WARBABChag/GetCOMDFB", // 后台接口的URL
                type: 'POST', // 请求方法
                data: { 
                    DFA001: DFA001,
                    DFB002: DFB002, //获取复选框是否被选中(true,false)
                    }, // 请求参数,根据后台接口的要求进行修改
                dataType: 'json', // 接收到的数据类型
                success: function(response) {
                  // 处理成功响应
                      console.log(response); // 输出响应数据,你可以根据实际接口返回的数据进行相应的处理
                      
                      if (response.status === 0) {
                          // 表格数据获取成功
                          var data = response.data;
                          var tableBody = document.querySelector("#myTable tbody");
                          tableBody.innerHTML = ""; // 清空表格内容
                          
                          for (var i = 0; i < data.物料名称.length; i++) {
                              // 创建新的表格行
                              var newRow = document.createElement("tr");
                              
                              // 创建并设置物料名称单元格
                              var nameCell = document.createElement("td");
                              nameCell.innerText = data.物料名称[i];
                              newRow.appendChild(nameCell);
                              
                              // 创建并设置物料代码单元格
                              var codeCell = document.createElement("td");
                              codeCell.innerText = data.物料代码[i];
                              newRow.appendChild(codeCell);
                              
                              // 创建并设置代发数量单元格
                              var pendingCell = document.createElement("td");
                              pendingCell.innerText = data.待发数量[i];
                              newRow.appendChild(pendingCell);
                              
                              // 创建并设置已发数量单元格
                              var shippedCell = document.createElement("td");
                              shippedCell.innerText = data.已发数量[i];
                              newRow.appendChild(shippedCell);
                              
                              // 创建并设置推荐仓位单元格
                              var locationCell = document.createElement("td");
                              locationCell.innerText = data.推荐仓位[i];
                              newRow.appendChild(locationCell);
                              
                              // 创建并设置规格型号单元格
                              var specificationCell = document.createElement("td");
                              specificationCell.innerText = data.规格型号[i];
                              newRow.appendChild(specificationCell);
                              
                              // 创建并设置图号单元格
                              var drawingCell = document.createElement("td");
                              drawingCell.innerText = data.图号[i];
                              newRow.appendChild(drawingCell);
                              
                              // 将新的表格行添加到表格体中
                              tableBody.appendChild(newRow);
                          }
                      } else {
                          // 表格数据获取失败
                          alert("发生错误:" + response.message); // 使用弹窗显示错误信息
                      }
                },
                error: function(xhr, type, errorThrown) {
                  // 处理错误响应
                  console.log(errorThrown); // 输出错误信息
                  alert("发生错误:" + errorThrown); // 使用弹窗显示错误信息
                }
              });
            });
            
            function GetBarInfo() {
              var barcodeInput = document.getElementById("DAB001");
              var barcodeValue = barcodeInput.value;
            
              
            
              if (event.keyCode == 13) {
            
                // 如果未输入条码,跳出方法
                if (barcodeValue === '') {
                    alert("请扫描条码!!!");
                    return;
                }
                
                var COMDFA = document.getElementById("order");
                var selectedValue = COMDFA.value;
                var splitValues = selectedValue.split("--");
                
                if (splitValues.length === 2) {
                    var DFA001 = splitValues[0]; // 第一个值存入 DFA001
                    var DFB002 = splitValues[1]; // 第二个值存入 DFB002
                    }
                
                console.log('1');
                // var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
                // var user_id = currentSession.user_id;
 
            
                mui.ajax(app.API_URL_HEADER + "/WARBABChag/CreateXSCK", {
                    data: {
                        DAB001: barcodeValue,
                        user_id: "ADMIN",
                        DFA001: DFA001,
                        DFB002: DFB002,
                    },
                    dataType: "json",
                    type: "post",
                    async: false,
                    // timeout: 15000,
                    success: function(data) {
                        // console.log(JSON.stringify(data));
                        if (data.status != 0) {
                            playerAudio("NG");
                            alert(data.message);
                            console.log("1");
                            barcodeInput.value = ''; // 清空输入框的值
                            barcodeInput.blur(); // 先让输入框失去焦点
                            focusOnDAB001();
                            return;
                        } else {
                            mui.toast("出库成功!");
                            barcodeInput.value = ''; // 清空输入框的值
                            barcodeInput.blur(); // 先让输入框失去焦点
                            
                            // 发起 AJAX 请求
                            mui.ajax({
                              url: app.API_URL_HEADER + "/WARBABChag/GetCOMDFB", // 后台接口的URL
                              type: 'POST', // 请求方法
                              data: { 
                                                DFA001: DFA001,
                                                DFB002: DFB002, //获取复选框是否被选中(true,false)
                                                }, // 请求参数,根据后台接口的要求进行修改
                              dataType: 'json', // 接收到的数据类型
                              success: function(response) {
                                // 处理成功响应
                                    console.log(response); // 输出响应数据,你可以根据实际接口返回的数据进行相应的处理
                                    
                                    if (response.status === 0) {
                                        // 表格数据获取成功
                                        var data = response.data;
                                        var tableBody = document.querySelector("#myTable tbody");
                                        tableBody.innerHTML = ""; // 清空表格内容
 
                                        
                                        for (var i = 0; i < data.物料名称.length; i++) {
                                            if(data.待发数量[i] == 0)
                                            {
                                                var tableBody = document.querySelector("#myTable tbody");
                                                tableBody.innerHTML = ""; // 清空表格内容
                                                fetchData();
                                                return;
                                            }
                                            
                                            
                                            // 创建新的表格行
                                            var newRow = document.createElement("tr");
                                            
                                            // 创建并设置物料名称单元格
                                            var nameCell = document.createElement("td");
                                            nameCell.innerText = data.物料名称[i];
                                            newRow.appendChild(nameCell);
                                            
                                            // 创建并设置物料代码单元格
                                            var codeCell = document.createElement("td");
                                            codeCell.innerText = data.物料代码[i];
                                            newRow.appendChild(codeCell);
                                            
                                            // 创建并设置代发数量单元格
                                            var pendingCell = document.createElement("td");
                                            pendingCell.innerText = data.待发数量[i];
                                            newRow.appendChild(pendingCell);
                                            
                                            // 创建并设置已发数量单元格
                                            var shippedCell = document.createElement("td");
                                            shippedCell.innerText = data.已发数量[i];
                                            newRow.appendChild(shippedCell);
                                            
                                            // 创建并设置推荐仓位单元格
                                            var locationCell = document.createElement("td");
                                            locationCell.innerText = data.推荐仓位[i];
                                            newRow.appendChild(locationCell);
                                            
                                            // 创建并设置规格型号单元格
                                            var specificationCell = document.createElement("td");
                                            specificationCell.innerText = data.规格型号[i];
                                            newRow.appendChild(specificationCell);
                                            
                                            // 创建并设置图号单元格
                                            var drawingCell = document.createElement("td");
                                            drawingCell.innerText = data.图号[i];
                                            newRow.appendChild(drawingCell);
                                            
                                            // 将新的表格行添加到表格体中
                                            tableBody.appendChild(newRow);
                                            
                                            
                                        }
                                    } else {
                                        // 表格数据获取失败
                                        alert("发生错误:" + response.message); // 使用弹窗显示错误信息
                                    }
                              },
                              error: function(xhr, type, errorThrown) {
                                // 处理错误响应
                                console.log(errorThrown); // 输出错误信息
                                              alert("发生错误:" + errorThrown); // 使用弹窗显示错误信息
                              }
                            });
                            
                        }
                    },
                    error: function(xhr, type, errorThrown) {
                        console.log("失败");
                        mui.alert("获取数据异常:" + JSON.stringify(errorThrown));
                    }
                });
              }
            }
            
            
            function focusOnDAB001() {
              var inputElement = document.getElementById("DAB001");
              MUIinputElement.focus();
            }
            
        </script>
 
<style>
          /* 添加表格样式 */
          .data-table {
            width: 100%;
            border-collapse: collapse;
            overflow-x: auto; /* 水平滚动条 */
          }
          
        
          .data-table th,
          .data-table td {
            border: 1px solid #ccc;
            padding: 8px;
            text-align: left;
            word-wrap: break-word;
            white-space: pre-wrap;
            text-overflow: ellipsis; /* 文本截断和省略号 */
            overflow: hidden;
          }
          
          /* 媒体查询 */
          @media (max-width: 768px) {
            .data-table {
              /* 调整表格样式以适应小屏幕 */
            }
          }
          
           option {
               font-size: 40px; /* 调整下拉选项的字体大小 */
               padding: 20px; /* 调整下拉选项的内边距 */
             }
        </style>