|  |  | 
 |  |  | <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> | 
 |  |  |     <title>浙江中扬立库技术有限公司</title> | 
 |  |  |     <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
 |  |  |     <style> | 
 |  |  |  | 
 |  |  |         * { | 
 |  |  |             font-size: 12px; | 
 |  |  |         } | 
 |  |  |         html { | 
 |  |  |             background-color: #fff; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         .mat-msg { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #tips { | 
 |  |  |             font-size: 12px; | 
 |  |  |             margin-top: 2px; | 
 |  |  |             margin-left: 10px; | 
 |  |  |             display: inline-block; | 
 |  |  |             vertical-align: middle; | 
 |  |  | 
 |  |  |     </style> | 
 |  |  | </head> | 
 |  |  | <body> | 
 |  |  | <button onclick="help()" style="padding: 0 3px; position: absolute; top: 0%; right: 0%">?</button> | 
 |  |  | <div> | 
 |  |  |     <span>条码</span> | 
 |  |  |     <input type="text" id="code"> | 
 |  |  | 
 |  |  | <div> | 
 |  |  |     <span>物料</span> | 
 |  |  |     <input type="text" id="matNo" onkeyup="find(this)" autocomplete="off"> | 
 |  |  |     <button onclick="find()">查询</button> | 
 |  |  | </div> | 
 |  |  |  | 
 |  |  | <div class="mat-msg" id="mat-msg-id"> | 
 |  |  | 
 |  |  |  | 
 |  |  | <div id="btn-con"> | 
 |  |  |     <button style="margin-right: 20px" onclick="reset()">重置</button> | 
 |  |  |     <button onclick="comb()">组托</button> | 
 |  |  |     <button id="comb" onclick="comb()">组托</button> | 
 |  |  |     <span id="tips"></span> | 
 |  |  | </div> | 
 |  |  |  | 
 |  |  | <!-- 详情 --> | 
 |  |  | <div class="form-box" id="mat-detail"> | 
 |  |  |     <div class="form-item form-count"> | 
 |  |  |         <span style="margin-right: 10px">数量</span> | 
 |  |  |         <button onclick="reduce()">-</button><input id="count" type="number" style="text-align: center"><button onclick="add()">+</button> | 
 |  |  |     </div> | 
 |  |  |     <div class="form-item"> | 
 |  |  |         <span>名称</span> | 
 |  |  |         <input id="matName" type="text" disabled="disabled" style="background-color: #ececec;color: #000"> | 
 |  |  | 
 |  |  |     <div class="form-item"> | 
 |  |  |         <span>单位</span> | 
 |  |  |         <input id="str1" type="text" disabled="disabled" style="background-color: #ececec;color: #000; text-align: center;"> | 
 |  |  |     </div> | 
 |  |  |     <div class="form-item form-count"> | 
 |  |  |         <span style="margin-right: 10px">数量</span> | 
 |  |  |         <button onclick="reduce()">-</button><input id="count" type="number" style="text-align: center"><button onclick="add()">+</button> | 
 |  |  |     </div> | 
 |  |  |     <div class="form-item form-btn-con"> | 
 |  |  |         <button id="confirm" onclick="confirm()">提取</button> | 
 |  |  | 
 |  |  |  | 
 |  |  | </body> | 
 |  |  | <script> | 
 |  |  |  | 
 |  |  |     var matMsgTableBlankRows = 0;   // 空白行数 | 
 |  |  |     var matData = []; // 表格数据 | 
 |  |  |     var code = document.getElementById("code") | 
 |  |  | 
 |  |  |     var ttbody = document.getElementById("ttbody"); | 
 |  |  |     var btnCon = document.getElementById("btn-con"); | 
 |  |  |     var tipDom = document.getElementById("tips"); | 
 |  |  |     var combBtn = document.getElementById("comb"); | 
 |  |  |  | 
 |  |  |     var matDetail = document.getElementById("mat-detail"); | 
 |  |  |     var matName = document.getElementById("matName"); | 
 |  |  |     var str1 = document.getElementById("str1"); | 
 |  |  |     var count = document.getElementById("count"); | 
 |  |  |     var confirmBtn = document.getElementById("confirm"); | 
 |  |  |  | 
 |  |  |     matDetail.style.display = 'none'; | 
 |  |  |     var initMatCount = 1; | 
 |  |  |     window.onload = function(){matMsg.focus();} | 
 |  |  |  | 
 |  |  |     // 查询物流 | 
 |  |  |     function find(el) { | 
 |  |  | 
 |  |  |             type: 'post', | 
 |  |  |             headers: [{token: getCookie('token')}], | 
 |  |  |             data: { | 
 |  |  |                 id: el.value | 
 |  |  |                 id: matNo.value | 
 |  |  |             }, | 
 |  |  |         }, function (res) { | 
 |  |  |             if (res.code === 200) { | 
 |  |  | 
 |  |  |                     // 填充数据 | 
 |  |  |                     matName.value = res.data.matName; | 
 |  |  |                     str1.value = res.data.str1; | 
 |  |  |  | 
 |  |  |                     // count.focus(); | 
 |  |  |                     count.value = initMatCount; | 
 |  |  |                     confirmBtn.focus(); | 
 |  |  |                 } else { | 
 |  |  |                     matMsg.style.display = 'block'; | 
 |  |  |                     btnCon.style.display = 'block'; | 
 |  |  | 
 |  |  |     function comb() { | 
 |  |  |         var barcode = code.value; | 
 |  |  |         if (isEmpty(barcode)) { | 
 |  |  |             tips("托盘条码为空", true); | 
 |  |  |             tips("请输入托盘条码", true); | 
 |  |  |             // document.getElementById("code").focus(); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         if (barcode.length !== 8) { | 
 |  |  |             tips("条码必须为8位", true); | 
 |  |  |             // document.getElementById("code").focus(); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  | 
 |  |  |             tips("请提取物料", true); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         console.log(JSON.stringify({ | 
 |  |  |             barcode: barcode, | 
 |  |  |             combMats: matData | 
 |  |  |         })) | 
 |  |  |         httpRequest({ | 
 |  |  |             httpUrl: baseUrl+"/mobile/comb/form", | 
 |  |  |             httpUrl: baseUrl+"/mobile/comb/auth", | 
 |  |  |             type: 'post', | 
 |  |  |             headers: [{token: getCookie('token')}], | 
 |  |  |             data: { | 
 |  |  |             headers: [ | 
 |  |  |                 {token: getCookie('token')} | 
 |  |  |                 ,{'Content-type':'application/json;charset=UTF-8',} | 
 |  |  |                 ], | 
 |  |  |             data: JSON.stringify({ | 
 |  |  |                 barcode: barcode, | 
 |  |  |                 combMats: matData | 
 |  |  |             }, | 
 |  |  |             }) , | 
 |  |  |         }, function (res) { | 
 |  |  |             if (res.code === 200) { | 
 |  |  |                 reset(); | 
 |  |  | 
 |  |  |         }) | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     initCrnMsgTable(); | 
 |  |  |     // initCrnMsgTable(); | 
 |  |  |     function initCrnMsgTable(row) { | 
 |  |  |         var line; | 
 |  |  |         if (row === undefined){ | 
 |  |  | 
 |  |  |             requestData += name + '='+ paramData[name] + '&'; | 
 |  |  |         } | 
 |  |  |         requestData = requestData === '' ? '' : requestData.substring(0,requestData.length - 1); | 
 |  |  |  | 
 |  |  |         /*请求接收*/ | 
 |  |  |         xmlhttp.onreadystatechange = function() { | 
 |  |  |             if(xmlhttp.readyState === 4 && xmlhttp.status === 200) { | 
 |  |  | 
 |  |  |             if (defaultContentType) { | 
 |  |  |                 xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | 
 |  |  |             } | 
 |  |  |             xmlhttp.send(requestData); | 
 |  |  |             xmlhttp.send(defaultContentType?requestData:paramData); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // todo | 
 |  |  |     setTimeout(function () { | 
 |  |  |         code.value = "888" | 
 |  |  |         addTableData({ | 
 |  |  |             matNo: "1902980-11/14", | 
 |  |  |             matName: "铝带|1100-O|0.33*475|", | 
 |  |  |             str1: "件", | 
 |  |  |             count: 1 | 
 |  |  |         }) | 
 |  |  |     }, 200) | 
 |  |  |     document.onkeyup = function (e) { | 
 |  |  |         if (window.event)//如果window.event对象存在,就以此事件对象为准 | 
 |  |  |             e = window.event; | 
 |  |  |         var key = e.charCode || e.keyCode; | 
 |  |  |         if (key === 112) { | 
 |  |  |             code.focus(); | 
 |  |  |         } else if (key === 113) { | 
 |  |  |             matNo.focus(); | 
 |  |  |         } else if (key === 114) { | 
 |  |  |             combBtn.focus(); | 
 |  |  |         } else if (key === 13) { | 
 |  |  |             confirmBtn.focus(); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     document.onkeydown = function (e) { | 
 |  |  |         if (window.event)//如果window.event对象存在,就以此事件对象为准 | 
 |  |  |             e = window.event; | 
 |  |  |         var key = e.charCode || e.keyCode; | 
 |  |  |         if (key === 114) { | 
 |  |  |             comb() | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     function help() { | 
 |  |  |         window.alert("① 按F1输入条码\n" + | 
 |  |  |             "② 按F2输入商品编号,按ENTER查询,选择数量后提取\n" + | 
 |  |  |             "③ 按F3开始组托\n" + | 
 |  |  |             "其它:按F5刷新页面"); | 
 |  |  |     } | 
 |  |  | </script> | 
 |  |  | </html> |