From 2df906a447195f9786dd468512ea895d6cc18532 Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期四, 15 五月 2025 14:53:54 +0800
Subject: [PATCH] APP3.5开发

---
 igds-app/js/admin/inout-in-handle-list.js |  179 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 89 insertions(+), 90 deletions(-)

diff --git a/igds-app/js/admin/inout-in-handle-list.js b/igds-app/js/admin/inout-in-handle-list.js
index 3f3b2c0..c7e9aaa 100644
--- a/igds-app/js/admin/inout-in-handle-list.js
+++ b/igds-app/js/admin/inout-in-handle-list.js
@@ -28,19 +28,22 @@
 function init() {
 	var user = JSON.parse(localStorage.getItem('user'));
 	var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
-	url = user.url + "/api-phone/v35/gateway";
+	url = user.url + "/api/phone/v35/gateway";
 	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;
 
@@ -64,56 +67,6 @@
 			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"
-	// 	}
-	// ]
 }
 
 //娓叉煋椤甸潰
@@ -122,26 +75,38 @@
 	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() {
@@ -149,12 +114,12 @@
 	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: "杩滅▼鍊间粨"
@@ -163,7 +128,7 @@
 	picker.show(function(SelectedItem) {
 		console.log(JSON.stringify(SelectedItem));
 		//鐜板満鍊间粨
-		if(SelectedItem.value == 'photo'){
+		if (SelectedItem[0].value == 'photo') {
 			mui.openWindow({
 				url: "inout-in-handle.html",
 				id: "inout-in-handle",
@@ -176,7 +141,7 @@
 					}
 				}
 			})
-		}else{ //杩滅▼鍊间粨
+		} else { //杩滅▼鍊间粨
 			mui.openWindow({
 				url: "inout-in-handle.html",
 				id: "inout-in-handle",
@@ -207,7 +172,6 @@
 var NdefRecord;
 var NdefMessage;
 var count = 0;
-
 //鐩戝惉NFC鐘舵��
 function listenNFCStatus() {
 	try {
@@ -218,11 +182,13 @@
 		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("璁惧涓嶆敮鎸丯FC鍔熻兘锛�", '鎻愮ず', ["纭畾"], function() {}, "div");
 			return;
 		}
+
 		//鍒ゆ柇璁惧鏄惁寮�鍚疦FC鍔熻兘
 		if (!nfcAdapter.isEnabled()) {
 			mui.alert("璇峰湪绯荤粺璁剧疆涓惎鐢∟FC鍔熻兘锛�", '鎻愮ず', ["纭畾"], function() {}, "div");
@@ -231,13 +197,15 @@
 		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) {
@@ -268,17 +236,20 @@
 			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();
@@ -291,8 +262,7 @@
 	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;
 
@@ -304,7 +274,7 @@
 			var id = ByteArrayToHexString(byteId);
 			//鍏抽棴绛夊緟鍦嗗湀
 			waiting.close();
-
+			id = tran_LH8(id);
 			//璇诲彇id鎴愬姛锛岃祴鍊煎苟鍙戦�佽姹傛煡璇�
 			data1.data.intelCard = id;
 			getInoutDetail();
@@ -322,32 +292,33 @@
 		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") {
 				//寮圭獥淇℃伅锛氬崟瀛愯溅鐗岃窡浠撳簱锛屽幓鍊间粨鍒欒繘鍏ュ�间粨椤甸潰锛屼紶閫掑崟瀛恑d锛�
 				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")
@@ -363,7 +334,6 @@
 		}
 	})
 }
-
 //灏嗗瓧鑺傛暟缁勮浆涓�16杩涘埗瀛楃涓�
 function ByteArrayToHexString(inarray) {
 	var i, j, inn;
@@ -379,7 +349,36 @@
 	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, //鏄惁鏄剧ず婊氬姩鏉�

--
Gitblit v1.9.3