From 1e40a94e41a811a30b49150b5feabe9b7797948a Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期二, 14 五月 2024 08:23:06 +0800
Subject: [PATCH] #

---
 pages/tzsk/AGV/AGVPick.vue |  399 ++++++++++++++++++++++++++++++++------------------------
 1 files changed, 227 insertions(+), 172 deletions(-)

diff --git a/pages/tzsk/AGV/AGVPick.vue b/pages/tzsk/AGV/AGVPick.vue
index 941f15d..aa51314 100644
--- a/pages/tzsk/AGV/AGVPick.vue
+++ b/pages/tzsk/AGV/AGVPick.vue
@@ -2,31 +2,80 @@
 	<view>
 		<view class="code">
 			<view class="item">
-				<view class="code-decs">妤煎彿:</view>
-				<uni-combox :candidates="floorList" placeholder="璇烽�夋嫨妤煎彿" v-model="floor" @input="getFloor"></uni-combox>
+				<view class="code-decs">閲囪喘鍗曞彿:</view>
+				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="orderNo" :focus="orderNoFocus"
+					@input="findOrder()">
 			</view>
 			<view class="item">
-				<view class="code-decs">鏆傚瓨浣�:</view>
-				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="stationCode" :focus="stationCodeFocus"
-					@input="stationCodeInput()">
+				<view class="code-decs">鏂欑鐮�:</view>
+				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus"
+					@input="barcodeInput()">
 			</view>
 		</view>
-		
 		<view class="mat-list-title">
-			<view style="-webkit-flex: 1;flex: 1;"></view>
-			<view style="-webkit-flex: 1;flex: 1;">绔欑偣鍒楄〃</view>
-			<view style="-webkit-flex: 1;flex: 1;"><button size="mini" @click="selectAll()">{{btnText}}</button></view>
+			鍟嗗搧鍒楄〃
 		</view>
 		<scroll-view>
-			<view class="list" v-for="(item,i) in dataList" :key="i" :class="'bg-'+item.color">
-				<view class="aside">
-					<checkbox :value="item.matnr" :checked="item.checked" @click="set(i)"/>
-				</view>
-				<view class="list-left" style="display: flex;justify-content: center;">
-					{{item.devNo}}
+			<view class="list" v-for="(item,i) in dataList" :key="i">
+				<view class="list-left">
+					<view class="list-left-item">
+						<view class="desc">No锛�</view>
+						<view class="left-item">{{i + 1}}</view>
+					</view>
+					<!-- <view class="list-left-item">
+						<view class="desc">绠辩爜锛�</view>
+						<view class="left-item">
+							<input type="text" v-model="item.containerCode">
+							<uni-tag :text="item.containerCode" type="primary"></uni-tag>
+						</view>
+					</view> -->
+					<view class="list-left-item">
+						<view class="desc">閿�鍞崟鍙凤細</view>
+						<view class="left-item">
+							<input type="text" v-model="item.csocode">
+							<!-- <uni-tag :text="item.containerCode" type="primary"></uni-tag> -->
+						</view>
+					</view>
+					<view class="list-left-item">
+						<view class="desc">璁㈠崟琛屽彿锛�</view>
+						<view class="left-item">
+							<input type="text" v-model="item.isoseq">
+							<!-- <uni-tag :text="item.containerCode" type="primary"></uni-tag> -->
+						</view>
+					</view>
+					<view class="list-left-item">
+						<view class="desc">鏂欏彿锛�</view>
+						<view class="left-item">
+							<uni-tag :text="item.matnr" type="primary"></uni-tag>
+						</view>
+					</view>
+					<view class="list-left-item">
+						<view class="desc">鍝佸悕锛�</view>
+						<view class="left-item">{{item.maktx}}</view>
+					</view>
+					<view class="list-left-item">
+						<view class="desc">瑙勬牸锛�</view>
+						<view class="left-item">{{item.specs}}</view>
+					</view>
+					<view class="list-left-item">
+						<view class="desc">鎵瑰彿锛�</view>
+						<view class="left-item">
+							<uni-tag :text="item.batch" type="warning"></uni-tag>
+						</view>
+					</view>
+					<!-- <view class="list-left-item">
+						<view class="desc">閲嶉噺锛�</view>
+						<view class="left-item">
+							<uni-tag :text="item.weight" type="warning"></uni-tag>
+						</view>
+					</view> -->
+					<view class="list-left-item">
+						<view class="desc">鏁伴噺锛�</view>
+						<view class="left-item">{{item.anfme}}</view>
+					</view>
 				</view>
 				<view class="list-right">
-					<!-- <uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons> -->
+					<uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons>
 					<uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons>
 				</view>
 			</view>
@@ -34,8 +83,7 @@
 		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
 		<view class="buttom">
 			<button size="mini" @click="reset('warn')">閲嶇疆</button>
-			<button size="mini" type="primary" @click="containerMove()">瀹瑰櫒绂诲満</button>
-			<button size="mini" type="primary" @click="containerPick()">鐩樼偣 / 鎷h揣</button>
+			<button size="mini" type="primary" @click="combConfirm('warn')">缁勬墭</button>
 		</view>
 		<!-- 寮圭獥 -->
 		<!-- 淇敼鏁伴噺 -->
@@ -45,20 +93,20 @@
 					<!-- 鏍囬 -->
 					<view class="title">淇敼</view>
 					<view class="popup-item">
-						<view class="popup-item-left">缂栫爜:</view>
+						<view class="popup-item-left">鏂欏彿:</view>
 						<view class="popup-item-right">
 							<input type="text" v-model="matnr" disabled="true"
 								style="background-color: #f7f7f7;padding: 0;color: #d5d5d5;">
 						</view>
 					</view>
-					<!-- <view class="popup-item">
+					<view class="popup-item">
 						<view class="popup-item-left">鎵瑰彿:</view>
 						<view class="popup-item-right"><input type="text" v-model="batch"></view>
-					</view> -->
-					<view class="popup-item">
+					</view>
+					<!-- <view class="popup-item">
 						<view class="popup-item-left">閲嶉噺:</view>
 						<view class="popup-item-right"><input type="text" v-model="weight"></view>
-					</view>
+					</view> -->
 					<view class="popup-item">
 						<view class="popup-item-left">鏁伴噺:</view>
 						<view class="popup-item-right" style="border: none;justify-content: center;">
@@ -86,7 +134,7 @@
 				<uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message>
 			</uni-popup>
 		</view>
-		<!-- 纭鍚姩 -->
+		<!-- 纭缁勬墭 -->
 		<view>
 			<uni-popup ref="combConfirm" type="dialog">
 				<uni-popup-dialog :type="msgType" cancelText="鍙栨秷" confirmText="纭" :title="title" :content="content"
@@ -100,6 +148,10 @@
 					@confirm="resetConfirm" @close="resetClose"></uni-popup-dialog>
 			</uni-popup>
 		</view>
+		
+		<view class="keyboard" :class="hidebg" mode="aspectFit" @click="hideKeyboard">
+			<image src="@/static/img/keyboard1.png" style="height: 70%;width: 70%;"></image>
+		</view>
 	</view>
 </template>
 
@@ -110,13 +162,8 @@
 				baseUrl: '',
 				token: '',
 				barcode: '',
-				stationCode: '',
-				stationCodeFocus: true,
-				dataList: [
-					{devNo:'12321321'},
-					{devNo:'12321321'},
-					{devNo:'12321321'},
-					],
+				orderNo: '',
+				dataList: [],
 				count: 0,
 				rowNum: '',
 				matnr: '',
@@ -127,137 +174,117 @@
 				messageText: '',
 				title: '',
 				content: '',
-				barcodeFocus: true,
+				orderNoFocus: true,
+				barcodeFocus: false,
 				matFocus: false,
 				matData: '',
 				removeNum: 0,
-				floorList: [1,3],
-				floor: "",
-				devNo: [],
-				btnText: '鍏ㄩ��',
-				
+				tempOrderInfo: {csocode: '',isoseq: ''},
+				hide: true,
+				hidebg: 'kb-bgtr'
 			}
 		},
 		onLoad() {
+			// #ifdef APP
+			setInterval(()=>{
+				if (this.hide) {
+					uni.hideKeyboard()
+				} else {
+					
+				}
+			},20)
+			// #endif
+		},
+		onBackPress() {
+			this.hide = false
 		},
 		onShow() {
 			this.baseUrl = uni.getStorageSync('baseUrl');
 			this.token = uni.getStorageSync('token');
 		},
 		methods: {
-			stationCodeInput() {
-				setTimeout(() => {
-					var len = this.stationCode.length
-					if (len != 15) {
-						this.stationCode = ''
-						this.stationCodeFocus = true
-						uni.showToast({
-							title: '鏆傚瓨鐮佹湁璇閲嶈瘯',
-							icon: "none",
-							position: 'top'
-						});
-						return;
-					}
-					this.pushDevNo()
-					this.stationCodeFocuss()
-				}, 200)
-			},
-			pushDevNo() {
-				var devNo = {"devNo":this.stationCode}
-				if (this.dataList.length == 0) {
-					this.dataList.push(devNo)
-					return
-				}
-				var flag = false
-				for(var i = 0; i < this.dataList.length; i++ ) {
-					if (this.dataList[i].devNo == devNo.devNo) {
-						this.messageText = "绔欑偣閲嶅"
-						this.messageToggle('warn')
-						return
-					} else {
-						flag = true
-					}
-				}
-				if(flag) {
-					this.dataList.push(devNo)
-				}
-				
-			},
-			stationCodeFocuss() {
-				let that = this;
-				this.stationCode = ''
-				that.stationCodeFocus = false;
-				setTimeout(() => {
-					that.stationCodeFocus = true;
-				}, 100);
-			},
-			getChecked() {
-				var checkedList = []
-				for(var i = 0; i < this.dataList.length; i++) {
-					var t = !this.dataList[i].checked
-					if (this.dataList[i].checked) {
-						checkedList.push(this.dataList[i])
-					}
-				}
-				this.dataList = checkedList
-			},
-			set(i) {
-				var ck = this.dataList[i].checked
-				this.dataList[i].checked = ck ? false:true
-				
-			},
-			selectAll() {
-				if (this.btnText == '鍏ㄩ��') {
-					for (let i in this.dataList) {
-						this.$set(this.dataList[i],'checked',true)
-						this.btnText = '鍙栨秷'
-					}
+			hideKeyboard() {
+				this.hide = this.hide ? false : true
+				if (this.hide) {
+					this.hidebg = 'kb-bgtr'
 				} else {
-					for (let i in this.dataList) {
-						var ck = this.dataList[i].checked
-						this.dataList[i].checked = ck ? false:true
-						this.btnText = '鍏ㄩ��'
-					}
+					this.hidebg = 'kb-bgfa'
 				}
-				
 			},
-			getFloor() {
+			// 鏍规嵁璁㈠崟鍙疯繑鍥炲晢鍝佽鎯�
+			findOrder() {
 				let that = this
-				if (this.floor == '') {
-					return
-				}
+				that.tempOrderInfo.csocode = ''
+				that.tempOrderInfo.isoseq = ''
 				uni.request({
-					url: that.baseUrl + '/agvMobile/getBasDevp/auth',
+					url: that.baseUrl + '/mobile/order/search/orderNo/auth',
+					header: {'token': uni.getStorageSync('token')},
 					data: {
-						floor: that.floor
+						orderNo: that.orderNo
 					},
-					header: {
-						'token': uni.getStorageSync('token')
-					},
-					method: 'POST',
 					success(res) {
 						res = res.data
-						for(var i = 0; i < res.data.length; i++) {
-							if (res.data[i].locSts === 'F') {
-								// res.data[i]["color"] = "red"
-								that.dataList.push(res.data[i])
+						console.log(res);
+						if (res.code === 200) {
+							if(res.data && res.data[0].combMats) {
+								for (let i = 0; i < res.data[0].combMats.length; i++) {
+									that.checkMat(res.data[0].combMats[i])
+								}
+								that.orderNoFocus = false
+								setTimeout(() => {
+									that.barcodeFocus = true
+								}, 10);
+							} else {
+								// uni.showToast({
+								// 	title: that.orderNo + '璇锋鏌ヨ鍗曞彿鏄惁姝g‘',
+								// 	icon: "none",
+								// 	position: 'top'
+								// })
 							}
+						} else if (res.code == 403) {
+							uni.showToast({
+								title: res.msg,
+								icon: "none",
+								position: 'top'
+							})
+							setTimeout(() => {
+								uni.reLaunch({
+									url: '../login/login'
+								});
+							}, 1000);
+						} else {
+							uni.showToast({
+								title: res.msg,
+								icon: "none",
+								position: 'top'
+							})
 						}
 					}
-				});
+				})
 			},
 			messageToggle(type) {
 				this.msgType1 = type
 				this.$refs.message.open()
 			},
 			// barcode input 浜嬩欢
-			barcodeInput() {
+			orderNoInput() {
 				// 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
 				setTimeout(() => {
-					var len = this.barcode.length
-					if (len != 8) {
+					var len = this.orderNo.length
+					this.barcodeFocuss()
+				}, 200)
+			},
+			barcodeInput() {
+				// 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
+				if (this.barcode.split('_')[1]) {
+					this.barcode = this.barcode.split('_')[1]
+				} 
+				// this.barcode = this.barcode.split('_')[1]
+				setTimeout(() => {
+					let len = this.barcode.length
+					if (len != 10) {
 						uni.showToast({
-							title: '鎵樼洏鐮佹湁璇閲嶈瘯',
+							title: '鏂欑鐮佹湁璇閲嶈瘯',
 							icon: "none",
 							position: 'top'
 						});
@@ -287,14 +314,17 @@
 			// 鎼滅储鐗╂枡
 			findMat() {
 				let that = this
+				// 鍒ゆ柇鐗╂枡闀垮害鏄惁涓�1
+				// if (that.dataList.length >= 1) {
+				// 	this.messageText = "鍙兘娣诲姞涓�绉嶇墿鏂�"
+				// 	this.messageToggle('warn')
+				// 	that.matnr = ''
+				// 	return
+				// }
 				uni.request({
 					url: that.baseUrl + '/mat/auth',
-					data: {
-						matnr: that.matnr
-					},
-					header: {
-						'token': uni.getStorageSync('token')
-					},
+					data: { matnr: that.matnr },
+					header: { 'token': uni.getStorageSync('token') },
 					success(result) {
 						result = result.data
 						if (result.code === 200 && result.data) {
@@ -302,16 +332,19 @@
 							that.matnr = ''
 							that.matData['batch'] = ''
 							uni.navigateTo({
-								url: "../mat/matSelected",
+								url: "../../mat/matSelected",
 								// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
 								success: function(res) {
 									res.eventChannel.emit('mat', {
-										data: result.data
+										data: result.data,
+										// tempOrderInfo: that.tempOrderInfo
 									})
 								},
 								// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
 								events: {
 									matList: function(data) {
+										data.data['csocode'] = ''
+										data.data['isoseq'] = ''
 										that.checkMat(data.data)
 										that.focuss()
 									},
@@ -343,7 +376,7 @@
 			selectMat() {
 				let that = this
 				uni.navigateTo({
-					url: "../mat/matQuery",
+					url: "../../mat/matQuery",
 					success: function(res) {
 						// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�   鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑
 						res.eventChannel.emit('commonUrl', {
@@ -442,25 +475,47 @@
 			combConfirm(type) {
 				this.msgType = type
 				this.title = '璀﹀憡'
-				this.content = '鏄惁鐜板湪鍚姩!'
+				this.content = '鏄惁鐜板湪缁勬墭!'
 				this.$refs.combConfirm.open()
 			},
 			combClose() {
 				this.$refs.combConfirm.close()
 			},
 			comb() {
-				this.devNo = []
 				uni.vibrateShort();
 				let that = this;
-				for (var i = 0; i < this.dataList.length; i++) {
-					if (this.dataList[i].checked) {
-						this.devNo.push(this.dataList[i].devNo)
+				if (that.barcode === '') {
+					this.messageText = "璇锋壂鎻忔墭鐩樻潯鐮�"
+					this.messageToggle('error')
+					return;
+				}
+				if (that.dataList.length === 0) {
+					this.messageText = "璇锋坊鍔犲晢鍝佸垪琛�"
+					this.messageToggle('error')
+					return;
+				}
+				// if (that.dataList.length > 1) {
+				// 	this.messageText = "鍙兘娣诲姞涓�绉嶇墿鏂�"
+				// 	this.messageToggle('error')
+				// 	return;
+				// }
+				for (var i = 0; i < that.dataList.length; i++) {
+					if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
+						this.messageText = that.dataList[i].matnr + '缁勬墭鏁伴噺涓嶈兘涓�0'
+						this.messageToggle('error')
+						return;
 					}
 				}
+				console.log(that.dataList);
+				console.log(that.barcode);
+				console.log(that.orderNo);
+				// return
 				uni.request({
-					url: that.baseUrl + '/agvMobile/pakin/auth',
+					url: that.baseUrl + '/agvMobile/comb/auth',
 					data: JSON.stringify({
-						devNo: that.devNo
+						orderNo: that.orderNo,
+						barcode: that.barcode,
+						combMats: that.dataList
 					}),
 					method: 'POST',
 					header: {
@@ -469,9 +524,15 @@
 					success(result) {
 						var res = result.data
 						if (res.code === 200) {
-							that.resst();
-							that.messageText = "鍚姩鎴愬姛"
+							that.dataList = []
+							that.findOrder()
+							// that.resst();
+							that.barcode = ''
+							that.messageText = "缁勬墭鎴愬姛"
 							that.messageToggle('success')
+							const innerAudioContext = uni.createInnerAudioContext();
+							innerAudioContext.src = '/static/music/pakinOk.mp3';
+							innerAudioContext.play()
 						} else if (res.code == 403) {
 							that.messageText = res.msg
 							that.messageToggle('error')
@@ -496,8 +557,8 @@
 			// 纭閲嶇疆
 			resetConfirm() {
 				this.dataList = []
-				this.stationCode = ''
-				this.floor = ''
+				this.barcode = ''
+				this.orderNo = ''
 				this.messageText = "閲嶇疆瀹屾垚"
 				this.messageToggle('success')
 			},
@@ -509,8 +570,7 @@
 			resst() {
 				this.dataList = []
 				this.barcode = ''
-				this.stationCode = ''
-				this.floor = ''
+				this.orderNo = ''
 				this.barcodeFocuss()
 			},
 		}
@@ -520,28 +580,25 @@
 <style>
 	@import url('../../../static/css/wms.css/wms.css');
 
-	.bg-red {
-		background-color: #e54d42;
-		color: #ffffff;
+	.keyboard{
+		width: 40px;height: 40px;background-size: 100%;position: absolute;z-index: 99;
+			top: 5px;right: 5px; border-radius: 50%;
+			display: flex;align-items: center;justify-content: center;
 	}
-	.bg-white {
-		background-color: #ffffff;
-		color: #666666;
+	.kb-bgtr {
+		background-color: #55557f;
 	}
+	.kb-bgfa {
+		background-color: #00aeec;
+	}
+
 	.list:first-child {
-		margin-top: 360rpx;
-	}
-	.aside {
-		width: 100rpx;
-		/* background-color: #303133; */
-		display: flex;
-		align-items: center;
-		justify-content: center;
+		margin-top: 340rpx;
 	}
 	.code {
 		width: 100%;
 		position: fixed;
-		min-height: 100rpx;
+		min-height: 140rpx;
 		background-color: #FFF;
 		z-index: 10;
 	}
@@ -549,7 +606,7 @@
 	.item {
 		display: flex;
 		align-items: center;
-		height: 100rpx;
+		height: 70rpx;
 		margin-left: 20rpx;
 		border-bottom: 1px solid #DCDFE6;
 	}
@@ -565,7 +622,6 @@
 	}
 
 	.code-decs {
-		width: 20vw;
 		font-size: 18px;
 		color: #303133;
 	}
@@ -576,16 +632,15 @@
 	}
 
 	.mat-list-title {
-		display: flex;
-		align-items: center;
 		height: 80rpx;
+		line-height: 80rpx;
 		width: 100%;
 		background-color: white;
 		position: fixed;
-		margin-top: 200rpx;
+		margin-top: 140rpx;
 		z-index: 9;
 		/* border-top: 1px solid #DCDFE6; */
 		text-align: center;
-		box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.5);
+		box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5);
 	}
 </style>

--
Gitblit v1.9.1