From 97486704c3d2d230fa0be89630f0fe950554b16b Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期二, 23 九月 2025 18:30:05 +0800
Subject: [PATCH] #

---
 pages/AGV/AGVStart.vue |  226 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 152 insertions(+), 74 deletions(-)

diff --git a/pages/AGV/AGVStart.vue b/pages/AGV/AGVStart.vue
index 563604f..08012f1 100644
--- a/pages/AGV/AGVStart.vue
+++ b/pages/AGV/AGVStart.vue
@@ -1,37 +1,27 @@
 <template>
 	<view>
-		<view class="code">
-			<!-- <view class="item">
-				<view class="code-decs">鎵樼洏鐮�:</view>
-				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus"
-					@input="barcodeInput()">
-			</view> -->
-			<!-- <view class="item">
-				<view class="code-decs">鏆傚瓨浣�:</view>
-				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="stationCode" :focus="matFocus" @input="stationCodeInput()">
-				<view class="item-right">
-					<button></button> -->
-					<!-- <text style="text-align: right;color: #409EFF;" @click="selectMat()">鎻愬彇+</text> -->
-					<!-- <uni-icons type="right" color="#c1c1c1"></uni-icons> -->
-				<!-- </view>
-			</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="stationCode" :focus="stationCodeFocus"
+				@input="stationCodeInput()"	>
+			</view>
+			<view class="item">
+				<view class="code-decs">鍏ュ簱绔�:</view>
+				<uni-combox :candidates="staList" placeholder="璇烽�夋嫨绔欑偣"  v-model="sta"></uni-combox>
 			</view>
 		</view>
+		
 		<view class="mat-list-title">
-			<view style="width: 200rpx;"></view>
-			<view style="-webkit-flex: 1;flex: 1;">鍟嗗搧鍒楄〃</view>
-			<view style="width: 200rpx;"><button size="mini" type="primary" @click="getChecked">鎻愬彇</button></view>
+			<view style="-webkit-flex: 1;flex: 1;"></view>
 		</view>
 		<scroll-view>
-			<view class="list" v-for="(item,i) in dataList" :key="i">
+			<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.name}}
+					{{item.devNo}}
 				</view>
 				<view class="list-right">
 					<!-- <uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons> -->
@@ -42,7 +32,7 @@
 		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
 		<view class="buttom">
 			<button size="mini" @click="reset('warn')">閲嶇疆</button>
-			<button size="mini" type="primary" @click="combConfirm('warn')">鍚姩</button>
+			<button size="mini" type="primary" @click="combConfirm('warn')" :disabled="isDisabled">鍚姩</button>
 		</view>
 		<!-- 寮圭獥 -->
 		<!-- 淇敼鏁伴噺 -->
@@ -118,7 +108,8 @@
 				token: '',
 				barcode: '',
 				stationCode: '',
-				dataList: [{name:'123'},{name:'456'},{name:'123'},{name:'456'},{name:'123'},{name:'456'},{name:'123'},{name:'456'},{name:'123'},{name:'456'},{name:'123'},{name:'456'},{name:'123'},{name:'456'},{name:'123'},{name:'456'},{name:'123'},{name:'456'}],
+				stationCodeFocus: true,
+				dataList: [],
 				count: 0,
 				rowNum: '',
 				matnr: '',
@@ -133,8 +124,12 @@
 				matFocus: false,
 				matData: '',
 				removeNum: 0,
-				floorList: [1,2,3],
-				floor: '',
+				floorList: [1,3],
+				floor: "",
+				devNo: [],
+				staList:[],
+				sta:'',
+				isDisabled:false
 			}
 		},
 		onLoad() {
@@ -144,6 +139,63 @@
 			this.token = uni.getStorageSync('token');
 		},
 		methods: {
+			stationCodeInput() {
+				setTimeout(() => {
+					console.log(this.stationCode.substring(0,1))
+					this.staList=[]
+					this.sta = ''
+					if(this.stationCode.substring(0,1) == 'a'){						
+						this.staList.push(1040)
+						this.sta = 1040
+					}else if(this.stationCode.substring(0,1) == 'b'){						
+						this.staList.push(2010)
+						// this.staList.push(2000)
+						this.sta = 2010
+					}else if(this.stationCode.substring(0,1) == 'c'){
+						this.staList.push(3010)
+						this.sta = 3010					
+					}else if(this.stationCode.substring(0,1) == 'd'){
+						this.staList.push(2000)
+						this.sta = 2000
+						
+					}else if(this.stationCode.substring(0,1) == 'e'){
+						this.staList.push(1000)
+						this.staList.push(1035)
+						this.sta = 1035
+						
+					}
+					
+				}, 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++) {
@@ -160,25 +212,32 @@
 			},
 			getFloor() {
 				let that = this
+				if (this.floor == '') {
+					return
+				}
 				uni.request({
-					url: that.baseUrl + '/mat/auth',
+					url: that.baseUrl + '/agvMobile/getBasDevp/auth',
 					data: {
-						matnr: that.matnr
+						floor: that.floor
 					},
 					header: {
 						'token': uni.getStorageSync('token')
 					},
-					success(result) {
-				
+					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])
+							}
+						}
 					}
 				});
 			},
-			messageToggle(type) {
+			messageToggle(type) {				
 				this.msgType1 = type
 				this.$refs.message.open()
-			},
-			stationCodeInput() {
-				this.dataList.push(this.stationCode)
 			},
 			// barcode input 浜嬩欢
 			barcodeInput() {
@@ -378,47 +437,58 @@
 			combClose() {
 				this.$refs.combConfirm.close()
 			},
-			comb() {
-				uni.vibrateShort();
+			comb() {				
 				let that = this;
-				if (that.barcode === '') {
-					this.messageText = "璇锋壂鎻忔墭鐩樻潯鐮�"
+				that.isDisabled = true
+				if (that.stationCode === '') {
+					this.messageText = "璇锋壂鎻忔殏瀛樹綅鏉$爜"
 					this.messageToggle('error')
+					that.isDisabled = false
 					return;
 				}
-				uni.request({
-					url: that.baseUrl + '/mobile/combBinging/auth',
-					data: JSON.stringify({
-						barcode: that.barcode,
-						stationCode: that.stationCode
-					}),
-					method: 'POST',
-					header: {
-						'token': uni.getStorageSync('token')
-					},
-					success(result) {
-						var res = result.data
-						if (res.code === 200) {
-							that.resst();
-							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
+				
+					uni.request({
+						url: that.baseUrl + '/mobile/agv/start',
+						data: JSON.stringify({
+							sta: that.stationCode,
+							inSta: that.sta
+						}),
+						method: 'POST',
+						header: {
+							'token': uni.getStorageSync('token')
+						},
+						success(result) {
+							var res = result.data
+							if (res.code === 200) {
+								that.resst();
+								that.messageText = "鍚姩鎴愬姛"
+								that.messageToggle('success')
+							} else if (res.code == 403) {
+								that.messageText = res.msg
+								that.messageToggle('error')
+								setTimeout(() => {
+									uni.reLaunch({
+										url: '../login/login'
+									});
+								}, 1000);
+							} else {
+								that.messageText = res.msg
+								that.messageToggle('error')
+							}
+						},
+						fail: () => {
+							that.messageText = "鎺ュ彛瓒呮椂"
 							that.messageToggle('error')
-							setTimeout(() => {
-								uni.reLaunch({
-									url: '../login/login'
-								});
-							}, 1000);
-						} else {
-							that.messageText = res.msg
-							that.messageToggle('error')
+						},
+						complete(){
+							that.isDisabled = false
 						}
-					}
-				});
+					});
+				
+					
+				
+				
+				
 			},
 			reset(type) {
 				this.msgType = type
@@ -440,8 +510,8 @@
 			},
 			// 娓呯┖
 			resst() {
-				this.dataList = []
-				this.barcode = ''
+				this.staList = []
+				this.sta = ''
 				this.stationCode = ''
 				this.floor = ''
 				this.barcodeFocuss()
@@ -453,8 +523,16 @@
 <style>
 	@import url('../../static/css/wms.css/wms.css');
 
+	.bg-red {
+		background-color: #e54d42;
+		color: #ffffff;
+	}
+	.bg-white {
+		background-color: #ffffff;
+		color: #666666;
+	}
 	.list:first-child {
-		margin-top: 260rpx;
+		margin-top: 360rpx;
 	}
 	.aside {
 		width: 100rpx;
@@ -503,11 +581,11 @@
 	.mat-list-title {
 		display: flex;
 		align-items: center;
-		height: 80rpx;
+		height: 30rpx;
 		width: 100%;
 		background-color: white;
 		position: fixed;
-		margin-top: 100rpx;
+		margin-top: 200rpx;
 		z-index: 9;
 		/* border-top: 1px solid #DCDFE6; */
 		text-align: center;

--
Gitblit v1.9.1