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/raworderboxing.vue | 472 ++++++++++++++++++++++++++++++----------------------------
1 files changed, 246 insertions(+), 226 deletions(-)
diff --git "a/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue" "b/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue"
index 5e9afbe..6512cb8 100644
--- "a/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue"
+++ "b/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue"
@@ -22,28 +22,18 @@
v-model="Initiallife" />
</uni-forms-item>
- <!-- <uni-forms-item>
- <checkbox checked="check">鏄惁婊$洏</checkbox>
- </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>
+ <button @click="submit" type="primary" size="default" style="width: 160rpx;"
+ :disabled="isSubmitting" :loading="isSubmitting">
+ {{ isSubmitting ? '鎻愪氦涓�...' : '缁勭洏' }}
+ </button>
</view>
</uni-forms-item>
</uni-forms>
<uni-list>
- <!-- <uni-list-item direction="column" v-for="item in matTotal" :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.matCode}}</view>
- <view class="uni-title-sub uni-ellipsis-2">鏁伴噺锛歿{item.matQuantity}}</view>
- </view>
- </view>
- </template>
- </uni-list-item> -->
<uni-list-item direction="column" v-for="(item,index) in matInfos" :key="index">
<template v-slot:body>
<view class="uni-list-box">
@@ -54,7 +44,16 @@
<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>
- <view class="uni-note">鏁伴噺锛歿{item.quantity}}</view>
+ <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>
@@ -77,7 +76,10 @@
placeholder="璇锋壂鎻忓湴鍧�鏉$爜" ref='midInput' :focus="addressFocus" />
</uni-forms-item>
<uni-forms-item>
- <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">鍏ュ簱纭</button>
+ <button @click="inbound" type="primary" size="default" style="margin-top: 2%;"
+ :disabled="isInbounding" :loading="isInbounding">
+ {{ isInbounding ? '鎻愪氦涓�...' : '鍏ュ簱纭' }}
+ </button>
</uni-forms-item>
</uni-forms>
</view>
@@ -92,8 +94,6 @@
<view style="font-size: 18px;">鍗曟嵁鍙凤細{{orderNo}}</view>
<view style="font-size: 18px;">鐗╂枡缂栫爜锛歿{item.materielCode}}</view>
<view>鐗╂枡鍚嶇О锛歿{item.materielName}}</view>
- <!-- <view>鐗╂枡瑙勬牸锛歿{item.materielSpec}}</view> -->
- <!-- <view style="font-size: 18px;">鐗╂枡鍚嶇О锛歿{item.matName}}</view> -->
<view style="font-size: 18px;">鏁伴噺锛歿{item.orderQuantity}}</view>
<view style="font-size: 18px;">缁勭洏鏁伴噺锛歿{item.receiptQuantity}}</view>
</view>
@@ -116,7 +116,9 @@
<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>
+ style="margin-top: 2%;" :disabled="isPkSubmitting" :loading="isPkSubmitting">
+ {{ isPkSubmitting ? '鎻愪氦涓�...' : '鍏ュ钩搴�' }}
+ </button>
</view>
</uni-forms-item>
@@ -132,7 +134,16 @@
<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>
- <view class="uni-note">鏁伴噺锛歿{item.quantity}}</view>
+ <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>
@@ -153,7 +164,7 @@
export default {
data() {
return {
- items: ['缁勭洏', '鍏ュ簱', '鍗曟嵁淇℃伅'], //, '瑙g洏'
+ items: ['缁勭洏', '鍏ュ簱', '鍗曟嵁淇℃伅'],
current: 0,
matTotal: [],
matInfos: [],
@@ -182,7 +193,13 @@
Testcheck: false,
pkmaterSn: "",
pkmatInfos: [],
- addressdisabled: false
+ addressdisabled: false,
+ // 鏍稿績閿侊細闃叉閲嶅鎻愪氦
+ isSubmitting: false,
+ isInbounding: false,
+ isPkSubmitting: false,
+ // 璇锋眰鍞竴鏍囪瘑锛氱敤浜庡彇娑堥噸澶嶈姹�
+ submitRequest: null
}
},
onShow() {},
@@ -212,12 +229,15 @@
this.getData();
},
methods: {
- // voiceSpeech(src) {
- // innerAudioContext.src = src; // '../../static/success.mp3';
- // innerAudioContext.play();
- // },
+ // 鏁伴噺缂栬緫鏍¢獙
+ 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() {
- debugger
this.$nextTick(() => {
this.materSn = '';
if (!this.focus) {
@@ -226,7 +246,6 @@
});
},
barcodeFocus() {
- debugger
this.barcode = '';
if (this.focus) {
this.focus = false;
@@ -260,120 +279,114 @@
barcodeInput() {
this.$nextTick(function(x) {
if (this.barcode.length > 0) {
- // if (this.barcode.substring(0, 1) == 'A' || this.barcode.substring(0, 2) == 'TP') {
this.focus = true;
- // } else {
- // this.$refs.uToast.show({
- // title: "鎵爜閿欒,璇锋壂鎻忔墭鐩樼爜",
- // type: "error"
- // })
- // }
}
})
},
+ // 缁勭洏椤靛唴绠辩爜瑙f瀽
snInput() {
this.$nextTick(() => {
- if (this.materSn != "") {
+ if (!this.materSn) return;
+ setTimeout(() => {
this.focus = false;
- var matSn = this.materSn;
+ let matSn = this.materSn.trim();
if (this.warehouseId == 11) {
matSn = matSn.replace(/,SC.*/, '');
}
- //鏌ヨmatSn鏄惁瀛樺湪瀛楃
- if(matSn.indexOf("PO")>0){
- 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: "error"
- })
- // setTimeout(() => {
- // this.voiceSpeech('../../static/fail.mp3');
- // }, 100);
- return;
- }
- // setTimeout(() => {
- // this.voiceSpeech('../../static/success.mp3');
- // }, 100);
- } else {
+ 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;
+ }
+ if (matSn.indexOf("PO") <= 0) {
+ this.$refs.uToast.show({
+ title: "鍐呯鐮佹牸寮忛敊璇紙鏃燩O鏍囪瘑锛�",
+ type: "error"
+ });
+ this.materSn = "";
+ return;
+ }
+ 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: "error"
- })
- // setTimeout(() => {
- // this.voiceSpeech('../../static/fail.mp3');
- // }, 100);
+ type: "warning"
+ });
}
- })
- }
- setTimeout(() => {
- this.materSn = "";
- }, 100);
- }
+ } else {
+ this.$refs.uToast.show({
+ title: res.message,
+ type: "error"
+ });
+ }
+ });
+ this.materSn = "";
+ }, 1000);
})
},
+ // 鍏ュ钩搴撻〉鍐呯鐮佽В鏋�
pksnInput() {
this.$nextTick(() => {
- if (this.pkmaterSn != "") {
-
- var matSn = this.pkmaterSn;
-
- if(matSn.indexOf("PO")>0){
- this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
- if (res.status) {
- this.pksns.push(res.data.serialNumber);
- this.pkmatInfos.push(res.data);
- if (!res.status) {
- this.$refs.uToast.show({
- title: res.message,
- type: "error"
- })
- // setTimeout(() => {
- // this.voiceSpeech('../../static/fail.mp3');
- // }, 100);
- return;
- }
- // setTimeout(() => {
- // this.voiceSpeech('../../static/success.mp3');
- // }, 100);
- return;
- } else {
- this.$refs.uToast.show({
- title: res.message,
- type: "error"
- })
- // setTimeout(() => {
- // this.voiceSpeech('../../static/fail.mp3');
- // }, 100);
- }
- })
- }
- setTimeout(() => {
+ if (!this.pkmaterSn) return;
+ 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 = "";
- }, 100);
- }
+ return;
+ }
+ if (matSn.indexOf("PO") <= 0) {
+ this.$refs.uToast.show({
+ title: "鍐呯鐮佹牸寮忛敊璇紙鏃燩O鏍囪瘑锛�",
+ type: "error"
+ });
+ this.pkmaterSn = "";
+ return;
+ }
+ 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.isInbounding) {
+ this.$refs.uToast.show({title: "姝e湪鎻愪氦涓紝璇峰嬁閲嶅鎿嶄綔", type: "warning"});
+ return;
+ }
if (this.inboundBarcode == "") {
- this.$refs.uToast.show({
- title: "璇锋壂鎻忔墭鐩樻潯鐮�",
- type: "error"
- })
+ this.$refs.uToast.show({title: "璇锋壂鎻忔墭鐩樻潯鐮�", type: "error"});
return;
}
if (this.address == "") {
- this.$refs.uToast.show({
- title: "璇锋壂鎻忓湴鍧�鏉$爜",
- type: "error"
- })
+ this.$refs.uToast.show({title: "璇锋壂鎻忓湴鍧�鏉$爜", type: "error"});
return;
}
+ this.isInbounding = true;
var postData = {
MainData: {
"barcode": this.inboundBarcode,
@@ -387,22 +400,15 @@
if (this.warehouseId != 5) this.address = "";
setTimeout(() => {
this.addressFocus = false;
- this.$refs.uToast.show({
- title: "鎴愬姛",
- type: "success"
- })
+ this.$refs.uToast.show({title: "鎴愬姛", type: "success"});
}, 200);
} else {
- this.$refs.uToast.show({
- title: res.message,
- type: "error"
- })
+ this.$refs.uToast.show({title: res.message, type: "error"});
}
}).catch(err => {
- this.$refs.uToast.show({
- title: err.message,
- type: "error"
- })
+ this.$refs.uToast.show({title: err.message, type: "error"});
+ }).finally(() => {
+ this.isInbounding = false;
})
},
inputChangebarcode() {
@@ -426,7 +432,7 @@
this.matInfos = [];
this.sns = [];
this.materSn = "";
- if (this.warehouseId = !6) {
+ if (this.warehouseId != 6) {
this.Initiallife = 0;
}
},
@@ -436,101 +442,130 @@
this.pkmatInfos = [];
this.pksns = [];
},
+ // 鍏ュ钩搴擄紙鍔犻攣锛�
pksubmit() {
- if (this.pkmatInfos.length == 0) {
- this.$refs.uToast.show({
- title: "璇锋壂鎻忓唴绠辨爣绛�",
- type: 'error'
- })
+ if (this.isPkSubmitting) {
+ this.$refs.uToast.show({title: "姝e湪鎻愪氦涓紝璇峰嬁閲嶅鎿嶄綔", type: "warning"});
return;
}
- this.$u.post('/api/InboundOrder/InPinKu?warehouseId=' + this.warehouseId + "&orderNo=" + this.orderNo, this
- .pksns).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'
+ if (this.pkmatInfos.length == 0) {
+ this.$refs.uToast.show({title: "璇锋壂鎻忓唴绠辨爣绛�", type: 'error'});
+ return;
+ }
+ this.isPkSubmitting = true;
+ 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"});
+ }
+ }).finally(() => {
+ this.isPkSubmitting = false;
})
+ },
+
+ // 鏍稿績淇锛氱粍鐩樻彁浜わ紙褰诲簳鏉滅粷閲嶅璋冪敤锛�
+ submit() {
+ // 1. 绗竴灞傞攣锛氱姸鎬侀攣鎷︽埅
+ if (this.isSubmitting) {
+ this.$refs.uToast.show({title: "姝e湪鎻愪氦涓紝璇峰嬁閲嶅鎿嶄綔", type: "warning"});
+ return;
+ }
+
+ // 2. 琛ㄥ崟鏍¢獙
+ if (this.barcode == "") {
+ this.$refs.uToast.show({title: "璇锋壂鎻忔墭鐩樻潯鐮�", type: 'error'});
return;
}
if (this.matInfos.length == 0) {
- this.$refs.uToast.show({
- title: "璇锋壂鎻忓唴绠辨爣绛�",
- type: 'error'
- })
+ 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;
- }
+ if (this.Test && !this.Testcheck) {
+ this.Testcheck = true;
+ this.$refs.uToast.show({
+ title: this.warehouseId == 2 ? "璇风‘璁ゆ暟閲�" : "璇风‘璁ゅ垵濮嬪鍛�",
+ type: 'error'
+ });
+ return;
}
- if (this.warehouseId == 2) { //娌瑰ⅷ浠撳簱鍖篒D
- this.sn = this.sns[0];
+
+ // 3. 寮哄埗鍙栨秷鏈畬鎴愮殑璇锋眰锛堝叧閿紒锛�
+ if (this.submitRequest) {
+ this.submitRequest.abort(); // 鍙栨秷涓婁竴娆℃湭瀹屾垚鐨勮姹�
+ }
+
+ // 4. 绔嬪嵆涓婇攣
+ this.isSubmitting = true;
+ uni.showLoading({title: '鎻愪氦涓�...', mask: true});
+
+ // 5. 鏋勯�犺姹傛暟鎹�
+ 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++) {
- this.sns.push(this.sn);
+ submitSns.push({...firstItem});
}
}
- this.$u.post('/api/InboundOrder/MaterielGroup', {
- MainData: {
- "palletCode": this.barcode,
- "orderNo": this.orderNo,
- "initiallife": this.Initiallife,
- // "isFull": this.check
- "warehouseId": this.warehouseId
+
+ // 6. 浣跨敤鍘熺敓uni.request锛堟敮鎸佸彇娑堬級锛屾浛浠�$u.post
+ const requestData = {
+ url: '/api/InboundOrder/MaterielGroup',
+ method: 'POST',
+ data: {
+ MainData: {
+ "palletCode": this.barcode,
+ "orderNo": this.orderNo,
+ "initiallife": this.Initiallife,
+ "warehouseId": this.warehouseId
+ },
+ DelKeys: submitSns
},
- DelKeys: this.sns
- }).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) { //娴嬭瘯鏋朵粨搴撳尯ID
- this.Initiallife = "";
+ success: (res) => {
+ // 閫傞厤鎺ュ彛杩斿洖鏍煎紡锛堟牴鎹綘鐨勫疄闄呰繑鍥炶皟鏁达級
+ const result = res.data;
+ this.Testcheck = false;
+ if (result.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: result.message, type: "error"});
}
- } else {
- this.$refs.uToast.show({
- title: res.message,
- type: "error"
- })
+ },
+ fail: (err) => {
+ // 鎺掗櫎涓诲姩鍙栨秷鐨勮姹傦紙閬垮厤璇彁绀猴級
+ if (err.errMsg !== 'request:fail abort') {
+ this.$refs.uToast.show({title: err.message || "鎻愪氦澶辫触", type: "error"});
+ }
+ },
+ complete: () => {
+ // 7. 瑙i攣 + 娓呯┖璇锋眰鏍囪瘑
+ this.isSubmitting = false;
+ this.submitRequest = null;
+ uni.hideLoading();
}
- })
+ };
+
+ // 8. 淇濆瓨璇锋眰鏍囪瘑锛岀敤浜庡彇娑堥噸澶嶈姹�
+ this.submitRequest = uni.request(requestData);
}
}
}
@@ -538,23 +573,8 @@
<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%;
- }
+ .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