Browse Source

2025-11-03

pda调整扫描、查询、确认逻辑(生产领料)
master
fengyuan_yang 2 months ago
parent
commit
64bdd042fa
  1. 8
      src/api/production.js
  2. 110
      src/views/modules/production-pick/productionPickingDetail.vue

8
src/api/production.js

@ -34,4 +34,10 @@ export const getOutboundMaterialList = data => createAPI(`production/outbound/ma
* 获取出库单物料明细列表
* @param {Object} data - 查询参数 {site, outboundNo}
*/
export const getOutboundMaterialDetails = data => createAPI(`production/outbound/materialDetails`, 'post', data)
export const getOutboundMaterialDetails = data => createAPI(`production/outbound/materialDetails`, 'post', data)
/**
* 获取已扫描标签列表从缓存表
* @param {Object} data - 查询参数 {site, buNo, outboundNo, relatedNo}
*/
export const getScannedLabelList = data => createAPI(`production/outbound/getScannedLabelList`, 'post', data)

110
src/views/modules/production-pick/productionPickingDetail.vue

@ -167,7 +167,7 @@
</template>
<script>
import { getOutboundDetails, validateLabelWithOutbound, confirmProductionPicking, getOutboundMaterialList } from "@/api/production.js";
import { getOutboundDetails, validateLabelWithOutbound, confirmProductionPicking, getOutboundMaterialList, getScannedLabelList } from "@/api/production.js";
import { getCurrentWarehouse } from '@/utils'
import moment from 'moment';
@ -204,41 +204,24 @@ export default {
this.scanCode = '';
},
//
//
validateAndAddLabel(labelCode) {
const params = {
labelCode: labelCode,
outboundNo: this.outboundNo,
warehouseId: getCurrentWarehouse(),
relatedNo: this.relatedNo,
site: localStorage.getItem('site'),
buNo: this.buNo,
relatedNo: this.relatedNo
operationType: 'I' //
};
validateLabelWithOutbound(params).then(({ data }) => {
if (data && data.code === 0) {
const resultList = data.data;
//
const exists = this.labelList.find(item => item.labelCode === labelCode);
if (exists) {
this.$message.warning('该标签已扫描,请勿重复扫描');
return;
}
//
resultList.forEach(result => {
this.labelList.push({
id: Date.now() + Math.random(), // ID
labelCode: result.labelCode,
partNo: result.partNo,
quantity: result.quantity,
batchNo: result.batchNo,
locationId: result.locationId
});
});
this.$message.success(`标签验证成功,共添加 ${resultList.length} 条记录`);
this.$message.success('标签添加成功');
//
this.loadScannedLabelList();
} else {
this.$message.error(data.msg || '该标签不符合退货条件,请检查');
this.$message.error(data.msg || '该标签不符合条件,请检查');
}
}).catch(error => {
console.error('标签验证失败:', error);
@ -246,18 +229,32 @@ export default {
});
},
//
//
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,
outboundNo: this.outboundNo,
relatedNo: this.relatedNo,
site: localStorage.getItem('site'),
buNo: this.buNo,
operationType: 'D' //
};
validateLabelWithOutbound(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('移除失败');
});
},
//
//
confirmOutbound() {
if (this.labelList.length === 0) {
this.$message.warning('请先扫描标签');
@ -267,26 +264,19 @@ export default {
site: this.outboundInfo.site,
buNo: this.buNo,
outboundNo: this.outboundNo,
warehouseId: getCurrentWarehouse(),
relatedNo: this.relatedNo,
labels: this.labelList.map(label => ({
labelCode: label.labelCode,
quantity: label.quantity,
batchNo: label.batchNo,
partNo: label.partNo,
locationId: label.locationId
}))
locationCode: getCurrentWarehouse() //
}
confirmProductionPicking(params).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('操作成功');
this.$message.success('领料成功');
this.$router.back();
} else {
this.$message.error(data.msg || '操作失败');
this.$message.error(data.msg || '领料失败');
}
}).catch(error => {
console.error('出库确认失败:', error);
this.$message.error('操作失败');
this.$message.error('领料失败');
});
},
@ -372,6 +362,8 @@ export default {
getOutboundDetails(params).then(({ data }) => {
if (data && data.code === 0) {
this.outboundInfo = data.data;
//
this.loadScannedLabelList();
} else {
this.$message.error(data.msg || '获取出库单详情失败');
}
@ -379,6 +371,34 @@ export default {
console.error('获取出库单详情失败:', error);
this.$message.error('获取出库单详情失败');
});
},
//
loadScannedLabelList() {
const params = {
site: localStorage.getItem('site'),
buNo: this.buNo,
outboundNo: this.outboundNo,
relatedNo: this.relatedNo
};
getScannedLabelList(params).then(({ data }) => {
if (data && data.code === 0) {
// UI
this.labelList = (data.data || []).map(item => ({
id: Date.now() + Math.random(), // ID
labelCode: item.labelCode,
partNo: item.partNo,
quantity: item.quantity,
batchNo: item.batchNo || '',
locationId: item.locationId || ''
}));
} else {
console.error('获取已扫描标签列表失败:', data.msg);
}
}).catch(error => {
console.error('获取已扫描标签列表失败:', error);
});
}
},

Loading…
Cancel
Save