From 387731cab892804912e68cb91e6fb804411c4756 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期一, 27 十月 2025 23:32:16 +0800
Subject: [PATCH] 优化与ERP出库单逻辑,增加打印程序

---
 项目代码/PDA/pages/task/Inbound.vue |  198 +++++++++++++++++++++++++++++++------------------
 1 files changed, 125 insertions(+), 73 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/PDA/pages/task/Inbound.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/PDA/pages/task/Inbound.vue"
index 01cda1b..6aaf79b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/PDA/pages/task/Inbound.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/PDA/pages/task/Inbound.vue"
@@ -23,7 +23,7 @@
 					</uni-forms-item>
 				</uni-forms>
 				<button @click="InboundTask" type="primary" size="default" style="margin-top: 2%;">鍏ュ簱</button>
-				<u-toast ref="InboundTaskluToast" />
+
 			</view>
 		</view>
 		<view v-show="current === 1">
@@ -37,16 +37,31 @@
 						<uni-easyinput type="text" placeholder="璇锋壂鎻忓绠辨爣绛�" ref='midInput' :focus="focus" v-model="materSn"
 							@input="snInput" />
 					</uni-forms-item>
-					<uni-list>
-						<!-- <uni-list-item direction="column" v-for="item in InBoundOrder" :key="item.matCode">
-							<template v-slot:body>
-								<view class="uni-list-box">
-									<view class="uni-content">
-										<view class="uni-title-sub uni-ellipsis-2">璁㈠崟鍞竴缂栫爜锛歿{item.orderNo}}</view>
-									</view>
+					<view v-if="group.length" class="scan-result">
+						<uni-card v-for="(item, index) in group" :key="item.orderNo">
+							<view class="info-grid">
+								<view class="info-row">
+									<text class="label">璁㈠崟缂栫爜锛�</text>
+									<text>{{ item.orderNo }}</text>
 								</view>
-							</template>
-						</uni-list-item> -->
+								<br>
+								<view class="info-row">
+									<text class="label">浠撳簱鍚嶇О锛�</text>
+									<text>{{ item.warehouseName }}</text>
+								</view><br>
+								<view class="info-row">
+									<text class="label">鐗╂枡缂栫爜锛�</text>
+									<text>{{ item.materialNo }}</text>
+								</view><br>
+								<uni-forms-item label="缁勭洏鏁伴噺">
+									<uni-easyinput v-model="item.quantity" type="number" />
+								</uni-forms-item>
+							</view>
+							<uni-icons type="trash" class="delete-icon" @click="removeScanItem(item.orderNo)" />
+						</uni-card>
+					</view>
+
+					<!-- <uni-list>
 						<uni-list-item direction="column" v-for="(item,index) in InBoundOrder" :key="item.sn">
 							<template v-slot:body>
 								<view class="uni-list-box">
@@ -54,15 +69,24 @@
 										@click="deleteList(item.orderNo)">
 									</uni-icons>
 									<view class="uni-content">
-										<view class="uni-title-sub uni-ellipsis-2">璁㈠崟鍙凤細{{item.orderNo}}</view>
+										<view class="uni-title-sub uni-ellipsis-2">璁㈠崟鍞竴缂栫爜锛歿{item.orderNo}}</view>
 									</view>
+									<view class="uni-content">
+										<view class="uni-title-sub uni-ellipsis-2">浠撳簱锛歿{item.warehouseName}}</view>
+									</view>
+									<view class="uni-content">
+										<view class="uni-title-sub uni-ellipsis-2">鐗╂枡缂栫爜锛歿{item.materialNo}}</view>
+									</view>
+									<uni-forms-item label="鏁伴噺">
+										<uni-easyinput type="text" :focus="barcodefocus" @input="quantity"
+											v-model="PalletCode2" placeholder="鏁伴噺" ref='midInput' />
+									</uni-forms-item>
 								</view>
 							</template>
 						</uni-list-item>
-					</uni-list>
+					</uni-list> -->
 				</uni-forms>
-				<button @click="OutboundTask" type="primary" size="default" style="margin-top: 2%;">缁勭洏</button>
-				<u-toast ref="OutboundTaskluToast" />
+				<button @click="GroupPlate" type="primary" size="default" style="margin-top: 2%;">缁勭洏</button>
 			</view>
 		</view>
 		<view v-show="current === 2">
@@ -73,10 +97,10 @@
 							placeholder="璇疯緭鍏ユ墭鐩樼紪鐮�" ref='midInput' />
 					</uni-forms-item>
 				</uni-forms>
-				<button @click="OutboundTask" type="primary" size="default" style="margin-top: 2%;">瑙g洏</button>
-				<u-toast ref="OutboundTaskluToast" />
+				<button @click="SolvePlate" type="primary" size="default" style="margin-top: 2%;">瑙g洏</button>
 			</view>
 		</view>
+		<u-toast ref="luToast" />
 	</view>
 	</view>
 </template>
@@ -89,17 +113,19 @@
 	export default {
 		data() {
 			return {
+				focus: false,
 				istrue: false,
 				barcodefocus: false,
 				range: [],
-				AreaId: "",
+				group: [],
+				AreaId: 0,
+				quantity: "",
 				SourceAddress: "",
 				TargetAddress: "",
 				PalletCode1: "",
 				PalletCode2: "",
 				PalletCode3: "",
 				materSn: "",
-				InBoundOrder: [],
 				items: ['鍏ュ簱', '缁勭洏', '瑙g洏'],
 				current: 0
 			}
@@ -113,84 +139,133 @@
 					this.current = e.currentIndex;
 				}
 			},
+			voiceSpeech(src) {
+				innerAudioContext.src = src; // '../../static/success.mp3';
+				innerAudioContext.play();
+			},
 			InboundTask() {
-				if (this.PalletCode.length <= 0 && this.Point.length) {
-					this.$refs.InboundTaskluToast.show({
+				if (this.PalletCode1.length <= 0 && this.SourceAddress.length) {
+					this.$refs.luToast.show({
 						title: "鎵樼洏缂栫爜璺熺粦瀹氳揣浣嶄笉鑳戒负绌�",
 						type: "error"
 					})
 					return;
 				}
 				var param = {
-					"PalletCode": this.PalletCode,
+					"PalletCode": this.PalletCode1,
 					"Position": this.SourceAddress,
-					"TargetAddress": this.TargetAddress
+					"TargetAddress": this.TargetAddress,
+					"AreaId": this.AreaId,
 				}
-				console.log(param);
-				this.$u.post('/api/Task/RequestTaskAsync', param).then(res => {
+				this.$u.post('/api/Task/RequestInboundTaskAsync', param).then(res => {
 					if (res.status) {
-						this.$refs.InboundTaskluToast.show({
+						this.$refs.luToast.show({
 							title: res.message,
 							type: "success"
 						})
-						this.PalletCode = "";
+						this.PalletCode1 = "";
 						this.SourceAddress = "";
 						this.TargetAddress = "";
+						this.AreaId = "";
 						this.istrue = false;
 					} else {
-						this.$refs.InboundTaskluToast.show({
+						this.$refs.luToast.show({
 							title: res.message,
 							type: "error"
 						})
 					}
 				})
 			},
-			OutboundTask() {
-				if (this.EndAddress.length <= 0 && this.Barcode.length) {
-					this.$refs.OutboundTaskluToast.show({
+			GroupPlate() {
+				if (this.PalletCode2.length <= 0 && this.InBoundOrder.length) {
+					this.$refs.luToast.show({
 						title: "璇疯緭鍏ヨ捣鐐圭珯鍙�",
 						type: "error"
 					})
 					return;
 				}
 				var param = {
-					"PalletCode": this.Barcode,
-					"Position": this.StartAddress,
-					"TargetAddress": this.EndAddress
+					"PalletCode": this.PalletCode2,
+					"groups": this.group
 				}
-				this.$u.post('/api/Task/RequestOutTaskAsync', param).then(res => {
+				this.$u.post('/api/BoxingInfo/AddGroupPlateAsync', param).then(res => {
 					if (res.status) {
-						this.$refs.OutboundTaskluToast.show({
+						this.$refs.luToast.show({
 							title: res.message,
 							type: "success"
 						})
-						this.Barcode = "";
-						this.EndAddress = "";
-						this.StartAddress = "";
+						this.PalletCode2 = "";
+						this.group = [];
 						this.barcodefocus = false;
 					} else {
-						this.$refs.OutboundTaskluToast.show({
+						this.$refs.luToast.show({
 							title: res.message,
 							type: "error"
 						})
 					}
 				})
 			},
+
+			SolvePlate() {
+				if (this.PalletCode3.length <= 0) {
+					this.$refs.luToast.show({
+						title: "璇疯緭鍏ユ墭鐩樻潯鐮�",
+						type: "error"
+					})
+					return;
+				}
+				var param = {
+					"PalletCode": this.PalletCode3,
+				}
+				this.$u.post('/api/StockInfo/DeleteGroupPlateAsync', param).then(res => {
+					if (res.status) {
+						this.$refs.luToast.show({
+							title: res.message,
+							type: "success"
+						})
+						this.PalletCode3 = "";
+						this.barcodefocus = false;
+					} else {
+						this.$refs.luToast.show({
+							title: res.message,
+							type: "error"
+						})
+					}
+				})
+			},
+			updateFocus() {
+				this.$nextTick(() => {
+					this.materSn = '';
+					if (!this.focus) {
+						this.focus = true;
+					}
+				});
+			},
 			snInput() {
 				this.$nextTick(() => {
 					var matObj = {
 						orderNo: this.materSn,
 					}
-					var temp = this.InBoundOrder.find(x => x.orderNo == matObj.orderNo);
-					console.log(temp)
+					var temp = this.group.find(x => x.orderNo == matObj.orderNo);
 					if (!temp) {
-						this.InBoundOrder.push(matObj);
-						setTimeout(this.updateFocus, 200);
-						setTimeout(() => {
-							this.voiceSpeech('../../static/success.mp3');
-						}, 100);
+						this.$u.post('/api/InboundOrder/GetInboundOrderInfo?orderNo=' + this.materSn, "").then(
+							res => {
+								if (res.status) {
+									this.group.push(res.data);
+									setTimeout(this.updateFocus, 200);
+									setTimeout(() => {
+										this.voiceSpeech('../../static/success.mp3');
+									}, 100);
+								} else {
+									this.$refs.luToast.show({
+										title: res.message,
+										type: "error"
+									})
+								}
+							})
+
 					} else {
-						this.$refs.uToast.show({
+						this.$refs.luToast.show({
 							title: "鎵爜閲嶅",
 							type: "error"
 						})
@@ -202,32 +277,9 @@
 
 				})
 			},
-			// deleteList(res) {
-			// 	this.matInfos.map((item, index) => {
-			// 		if (item.orderNo == res) {
-			// 			this.matInfos.splice(index, 1);
-						
-			// 		}
-			// 	})
-			// 	this.orderNo.map((item, index) => {
-			// 		if (item == res) {
-			// 			this.orderNo.splice(index, 1);
-			// 		}
-			// 	})
-			// },
-			deleteList(res) {
-			      // 鍒犻櫎matInfos涓璷rderNo鍖归厤椤�
-			      this.matInfos = this.matInfos.filter(item => item.orderNo !== res);
-			      
-			      // 鍒犻櫎orderNo涓尮閰嶉」
-			      this.orderNo = this.orderNo.filter(item => item !== res);
-			      
-			      // 鍙�夛細娣诲姞鍒犻櫎鍙嶉
-			      this.$refs.uToast.show({
-			        title: `宸插垹闄�: ${res}`,
-			        type: "success"
-			      });
-			    }
+			removeScanItem(orderNo) {
+				this.group = this.group.filter(item => item.orderNo !== orderNo);
+			}
 		}
 	}
 </script>

--
Gitblit v1.9.3