From 844c7c3ce2c39139490a6ecb0f35170f6cade290 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 28 四月 2026 16:31:54 +0800
Subject: [PATCH] 1

---
 吉安PDA/pages/stash/YSraworderboxing.vue |  609 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 609 insertions(+), 0 deletions(-)

diff --git "a/\345\220\211\345\256\211PDA/pages/stash/YSraworderboxing.vue" "b/\345\220\211\345\256\211PDA/pages/stash/YSraworderboxing.vue"
new file mode 100644
index 0000000..2591d45
--- /dev/null
+++ "b/\345\220\211\345\256\211PDA/pages/stash/YSraworderboxing.vue"
@@ -0,0 +1,609 @@
+<template>
+	<view>
+		<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
+		</uni-segmented-control>
+		<view class="content">
+			<view v-if="current === 0" class="headerstyle">
+				<view class="itemstyle">
+					<uni-forms label-width="180">
+						<uni-forms-item :label="label">
+						</uni-forms-item>
+						<uni-forms-item label="鎵樼洏鏉$爜:">
+							<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="璇锋壂鎻忓唴绠辨爣绛�" 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'
+								v-model="Initiallife" />
+						</uni-forms-item>
+
+						<uni-forms-item>
+							<view style="display: flex;justify-content: space-around;margin-top: 2%;">
+								<button @click="reset" type="default" size="default"
+									style="width: 160rpx;border: 1rpx solid #007aff;color: #007aff;">閲嶇疆</button>
+								<button @click="submit" type="primary" size="default" style="width: 160rpx;">缁勭洏</button>
+							</view>
+						</uni-forms-item>
+					</uni-forms>
+					<uni-list>
+						<uni-list-item direction="column" v-for="(item,index) in matInfos" :key="index">
+							<template v-slot:body>
+								<view class="uni-list-box">
+									<uni-icons type="trash" size="22" style="position: absolute;right: 5%;"
+										@click="deleteList(index)">
+									</uni-icons>
+									<view class="uni-content">
+										<view class="uni-title-sub uni-ellipsis-2">閲囪喘鍗曞彿锛歿{item.purchaseOrderNo}}</view>
+										<view class="uni-note">鐗╂枡缂栫爜锛歿{item.materielCode}}</view>
+										<view class="uni-note">鎵规鍙凤細{{item.lotNo}}</view>
+										<!-- 鐩存帴缂栬緫Q鍊煎搴旂殑quantity瀛楁 -->
+										<view class="uni-note" style="display: flex; align-items: center; gap: 10rpx;">
+											鏁伴噺锛�
+											<uni-easyinput 
+												type="number" 
+												min="1" 
+												style="width: 150rpx; display: inline-block;"
+												v-model="item.quantity" 
+												@input="handleQuantityChange(item)"
+											/>
+										</view>
+										<view class="uni-note">鐢熶骇鏃ユ湡锛歿{item.productionDate}}</view>
+										<view class="uni-note">鏈夋晥鏈燂細{{item.effectiveDate}}</view>
+										<view class="uni-note">浜よ揣鍗曞彿锛歿{item.deliveryNote}}</view>
+									</view>
+								</view>
+							</template>
+						</uni-list-item>
+					</uni-list>
+				</view>
+			</view>
+			<view v-if="current === 1" class="headerstyle">
+				<view class="itemstyle">
+					<uni-forms label-width="120">
+						<uni-forms-item label="鎵樼洏鏉$爜">
+							<uni-easyinput type="text" :focus="!addressFocus" v-model="inboundBarcode"
+								placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" ref='midInput' @confirm="inputChangebarcode" />
+						</uni-forms-item>
+						<uni-forms-item label="鍦板潃鏉$爜">
+							<uni-easyinput type="text" v-model="address" :disabled="addressdisabled"
+								placeholder="璇锋壂鎻忓湴鍧�鏉$爜" ref='midInput' :focus="addressFocus" />
+						</uni-forms-item>
+						<uni-forms-item>
+							<button @click="inbound" type="primary" size="default" style="margin-top: 2%;">鍏ュ簱纭</button>
+						</uni-forms-item>
+					</uni-forms>
+				</view>
+			</view>
+			<view v-if="current === 2" class="headerstyle">
+				<view class="itemstyle">
+					<uni-list :border="true">
+						<uni-list-item direction="column" v-for="(item,index) in orderInfo" :key="index">
+							<template v-slot:body>
+								<view class="uni-list-box">
+									<view class="uni-content">
+										<view style="font-size: 18px;">鍗曟嵁鍙凤細{{orderNo}}</view>
+										<view style="font-size: 18px;">鐗╂枡缂栫爜锛歿{item.materielCode}}</view>
+										<view>鐗╂枡鍚嶇О锛歿{item.materielName}}</view>
+										<view style="font-size: 18px;">鏁伴噺锛歿{item.orderQuantity}}</view>
+										<view style="font-size: 18px;">缁勭洏鏁伴噺锛歿{item.receiptQuantity}}</view>
+									</view>
+								</view>
+							</template>
+						</uni-list-item>
+					</uni-list>
+				</view>
+			</view>
+			<view v-if="current === 3" class="headerstyle">
+				<view class="itemstyle">
+					<uni-forms label-width="180">
+						<uni-forms-item label="鍐呯鏍囩:">
+							<uni-easyinput type="text" placeholder="璇锋壂鎻忓唴绠辨爣绛�" ref='midInput' :focus="!pkfocus"
+								v-model="pkmaterSn" @confirm="pksnInput" />
+						</uni-forms-item>
+
+						<uni-forms-item>
+							<view style="display: flex;justify-content: space-around;margin-top: 2%;">
+								<button @click="resetInPk" type="default" size="default"
+									style="width: 160rpx;border: 1rpx solid #007aff;color: #007aff;">閲嶇疆</button>
+								<button @click="pksubmit" type="primary" size="default"
+									style="margin-top: 2%;">鍏ュ钩搴�</button>
+							</view>
+						</uni-forms-item>
+
+					</uni-forms>
+					<uni-list>
+						<uni-list-item direction="column" v-for="(item,index) in pkmatInfos" :key="index">
+							<template v-slot:body>
+								<view class="uni-list-box">
+									<uni-icons type="trash" size="22" style="position: absolute;right: 5%;"
+										@click="pkdeleteList(index)">
+									</uni-icons>
+									<view class="uni-content">
+										<view class="uni-title-sub uni-ellipsis-2">閲囪喘鍗曞彿锛歿{item.purchaseOrderNo}}</view>
+										<view class="uni-note">鐗╂枡缂栫爜锛歿{item.materielCode}}</view>
+										<view class="uni-note">鎵规鍙凤細{{item.lotNo}}</view>
+										<!-- 鐩存帴缂栬緫Q鍊煎搴旂殑quantity瀛楁 -->
+										<view class="uni-note" style="display: flex; align-items: center; gap: 10rpx;">
+											鏁伴噺锛�
+											<uni-easyinput 
+												type="number" 
+												min="1" 
+												style="width: 150rpx; display: inline-block;"
+												v-model="item.quantity" 
+												@input="handlePkQuantityChange(item)"
+											/>
+										</view>
+										<view class="uni-note">鐢熶骇鏃ユ湡锛歿{item.productionDate}}</view>
+										<view class="uni-note">鏈夋晥鏈燂細{{item.effectiveDate}}</view>
+										<view class="uni-note">浜よ揣鍗曞彿锛歿{item.deliveryNote}}</view>
+									</view>
+								</view>
+							</template>
+						</uni-list-item>
+					</uni-list>
+				</view>
+			</view>
+		</view>
+		<u-toast ref="uToast" />
+	</view>
+</template>
+
+<script>
+	const innerAudioContext = uni.createInnerAudioContext();
+	export default {
+		data() {
+			return {
+				items: ['缁勭洏', '鍏ュ簱', '鍗曟嵁淇℃伅'],
+				current: 0,
+				matTotal: [],
+				matInfos: [],
+				orderNo: "",
+				label: "",
+				orderInfo: [],
+				focus: false,
+				pkfocus: false,
+				barcode: "",
+				materSn: "",
+				Initiallife: 1000,
+				sns: [],
+				pksns: [],
+				addressFocus: false,
+				inboundBarcode: "",
+				address: "",
+				check: true,
+				value: "",
+				matInfo: [],
+				value2: "",
+				matTotals: [],
+				warehouseId: "",
+				Test: false,
+				Testlabel: "",
+				Testplaceholder: "",
+				Testcheck: false,
+				pkmaterSn: "",
+				pkmatInfos: [],
+				addressdisabled: false
+			}
+		},
+		onShow() {},
+		onLoad(res) {
+			this.focus = false;
+			this.addressFocus = false;
+			this.orderNo = res.orderNo;
+			this.warehouseId = res.warehouseId;
+			// if (this.warehouseId == 6) { //娴嬭瘯鏋朵粨搴撳尯ID
+			// 	this.Test = true;
+			// 	this.Testlabel = "鍒濆瀵垮懡:";
+			// 	this.Testplaceholder = "璇疯緭鍏ュ垵濮嬪鍛�";
+			// } else if (this.warehouseId == 2) { //娌瑰ⅷ浠撳簱鍖篒D
+			// 	this.Test = true;
+			// 	this.Testlabel = "鏁伴噺:";
+			// 	this.Testplaceholder = "璇疯緭鍏ユ暟閲�";
+			// 	this.Initiallife = 16;
+			// } else if (this.warehouseId == 5) { //杈呮枡
+			// 	this.items.push("鍏ュ钩搴�");
+			// 	this.items[1] = "鍏ョ珛搴�";
+			// 	this.address = "8005";
+			// } else if (this.warehouseId == 3) { //杈呮枡
+			// 	this.address = "1011";
+			// 	this.addressdisabled = true;
+			// }
+			this.label = "鍗曟嵁缂栧彿锛�" + this.orderNo;
+			this.getData();
+		},
+		methods: {
+			// 缁勭洏椤垫暟閲忕紪杈戞牎楠岋紙鐩存帴淇敼鍘熺敓quantity瀛楁锛�
+			handleQuantityChange(item) {
+				item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
+			},
+
+			// 鍏ュ钩搴撻〉鏁伴噺缂栬緫鏍¢獙锛堢洿鎺ヤ慨鏀瑰師鐢焣uantity瀛楁锛�
+			handlePkQuantityChange(item) {
+				item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
+			},
+
+			updateFocus() {
+				this.$nextTick(() => {
+					this.materSn = '';
+					if (!this.focus) {
+						this.focus = true;
+					}
+				});
+			},
+			
+			barcodeFocus() {
+				this.barcode = '';
+				if (this.focus) {
+					this.focus = false;
+				}
+			},
+			
+			getData() {
+				var postData = {
+					MainData: {
+						orderNo: this.orderNo
+					},
+				}
+				this.$u.post('/api/InboundOrderDetail/GetInboundOrderDetails', postData).then((res) => {
+					if (res.status) {
+						this.orderInfo = res.data;
+						if (this.orderInfo.length > 3) {
+							this.loadVisible = true;
+						}
+					}
+				})
+			},
+			
+			onClickItem(e) {
+				this.focus = false;
+				this.addressFocus = false;
+				if (this.current !== e.currentIndex) {
+					this.current = e.currentIndex;
+					if (this.current == 2) {
+						this.getData();
+					}
+				}
+			},
+			
+			barcodeInput() {
+				this.$nextTick(function(x) {
+					if (this.barcode.length > 0) {
+						this.focus = true;
+					}
+				})
+			},
+			
+			// 缁勭洏椤靛唴绠辩爜瑙f瀽锛堢洿鎺ユ搷浣滃師鐢焣uantity瀛楁锛�
+			snInput() {
+				this.$nextTick(() => {
+					if (!this.materSn) return;
+
+					// 寤惰繜100ms纭繚鎵爜瀹屾垚
+					setTimeout(() => {
+						this.focus = false;
+						let matSn = this.materSn.trim();
+
+						// 浠撳簱11鐨勭壒娈婂鐞�
+						if (this.warehouseId == 11) {
+							matSn = matSn.replace(/,SC.*/, '');
+						}
+
+						// 鏍¢獙鍐呯鐮佸畬鏁存��
+						const requiredFields = ['M:', 'BS:', 'DM:', 'DE:', 'Q:', 'PO:', 'DN:'];
+						const hasAllFields = requiredFields.every(field => matSn.includes(field));
+						if (!hasAllFields) {
+							this.$refs.uToast.show({
+								title: "鍐呯鐮佷笉瀹屾暣锛岃閲嶆柊鎵弿",
+								type: "error"
+							});
+							this.materSn = "";
+							return;
+						}
+
+						// 鏍¢獙PO瀛楁瀛樺湪鎬�
+						if (matSn.indexOf("PO") <= 0) {
+							this.$refs.uToast.show({
+								title: "鍐呯鐮佹牸寮忛敊璇紙鏃燩O鏍囪瘑锛�",
+								type: "error"
+							});
+							this.materSn = "";
+							return;
+						}
+
+						// 瑙f瀽鍐呯鐮侊紙鐩存帴浣跨敤杩斿洖鐨剄uantity浣滀负Q鍊硷級
+						this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
+							this.Testcheck = false;
+							if (res.status) {
+								this.sns.push(res.data.serialNumber);
+								this.matInfos.push(res.data);
+
+								if (res.message) {
+									this.$refs.uToast.show({
+										title: res.message,
+										type: "warning"
+									});
+								}
+							} else {
+								this.$refs.uToast.show({
+									title: res.message,
+									type: "error"
+								});
+							}
+						});
+
+						this.materSn = "";
+					}, 1000);
+				})
+			},
+			
+			// 鍏ュ钩搴撻〉鍐呯鐮佽В鏋愶紙鐩存帴鎿嶄綔鍘熺敓quantity瀛楁锛�
+			pksnInput() {
+				this.$nextTick(() => {
+					if (!this.pkmaterSn) return;
+
+					// 寤惰繜100ms纭繚鎵爜瀹屾垚
+					setTimeout(() => {
+						let matSn = this.pkmaterSn.trim();
+
+						// 鏍¢獙鍐呯鐮佸畬鏁存��
+						const requiredFields = ['M:', 'BS:', 'DM:', 'DE:', 'Q:', 'PO:', 'DN:'];
+						const hasAllFields = requiredFields.every(field => matSn.includes(field));
+						if (!hasAllFields) {
+							this.$refs.uToast.show({
+								title: "鍐呯鐮佷笉瀹屾暣锛岃閲嶆柊鎵弿",
+								type: "error"
+							});
+							this.pkmaterSn = "";
+							return;
+						}
+
+						// 鏍¢獙PO瀛楁瀛樺湪鎬�
+						if (matSn.indexOf("PO") <= 0) {
+							this.$refs.uToast.show({
+								title: "鍐呯鐮佹牸寮忛敊璇紙鏃燩O鏍囪瘑锛�",
+								type: "error"
+							});
+							this.pkmaterSn = "";
+							return;
+						}
+
+						// 瑙f瀽鍐呯鐮侊紙鐩存帴浣跨敤杩斿洖鐨剄uantity浣滀负Q鍊硷級
+						this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
+							if (res.status) {
+								this.pksns.push(res.data.serialNumber);
+								this.pkmatInfos.push(res.data);
+							} else {
+								this.$refs.uToast.show({
+									title: res.message,
+									type: "error"
+								});
+							}
+						});
+
+						this.pkmaterSn = "";
+					}, 100);
+				})
+			},
+			
+			inbound() {
+				if (this.inboundBarcode == "") {
+					this.$refs.uToast.show({
+						title: "璇锋壂鎻忔墭鐩樻潯鐮�",
+						type: "error"
+					})
+					return;
+				}
+				if (this.address == "") {
+					this.$refs.uToast.show({
+						title: "璇锋壂鎻忓湴鍧�鏉$爜",
+						type: "error"
+					})
+					return;
+				}
+				var postData = {
+					MainData: {
+						"barcode": this.inboundBarcode,
+						"startPoint": this.address,
+						"warehouseId": this.warehouseId
+					}
+				}
+				this.$u.post('/api/Task/RequestInboundTask', postData).then(res => {
+					if (res.status) {
+						this.inboundBarcode = "";
+						if (this.warehouseId != 5) this.address = "";
+						setTimeout(() => {
+							this.addressFocus = false;
+							this.$refs.uToast.show({
+								title: "鎴愬姛",
+								type: "success"
+							})
+						}, 200);
+					} else {
+						this.$refs.uToast.show({
+							title: res.message,
+							type: "error"
+						})
+					}
+				}).catch(err => {
+					this.$refs.uToast.show({
+						title: err.message,
+						type: "error"
+					})
+				})
+			},
+			
+			inputChangebarcode() {
+				this.addressFocus = false;
+				this.$nextTick(function(x) {
+					if (this.inboundBarcode != '') {
+						this.addressFocus = true;
+					}
+				})
+			},
+			
+			deleteList(res) {
+				this.matInfos.splice(res, 1);
+				this.sns.splice(res, 1);
+			},
+			
+			pkdeleteList(res) {
+				this.pkmatInfos.splice(res, 1);
+				this.pksns.splice(res, 1);
+			},
+			
+			reset() {
+				this.barcode = "";
+				this.matInfos = [];
+				this.sns = [];
+				this.materSn = "";
+				if (this.warehouseId != 6) {
+					this.Initiallife = 0;
+				}
+			},
+			
+			resetInPk() {
+				this.pkmaterSn = "";
+				this.pkfocus = false;
+				this.pkmatInfos = [];
+				this.pksns = [];
+			},
+			
+			pksubmit() {
+				if (this.pkmatInfos.length == 0) {
+					this.$refs.uToast.show({
+						title: "璇锋壂鎻忓唴绠辨爣绛�",
+						type: 'error'
+					})
+					return;
+				}
+				
+				// 鐩存帴浣跨敤淇敼鍚庣殑quantity锛堝搴擰鍊硷級鎻愪氦
+				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 == "") {
+					this.$refs.uToast.show({
+						title: "璇锋壂鎻忔墭鐩樻潯鐮�",
+						type: 'error'
+					})
+					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'
+							})
+						} 
+						return;
+					}
+				}
+				
+				// 鐩存帴浣跨敤淇敼鍚庣殑quantity锛堝搴擰鍊硷級鎻愪氦
+				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/NewMaterielGroup', {
+					MainData: {
+						"palletCode": this.barcode,
+						"orderNo": this.orderNo,
+						"initiallife": this.Initiallife,
+						"warehouseId": this.warehouseId
+					},
+					DelKeys: submitSns
+				}).then(res => {
+					this.Testcheck = false;
+					if (res.status) {
+						this.$refs.uToast.show({
+							title: "缁勭洏鎴愬姛",
+							type: "success"
+						})
+						this.focus = false;
+						this.barcode = "";
+						this.matInfos = [];
+						this.sns = [];
+						this.matTotal = [];
+						if (this.warehouseId != 6) {
+							this.Initiallife = "";
+						}
+					} else {
+						this.$refs.uToast.show({
+							title: res.message,
+							type: "error"
+						})
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	@import '@/common/uni-ui.scss';
+
+	.content {
+		display: flex;
+		height: 150px;
+	}
+
+	.content-text {
+		font-size: 14px;
+		color: #666;
+	}
+
+	.itemstyle {
+		margin-top: 30px;
+		margin-left: 5%;
+	}
+
+	.headerstyle {
+		width: 90%;
+	}
+</style>
+    
\ No newline at end of file

--
Gitblit v1.9.3