| | |
| | | data.tokenAuth = user.tokenAuth; |
| | | data1.tokenAuth = user.tokenAuth; |
| | | data.data.deptId = selectDeptId; |
| | | |
| | | |
| | | //获取入库待值仓列表 |
| | | getInHandleList(); |
| | | } |
| | | window.addEventListener('refresh2', function(e){//执行刷新 |
| | | getInHandleList(); |
| | | }); |
| | | |
| | | //查询入库记录 |
| | | function getInHandleList() { |
| | | inHandleData = null; |
| | | |
| | | |
| | | //查询的车牌号 |
| | | data.data.plateNum = mui("#plateNum")[0].value; |
| | | |
| | |
| | | if (result.code == "0000") { |
| | | inHandleData = result.data; |
| | | renderData(); |
| | | mui.toast(result.msg); |
| | | } else { |
| | | renderData(); |
| | | mui.toast(result.msg); |
| | |
| | | mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div") |
| | | } |
| | | }) |
| | | |
| | | // inHandleData = [{ |
| | | // "id": "44", |
| | | // "plateNum": "97", |
| | | // "deHandle": "ut", |
| | | // "depotId": "16", |
| | | // "depotName": "青张列做总", |
| | | // "foodVariety": "magna pariatur laboris sunt dolor", |
| | | // "foodVarietyName": "提清除", |
| | | // "foodLevel": "fugiat", |
| | | // "foodLevelName": "应发热四民是始", |
| | | // "storeKeeperName": "" |
| | | // }, |
| | | // { |
| | | // "id": "62", |
| | | // "plateNum": "71", |
| | | // "deHandle": "dolore ut non", |
| | | // "depotId": "79", |
| | | // "depotName": "增象定立样", |
| | | // "foodVariety": "Lorem est", |
| | | // "foodVarietyName": "市条群求被团两", |
| | | // "foodLevel": "ex labore", |
| | | // "foodLevelName": "持在写称情并", |
| | | // "storeKeeperName": "2" |
| | | // }, |
| | | // { |
| | | // "id": "96", |
| | | // "plateNum": "61", |
| | | // "deHandle": "nulla magna ut proident cillum", |
| | | // "depotId": "42", |
| | | // "depotName": "条全他", |
| | | // "foodVariety": "aliquip", |
| | | // "foodVarietyName": "连开阶动际干", |
| | | // "foodLevel": "in id sunt", |
| | | // "foodLevelName": "没置定使文", |
| | | // "storeKeeperName": "3" |
| | | // }, |
| | | // { |
| | | // "id": "61", |
| | | // "plateNum": "17", |
| | | // "deHandle": "commodo", |
| | | // "depotId": "80", |
| | | // "depotName": "展观快火全领", |
| | | // "foodVariety": "voluptate eu Lorem", |
| | | // "foodVarietyName": "他边派斯重离", |
| | | // "foodLevel": "dolor", |
| | | // "foodLevelName": "装第上", |
| | | // "storeKeeperName": "4" |
| | | // } |
| | | // ] |
| | | } |
| | | |
| | | //渲染页面 |
| | |
| | | if (inHandleData && inHandleData.length > 0) { |
| | | $.each(inHandleData, function(index, item) { |
| | | html += '<li><div class="con"><div class="top">'; |
| | | html += '<div class="info">车牌号: <b>' + (item.plateNum == null ? "" : item.plateNum) +'</b></div>'; |
| | | html += '<a href="" id = "' + item.id + '" plateNum = "' + item.plateNum + '" depotName = "' + item.depotName + '" storeKeeperName = "' + (item.storeKeeperName == "" || item |
| | | .storeKeeperName == "" ? '--' : item.storeKeeperName) + '" class="link">值仓<span class="mui-icon mui-icon-arrowright"></span></a>'; |
| | | html += '<div class="info">车牌号: <b>' + (item.plateNum == null ? "" : item.plateNum) + '</b></div>'; |
| | | html += '<a href="" id = "' + item.id + '" plateNum = "' + item.plateNum + '" depotName = "' + (item.depotName == null ? "" : item.depotName) + |
| | | '" storeKeeperName = "' + (item.storeKeeperName == null ? '' : item.storeKeeperName) + |
| | | '" class="link">值仓<span class="mui-icon mui-icon-arrowright"></span></a>'; |
| | | html += '</div><div class="box">'; |
| | | html += '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i19.png);">'; |
| | | html += |
| | | '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i19.png);">'; |
| | | html += '<div class="h3">' + (item.depotName == null ? "" : item.depotName) + '</div>'; |
| | | html += '<div class="bot">目标仓库</div></div></div>'; |
| | | html += '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i20.png);">'; |
| | | html += |
| | | '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i20.png);">'; |
| | | html += '<div class="h3">' + (item.foodVarietyName == null ? "" : item.foodVarietyName) + '</div>'; |
| | | html += '<div class="bot">粮食品种</div></div></div>'; |
| | | html += '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i21.png);">'; |
| | | html += |
| | | '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i21.png);">'; |
| | | html += '<div class="h3">' + (item.foodLevelName == null ? "" : item.foodLevelName) + '</div>'; |
| | | html += '<div class="bot">粮食等级</div></div></div>'; |
| | | html += '</div></div></li>'; |
| | | }) |
| | | } else { |
| | | html += '<li><div class="con"><div style="text-align: center;font-size: 20px;color:#dd524d;padding-top: 18px;">暂无入库待值仓信息</div></div></li>'; |
| | | html += |
| | | '<li><div class="con"><div style="text-align: center;font-size: 20px;color:#dd524d;padding-top: 18px;">暂无入库待值仓信息</div></div></li>'; |
| | | } |
| | | $("#handleList").html(html); |
| | | } |
| | | //查询 |
| | | mui(".g-sobox").on("tap", ".row button", function() { |
| | | var plateNum = mui("#plateNum")[0].value |
| | | data.data.plateNum = plateNum; |
| | | getInHandleList(); |
| | | |
| | | }) |
| | | |
| | | //功能模块跳转 |
| | | mui(".mui-scroll-wrapper").on("tap", ".mui-scroll ul li a", function() { |
| | |
| | | var depotName = this.getAttribute("depotName") |
| | | var plateNum = this.getAttribute("plateNum") |
| | | var storeKeeperName = this.getAttribute("storeKeeperName") |
| | | |
| | | console.log(JSON.stringify(storeKeeperName)) |
| | | var picker = new mui.PopPicker(); |
| | | picker.setData([{ |
| | | value: "photo", |
| | | text: "现场值仓" |
| | | |
| | | |
| | | }, { |
| | | value: "snap", |
| | | text: "远程值仓" |
| | |
| | | picker.show(function(SelectedItem) { |
| | | console.log(JSON.stringify(SelectedItem)); |
| | | //现场值仓 |
| | | if(SelectedItem[0].value == 'photo'){ |
| | | if (SelectedItem[0].value == 'photo') { |
| | | mui.openWindow({ |
| | | url: "inout-in-handle.html", |
| | | id: "inout-in-handle", |
| | |
| | | } |
| | | } |
| | | }) |
| | | }else{ //远程值仓 |
| | | } else { //远程值仓 |
| | | mui.openWindow({ |
| | | url: "inout-in-handle.html", |
| | | id: "inout-in-handle", |
| | |
| | | var NdefRecord; |
| | | var NdefMessage; |
| | | var count = 0; |
| | | |
| | | //监听NFC状态 |
| | | function listenNFCStatus() { |
| | | try { |
| | |
| | | var IntentFilter = plus.android.importClass('android.content.IntentFilter'); |
| | | NfcAdapter = plus.android.importClass('android.nfc.NfcAdapter'); |
| | | var nfcAdapter = NfcAdapter.getDefaultAdapter(main); |
| | | |
| | | //判断设备是否支持NFC功能 |
| | | if (nfcAdapter == null) { |
| | | mui.alert("设备不支持NFC功能!", '提示', ["确定"], function() {}, "div"); |
| | | return; |
| | | } |
| | | |
| | | //判断设备是否开启NFC功能 |
| | | if (!nfcAdapter.isEnabled()) { |
| | | mui.alert("请在系统设置中启用NFC功能!", '提示', ["确定"], function() {}, "div"); |
| | |
| | | waiting = plus.nativeUI.showWaiting("请将NFC标签靠近!"); |
| | | |
| | | //倒计时10秒,读取不到后提示是否重新读卡 |
| | | var interval = setInterval(function() { //定义定时器 |
| | | var interval = setInterval(function() { |
| | | //定义定时器 |
| | | count++; |
| | | if (count == 10 && readyRead) { |
| | | readyRead = false; |
| | | count = 0; |
| | | waiting.close(); |
| | | clearInterval(interval); //清除定时器 |
| | | //清除定时器 |
| | | clearInterval(interval); |
| | | var btnArray = ["重试", "取消"]; |
| | | mui.confirm("已超时,是否重新读卡!", "提示", btnArray, function(e) { |
| | | if (e.index == 0) { |
| | |
| | | function() { |
| | | setTimeout(readData, 1000); |
| | | }, false); |
| | | document.addEventListener("pause", function(e) { |
| | | if (nfcAdapter) { |
| | | nfcAdapter.disableForegroundDispatch(main); |
| | | } |
| | | }, false); |
| | | document.addEventListener("resume", function(e) { |
| | | if (nfcAdapter) { |
| | | nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray); |
| | | } |
| | | }, false); |
| | | document.addEventListener("pause", |
| | | function(e) { |
| | | if (nfcAdapter) { |
| | | nfcAdapter.disableForegroundDispatch(main); |
| | | } |
| | | }, false); |
| | | document.addEventListener("resume", |
| | | function(e) { |
| | | if (nfcAdapter) { |
| | | nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray); |
| | | } |
| | | }, false); |
| | | nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray); |
| | | |
| | | } catch (e) { |
| | | mui.toast("读卡失败,请重试!"); |
| | | waiting.close(); |
| | |
| | | NdefMessage = plus.android.importClass("android.nfc.NdefMessage"); |
| | | var main = plus.android.runtimeMainActivity(); |
| | | var intent = main.getIntent(); |
| | | // if ("android.nfc.action.TAG_DISCOVERED" == intent.getAction()) { //真机调试 |
| | | if ("android.nfc.action.TECH_DISCOVERED" == intent.getAction()) { //打包 |
| | | if ("android.nfc.action.TECH_DISCOVERED" == intent.getAction()) { //打包时 |
| | | if (readyRead) { |
| | | readyRead = false; |
| | | |
| | |
| | | var id = ByteArrayToHexString(byteId); |
| | | //关闭等待圆圈 |
| | | waiting.close(); |
| | | |
| | | id = tran_LH8(id); |
| | | //读取id成功,赋值并发送请求查询 |
| | | data1.data.intelCard = id; |
| | | getInoutDetail(); |
| | |
| | | dataType: "json", |
| | | crossDomain: true, |
| | | contentType: "application/json;charset=utf-8", |
| | | data: JSON.stringify(data1), |
| | | data: JSON.stringify(data), |
| | | success: function(result) { |
| | | if (result.code == "0000") { |
| | | //弹窗信息:单子车牌跟仓库,去值仓则进入值仓页面,传递单子id; |
| | | var btnArray = ["去值仓", "取消"]; |
| | | var text = '值仓仓库:' + result.data.depotName + '<br/>车牌号:' + result.data.plateNum + '<br/>保管员:' + result.data.plateNum |
| | | var text = '值仓仓库:' + result.data[0].depotName + '<br/>车牌号:' + result.data[0].plateNum + |
| | | '<br/>保管员:' + result.data[0].storeKeeperName |
| | | mui.confirm(text, "检测到待值仓信息如下", btnArray, function(e) { |
| | | if (e.index == 0) { |
| | | //先判断单子是否在值仓状态 |
| | | if (result.data.progress == "HANDLE") { |
| | | if (result.data[0].progress == "HANDLE") { |
| | | //去值仓时判断单子类型是否是入库,不是给出提醒; |
| | | if (result.data.type == "IN") { |
| | | if (result.data[0].type == "IN") { |
| | | mui.openWindow({ |
| | | url: "inout-in-handle.html", |
| | | id: "inout-in-handle", |
| | | extras: { |
| | | data: { |
| | | serialNumber: result.data.id, |
| | | plateNum: result.data.plateNum, |
| | | depotName: result.data.depotName, |
| | | storeKeeperName: result.data.storeKeeperName |
| | | serialNumber: result.data[0].id, |
| | | plateNum: result.data[0].plateNum, |
| | | depotName: result.data[0].depotName, |
| | | storeKeeperName: result.data[0].storeKeeperName |
| | | } |
| | | } |
| | | }) |
| | | } else { |
| | | mui.alert("该卡信息不是出库类型,请核对!", "提示", ["确定"], function() {}, "div") |
| | | mui.alert("该卡信息不是入库类型,请核对!", "提示", ["确定"], function() {}, "div") |
| | | } |
| | | } else { |
| | | mui.alert("当前卡不在值仓状态,请核查!", "提示", ["确定"], function() {}, "div") |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //将字节数组转为16进制字符串 |
| | | function ByteArrayToHexString(inarray) { |
| | | var i, j, inn; |
| | |
| | | return out; |
| | | } |
| | | |
| | | //16进制字符串 高低换位 8个字符 |
| | | function tran_LH8(info) { |
| | | var tag = tran_LH(info.substring(4)) + tran_LH(info.substring(0, 4)); |
| | | return hex2int(tag); |
| | | } |
| | | |
| | | //16进制字符串 高低换位 4个字符 |
| | | function tran_LH(info) { |
| | | return info.substring(2) + info.substring(0, 2); |
| | | } |
| | | |
| | | function hex2int(hex) { |
| | | var len = hex.length, |
| | | a = new Array(len), |
| | | code; |
| | | for (var i = 0; i < len; i++) { |
| | | code = hex.charCodeAt(i); |
| | | if (48 <= code && code < 58) { |
| | | code -= 48; |
| | | } else { |
| | | code = (code & 0xdf) - 65 + 10; |
| | | } |
| | | a[i] = code; |
| | | } |
| | | |
| | | return a.reduce(function(acc, c) { |
| | | acc = 16 * acc + c; |
| | | return acc; |
| | | }, 0); |
| | | } |
| | | //滑动 |
| | | mui('.mui-scroll-wrapper').scroll({ |
| | | indicators: false, //是否显示滚动条 |