From 04839b0c8660e2ba4228a743edf8f784e2470d6c Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期三, 19 二月 2025 09:21:12 +0800
Subject: [PATCH] #

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

diff --git a/pages/phyz/stationManage/pickAgain.vue b/pages/phyz/stationManage/pickAgain.vue
index dfd1b5c..ec5d9b2 100644
--- a/pages/phyz/stationManage/pickAgain.vue
+++ b/pages/phyz/stationManage/pickAgain.vue
@@ -8,6 +8,7 @@
 				<view>鍚嶇О锛歿{orderDetl.maktx}}</view>
 				<view>搴撳瓨鏁伴噺锛歿{orderDetl.anfme}}</view>
 				<view>璁㈠崟鍙嚭鏁伴噺锛歿{orderDetl.stock}}</view>
+				<view>宸叉嫞鏁伴噺锛歿{orderDetl.pickedAnfme}}</view>
 				<view>鎷f枡鏁伴噺锛歿{orderDetl.count}}</view>
 			</view>
 			<view class="list-right" @click="addItem(index)">
@@ -24,7 +25,7 @@
 					<!-- 鏍囬 -->
 					<view class="title">鎷f枡鏁伴噺</view>
 					<view class="popup-item">
-						<uni-number-box :value="count" :step='1' :max="maxCount" color="#747474" @change="changeValue" />
+						<uni-number-box :value="count" :step='0.01' :max="maxCount" color="#747474" @change="changeValue" />
 					</view>
 					<view class="btn">
 						<view class="btn-left" @click="addClose">鍙栨秷</view>
@@ -35,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>
@@ -51,7 +52,9 @@
 				count: 0,
 				maxCount: 0,
 				wrkNo: '',
-				locNo: ''
+				locNo: '',
+				pickedAnfme: 0,
+				pickAgaDis: false
 			}
 		},
 		onShow() {
@@ -62,11 +65,11 @@
 			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
-				_this.getLocDetl(data.item.sourceLocNo)
+				_this.getWrkDetl(data.wrkDetls[0].wrkNo)
 			})
 		},
 		methods: {
@@ -83,8 +86,10 @@
 					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
 							let enbleList = [], isfl;
 							for (let k of res.data.records) {
 								isfl = false;
@@ -116,19 +121,87 @@
 						} else {
 							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
 						}
+					},
+				})
+			},
+			// 鑾峰彇宸ヤ綔鏄庣粏
+			getWrkDetl(wrkNo) {
+				let _this = this
+				uni.request({
+					url: `${_this.baseUrl}/agv/wrkDetl/list/auth`,
+					header: {'token': uni.getStorageSync('token')},
+					data: {
+						curr: 1,
+						limit: 1000,
+						wrk_no: wrkNo
+					},
+					method: 'GET',
+					success(res) {
+						res = res.data
+						if (res.code === 200) {
+							_this.pickList = res.data.records
+							_this.getLocDetl(_this.locNo)
+						} else if (res.code == 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+							setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+						}
 					}
 				})
 			},
 			// 宸查�夋嫞鏂欏垪琛�
-			orderCar() {
-				
+			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) {
+						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
+							}
+							if (wrkDetl.anfme < locDetl.anfme) {
+								locDetl['color'] = 'order-sts-working'
+								locDetl['pickedAnfme'] = wrkDetl.anfme
+								locDetl['count'] = 0
+							} else {
+								locDetl['color'] = 'order-sts-end'
+							}
+							break
+						} 
+					}
+					
+				}
+				this.dataList = locDetls
 			},
 			// 娣诲姞鍏ュ簱鍟嗗搧鑷� 寰呯粍鎵樺垪琛�
 			addItem(index) {
 				// 鍒ゆ柇娣诲姞鐨勫晢鍝佹槸鍚﹀拰宸茬粡娣诲姞鐨勯噸澶�
 				let dataList = this.dataList
 				this.index = index
-				this.maxCount = this.dataList[index].stock
+				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 {
+					if (ftCount > locCount) {
+						this.maxCount = locCount -pickedAnfme
+					} else {
+						this.maxCount = orderCount 
+					}
+					
+				}
+				
 				this.$refs.addItem.open()
 			},
 			addClose() {
@@ -144,6 +217,7 @@
 			},
 			// 纭鍐嶆鎷f枡
 			confirmPick() {
+				this.pickAgaDis = true
 				let _this = this
 				uni.request({
 					url: `${_this.baseUrl}/agvMobile/pick/again/auth`,
@@ -155,8 +229,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(()=>{
@@ -170,6 +244,9 @@
 						}
 					}
 				})
+			},
+			fail(res) {
+				_this.pickAgaDis = false
 			}
 		}
 	}

--
Gitblit v1.9.1