From 2b5bf2b63f6b8718a396f16f02c682f635744425 Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期五, 18 十月 2024 10:56:17 +0800
Subject: [PATCH] 再次拣料-销售单号空格过滤

---
 pages/phyz/stationManage/pickAgain.vue |   39 +++++++++++++++++++++++++++++----------
 1 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/pages/phyz/stationManage/pickAgain.vue b/pages/phyz/stationManage/pickAgain.vue
index 446135c..73c71ca 100644
--- a/pages/phyz/stationManage/pickAgain.vue
+++ b/pages/phyz/stationManage/pickAgain.vue
@@ -36,7 +36,7 @@
 		</view>
 		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
 		<view class="buttom">
-			<button size="mini" type="primary" @click="confirmPick('warn')">纭鎷f枡</button>
+			<button size="mini" type="primary" @click="confirmPick('warn')" :disabled="pickAgaDis">纭鎷f枡</button>
 		</view>
 	</view>
 </template>
@@ -53,7 +53,8 @@
 				maxCount: 0,
 				wrkNo: '',
 				locNo: '',
-				pickedAnfme: 0
+				pickedAnfme: 0,
+				pickAgaDis: false
 			}
 		},
 		onShow() {
@@ -64,7 +65,7 @@
 			const eventChannel = this.getOpenerEventChannel();
 			// 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
 			eventChannel.on('item', function(data) {
-				console.log(data);
+				// console.log(data);
 				_this.pickList = data.wrkDetls
 				_this.wrkNo = data.wrkDetls[0].wrkNo
 				_this.locNo = data.item.sourceLocNo
@@ -85,7 +86,7 @@
 					method: 'GET',
 					success(res) {
 						res = res.data
-						console.log(res);
+						// console.log(res);
 						if (res.code === 200) {
 							_this.chosed(_this.pickList,res.data.records)
 							return
@@ -120,18 +121,21 @@
 						} else {
 							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
 						}
-					}
+					},
 				})
 			},
 			// 宸查�夋嫞鏂欏垪琛�
 			chosed(wrkDetls,locDetls) {
+				console.log(wrkDetls,locDetls);
 				let isfl = false, enbleList = []
 				for (let locDetl of locDetls) {
 					locDetl['color'] = 'order-sts-start'
 					locDetl['pickedAnfme'] = 0
 					locDetl['count'] = 0
 					for (let wrkDetl of wrkDetls) {
-						if (wrkDetl.threeCode == locDetl.threeCode && wrkDetl.matnr == locDetl.matnr) {
+						console.log(wrkDetl);
+						if (wrkDetl.threeCode.replace(/\s/g, "") == locDetl.threeCode.replace(/\s/g, "") && wrkDetl.matnr == locDetl.matnr) {
+							console.log(wrkDetl);
 							locDetl['pickedAnfme'] = wrkDetl.anfme
 							if (locDetl.stock == -1) {
 								locDetl.stock = 0
@@ -155,10 +159,21 @@
 				// 鍒ゆ柇娣诲姞鐨勫晢鍝佹槸鍚﹀拰宸茬粡娣诲姞鐨勯噸澶�
 				let dataList = this.dataList
 				this.index = index
-				if (this.dataList[index].stock > this.dataList[index].anfme) {
-					this.maxCount = this.dataList[index].anfme
+				let orderCount = this.dataList[index].stock
+				let locCount = this.dataList[index].anfme
+				let pickedAnfme = this.dataList[index].pickedAnfme
+				// 棰勮鏈�澶ц鍑哄簱
+				let ftCount = pickedAnfme + orderCount
+				
+				if (orderCount > locCount) {
+					this.maxCount = locCount - pickedAnfme
 				} else {
-					this.maxCount = this.dataList[index].stock
+					if (ftCount > locCount) {
+						this.maxCount = locCount -pickedAnfme
+					} else {
+						this.maxCount = orderCount 
+					}
+					
 				}
 				
 				this.$refs.addItem.open()
@@ -176,6 +191,7 @@
 			},
 			// 纭鍐嶆鎷f枡
 			confirmPick() {
+				this.pickAgaDis = true
 				let _this = this
 				uni.request({
 					url: `${_this.baseUrl}/agvMobile/pick/again/auth`,
@@ -187,8 +203,8 @@
 					}),
 					method: 'POST',
 					success(res) {
+						_this.pickAgaDis = false
 						res = res.data
-						console.log(res);
 						if  (res.code === 200) {
 							_this.getOpenerEventChannel().emit('acceptDataFromOpenedPage', {data: 1});
 							setTimeout(()=>{
@@ -202,6 +218,9 @@
 						}
 					}
 				})
+			},
+			fail(res) {
+				_this.pickAgaDis = false
 			}
 		}
 	}

--
Gitblit v1.9.1