|
|
|
@ -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('操作成功'); |
|
|
|
} else { |
|
|
|
this.$message.warning('未找到该标签'); |
|
|
|
} |
|
|
|
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.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(); |
|
|
|
|