From 4f004573e398c7f5b3823e417766772f501c44fe Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期五, 03 十月 2025 13:35:44 +0800
Subject: [PATCH] 1

---
 pages/AGV/AGVPakin.vue |  192 +++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 172 insertions(+), 20 deletions(-)

diff --git a/pages/AGV/AGVPakin.vue b/pages/AGV/AGVPakin.vue
index 1073456..b37e5a7 100644
--- a/pages/AGV/AGVPakin.vue
+++ b/pages/AGV/AGVPakin.vue
@@ -2,6 +2,11 @@
 	<view>
 		<view class="code">
 			<view class="item">
+				<view class="code-decs">绔欑偣鍙�:</view>
+				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="rsta" :focus="rstaFocus"
+					@input="rstaInput()">
+			</view>
+			<view class="item">
 				<view class="code-decs">鎵樼洏鐮�:</view>
 				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus"
 					@input="barcodeInput()">
@@ -14,6 +19,21 @@
 					<text style="text-align: right;color: #409EFF;" @click="selectMat()">鎻愬彇+</text>
 					<uni-icons type="right" color="#c1c1c1"></uni-icons>
 				</view>
+			</view>
+			<view class="item">
+				<view class="code-decs">浠撳簱:</view>
+				<uni-combox :candidates="floorList" placeholder="璇烽�夋嫨浠撳簱" v-model="floor"></uni-combox>
+			</view>
+			<view class="item">
+			<view class="code-decs" style="width: 25vw;">澶у皬鎵樼洏:</view>
+			<radio-group @change="isFullPlt">
+				<label>
+					<radio :checked="ck1" style="transform: scale(0.7)"/><text>灏忔墭鐩�</text>
+				</label>
+				<label>
+					<radio :checked="ck2" style="margin-left: 50rpx;transform: scale(0.7);"/><text>澶ф墭鐩�</text>
+				</label>
+			</radio-group>
 			</view>
 		</view>
 		<view class="mat-list-title">
@@ -64,9 +84,10 @@
 			</view>
 		</scroll-view>
 		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
-		<view class="buttom">
-			<button size="mini" @click="reset('warn')">閲嶇疆</button>
+		<view class="buttom">銆�
 			<button size="mini" type="primary" @click="combConfirm('warn')">缁勬墭</button>
+			<button size="mini" @click="reset('warn')">閲嶇疆</button>
+			<button size="mini" type="primary" @click="combConfirmAndFillEmptyPallets('warn')">缁勬墭骞惰ˉ绌烘墭鐩�</button>
 		</view>
 		<!-- 寮圭獥 -->
 		<!-- 淇敼鏁伴噺 -->
@@ -124,6 +145,13 @@
 					@confirm="comb" @close="combClose"></uni-popup-dialog>
 			</uni-popup>
 		</view>
+		<view>
+			<uni-popup ref="combConfirmAndFillEmptyPallets" type="dialog">
+				<uni-popup-dialog :type="msgType" cancelText="鍙栨秷" confirmText="纭" :title="title" :content="content"
+					@confirm="combAndFillEmptyPallets" @close="combClose"></uni-popup-dialog>
+			</uni-popup>
+		</view>
+		
 		<!-- 纭閲嶇疆 -->
 		<view>
 			<uni-popup ref="resetConfirm" type="dialog">
@@ -141,6 +169,7 @@
 				baseUrl: '',
 				token: '',
 				barcode: '',
+				rsta: '',
 				dataList: [],
 				count: 0,
 				rowNum: '',
@@ -154,8 +183,15 @@
 				content: '',
 				barcodeFocus: true,
 				matFocus: false,
+				rstaFocus: false,
 				matData: '',
 				removeNum: 0,
+				ck1: true,
+				ck2: false,
+				fullPlt: '1',
+				ck : '',
+				floorList: [],
+				floor: '',
 			}
 		},
 		onLoad() {
@@ -164,18 +200,64 @@
 		onShow() {
 			this.baseUrl = uni.getStorageSync('baseUrl');
 			this.token = uni.getStorageSync('token');
+			this.getSite();
 		},
 		methods: {
+			// 澶у皬鎵樼洏
+			isFullPlt() {
+				var temp = this.ck1
+				this.ck1 = this.ck2
+				this.ck2 = temp
+				if (this.ck1) {
+					this.fullPlt = '1'
+				} else {
+					this.fullPlt = '2'
+				}
+			},
+			//鑾峰彇浠撳簱
+			getSite() {
+				let that = this
+				uni.request({
+					url: that.baseUrl + '/mobile/ck',
+					header: { 'token': uni.getStorageSync('token') },
+					method: 'POST',
+					success(res) {
+						res = res.data 
+						console.log(res)
+						if (res.code === 200) {
+							that.floorList = res.data
+						} 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')
+						}
+					}
+				})
+			},
 			messageToggle(type) {
 				this.msgType1 = type
 				this.$refs.message.open()
 			},
 			// barcode input 浜嬩欢
+			rstaInput() {
+				// 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
+				setTimeout(() => {
+					var len = this.rsta.length
+					this.barcodeFocuss()
+				}, 200)
+			},
 			barcodeInput() {
 				// 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
 				setTimeout(() => {
 					var len = this.barcode.length
-					if (len != 10) {
+					if (len != 8) {
 						uni.showToast({
 							title: '鎵樼洏鐮佹湁璇閲嶈瘯',
 							icon: "none",
@@ -205,15 +287,8 @@
 				}, 100);
 			},
 			// 鎼滅储鐗╂枡
-			findMat() {
+				findMat() {
 				let that = this
-				// 鍒ゆ柇鐗╂枡闀垮害鏄惁涓�1
-				if (that.dataList.length >= 1) {
-					this.messageText = "鍙兘娣诲姞涓�绉嶇墿鏂�"
-					this.messageToggle('warn')
-					that.matnr = ''
-					return
-				}
 				uni.request({
 					url: that.baseUrl + '/mat/auth',
 					data: {
@@ -233,8 +308,10 @@
 								// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
 								success: function(res) {
 									res.eventChannel.emit('mat', {
+										
 										data: result.data
 									})
+									console.log(res);
 								},
 								// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
 								events: {
@@ -308,12 +385,13 @@
 								add = true
 							}
 							
-						} else {
-							// 鐩稿悓鐗╂枡鐩稿悓鎵瑰彿 鏁伴噺绱姞
-							this.dataList[i].anfme += mat.anfme
-							this.$forceUpdate() // 寮哄埗鍒锋柊
-							add = false
-						}
+						} 
+						// else {
+						// 	// 鐩稿悓鐗╂枡鐩稿悓鎵瑰彿 鏁伴噺绱姞
+						// 	this.dataList[i].anfme += mat.anfme
+						// 	this.$forceUpdate() // 寮哄埗鍒锋柊
+						// 	add = false
+						// }
 					}
 				}
 				if (add) {
@@ -372,10 +450,81 @@
 				this.content = '鏄惁鐜板湪缁勬墭!'
 				this.$refs.combConfirm.open()
 			},
+			combConfirmAndFillEmptyPallets(type) {
+				this.msgType = type
+				this.title = '璀﹀憡'
+				this.content = '鏄惁鐜板湪缁勬墭骞惰ˉ绌烘澘!'
+				this.$refs.combConfirmAndFillEmptyPallets.open()
+			},
 			combClose() {
 				this.$refs.combConfirm.close()
 			},
 			comb() {
+				console.log("鏅�氱粍鎵�")
+				uni.vibrateShort();
+				let that = this;
+				if (that.barcode === '') {
+					this.messageText = "璇锋壂鎻忔墭鐩樻潯鐮�"
+					this.messageToggle('error')
+					return;
+				}
+				if (that.dataList.length === 0) {
+					this.messageText = "璇锋坊鍔犲晢鍝佸垪琛�"
+					this.messageToggle('error')
+					return;
+				}
+				if(that.floor===''){
+					this.messageText = "浠撳簱涓嶈兘涓虹┖"
+					this.messageToggle('error')
+					return;
+				}
+				for (var i = 0; i < that.dataList.length; i++) {
+					if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
+						this.messageText = that.dataList[i].matnr + '缁勬墭鏁伴噺涓嶈兘涓�0'
+						this.messageToggle('error')
+						return;
+					}
+				}
+				uni.request({
+					url: that.baseUrl + '/mobile/comb/auth',
+					data: JSON.stringify({
+						beBatch : 1,
+						barcodeSize: '0',
+						rsta: that.rsta,
+						barcode: that.barcode,
+						combMats: that.dataList,
+						ck : that.floor,
+					}),
+					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
+							that.messageToggle('error')
+							setTimeout(() => {
+								uni.reLaunch({
+									url: '../login/login'
+								});
+							}, 1000);
+						} else {
+							that.messageText = res.msg
+							that.messageToggle('error')
+						}
+					}
+				});
+			},
+			//缁勬墭骞惰ˉ绌烘墭鐩�
+			combAndFillEmptyPallets() {
 				uni.vibrateShort();
 				let that = this;
 				if (that.barcode === '') {
@@ -396,8 +545,11 @@
 					}
 				}
 				uni.request({
-					url: that.baseUrl + '/agvMobile/comb/auth',
+					url: that.baseUrl + '/mobile/comb/auth',
 					data: JSON.stringify({
+						beBatch : 1,
+						barcodeSize : this.fullPlt,
+						rsta: that.rsta,
 						barcode: that.barcode,
 						combMats: that.dataList
 					}),
@@ -460,7 +612,7 @@
 	@import url('../../static/css/wms.css/wms.css');
 
 	.list:first-child {
-		margin-top: 360rpx;
+		margin-top: 530rpx;
 	}
 	.code {
 		width: 100%;
@@ -505,7 +657,7 @@
 		width: 100%;
 		background-color: white;
 		position: fixed;
-		margin-top: 200rpx;
+		margin-top: 300rpx;
 		z-index: 9;
 		/* border-top: 1px solid #DCDFE6; */
 		text-align: center;

--
Gitblit v1.9.1