From 67d4e9ca4267049cc67cff15828080d2d5dfce0b Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期三, 01 四月 2026 16:23:01 +0800
Subject: [PATCH] 1

---
 吉安PDA/pages/stash/CPraworderboxing.vue |  192 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 188 insertions(+), 4 deletions(-)

diff --git "a/\345\220\211\345\256\211PDA/pages/stash/CPraworderboxing.vue" "b/\345\220\211\345\256\211PDA/pages/stash/CPraworderboxing.vue"
index 2f8ceaa..81fe8f0 100644
--- "a/\345\220\211\345\256\211PDA/pages/stash/CPraworderboxing.vue"
+++ "b/\345\220\211\345\256\211PDA/pages/stash/CPraworderboxing.vue"
@@ -12,7 +12,10 @@
 							<uni-easyinput type="text" placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" ref='midInput' :focus="!focus"
 								v-model="barcode" @confirm="barcodeInput" />
 						</uni-forms-item>
-
+						<uni-forms-item label="鍐呯鏍囩:">
+							<uni-easyinput type="text" placeholder="璇锋壂鎻忕鍙凤紙濡侭OX202510160019锛�" ref='midInput' :focus="focus"
+								v-model="materSn" @confirm="snInput" />
+						</uni-forms-item>
 
 						<uni-forms-item :label="Testlabel" v-if="Test">
 							<uni-easyinput type="text" :placeholder="Testplaceholder" ref='midInput'
@@ -84,8 +87,8 @@
 				<view class="itemstyle">
 					<uni-forms label-width="180">
 						<uni-forms-item label="鍐呯鏍囩:">
-							<uni-easyinput type="text" placeholder="璇锋壂鎻忕鍙凤紙濡侭OX202510160019锛�" ref='midInput'
-								:focus="!pkfocus" v-model="pkmaterSn" @confirm="pksnInput" />
+							<uni-easyinput type="text" placeholder="璇锋壂鎻忕鍙凤紙濡侭OX202510160019锛�" ref='midInput' :focus="!pkfocus"
+								v-model="pkmaterSn" @confirm="pksnInput" />
 						</uni-forms-item>
 
 						<uni-forms-item>
@@ -184,7 +187,16 @@
 			this.getData();
 		},
 		methods: {
-		
+			// 缁勭洏椤垫暟閲忕紪杈戞牎楠�
+			handleQuantityChange(item) {
+				item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
+			},
+
+			// 鍏ュ钩搴撻〉鏁伴噺缂栬緫鏍¢獙
+			handlePkQuantityChange(item) {
+				item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
+			},
+
 			updateFocus() {
 				this.$nextTick(() => {
 					this.materSn = '';
@@ -233,6 +245,96 @@
 					if (this.barcode.length > 0) {
 						this.focus = true;
 					}
+				})
+			},
+
+			// 缁勭洏椤电鍙锋壂鎻�
+			snInput() {
+				this.$nextTick(() => {
+					if (!this.materSn) return;
+
+					// 寤惰繜100ms纭繚鎵爜瀹屾垚
+					setTimeout(() => {
+						this.focus = false;
+						let boxNumber = this.materSn.trim();
+						
+						// 鏍¢獙鏄惁宸叉壂鎻忚繃
+						const isAlreadyScanned = this.sns.some(sn => sn === boxNumber);
+						if (isAlreadyScanned) {
+							this.$refs.uToast.show({
+								title: "璇ョ鍙峰凡鎵弿锛岃鍕块噸澶嶆壂鎻�",
+								type: "warning"
+							});
+							this.materSn = "";
+							return;
+						}
+						
+						// 绠�鍗曟牎楠岀鍙锋牸寮忥紙浠OX寮�澶达級
+						if (!boxNumber.startsWith('BOX')) {
+							this.$refs.uToast.show({
+								title: "绠卞彿鏍煎紡閿欒锛屽簲浠OX寮�澶�",
+								type: "error"
+							});
+							this.materSn = "";
+							return;
+						}
+						
+						// 娣诲姞绠卞彿鍒板垪琛�
+						const boxData = {
+							boxNumber: boxNumber,
+							quantity: 1, // 榛樿鏁伴噺涓�1
+							serialNumber: boxNumber // 绠卞彿浣滀负搴忓垪鍙�
+						};
+						
+						this.sns.push(boxNumber);
+						this.matInfos.push(boxData);
+						
+						this.$refs.uToast.show({
+							title: "绠卞彿娣诲姞鎴愬姛",
+							type: "success"
+						});
+
+						this.materSn = "";
+					}, 100);
+				})
+			},
+
+			// 鍏ュ钩搴撻〉绠卞彿鎵弿
+			pksnInput() {
+				this.$nextTick(() => {
+					if (!this.pkmaterSn) return;
+
+					// 寤惰繜100ms纭繚鎵爜瀹屾垚
+					setTimeout(() => {
+						let boxNumber = this.pkmaterSn.trim();
+
+						// 绠�鍗曟牎楠岀鍙锋牸寮忥紙浠OX寮�澶达級
+						if (!boxNumber.startsWith('BOX')) {
+							this.$refs.uToast.show({
+								title: "绠卞彿鏍煎紡閿欒锛屽簲浠OX寮�澶�",
+								type: "error"
+							});
+							this.pkmaterSn = "";
+							return;
+						}
+						
+						// 娣诲姞绠卞彿鍒板垪琛�
+						const boxData = {
+							boxNumber: boxNumber,
+							quantity: 1, // 榛樿鏁伴噺涓�1
+							serialNumber: boxNumber // 绠卞彿浣滀负搴忓垪鍙�
+						};
+						
+						this.pksns.push(boxNumber);
+						this.pkmatInfos.push(boxData);
+						
+						this.$refs.uToast.show({
+							title: "绠卞彿娣诲姞鎴愬姛",
+							type: "success"
+						});
+
+						this.pkmaterSn = "";
+					}, 100);	
 				})
 			},
 
@@ -312,6 +414,47 @@
 				}
 			},
 
+			resetInPk() {
+				this.pkmaterSn = "";
+				this.pkfocus = false;
+				this.pkmatInfos = [];
+				this.pksns = [];
+			},
+
+			pksubmit() {
+				if (this.pkmatInfos.length == 0) {
+					this.$refs.uToast.show({
+						title: "璇锋壂鎻忕鍙�",
+						type: 'error'
+					})
+					return;
+				}
+
+				// 浣跨敤绠卞彿鏁版嵁鎻愪氦
+				const submitData = this.pkmatInfos.map(item => ({
+					serialNumber: item.serialNumber,
+					quantity: item.quantity
+				}));
+
+				this.$u.post('/api/InboundOrder/InPinKu?warehouseId=' + this.warehouseId + "&orderNo=" + this.orderNo,
+						submitData)
+					.then(res => {
+						if (res.status) {
+							this.$refs.uToast.show({
+								title: "鍏ュ簱鎴愬姛",
+								type: "success"
+							})
+							this.pkfocus = false;
+							this.pkmatInfos = [];
+							this.pksns = [];
+						} else {
+							this.$refs.uToast.show({
+								title: res.message,
+								type: "error"
+							})
+						}
+					})
+			},
 
 			submit() {
 				if (this.barcode == "") {
@@ -321,14 +464,55 @@
 					})
 					return;
 				}
+				if (this.matInfos.length == 0) {
+					this.$refs.uToast.show({
+						title: "璇锋壂鎻忕鍙�",
+						type: 'error'
+					})
+					return;
+				}
+				if (this.Test) {
+					if (!this.Testcheck) {
+						this.Testcheck = true;
+						if (this.warehouseId == 2) {
+							this.$refs.uToast.show({
+								title: "璇风‘璁ゆ暟閲�",
+								type: 'error'
+							})
+						} else if (this.warehouseId == 6) {
+							this.$refs.uToast.show({
+								title: "璇风‘璁ゅ垵濮嬪鍛�",
+								type: 'error'
+							})
+						}
+						return;
+					}
+				}
 
+				// 浣跨敤绠卞彿鏁版嵁鎻愪氦
+				let submitSns = this.matInfos.map(item => ({
+					serialNumber: item.serialNumber,
+					quantity: item.quantity
+				}));
+
+				// 娌瑰ⅷ浠撳簱鐗规畩澶勭悊
+				if (this.warehouseId == 2) {
+					const firstItem = submitSns[0];
+					for (var i = 0; i < this.Initiallife - 1; i++) {
+						submitSns.push({
+							...firstItem
+						});
+					}
+				}
 
 				this.$u.post('/api/InboundOrder/CPMaterielGroup', {
 					MainData: {
 						"palletCode": this.barcode,
 						"orderNo": this.orderNo,
+						"initiallife": this.Initiallife,
 						"warehouseId": this.warehouseId
 					},
+					DelKeys: submitSns
 				}).then(res => {
 					this.Testcheck = false;
 					if (res.status) {

--
Gitblit v1.9.3