From e0fb00cb3bb37f519b8444b3c5408111207fb069 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 25 三月 2025 18:37:33 +0800
Subject: [PATCH] 1

---
 代码管理/AGVjiaoliaoPDA/pages/materielGroup/HCJStaue.vue |  112 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 75 insertions(+), 37 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/AGVjiaoliaoPDA/pages/materielGroup/HCJStaue.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/AGVjiaoliaoPDA/pages/materielGroup/HCJStaue.vue"
index 777a8d6..89eaa7d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/AGVjiaoliaoPDA/pages/materielGroup/HCJStaue.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/AGVjiaoliaoPDA/pages/materielGroup/HCJStaue.vue"
@@ -10,10 +10,6 @@
 							<uni-easyinput type="text" v-model="stationcode" placeholder="璇锋壂鐬勭紦瀛樼偣缂栧彿" ref='midInput'
 								:focus="addressFocus" />
 						</uni-forms-item>
-						<!-- 						<uni-forms-item label="鎵樼洏鏉$爜">
-							<uni-easyinput type="text" :focus="!addressFocus" v-model="inboundBarcode"
-								placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" ref='midInput' @input="inputChangebarcode" />
-						</uni-forms-item> -->
 						<uni-forms-item label="鐗╂枡绫诲瀷">
 							<uni-easyinput type="text" v-model="PalletCode" placeholder="璇锋壂鎻忕墿鏂欑被鍨�" ref='midInput'
 								:focus="addressFocus" />
@@ -21,9 +17,6 @@
 						<uni-forms-item label="缂撳瓨鐐圭姸鎬�">
 							<uni-data-checkbox v-model="value" :localdata="range" @change="change"></uni-data-checkbox>
 						</uni-forms-item>
-					<!-- 	<uni-forms-item label="缂撳瓨鐐圭姸鎬�">
-							<uni-data-checkbox v-model="values" :localdata="ranges" @change="change"></uni-data-checkbox>
-						</uni-forms-item> -->
 						<uni-forms-item>
 							<button @click="inbound" type="primary" size="default"
 								style="margin-top: 2%;">鐘舵�佷慨鏀圭‘璁�</button>
@@ -41,7 +34,6 @@
 	export default {
 		data() {
 			return {
-				// items: ['缁勭洏', '鍏ュ簱', '鍗曟嵁淇℃伅', '瑙g洏'],
 				items: ['缂撳瓨鏋剁姸鎬佷慨鏀�'],
 				current: 0,
 				matTotal: [],
@@ -55,18 +47,16 @@
 				sns: [],
 				addressFocus: false,
 				PalletCode: "",
-				stationcode: "",
+				stationcode: "", // 缂撳瓨鐐圭紪鍙�
 				address: "",
 				check: true,
 				value: "",
 				values: "",
-				range: [{
-					"value": 0,
-					"text": "绌洪棽"
-				}, {
-					"value": 1,
-					"text": "閿佸畾"
-				}],
+				range: [
+					{ value: 0, text: "绌洪棽" },
+					{ value: 1, text: "閿佸畾" },
+					{ value: 2, text: "鏈夎揣" } // 鍋囪鎺ュ彛杩斿洖鐨勭姸鎬佸�间负 2锛岃〃绀哄崰鐢�
+				],
 				code: [],
 			}
 		},
@@ -77,11 +67,18 @@
 			this.orderNo = res.orderNo;
 			this.label = "鍗曟嵁缂栧彿锛�" + this.orderNo;
 			this.getData();
-			this.getEndLocations();
+		},
+		watch: {
+			// 鐩戝惉 stationcode 鐨勫彉鍖�
+			stationcode(newVal, oldVal) {
+				if (newVal && newVal !== oldVal) {
+					this.getEndLocations(); // 鑷姩璋冪敤鎺ュ彛
+				}
+			}
 		},
 		methods: {
 			voiceSpeech(src) {
-				innerAudioContext.src = src; // '../../static/success.mp3';
+				innerAudioContext.src = src;
 				innerAudioContext.play();
 			},
 			updateFocus() {
@@ -99,8 +96,7 @@
 				}
 			},
 			getData() {
-				var postData = this.orderNo
-
+				var postData = this.orderNo;
 				this.$u.post('/api/InboundOrder/GetInboundOrderDetail', postData).then((res) => {
 					if (res.status) {
 						this.orderDetail = res.data;
@@ -131,17 +127,16 @@
 				var postData = {
 					MainData: {
 						"stationcode": this.stationcode,
-						"PalletCode": this.PalletCode,
+						"palletCode": this.PalletCode,
 						"toaddress": this.value,
 					}
 				}
-
-				this.$u.post('/api/Task/EmptyTask', postData).then(res => {
+				this.$u.post('/api/CachePoint/UpdateHCJStaue', postData).then(res => {
 					if (res.status) {
-						uni.$showMsg("浠诲姟娣诲姞鎴愬姛");
+						uni.$showMsg("淇敼缂撳瓨鏋朵俊鎭垚鍔�");
 						this.stationcode = "";
 						this.PalletCode = "";
-						this.toaddress = "";
+						this.value = "";
 						setTimeout(() => {
 							// this.materialtype = false;
 						}, 200);
@@ -158,7 +153,6 @@
 					})
 				})
 			},
-
 			inputChangebarcode() {
 				this.addressFocus = false;
 				this.$nextTick(function(x) {
@@ -167,19 +161,63 @@
 					}
 				})
 			},
+			// getEndLocations() {
+			// 	var stationcode=this.stationcode;
+			// 		this.$u.post('/api/CachePoint/GetHCJStaue?stationcode=' + stationcode, {}).then(res => {
+			// 			if (res.status) {
+			// 				this.value = 2;
+			// 				console.log(res.data);
+			// 				console.log(res.data.materialtype);
+			// 				this.PalletCode=res.data.materialtype;
+			// 				this.range.value=2;
+			// 			} else {
+			// 				this.$refs.uToast.show({
+			// 					title: res.message,
+			// 					type: "error"
+			// 				})
+			// 			}
+			// 		})
+			// }
 			getEndLocations() {
-				this.$u.post('/api/CachePoint/GetHCJStaue?stationcode', null).then(res => {
-					if (res.status) {
-						this.value = 2;
-						console.log(res.data);
-					} else {
-						this.$refs.uToast.show({
-							title: res.message,
-							type: "error"
-						})
-					}
-				})
+			    var stationcode = this.stationcode;
+			    this.$u.post('/api/CachePoint/GetHCJStaue?stationcode=' + stationcode, {}).then(res => {
+			        if (res.status) {
+			            // 鍋囪鎺ュ彛杩斿洖鐨勬暟鎹粨鏋勪负 { status: true, data: { state: 1, materialtype: 'A' } }
+			            const responseData = res.data;
+			
+			            // 鏇存柊缂撳瓨鐐圭姸鎬�
+			            this.value = responseData.pointStatus; // 鍋囪 state 鏄紦瀛樼偣鐘舵�佺殑鍊�
+			
+			            // 鏇存柊鐗╂枡绫诲瀷
+			            this.PalletCode = responseData.materialtype; // 鍋囪 materialtype 鏄墿鏂欑被鍨�
+			
+			            // 濡傛灉闇�瑕佹洿鏂� range 鐨勯�夐」
+			            this.range = [
+			                { value: 0, text: "绌洪棽" },
+			                { value: 1, text: "閿佸畾" },
+			                { value: 2, text: "鏈夎揣" } // 鍋囪鎺ュ彛杩斿洖鐨勭姸鎬佸�间负 2锛岃〃绀哄崰鐢�
+			            ];
+			
+			            // 濡傛灉闇�瑕佹牴鎹姸鎬佸�煎姩鎬佽缃� range 鐨勯粯璁ゅ��
+			            this.range.forEach(item => {
+			                if (item.value === responseData.state) {
+			                    this.value = item.value; // 璁剧疆榛樿閫変腑椤�
+			                }
+			            });
+			        } else {
+			            this.$refs.uToast.show({
+			                title: res.message,
+			                type: "error"
+			            });
+			        }
+			    }).catch(err => {
+			        this.$refs.uToast.show({
+			            title: err.message,
+			            type: "error"
+			        });
+			    });
 			}
+			
 		}
 	}
 </script>

--
Gitblit v1.9.3