Browse Source

2025-12-26

pda其他出库调用存储过程,且调用erp接口
master
fengyuan_yang 3 weeks ago
parent
commit
13b8bd8dea
  1. 6
      src/api/other-outbound/other-outbound.js
  2. 136
      src/views/modules/other-inout/otherOutboundDetail.vue

6
src/api/other-outbound/other-outbound.js

@ -29,3 +29,9 @@ export const confirmOtherOutbound = data => createAPI(`otherOutbound/confirmOthe
* @param {Object} data - 查询参数 {site, buNo, outboundNo}
*/
export const getMaterialList = data => createAPI(`otherOutbound/getMaterialList`, 'post', data)
/**
* 获取已扫描标签列表从临时表
* @param {Object} data - 查询参数 {site, buNo, outboundNo, relatedNo, relatedLineNo}
*/
export const getScannedLabelList = data => createAPI(`otherOutbound/getScannedLabelList`, 'post', data)

136
src/views/modules/other-inout/otherOutboundDetail.vue

@ -102,9 +102,6 @@
<!-- 底部操作按钮 -->
<div class="bottom-actions">
<button class="action-btn secondary" @click="confirmOutbound">确定</button>
<button class="action-btn secondary" style="margin-left: 10px;" @click="printLabels">
打印
</button>
<button class="action-btn secondary" style="margin-left: 10px;" @click="cancelOutbound">
取消
</button>
@ -208,7 +205,7 @@
</template>
<script>
import { getOtherOutboundDetails, validateLabelWithOutbound, confirmOtherOutbound, getMaterialList } from "@/api/other-outbound/other-outbound.js";
import { getOtherOutboundDetails, validateLabelWithOutbound, confirmOtherOutbound, getMaterialList, getScannedLabelList } from "@/api/other-outbound/other-outbound.js";
import { getInventoryStock } from "@/api/inbound.js";
import { getCurrentWarehouse } from '@/utils'
import moment from 'moment';
@ -220,6 +217,8 @@ export default {
outboundInfo: {},
labelList: [],
outboundNo: '',
relatedNo: '',
relatedLineNo: '',
showMaterialDialog: false,
materialList: [],
materialListLoading: false,
@ -231,8 +230,7 @@ export default {
//
showPartNameTooltip: false,
currentPartName: '',
tooltipStyle: { top: '0px', left: '0px' },
relatedNo: ''
tooltipStyle: { top: '0px', left: '0px' }
};
},
methods: {
@ -254,33 +252,23 @@ export default {
this.scanCode = '';
},
//
//
validateAndAddLabel(labelCode) {
const params = {
labelCode: labelCode,
outboundNo: this.outboundNo,
warehouseId: getCurrentWarehouse(),
relatedNo: this.relatedNo,
relatedLineNo: this.relatedLineNo,
site: localStorage.getItem('site'),
buNo: this.buNo
buNo: this.buNo,
operationType: 'I', //
warehouseId: getCurrentWarehouse()
};
validateLabelWithOutbound(params).then(({ data }) => {
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,
locationId: data.data.locationId
});
this.$message.success('操作成功');
this.$message.success('标签添加成功');
//
this.loadScannedLabelList();
} else {
this.$message.error(data.msg || '该标签与出库单不符,请检查');
}
@ -290,35 +278,51 @@ export default {
});
},
//
//
removeLabelByCode(labelCode) {
const index = this.labelList.findIndex(item => item.labelCode === labelCode);
if (index !== -1) {
this.labelList.splice(index, 1);
this.$message.success('操作成功');
const params = {
labelCode: labelCode,
outboundNo: this.outboundNo,
relatedNo: this.relatedNo,
relatedLineNo: this.relatedLineNo,
site: localStorage.getItem('site'),
buNo: this.buNo,
operationType: 'D', //
warehouseId: getCurrentWarehouse()
};
validateLabelWithOutbound(params).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('标签移除成功');
//
this.loadScannedLabelList();
} else {
this.$message.warning('未找到该标签');
this.$message.error(data.msg || '移除失败');
}
}).catch(error => {
console.error('标签移除失败:', error);
this.$message.error('移除失败');
});
},
//
//
confirmOutbound() {
if (this.labelList.length === 0) {
this.$message.warning('请先扫描标签');
return;
}
// 使
const locationCode = this.labelList.length > 0 && this.labelList[0].locationId
? this.labelList[0].locationId
: '';
const params = {
site: this.outboundInfo.site,
buNo: this.outboundInfo.buNo,
outboundNo: this.outboundNo,
warehouseId: getCurrentWarehouse(),
labels: this.labelList.map(label => ({
labelCode: label.labelCode,
partNo: label.partNo,
quantity: label.quantity,
batchNo: label.batchNo,
locationId: label.locationId
}))
relatedNo: this.relatedNo,
relatedLineNo: this.relatedLineNo,
locationCode: locationCode
};
confirmOtherOutbound(params).then(({ data }) => {
if (data && data.code === 0) {
@ -333,16 +337,6 @@ export default {
});
},
//
printLabels() {
if (this.labelList.length === 0) {
this.$message.warning('暂无标签可打印');
return;
}
this.$message.warning('打印功能开发中...');
},
//
cancelOutbound() {
if (this.labelList.length > 0) {
@ -463,6 +457,15 @@ export default {
getOtherOutboundDetails(params).then(({ data }) => {
if (data && data.code === 0) {
this.outboundInfo = data.data;
//
if (data.data.relatedNo) {
this.relatedNo = data.data.relatedNo;
}
if (data.data.relatedLineNo) {
this.relatedLineNo = data.data.relatedLineNo;
}
//
this.loadScannedLabelList();
} else {
this.$message.error(data.msg || '获取出库单详情失败');
}
@ -470,6 +473,36 @@ export default {
console.error('获取出库单详情失败:', error);
this.$message.error('获取出库单详情失败');
});
},
//
loadScannedLabelList() {
const params = {
site: localStorage.getItem('site'),
buNo: this.buNo,
outboundNo: this.outboundNo,
relatedNo: this.relatedNo,
relatedLineNo: this.relatedLineNo
};
getScannedLabelList(params).then(({ data }) => {
if (data && data.code === 0) {
this.labelList = (data.data || []).map(item => ({
id: Date.now() + Math.random(),
labelCode: item.labelCode || item.RollNo,
partNo: item.partNo || item.part_no,
quantity: item.quantity || item.RollQty,
batchNo: item.batchNo || '',
locationId: item.locationId || ''
}));
} else {
console.error('获取已扫描标签列表失败:', data.msg);
this.labelList = [];
}
}).catch(error => {
console.error('获取已扫描标签列表失败:', error);
this.labelList = [];
});
}
},
@ -477,7 +510,8 @@ export default {
//
this.outboundNo = this.$route.params.outboundNo;
this.buNo = this.$route.params.buNo;
this.relatedNo = this.$route.params.relatedNo;
this.relatedNo = this.$route.params.relatedNo || '';
this.relatedLineNo = this.$route.params.relatedLineNo || '';
if (!this.outboundNo || !this.buNo) {
this.$message.error('参数错误');
this.$router.back();

Loading…
Cancel
Save