|
|
@ -156,7 +156,7 @@ |
|
|
<script> |
|
|
<script> |
|
|
import { getCurrentWarehouse } from '@/utils' |
|
|
import { getCurrentWarehouse } from '@/utils' |
|
|
import moment from 'moment' |
|
|
import moment from 'moment' |
|
|
import { searchIssueOrders, getOrderDetail, scanLabel, submitIssueReturn } from '@/api/production/production-issue-return.js' |
|
|
|
|
|
|
|
|
import { searchIssueOrders, getOrderDetail, validateLabel, getScannedLabelList, confirmSave } from '@/api/production/production-issue-return.js' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
@ -194,6 +194,9 @@ export default { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 加载已扫描标签列表 |
|
|
|
|
|
this.loadScannedLabelList() |
|
|
|
|
|
|
|
|
// 聚焦到扫描输入框 |
|
|
// 聚焦到扫描输入框 |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
if (this.$refs.scanInput) { |
|
|
if (this.$refs.scanInput) { |
|
|
@ -219,61 +222,96 @@ export default { |
|
|
|
|
|
|
|
|
// 添加标签 |
|
|
// 添加标签 |
|
|
addLabel(labelCode) { |
|
|
addLabel(labelCode) { |
|
|
// 检查是否已存在 |
|
|
|
|
|
const exists = this.labelList.find(item => item.labelCode === labelCode) |
|
|
|
|
|
if (exists) { |
|
|
|
|
|
this.$message.warning('该标签已扫描') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const currentWarehouse = getCurrentWarehouse() |
|
|
const currentWarehouse = getCurrentWarehouse() |
|
|
if (!currentWarehouse) { |
|
|
if (!currentWarehouse) { |
|
|
this.$message.error('请先选择仓库') |
|
|
this.$message.error('请先选择仓库') |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 调用后端接口获取标签信息 |
|
|
|
|
|
|
|
|
// 调用存储过程验证标签 |
|
|
const params = { |
|
|
const params = { |
|
|
site: localStorage.getItem('site'), |
|
|
site: localStorage.getItem('site'), |
|
|
buNo: this.buNo, // 使用从路由参数获取的buNo |
|
|
|
|
|
warehouseId: currentWarehouse, |
|
|
|
|
|
labelCode: labelCode |
|
|
|
|
|
|
|
|
buNo: this.buNo, |
|
|
|
|
|
returnOrderNo: this.returnOrderNo, |
|
|
|
|
|
issueOrderNo: this.issueOrderNo || '', |
|
|
|
|
|
operationSeq: this.operationSeq || '', |
|
|
|
|
|
labelCode: labelCode, |
|
|
|
|
|
operationType: 'I', // 添加 |
|
|
|
|
|
userName: localStorage.getItem('userName'), |
|
|
|
|
|
warehouseId: currentWarehouse |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
scanLabel(params).then(({ data }) => { |
|
|
|
|
|
if (data && data.code === 0 && data.labelInfo) { |
|
|
|
|
|
const newLabel = { |
|
|
|
|
|
id: Date.now(), |
|
|
|
|
|
labelCode: labelCode, |
|
|
|
|
|
partNo: data.labelInfo.partNo, |
|
|
|
|
|
partDesc: data.labelInfo.partDesc, |
|
|
|
|
|
quantity: data.labelInfo.quantity, |
|
|
|
|
|
rollNo: data.labelInfo.rollNo, |
|
|
|
|
|
warehouseId: data.labelInfo.warehouseId, |
|
|
|
|
|
locationId: data.labelInfo.locationId |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.labelList.unshift(newLabel) |
|
|
|
|
|
|
|
|
validateLabel(params).then(({ data }) => { |
|
|
|
|
|
if (data && data.code === 0) { |
|
|
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) |
|
|
|
|
|
this.$message.error('标签信息获取失败') |
|
|
|
|
|
|
|
|
console.error('添加标签失败:', error) |
|
|
|
|
|
this.$message.error('标签添加失败') |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 移除标签 |
|
|
// 移除标签 |
|
|
removeLabel(labelCode) { |
|
|
removeLabel(labelCode) { |
|
|
const index = this.labelList.findIndex(item => item.labelCode === labelCode) |
|
|
|
|
|
if (index === -1) { |
|
|
|
|
|
this.$message.warning('未找到该标签') |
|
|
|
|
|
|
|
|
const currentWarehouse = getCurrentWarehouse() |
|
|
|
|
|
if (!currentWarehouse) { |
|
|
|
|
|
this.$message.error('请先选择仓库') |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.labelList.splice(index, 1) |
|
|
|
|
|
this.$message.success('标签移除成功') |
|
|
|
|
|
|
|
|
// 调用存储过程移除标签 |
|
|
|
|
|
const params = { |
|
|
|
|
|
site: localStorage.getItem('site'), |
|
|
|
|
|
buNo: this.buNo, |
|
|
|
|
|
returnOrderNo: this.returnOrderNo, |
|
|
|
|
|
issueOrderNo: this.issueOrderNo || '', |
|
|
|
|
|
operationSeq: this.operationSeq || '', |
|
|
|
|
|
labelCode: labelCode, |
|
|
|
|
|
operationType: 'D', // 移除 |
|
|
|
|
|
userName: localStorage.getItem('userName'), |
|
|
|
|
|
warehouseId: currentWarehouse |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
validateLabel(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('标签移除失败') |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 加载已扫描标签列表 |
|
|
|
|
|
loadScannedLabelList() { |
|
|
|
|
|
const params = { |
|
|
|
|
|
site: localStorage.getItem('site'), |
|
|
|
|
|
buNo: this.buNo, |
|
|
|
|
|
returnOrderNo: this.returnOrderNo |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getScannedLabelList(params).then(({ data }) => { |
|
|
|
|
|
if (data && data.code === 0) { |
|
|
|
|
|
this.labelList = (data.labelList || []).map((item, index) => ({ |
|
|
|
|
|
id: Date.now() + index, |
|
|
|
|
|
labelCode: item.labelCode || item.rollNo, |
|
|
|
|
|
partNo: item.partNo, |
|
|
|
|
|
quantity: item.quantity || item.rollQty |
|
|
|
|
|
})) |
|
|
|
|
|
} else { |
|
|
|
|
|
console.error('加载标签列表失败:', data.msg) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
console.error('加载标签列表失败:', error) |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 搜索领料工单(模糊查询,返回top3) |
|
|
// 搜索领料工单(模糊查询,返回top3) |
|
|
@ -401,12 +439,6 @@ export default { |
|
|
|
|
|
|
|
|
// 提交领退料 |
|
|
// 提交领退料 |
|
|
submitIssueReturn() { |
|
|
submitIssueReturn() { |
|
|
const currentWarehouse = getCurrentWarehouse() |
|
|
|
|
|
if (!currentWarehouse) { |
|
|
|
|
|
this.$message.error('请先选择仓库') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.submitting) { |
|
|
if (this.submitting) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
@ -415,27 +447,16 @@ export default { |
|
|
|
|
|
|
|
|
const params = { |
|
|
const params = { |
|
|
site: localStorage.getItem('site'), |
|
|
site: localStorage.getItem('site'), |
|
|
buNo: this.buNo, // 使用从路由参数获取的buNo |
|
|
|
|
|
warehouseId: currentWarehouse, |
|
|
|
|
|
userName: localStorage.getItem('userName'), |
|
|
|
|
|
|
|
|
buNo: this.buNo, |
|
|
returnOrderNo: this.returnOrderNo, |
|
|
returnOrderNo: this.returnOrderNo, |
|
|
issueOrderNo: this.issueOrderNo, |
|
|
issueOrderNo: this.issueOrderNo, |
|
|
operationSeq: this.operationSeq, |
|
|
operationSeq: this.operationSeq, |
|
|
operationName: this.operationName, |
|
|
|
|
|
remark: this.remark, |
|
|
|
|
|
labelList: this.labelList.map(label => ({ |
|
|
|
|
|
labelCode: label.labelCode, |
|
|
|
|
|
rollNo: label.rollNo, |
|
|
|
|
|
partNo: label.partNo, |
|
|
|
|
|
partDesc: label.partDesc, |
|
|
|
|
|
quantity: label.quantity, |
|
|
|
|
|
warehouseId: label.warehouseId, |
|
|
|
|
|
locationId: label.locationId |
|
|
|
|
|
})) |
|
|
|
|
|
|
|
|
locationCode: '', // 库位,如果需要可以添加输入框 |
|
|
|
|
|
userName: localStorage.getItem('userName') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 调用后端接口提交(退仓+领料申请+过账+回传ERP) |
|
|
|
|
|
submitIssueReturn(params).then(({ data }) => { |
|
|
|
|
|
|
|
|
// 调用存储过程保存 |
|
|
|
|
|
confirmSave(params).then(({ data }) => { |
|
|
this.submitting = false |
|
|
this.submitting = false |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.$message.success('提交成功') |
|
|
this.$message.success('提交成功') |
|
|
|