|
|
|
@ -186,34 +186,32 @@ export default { |
|
|
|
this.$router.back() |
|
|
|
}, |
|
|
|
|
|
|
|
// 处理托盘编码(去掉末尾R/L)- rqrq |
|
|
|
processPalletCode(palletCode) { |
|
|
|
if (palletCode && palletCode.length > 0) { |
|
|
|
const lastChar = palletCode.charAt(palletCode.length - 1) |
|
|
|
if (lastChar === 'R' || lastChar === 'L' || lastChar === 'r' || lastChar === 'l') { |
|
|
|
return palletCode.substring(0, palletCode.length - 1) |
|
|
|
// 处理扫描输入(去掉所有空格)- rqrq |
|
|
|
processScanInput(input) { |
|
|
|
if (input) { |
|
|
|
// 去掉所有空格(包括中间的空格)- rqrq |
|
|
|
return input.replace(/\s+/g, '') |
|
|
|
} |
|
|
|
} |
|
|
|
return palletCode |
|
|
|
return input |
|
|
|
}, |
|
|
|
|
|
|
|
// 来源托盘扫描 - rqrq |
|
|
|
handleSourcePalletScan() { |
|
|
|
if (!this.sourcePalletCode.trim()) { |
|
|
|
// 去掉所有空格 - rqrq |
|
|
|
const scannedCode = this.processScanInput(this.sourcePalletCode) |
|
|
|
if (!scannedCode) { |
|
|
|
this.$message.error('请输入来源托盘编码') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 处理托盘编码 - rqrq |
|
|
|
const processedCode = this.processPalletCode(this.sourcePalletCode.trim()) |
|
|
|
this.sourcePalletCode = processedCode |
|
|
|
|
|
|
|
// 校验来源托盘 - rqrq |
|
|
|
// 校验来源托盘(后台会处理LR并返回真实托盘号)- rqrq |
|
|
|
checkPalletForMerge({ |
|
|
|
site: this.site, |
|
|
|
palletId: processedCode |
|
|
|
palletId: scannedCode |
|
|
|
}).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
// 使用后台返回的真实托盘号更新输入框 - rqrq |
|
|
|
this.sourcePalletCode = data.palletId || scannedCode |
|
|
|
this.sourceValidated = true |
|
|
|
this.sourcePalletType = data.palletType || '' |
|
|
|
this.sourceTypeDesc = data.typeDesc || '' |
|
|
|
@ -286,37 +284,39 @@ export default { |
|
|
|
|
|
|
|
// 目标托盘扫描 - rqrq |
|
|
|
handleTargetPalletScan() { |
|
|
|
if (!this.targetPalletCode.trim()) { |
|
|
|
// 去掉所有空格 - rqrq |
|
|
|
const scannedCode = this.processScanInput(this.targetPalletCode) |
|
|
|
if (!scannedCode) { |
|
|
|
this.$message.error('请输入目标托盘编码') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 处理托盘编码 - rqrq |
|
|
|
const processedCode = this.processPalletCode(this.targetPalletCode.trim()) |
|
|
|
this.targetPalletCode = processedCode |
|
|
|
|
|
|
|
// 不能和来源托盘相同 - rqrq |
|
|
|
if (this.sourcePalletCode && processedCode === this.sourcePalletCode) { |
|
|
|
this.$message.error('目标托盘不能与来源托盘相同') |
|
|
|
this.targetPalletCode = '' |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 先校验目标托盘是否存在 - rqrq |
|
|
|
// 先校验目标托盘是否存在(后台会处理LR并返回真实托盘号)- rqrq |
|
|
|
checkPalletForMerge({ |
|
|
|
site: this.site, |
|
|
|
palletId: processedCode |
|
|
|
palletId: scannedCode |
|
|
|
}).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
// 使用后台返回的真实托盘号 - rqrq |
|
|
|
const realPalletId = data.palletId || scannedCode |
|
|
|
const palletType = data.palletType || '' |
|
|
|
const typeDesc = data.typeDesc || '' |
|
|
|
|
|
|
|
// 不能和来源托盘相同(使用真实托盘号比较)- rqrq |
|
|
|
if (this.sourcePalletCode && realPalletId === this.sourcePalletCode) { |
|
|
|
this.$message.error('目标托盘不能与来源托盘相同') |
|
|
|
this.targetPalletCode = '' |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 再校验目标托盘是否为混装托盘(wcs_auto_sort = 'N')- rqrq |
|
|
|
checkTargetPalletType({ |
|
|
|
site: this.site, |
|
|
|
palletType: palletType |
|
|
|
}).then(({ data: typeData }) => { |
|
|
|
if (typeData && typeData.code === 0) { |
|
|
|
// 更新输入框为真实托盘号 - rqrq |
|
|
|
this.targetPalletCode = realPalletId |
|
|
|
this.targetValidated = true |
|
|
|
this.targetPalletType = palletType |
|
|
|
this.targetTypeDesc = typeDesc |
|
|
|
|