|
|
@ -184,7 +184,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { getOutboundDetails, validateLabelWithOutbound, confirmSalesOutbound, getMaterialList } from "@/api/sales/sales-outbound.js"; |
|
|
|
|
|
|
|
|
import { getOutboundDetails, validateLabelWithOutbound, confirmSalesOutbound, getMaterialList, getScannedLabelList } from "@/api/sales/sales-outbound.js"; |
|
|
import { getCurrentWarehouse } from '@/utils' |
|
|
import { getCurrentWarehouse } from '@/utils' |
|
|
import moment from 'moment'; |
|
|
import moment from 'moment'; |
|
|
|
|
|
|
|
|
@ -195,6 +195,8 @@ export default { |
|
|
outboundInfo: {}, |
|
|
outboundInfo: {}, |
|
|
labelList: [], |
|
|
labelList: [], |
|
|
outboundNo: '', |
|
|
outboundNo: '', |
|
|
|
|
|
relatedNo: '', |
|
|
|
|
|
relatedLineNo: '', |
|
|
showMaterialDialog: false, |
|
|
showMaterialDialog: false, |
|
|
materialList: [], |
|
|
materialList: [], |
|
|
materialListLoading: false, |
|
|
materialListLoading: false, |
|
|
@ -220,36 +222,23 @@ export default { |
|
|
this.scanCode = ''; |
|
|
this.scanCode = ''; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 验证标签并添加到列表 |
|
|
|
|
|
|
|
|
// 验证标签并添加到列表(调用存储过程) |
|
|
validateAndAddLabel(labelCode) { |
|
|
validateAndAddLabel(labelCode) { |
|
|
const params = { |
|
|
const params = { |
|
|
labelCode: labelCode, |
|
|
labelCode: labelCode, |
|
|
outboundNo: this.outboundNo, |
|
|
outboundNo: this.outboundNo, |
|
|
warehouseId: getCurrentWarehouse(), |
|
|
|
|
|
|
|
|
relatedNo: this.relatedNo, |
|
|
|
|
|
relatedLineNo: this.relatedLineNo, |
|
|
site: localStorage.getItem('site'), |
|
|
site: localStorage.getItem('site'), |
|
|
buNo: this.buNo |
|
|
|
|
|
|
|
|
buNo: this.buNo, |
|
|
|
|
|
operationType: 'I', // 添加标签 |
|
|
|
|
|
warehouseId: getCurrentWarehouse() // 当前仓库 |
|
|
}; |
|
|
}; |
|
|
validateLabelWithOutbound(params).then(({ data }) => { |
|
|
validateLabelWithOutbound(params).then(({ data }) => { |
|
|
if (data && data.code === 0) { |
|
|
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 { |
|
|
} else { |
|
|
this.$message.error(data.msg || '该标签与出库单不符,请检查'); |
|
|
this.$message.error(data.msg || '该标签与出库单不符,请检查'); |
|
|
} |
|
|
} |
|
|
@ -259,35 +248,51 @@ export default { |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 通过条码移除标签 |
|
|
|
|
|
|
|
|
// 通过条码移除标签(调用存储过程) |
|
|
removeLabelByCode(labelCode) { |
|
|
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() { |
|
|
confirmOutbound() { |
|
|
if (this.labelList.length === 0) { |
|
|
if (this.labelList.length === 0) { |
|
|
this.$message.warning('请先扫描标签'); |
|
|
this.$message.warning('请先扫描标签'); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取库位(使用第一个标签的库位,如果有的话) |
|
|
|
|
|
const locationCode = this.labelList.length > 0 && this.labelList[0].locationId |
|
|
|
|
|
? this.labelList[0].locationId |
|
|
|
|
|
: ''; |
|
|
|
|
|
|
|
|
const params = { |
|
|
const params = { |
|
|
site: this.outboundInfo.site, |
|
|
site: this.outboundInfo.site, |
|
|
buNo: this.outboundInfo.buNo, |
|
|
buNo: this.outboundInfo.buNo, |
|
|
outboundNo: this.outboundNo, |
|
|
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 |
|
|
}; |
|
|
}; |
|
|
confirmSalesOutbound(params).then(({ data }) => { |
|
|
confirmSalesOutbound(params).then(({ data }) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
@ -382,6 +387,15 @@ export default { |
|
|
getOutboundDetails(params).then(({ data }) => { |
|
|
getOutboundDetails(params).then(({ data }) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.outboundInfo = data.data; |
|
|
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 { |
|
|
} else { |
|
|
this.$message.error(data.msg || '获取出库单详情失败'); |
|
|
this.$message.error(data.msg || '获取出库单详情失败'); |
|
|
} |
|
|
} |
|
|
@ -389,6 +403,36 @@ export default { |
|
|
console.error('获取出库单详情失败:', error); |
|
|
console.error('获取出库单详情失败:', error); |
|
|
this.$message.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 = []; |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|