入库出库添加防抖

This commit is contained in:
2024-05-17 11:45:50 +08:00
parent eb6abd6e9a
commit a59877663c
2 changed files with 66 additions and 60 deletions

View File

@@ -288,36 +288,39 @@
location: this.warehouseInfo.location,
packagelist: list
};
WarehoseApi.handlerIntoProductWarehouse(data).then((res) => {
if (res.code === 200) {
if (!res.data) {
uni.showModal({
title: '提示',
content: '入库失败:' + res.msg,
showCancel: false,
confirmText: '确定'
uni.$u.throttle(()=>{
WarehoseApi.handlerIntoProductWarehouse(data).then((res) => {
if (res.code === 200) {
if (!res.data) {
uni.showModal({
title: '提示',
content: '入库失败:' + res.msg,
showCancel: false,
confirmText: '确定'
});
this.loading = false;
return;
}
uni.showToast({
icon: 'success',
title: '入库成功!'
});
this.loading = false;
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData
.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData
.newMaterialList));
// this.clear();
} else {
uni.showToast({
icon: 'error',
title: '入库失败!'
});
this.loading = false;
return;
}
uni.showToast({
icon: 'success',
title: '入库成功!'
});
this.loading = false;
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData
.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData
.newMaterialList));
// this.clear();
} else {
uni.showToast({
icon: 'error',
title: '入库失败!'
});
this.loading = false;
}
});
});
},5000)
}
}
});

View File

@@ -406,47 +406,50 @@
this.loading = false;
return;
}
WarehoseApi.doMaterialOut(data).then((res) => {
if (res.code !== 200) {
uni.showModal({
title: '提示',
content: '出库异常',
showCancel: false,
confirmText: '确认'
});
this.loading = false;
return;
} else {
if (res.data.item1 == 100) {
uni.$u.throttle(() => {
WarehoseApi.doMaterialOut(data).then((res) => {
if (res.code !== 200) {
uni.showModal({
title: '提示',
content: '此物料已经出库完成,不可以再出库',
content: '出库异常',
showCancel: false,
confirmText: '确认'
});
this.newMaterialList = [];
this.loading = false;
} else if (res.data.item2 == 200) {
uni.showModal({
title: '提示',
content: '不是此物料最早批次,无法出库',
showCancel: false,
confirmText: '确认'
});
this.newMaterialList = [];
this.loading = false;
return;
} else {
uni.showModal({
title: '提示',
content: '出库成功!已成功出库' + res.data.item1 + '',
showCancel: false,
confirmText: '确认'
});
this.newMaterialList = [];
this.loading = false;
if (res.data.item1 == 100) {
uni.showModal({
title: '提示',
content: '此物料已经出库完成,不可以再出库',
showCancel: false,
confirmText: '确认'
});
this.newMaterialList = [];
this.loading = false;
} else if (res.data.item2 == 200) {
uni.showModal({
title: '提示',
content: '不是此物料最早批次,无法出库',
showCancel: false,
confirmText: '确认'
});
this.newMaterialList = [];
this.loading = false;
} else {
uni.showModal({
title: '提示',
content: '出库成功!已成功出库' + res.data
.item1 + '箱',
showCancel: false,
confirmText: '确认'
});
this.newMaterialList = [];
this.loading = false;
}
}
}
});
});
}, 5000)
} else {
this.loading = false;
}