From f1bf3ef09713182d434e22dfd8623ea73e02d6d3 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期三, 01 四月 2026 15:33:01 +0800
Subject: [PATCH] 1
---
吉安PDA/pages/stash/raworderboxing.vue | 282 ++++++++++++++++++++++++-------------------------------
1 files changed, 124 insertions(+), 158 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 7b52fb5..6512cb8 100644
--- "a/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue"
+++ "b/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue"
@@ -26,7 +26,10 @@
<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>
@@ -41,7 +44,6 @@
<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
@@ -74,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>
@@ -111,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>
@@ -127,7 +134,6 @@
<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
@@ -187,7 +193,13 @@
Testcheck: false,
pkmaterSn: "",
pkmatInfos: [],
- addressdisabled: false
+ addressdisabled: false,
+ // 鏍稿績閿侊細闃叉閲嶅鎻愪氦
+ isSubmitting: false,
+ isInbounding: false,
+ isPkSubmitting: false,
+ // 璇锋眰鍞竴鏍囪瘑锛氱敤浜庡彇娑堥噸澶嶈姹�
+ submitRequest: null
}
},
onShow() {},
@@ -217,12 +229,10 @@
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;
},
@@ -235,14 +245,12 @@
}
});
},
-
barcodeFocus() {
this.barcode = '';
if (this.focus) {
this.focus = false;
}
},
-
getData() {
var postData = {
MainData: {
@@ -258,7 +266,6 @@
}
})
},
-
onClickItem(e) {
this.focus = false;
this.addressFocus = false;
@@ -269,7 +276,6 @@
}
}
},
-
barcodeInput() {
this.$nextTick(function(x) {
if (this.barcode.length > 0) {
@@ -277,23 +283,16 @@
}
})
},
-
- // 缁勭洏椤靛唴绠辩爜瑙f瀽锛堢洿鎺ユ搷浣滃師鐢焣uantity瀛楁锛�
+ // 缁勭洏椤靛唴绠辩爜瑙f瀽
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) {
@@ -304,8 +303,6 @@
this.materSn = "";
return;
}
-
- // 鏍¢獙PO瀛楁瀛樺湪鎬�
if (matSn.indexOf("PO") <= 0) {
this.$refs.uToast.show({
title: "鍐呯鐮佹牸寮忛敊璇紙鏃燩O鏍囪瘑锛�",
@@ -314,14 +311,11 @@
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,
@@ -335,22 +329,16 @@
});
}
});
-
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) {
@@ -361,8 +349,6 @@
this.pkmaterSn = "";
return;
}
-
- // 鏍¢獙PO瀛楁瀛樺湪鎬�
if (matSn.indexOf("PO") <= 0) {
this.$refs.uToast.show({
title: "鍐呯鐮佹牸寮忛敊璇紙鏃燩O鏍囪瘑锛�",
@@ -371,8 +357,6 @@
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);
@@ -384,27 +368,25 @@
});
}
});
-
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,
@@ -418,25 +400,17 @@
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() {
this.addressFocus = false;
this.$nextTick(function(x) {
@@ -445,17 +419,14 @@
}
})
},
-
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 = [];
@@ -465,125 +436,136 @@
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'
- })
+ if (this.isPkSubmitting) {
+ this.$refs.uToast.show({title: "姝e湪鎻愪氦涓紝璇峰嬁閲嶅鎿嶄綔", type: "warning"});
return;
}
-
- // 鐩存帴浣跨敤淇敼鍚庣殑quantity锛堝搴擰鍊硷級鎻愪氦
+ 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.$refs.uToast.show({title: "鍏ュ簱鎴愬姛", type: "success"});
this.pkfocus = false;
this.pkmatInfos = [];
this.pksns = [];
} else {
- this.$refs.uToast.show({
- title: res.message,
- type: "error"
- })
+ 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'
- })
+ 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;
}
-
- // 鐩存帴浣跨敤淇敼鍚庣殑quantity锛堝搴擰鍊硷級鎻愪氦
+
+ // 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++) {
submitSns.push({...firstItem});
}
}
-
- this.$u.post('/api/InboundOrder/MaterielGroup', {
- MainData: {
- "palletCode": this.barcode,
- "orderNo": this.orderNo,
- "initiallife": this.Initiallife,
- "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: 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 = "";
+ 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);
}
}
}
@@ -591,24 +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%;
- }
-</style>
-
\ No newline at end of file
+ .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