Browse Source

2025-11-27

pda调整扫描、查询、确认逻辑(其他入库)
master
fengyuan_yang 2 months ago
parent
commit
11c6bce604
  1. 16
      src/api/other-inbound/other-inbound.js
  2. 183
      src/views/modules/other-inout/otherInboundDetail.vue

16
src/api/other-inbound/other-inbound.js

@ -13,14 +13,14 @@ export const getOtherInboundList = data => createAPI(`otherInbound/getInboundLis
export const getOtherInboundDetails = data => createAPI(`otherInbound/getInboundDetails`, 'post', data)
/**
* 验证物料与其它入库单是否匹配
* @param {Object} data - 验证参数
* 验证物料与其它入库单是否匹配通过存储过程GetScanLabelVerification
* @param {Object} data - 验证参数包含documentType: '其他入库'
*/
export const validateMaterialWithInbound = data => createAPI(`otherInbound/validateMaterialWithInbound`, 'post', data)
export const validateLabelWithOtherInbound = data => createAPI(`otherInbound/validateLabelWithOtherInbound`, 'post', data)
/**
* 确认其它入库
* @param {Object} data - 入库数据
* 确认其它入库通过存储过程GetSaveLabelVerification
* @param {Object} data - 入库数据包含documentType: '其他入库'
*/
export const confirmOtherInbound = data => createAPI(`otherInbound/confirmOtherInbound`, 'post', data)
@ -31,7 +31,7 @@ export const confirmOtherInbound = data => createAPI(`otherInbound/confirmOtherI
export const getMaterialList = data => createAPI(`otherInbound/getMaterialList`, 'post', data)
/**
* 添加物料到入库单
* @param {Object} data - 添加物料参数 {site, buNo, inboundNo, materialCode, actualQty, warehouseId}
* 获取已扫描标签列表从ScannedRollTempTable缓存表
* @param {Object} data - 查询参数 {site, buNo, inboundNo, documentType}
*/
export const addMaterialToInbound = data => createAPI(`otherInbound/addMaterialToInbound`, 'post', data)
export const getScannedLabelList = data => createAPI(`otherInbound/getScannedLabelList`, 'post', data)

183
src/views/modules/other-inout/otherInboundDetail.vue

@ -47,14 +47,24 @@
<!-- 物料编码 -->
<div class="input-item material-code-item">
<span class="input-label">物料编码</span>
<el-input
<el-select
v-model="materialCode"
placeholder="请输入物料编码"
@keyup.enter.native="handleMaterialInput"
@blur="handleMaterialInput"
ref="materialInput"
class="input-field" clearable
/>
placeholder="请选择物料"
filterable
@change="handleMaterialSelect"
ref="materialSelect"
class="input-field"
>
<el-option
v-for="item in materialOptions"
:key="item.materialCode"
:label="`${item.materialCode} - ${item.materialName}`"
:value="item.materialCode"
>
<span style="float: left">{{ item.materialCode }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.materialName }}</span>
</el-option>
</el-select>
</div>
<!-- 单位 -->
@ -126,7 +136,7 @@
class="list-item"
>
<div class="col-no">{{ materialList.length - index }}</div>
<div class="col-label">{{ item.labelCode || item.materialCode }}</div>
<div class="col-label">{{ item.labelCode }}</div>
<div class="col-part">{{ item.materialCode }}</div>
<div class="col-batch">{{ item.batchNo || '-' }}</div>
<div class="col-qty">{{ item.actualQty }}</div>
@ -233,7 +243,7 @@
</template>
<script>
import { getOtherInboundDetails, validateMaterialWithInbound, confirmOtherInbound, getMaterialList, addMaterialToInbound } from "@/api/other-inbound/other-inbound.js";
import { getOtherInboundDetails, getMaterialList, validateLabelWithOtherInbound, confirmOtherInbound, getScannedLabelList } from "@/api/other-inbound/other-inbound.js";
import { getCurrentWarehouse } from '@/utils'
import moment from 'moment';
@ -246,6 +256,7 @@ export default {
inboundInfo: {},
materialList: [],
originalMaterialList: [],
materialOptions: [], //
currentMaterial: {},
inboundNo: '',
buNo: '',
@ -260,45 +271,58 @@ export default {
return date ? moment(date).format('YYYY-MM-DD') : '';
},
//
handleMaterialInput() {
if (!this.materialCode.trim()) {
//
handleMaterialSelect() {
if (!this.materialCode) {
this.currentMaterial = {};
return;
}
this.validateMaterial(this.materialCode.trim());
//
const material = this.materialOptions.find(m => m.materialCode === this.materialCode);
if (material) {
this.currentMaterial = {
materialCode: material.materialCode,
materialName: material.materialName,
unit: material.unit
};
}
},
//
validateMaterial(materialCode) {
//
loadMaterialOptions() {
if (!this.inboundInfo.site || !this.inboundInfo.buNo || !this.inboundNo) {
return;
}
const params = {
materialCode: materialCode,
site: this.inboundInfo.site,
buNo: this.inboundInfo.buNo,
inboundNo: this.inboundNo,
warehouseId: getCurrentWarehouse(),
site: localStorage.getItem('site'),
buNo: this.buNo
documentType: '其他入库' //
};
validateMaterialWithInbound(params).then(({ data }) => {
getMaterialList(params).then(({ data }) => {
if (data && data.code === 0) {
this.currentMaterial = data.data;
this.materialOptions = (data.data || []).map(item => ({
materialCode: item.materialCode,
materialName: item.materialName,
unit: item.unit
}));
} else {
this.currentMaterial = {};
this.$message.error(data.msg || '该物料与入库单不符,请检查');
console.error('获取物料选项失败:', data.msg);
this.materialOptions = [];
}
}).catch(error => {
console.error('物料验证失败:', error);
this.currentMaterial = {};
this.$message.error('该物料与入库单不符,请检查');
console.error('获取物料选项失败:', error);
this.materialOptions = [];
});
},
//
// GetScanLabelVerification
handleAddMaterial() {
if (!this.materialCode.trim()) {
this.$message.warning('请输入物料编码');
this.$refs.materialInput.focus();
this.$message.warning('请选择物料编码');
return;
}
@ -313,57 +337,36 @@ export default {
return;
}
//
// const exists = this.materialList.find(item =>
// item.materialCode === this.materialCode.trim()
// );
// if (exists) {
// this.$message.warning('');
// return;
// }
//
// GetScanLabelVerification
const params = {
site: localStorage.getItem('site'),
buNo: this.buNo,
site: this.inboundInfo.site,
buNo: this.inboundInfo.buNo,
inboundNo: this.inboundNo,
materialCode: this.materialCode.trim(),
actualQty: parseFloat(this.actualQty),
batchNo: this.batchNo.trim(),
warehouseId: getCurrentWarehouse()
warehouseId: getCurrentWarehouse(),
operationType: 'I', // I
documentType: '其他入库' //
};
addMaterialToInbound(params).then(({ data }) => {
validateLabelWithOtherInbound(params).then(({ data }) => {
if (data && data.code === 0) {
const materialData = data.data;
//
this.materialList.unshift({
id: Date.now(),
materialCode: materialData.materialCode,
materialName: materialData.materialName,
unit: materialData.unit,
actualQty: materialData.actualQty,
batchNo: this.batchNo.trim(),
labelCode: materialData.labelCode
});
this.$message.success('操作成功');
//
this.loadScannedLabelList();
//
this.materialCode = '';
this.actualQty = '';
this.batchNo = '*';
this.currentMaterial = {};
//
this.$nextTick(() => {
this.$refs.materialInput.focus();
});
} else {
this.$message.error(data.msg || '添加物料失败');
this.$message.error(data.msg || '操作失败');
}
}).catch(error => {
console.error('添加物料失败:', error);
this.$message.error('添加物料失败');
this.$message.error('操作失败');
});
},
@ -392,7 +395,7 @@ export default {
this.locationCode = '';
},
//
// GetSaveLabelVerification
submitInbound() {
if (!this.locationCode.trim()) {
this.$message.warning('请输入库位号');
@ -403,13 +406,8 @@ export default {
buNo: this.inboundInfo.buNo,
inboundNo: this.inboundNo,
locationCode: this.locationCode.trim(),
materials: this.materialList.map(material => ({
materialCode: material.materialCode,
actualQty: material.actualQty,
batchNo: material.batchNo,
labelCode: material.labelCode
}))
}
documentType: '其他入库' //
};
confirmOtherInbound(params).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('入库成功');
@ -494,6 +492,9 @@ export default {
getOtherInboundDetails(params).then(({ data }) => {
if (data && data.code === 0) {
this.inboundInfo = data.data;
//
this.loadMaterialOptions();
this.loadScannedLabelList();
} else {
this.$message.error(data.msg || '获取入库单详情失败');
}
@ -501,6 +502,41 @@ export default {
console.error('获取入库单详情失败:', error);
this.$message.error('获取入库单详情失败');
});
},
// ScannedRollTempTable
loadScannedLabelList() {
if (!this.inboundInfo.site || !this.inboundInfo.buNo || !this.inboundNo) {
return;
}
const params = {
site: this.inboundInfo.site,
buNo: this.inboundInfo.buNo,
inboundNo: this.inboundNo,
documentType: '其他入库' //
};
getScannedLabelList(params).then(({ data }) => {
if (data && data.code === 0) {
// materialList
this.materialList = (data.data || []).map((item, index) => ({
id: Date.now() + index,
labelCode: item.labelCode,
materialCode: item.materialCode,
actualQty: item.actualQty,
batchNo: item.batchNo
}));
//
this.inboundInfo.totalLabels = this.materialList.length;
this.inboundInfo.totalQty = this.materialList.reduce((sum, item) => sum + parseFloat(item.actualQty || 0), 0);
} else {
console.error('获取已扫描标签列表失败:', data.msg);
}
}).catch(error => {
console.error('获取已扫描标签列表失败:', error);
});
}
},
@ -519,13 +555,6 @@ export default {
this.actualQty = '';
this.batchNo = '*';
//
this.$nextTick(() => {
if (this.$refs.materialInput) {
this.$refs.materialInput.focus();
}
});
//
this.loadInboundDetails();
}

Loading…
Cancel
Save