From de398f47dd12b3890c9ee545422da78e82b60fa9 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期一, 08 十二月 2025 09:22:06 +0800
Subject: [PATCH] 修改PDA出入库中出现undefined问题,修改job中因为上游调用频率过快导致job死掉,修改前端报警信息使用不同颜色

---
 新建文件夹/PDA/pages/stash/CheckFinish.vue |  247 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 167 insertions(+), 80 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/CheckFinish.vue" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/CheckFinish.vue"
index bdc9c63..5d6593e 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/CheckFinish.vue"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/CheckFinish.vue"
@@ -16,12 +16,18 @@
 						</uni-forms-item>
 						<uni-forms-item :label="order_qty">
 						</uni-forms-item>
+						<uni-forms-item label="寰呮壂鐗╂枡缂栫爜:">
+						<uni-easyinput type="text" placeholder="璇锋壂鎻忕墿鏂欑紪鐮�" ref='materialInput' 
+							:focus="step === 1" v-model="materialCode" 
+							@confirm="materialCodeInput"
+							@blur="materialCodeInput" />
+						</uni-forms-item>
 						<uni-forms-item label="搴撲綅缂栧彿:">
-							<uni-easyinput type="text" placeholder="璇锋壂鎻忓簱浣嶇紪鍙�" ref='midInput' :focus="!focus"
+							<uni-easyinput type="text" placeholder="璇锋壂鎻忓簱浣嶇紪鍙�" ref='midInput' :focus="step === 2"
 								v-model="barcode" @confirm="barcodeInput" />
 						</uni-forms-item>
 						<uni-forms-item label="瀹炵洏鏁伴噺:">
-							<uni-easyinput type="text" placeholder="璇疯緭鍏ュ疄鐩樻暟閲�" ref='midInput' :focus="focus"
+							<uni-easyinput type="text" placeholder="璇疯緭鍏ュ疄鐩樻暟閲�" ref='midInput' :focus="step === 3"
 								v-model="materSn" @confirm="snInput" />
 						</uni-forms-item>
 
@@ -37,7 +43,7 @@
 							<view style="display: flex;justify-content: space-around;margin-top: 2%;">
 								<!-- <button @click="reset" type="default" size="default"
 									style="width: 160rpx;border: 1rpx solid #007aff;color: #007aff;">閲嶇疆</button> -->
-								<button @click="submit" type="primary" size="default" style="width: 200rpx;">鐩樼偣瀹屾垚</button>
+								<button @click="submit" type="primary" size="default" style="width: 250rpx;">鐩樼偣瀹屾垚</button>
 							</view>
 						</uni-forms-item>
 					</uni-forms>
@@ -167,7 +173,10 @@
 				Testcheck: false,
 				pkmaterSn: "",
 				pkmatInfos: [],
-				addressdisabled: false
+				addressdisabled: false,
+				materialCode: "", // 鏂板锛氭壂鎻忕殑鐗╂枡缂栫爜
+				materialCodeValid: false, // 鏂板锛氱墿鏂欑紪鐮侀獙璇佺姸鎬�
+				step: 1, // 鏂板锛�1-鐗╂枡缂栫爜锛�2-搴撲綅缂栧彿锛�3-鍏ュ簱鏁伴噺
 			}
 		},
 		onShow() {},
@@ -185,9 +194,60 @@
 			this.order_qty="璐﹂潰鏁伴噺锛�"+res.stockQuantity;
 			this.order_Inqty="鐗╂枡鍚嶇О锛�"+res.materielName;
 			this.goods_no="鐗╂枡缂栧彿锛�"+res.materielCode;
+			this.materielCode = res.materielCode;  // 璁剧疆鐢ㄤ簬楠岃瘉鐨勭墿鏂欑紪鐮�
+			
 			// this.getData();
 		},
 		methods: {
+			// 鐗╂枡缂栫爜楠岃瘉
+materialCodeInput() {
+    console.log("materialCodeInput 琚Е鍙�");
+    console.log("杈撳叆鍊�:", this.materialCode);
+    this.$nextTick(() => {
+        if (this.materialCode.trim() !== "") {
+            const scannedCode = this.materialCode.trim();
+            const expectedCode = this.materielCode;
+            
+            console.log("鎵弿缂栫爜:", scannedCode);
+            console.log("鏈熸湜缂栫爜锛坢aterielCode锛�:", expectedCode);
+            
+            if (scannedCode === expectedCode) {
+                this.materialCodeValid = true;
+                console.log("鉁� 鐗╂枡缂栫爜楠岃瘉鎴愬姛");
+                
+                // 楠岃瘉鎴愬姛鍚庝笉娓呯┖鍊硷紝鐩存帴鍒囨崲鍒颁笅涓�姝�
+                this.step = 2;
+                this.$refs.uToast.show({
+                    title: "鐗╂枡缂栫爜楠岃瘉鎴愬姛",
+                    type: "success"
+                });
+                // 浣跨敤 $nextTick 纭繚鐒︾偣鍒囨崲鍦� DOM 鏇存柊鍚庢墽琛�
+                this.$nextTick(() => {
+                    // 璁╁簱浣嶇紪鍙疯緭鍏ユ鑾峰緱鐒︾偣
+                    this.$refs.midInput.focus();
+                });
+            } else {
+                this.materialCodeValid = false;
+                console.log("鉂� 鐗╂枡缂栫爜楠岃瘉澶辫触");
+                
+                this.$refs.uToast.show({
+                    title: `鐗╂枡缂栫爜涓嶅尮閰峘,
+                    type: "error"
+                });
+                
+                // 楠岃瘉澶辫触鏃舵竻绌哄�煎苟淇濇寔鐒︾偣鍦ㄧ墿鏂欑紪鐮佽緭鍏ユ
+                setTimeout(() => {
+                    this.materialCode = "";
+                    this.step = 1;
+                    // 纭繚鐒︾偣鍥炲埌鐗╂枡缂栫爜杈撳叆妗�
+                    this.$nextTick(() => {
+                        this.$refs.materialInput.focus();
+                    });
+                }, 500);
+            }
+        }
+    });
+},
 			// voiceSpeech(src) {
 			// 	innerAudioContext.src = src; // '../../static/success.mp3';
 			// 	innerAudioContext.play();
@@ -234,19 +294,23 @@
 				}
 			},
 			barcodeInput() {
-				this.$nextTick(function(x) {
+				this.$nextTick(() => {
 					if (this.barcode.length > 0) {
-						// if (this.barcode.substring(0, 1) == 'A' || this.barcode.substring(0, 2) == 'TP') {
-						this.focus = true;
-						// } else {
-						// 	this.$refs.uToast.show({
-						// 		title: "鎵爜閿欒,璇锋壂鎻忔墭鐩樼爜",
-						// 		type: "error"
-						// 	})
-						// }
+						this.step = 3; // 鍒囨崲鍒板叆搴撴暟閲�
+						this.$refs.uToast.show({
+							title: "搴撲綅缂栧彿鎵弿鎴愬姛",
+							type: "success"
+						});
+						// 娣诲姞寤舵椂纭繚鎵爜瀹屾垚
+						setTimeout(() => {
+							this.$nextTick(() => {
+								this.$refs.midInput.focus();
+							});
+						}, 100);
 					}
 				})
 			},
+
 			snInput() {
 				this.$nextTick(() => {
 					if (this.materSn != "") {
@@ -501,74 +565,97 @@
 			// 		}
 			// 	})
 			// }
-			submit() {
-    if (this.barcode == "") {
-        this.$refs.uToast.show({
-            title: "璇锋壂鎻忚揣浣嶇紪鍙�",
-            type: 'error'
-        })
-        return;
-    }
-    if (this.materSn.length == 0) {
-        this.$refs.uToast.show({
-            title: "璇疯緭鍏ュ疄鐩樻暟閲�",
-            type: 'error'
-        })
-        return;
-    }
+		submit() {
+		if (!this.materialCodeValid) {
+			this.$refs.uToast.show({
+			title: "璇峰厛鎵弿骞堕獙璇佺墿鏂欑紪鐮�",
+			type: 'error'
+			});
+			return;
+		}
+		if (this.barcode == "") {
+			this.$refs.uToast.show({
+			title: "璇锋壂鎻忚揣浣嶇紪鍙�",
+			type: 'error'
+			})
+			return;
+		}
+		if (this.materSn.length == 0) {
+			this.$refs.uToast.show({
+			title: "璇疯緭鍏ュ疄鐩樻暟閲�",
+			type: 'error'
+			})
+			return;
+		}
 
-    // 鏂板浜屾纭閫昏緫
-    uni.showModal({
-        title: '纭鐩樼偣',
-        content: '鎮ㄧ‘瀹氳鎻愪氦鐩樼偣淇℃伅鍚楋紵',
-        success: (res) => {
-            if (res.confirm) {
-                // 鐢ㄦ埛鐐瑰嚮纭畾锛屾墽琛屽師鏈夌殑鎻愪氦閫昏緫
-                this.$u.post('/api/DeliveryOrder/CheckFinish', {
-                    MainData: {
-                        "locationCode": this.barcode,
-                        "taskId": this.taskId,
-                        "qty": this.materSn,
-                    },
-                }).then(res => {
-                    this.Testcheck = false;
-                    if (res.status) {
-                        this.$refs.uToast.show({
-                            title: "鐩樼偣鎴愬姛",
-                            type: "success"
-                        })
-                        this.barcode = "";
-
-                        // 鍏抽敭淇敼锛氫娇鐢� getCurrentPages 鑾峰彇鍓嶄竴涓〉闈㈠苟鐩存帴璋冪敤鍏舵柟娉�
-                        const pages = getCurrentPages();
-                        const prevPage = pages[pages.length - 2]; // 鑾峰彇涓婁竴涓〉闈㈠疄渚�
-                        console.log('鍓嶄竴涓〉闈�:', prevPage);
-                        
-                        if (prevPage && prevPage.refreshData) {
-                            // 鐩存帴璋冪敤涓婁竴涓〉闈㈢殑鍒锋柊鏂规硶
-                            prevPage.refreshData();
-                            console.log('宸茶皟鐢ㄥ墠涓�涓〉闈㈢殑鐩樼偣鍒锋柊鏂规硶');
-                        } 
-
-                        setTimeout(() => {
-                            uni.navigateBack({
-                                delta: 1
-                            });
-                        }, 300);
-                    } else {
-                        this.$refs.uToast.show({
-                            title: res.message,
-                            type: "error"
-                        })
-                    }
-                })
-            } else {
-                // 鐢ㄦ埛鐐瑰嚮鍙栨秷锛屼笉鍋氫换浣曟搷浣�
-            }
-        }
-    });
-}
-
+		// 鏂板浜屾纭閫昏緫
+		uni.showModal({
+			title: '纭鐩樼偣',
+			content: '鎮ㄧ‘瀹氳鎻愪氦鐩樼偣淇℃伅鍚楋紵',
+			success: (res) => {
+			if (res.confirm) {
+				// 鏄剧ず鍔犺浇涓�
+				uni.showLoading({
+				title: '鎻愪氦涓�...',
+				mask: true
+				});
+				
+				this.$u.post('/api/DeliveryOrder/CheckFinish', {
+				MainData: {
+					"locationCode": this.barcode,
+					"taskId": this.taskId,
+					"qty": this.materSn,
+				},
+				}).then(res => {
+				uni.hideLoading();
+				
+				this.Testcheck = false;
+				if (res.status) {
+					this.$refs.uToast.show({
+					title: "鐩樼偣鎴愬姛",
+					type: "success"
+					})
+					
+					// 鎵嬪姩娓呯┖鎵�鏈夎緭鍏ユ暟鎹�
+					this.materialCode = "";
+					this.materialCodeValid = false;
+					this.barcode = "";
+					this.materSn = "";
+					this.step = 1;  // 閲嶇疆姝ラ鍒扮涓�姝�
+					
+					// 璁剧疆鐩樼偣涓撶敤鐨勫埛鏂版爣璁�
+					uni.setStorageSync('needRefreshCheck', true);
+					
+					// 寤惰繜杩斿洖锛岃B椤甸潰鍒锋柊鏁版嵁
+					setTimeout(() => {
+					uni.navigateBack({
+						delta: 1
+					});
+					}, 500);
+					
+					// 浣跨敤 $nextTick 纭繚鐒︾偣璁剧疆鍦� DOM 鏇存柊鍚庢墽琛�
+					this.$nextTick(() => {
+					// 纭繚鐗╂枡缂栫爜杈撳叆妗嗚幏寰楃劍鐐�
+					this.$refs.materialInput.focus();
+					});
+					
+				} else {
+					this.$refs.uToast.show({
+					title: res.message,
+					type: "error"
+					})
+				}
+				}).catch(err => {
+				uni.hideLoading();
+				this.$refs.uToast.show({
+					title: "璇锋眰澶辫触锛岃閲嶈瘯",
+					type: "error"
+				});
+				});
+			}
+			}
+		});
+		}
 		}
 	}
 </script>

--
Gitblit v1.9.3