Browse Source

2025-10-31

pda调整扫描、查询、确认逻辑(生产退仓)
master
fengyuan_yang 4 months ago
parent
commit
10d3799fe5
  1. 6
      src/api/production/production-return2.js
  2. 102
      src/views/modules/production/productionReturnStorage.vue

6
src/api/production/production-return2.js

@ -10,3 +10,9 @@ export const validateLabelWithReturn = data => createAPI(`productionReturn/valid
export const confirmReturnStorage = data => createAPI(`productionReturn/confirmReturnStorage`, 'post', data) export const confirmReturnStorage = data => createAPI(`productionReturn/confirmReturnStorage`, 'post', data)
export const getMaterialList = data => createAPI(`productionReturn/getMaterialList`, 'post', data) export const getMaterialList = data => createAPI(`productionReturn/getMaterialList`, 'post', data)
/**
* 获取已扫描标签列表从缓存表
* @param {Object} data - 查询参数 {site, buNo, inboundNo}
*/
export const getScannedLabelList = data => createAPI(`productionReturn/getScannedLabelList`, 'post', data)

102
src/views/modules/production/productionReturnStorage.vue

@ -205,7 +205,8 @@ import {
getReturnDetails, getReturnDetails,
validateLabelWithReturn, validateLabelWithReturn,
confirmReturnStorage, confirmReturnStorage,
getMaterialList
getMaterialList,
getScannedLabelList
} from "@/api/production/production-return2.js"; } from "@/api/production/production-return2.js";
import { getCurrentWarehouse } from '@/utils' import { getCurrentWarehouse } from '@/utils'
import moment from 'moment'; import moment from 'moment';
@ -242,37 +243,22 @@ export default {
this.scanCode = ''; this.scanCode = '';
}, },
//
//
validateAndAddLabel(labelCode) { validateAndAddLabel(labelCode) {
const params = { const params = {
labelCode: labelCode, labelCode: labelCode,
inboundNo: this.inboundNo, inboundNo: this.inboundNo,
partNo: this.partNo,
warehouseId: getCurrentWarehouse(),
site: localStorage.getItem('site'),
buNo: this.materialInfo.buNo
site: this.materialInfo.site,
buNo: this.materialInfo.buNo,
operationType: 'I' // I
}; };
validateLabelWithReturn(params).then(({ data }) => { validateLabelWithReturn(params).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
//
const exists = this.labelList.find(item => item.labelCode === labelCode);
if (exists) {
this.$message.warning('该标签已扫描,请勿重复扫描');
return;
}
//
this.labelList.unshift({
id: Date.now(),
labelCode: labelCode,
partNo: data.data.partNo,
quantity: data.data.quantity,
batchNo: data.data.batchNo
});
this.$message.success('操作成功'); this.$message.success('操作成功');
//
this.loadScannedLabelList();
} else { } else {
this.$message.error(data.msg || '该标签与入库单不符,请检查');
this.$message.error(data.msg || '操作失败');
} }
}).catch(error => { }).catch(error => {
console.error('标签验证失败:', error); console.error('标签验证失败:', error);
@ -280,15 +266,27 @@ export default {
}); });
}, },
//
//
removeLabelByCode(labelCode) { removeLabelByCode(labelCode) {
const index = this.labelList.findIndex(item => item.labelCode === labelCode);
if (index !== -1) {
this.labelList.splice(index, 1);
this.$message.success('操作成功');
} else {
this.$message.warning('未找到该标签');
}
const params = {
labelCode: labelCode,
inboundNo: this.inboundNo,
site: this.materialInfo.site,
buNo: this.materialInfo.buNo,
operationType: 'D' // D
};
validateLabelWithReturn(params).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('操作成功');
//
this.loadScannedLabelList();
} else {
this.$message.error(data.msg || '操作失败');
}
}).catch(error => {
console.error('标签移除失败:', error);
this.$message.error('操作失败');
});
}, },
// //
@ -317,7 +315,7 @@ export default {
this.locationCode = ''; this.locationCode = '';
}, },
//
//
submitInbound() { submitInbound() {
if (!this.locationCode.trim()) { if (!this.locationCode.trim()) {
this.$message.warning('请输入库位号'); this.$message.warning('请输入库位号');
@ -327,13 +325,7 @@ export default {
site: this.materialInfo.site, site: this.materialInfo.site,
buNo: this.materialInfo.buNo, buNo: this.materialInfo.buNo,
inboundNo: this.inboundNo, inboundNo: this.inboundNo,
locationCode: this.locationCode.trim(),
labels: this.labelList.map(label => ({
labelCode: label.labelCode,
quantity: label.quantity,
batchNo: label.batchNo,
partNo: label.partNo,
}))
locationCode: this.locationCode.trim()
}; };
confirmReturnStorage(params).then(({ data }) => { confirmReturnStorage(params).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
@ -429,6 +421,8 @@ export default {
getReturnDetails(params).then(({ data }) => { getReturnDetails(params).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.materialInfo = data.data; this.materialInfo = data.data;
//
this.loadScannedLabelList();
} else { } else {
this.$message.error(data.msg || '获取入库单详情失败'); this.$message.error(data.msg || '获取入库单详情失败');
} }
@ -436,6 +430,36 @@ export default {
console.error('获取入库单详情失败:', error); console.error('获取入库单详情失败:', error);
this.$message.error('获取入库单详情失败'); this.$message.error('获取入库单详情失败');
}); });
},
//
loadScannedLabelList() {
if (!this.materialInfo.site || !this.materialInfo.buNo || !this.inboundNo) {
return;
}
const params = {
site: this.materialInfo.site,
buNo: this.materialInfo.buNo,
inboundNo: this.inboundNo
};
getScannedLabelList(params).then(({ data }) => {
if (data && data.code === 0) {
// labelList
this.labelList = (data.data || []).map((item, index) => ({
id: Date.now() + index,
labelCode: item.labelCode,
partNo: item.partNo,
quantity: item.quantity,
buNo: item.buNo
}));
} else {
console.error('获取已扫描标签列表失败:', data.msg);
}
}).catch(error => {
console.error('获取已扫描标签列表失败:', error);
});
} }
}, },

Loading…
Cancel
Save