自动化立体仓库 - WMS系统
#
luxiaotao1123
2020-07-09 27991963196d5d59fe2ccb73d28bb25faaa15177
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, target-densitydpi=high-dpi, initial-scale=1.0, user-scalable=no"/>
    <title>中扬物流</title>
    <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
    <style>
        .mat-msg {
            overflow: auto;
            margin-top: 10px;
            height: 100px;
            background-color: #fff;
            border-radius: 5px;
            box-shadow: 0 0 3px rgba(0,0,0,.3);
        }
        /* 堆垛机状态信息表 */
        #mat-msg-table {
            font-size: 12px;
            border-collapse: collapse;
            margin: 0 auto;
            text-align: center;
        }
        #mat-msg-table td, #mat-msg-table th {
            border: 1px solid #f1f1f1;
            color: #666;
            height: 15px;
            line-height: 15px;
        }
        #mat-msg-table thead th {
            background-color: #fff;
            width: 400px;
            font-weight: normal;
        }
        #mat-msg-table tr:nth-child(odd) {
            background: #fff;
        }
        #mat-msg-table tr:nth-child(even) {
            background: #fff;
        }
 
        .btn-con {
            padding-left: 10px;
            position: absolute;
            bottom: 10px;
            width: 100%;
        }
        .btn-con button {
            display: inline-block;
            vertical-align: middle;
        }
        #tips {
            font-size: 12px;
            margin-left: 10px;
            display: inline-block;
            vertical-align: middle;
            width: 90px;
            overflow:hidden;
            white-space:nowrap;
            text-overflow:ellipsis;
        }
    </style>
</head>
<body>
<div>
    <span>条码</span>
    <input type="text" id="code">
</div>
<div>
    <span>物料</span>
    <input type="text" id="matnr" onkeyup="find(this)" autocomplete="off">
</div>
 
<!-- 堆垛机状态 -->
<div class="mat-msg" id="mat-msg-id">
    <table id="mat-msg-table">
        <thead>
        <tr>
            <th>编码</th>
            <th>名称</th>
            <th>单位</th>
            <th>数量</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
</div>
 
<div class="btn-con">
    <button style="margin-right: 20px" onclick="reset()">重置</button>
    <button >组托</button>
    <span id="tips"></span>
</div>
</body>
<script>
    // initCrnMsgTable()
    var code = document.getElementById("code")
    var matnr = document.getElementById("matnr")
    var matMsg = document.getElementById("mat-msg-id");
    var tipDom = document.getElementById("tips");
 
    // 查询物流
    function find(el) {
        httpRequest({
            httpUrl: baseUrl + "/matCode/auth",
            type: 'post',
            data: {
                id: el.value
            },
        }, function (res) {
            if (res.code === 200) {
                if (res.data != null) {
                    matMsg.style.display = 'none';
                } else {
                    matMsg.style.display = 'block';
                }
            } else {
                alert(res.msg);
            }
 
        })
    }
 
    // 堆垛机数据表获取  ----- 表二
    function initCrnMsgTable(row) {
        var line;
        if (row === undefined){
            var one = $('#crn-msg-table thead').height();
            var total = $('.crn-msg').height();
            var count = total / one;
            count = parseInt(count) - 1;
            crnMsgTableBlankRows = count;
            line = count;
        } else {
            line = row;
        }
        var html = "";
        for (var i = 0; i < line; i ++){
            html += " <tr>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "     </tr>\n";
        }
        $('#crn-msg-table tbody').after(html);
    }
 
    // 重置
    function reset() {
        code.value = "";
        matnr.value = "";
    }
 
    /**
     * 提示信息
     * @param msg 提示内容
     * @param warn true:红色字体
     */
    function tips(msg, warn) {
        tipDom.innerText = msg;
        if (warn) {
            tipDom.style.color = "red";
        } else {
            tipDom.style.color = "#000";
        }
    }
 
    function httpRequest(paramObj,fun,errFun) {
        var xmlhttp = null;
        /*创建XMLHttpRequest对象,
         *老版本的 Internet Explorer(IE5 和 IE6)使用 ActiveX 对象:new ActiveXObject("Microsoft.XMLHTTP")
         * */
        if(window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        }else if(window.ActiveXObject) {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        /*判断是否支持请求*/
        if(xmlhttp == null) {
            alert('你的浏览器不支持XMLHttp');
            return;
        }
        /*请求方式,并且转换为大写*/
        var httpType = (paramObj.type || 'GET').toUpperCase();
        /*数据类型*/
        var dataType = paramObj.dataType || 'json';
        /*请求接口*/
        var httpUrl = paramObj.httpUrl || '';
        /*是否异步请求*/
        var async = paramObj.async || true;
        /*请求参数--post请求参数格式为:foo=bar&lorem=ipsum*/
        var paramData = paramObj.data || [];
        var requestData = '';
        for(var name in paramData) {
            requestData += name + '='+ paramData[name] + '&';
        }
        requestData = requestData === '' ? '' : requestData.substring(0,requestData.length - 1);
 
        /*请求接收*/
        xmlhttp.onreadystatechange = function() {
            if(xmlhttp.readyState === 4 && xmlhttp.status === 200) {
                /*成功回调函数*/
                fun(JSON.parse(xmlhttp.responseText));
            }else{
                /*失败回调函数*/
                errFun;
            }
        }
 
        /*接口连接,先判断连接类型是post还是get*/
        if(httpType === 'GET') {
            xmlhttp.open("GET",httpUrl,async);
            xmlhttp.send(null);
        }else if(httpType === 'POST'){
            xmlhttp.open("POST",httpUrl,async);
            //发送合适的请求头信息
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlhttp.send(requestData);
        }
    }
</script>
</html>