|
|
@ -127,6 +127,8 @@ export default { |
|
|
wcsOccupied: false, |
|
|
wcsOccupied: false, |
|
|
stationLoading: false, |
|
|
stationLoading: false, |
|
|
stationRequestSeq: 0, |
|
|
stationRequestSeq: 0, |
|
|
|
|
|
// 扫码及重查请求版本:离开或重新扫码后,旧响应不得覆盖当前页面 - rqrq |
|
|
|
|
|
scanRequestSeq: 0, |
|
|
areaOptions: [], |
|
|
areaOptions: [], |
|
|
stationOptions: [], |
|
|
stationOptions: [], |
|
|
form: { |
|
|
form: { |
|
|
@ -150,26 +152,38 @@ export default { |
|
|
return !!(area && area.stockArea) |
|
|
return !!(area && area.stockArea) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
if (this.$refs.palletInput) { |
|
|
|
|
|
this.$refs.palletInput.focus() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
handleBack () { |
|
|
handleBack () { |
|
|
if (this.pageBusy) { |
|
|
if (this.pageBusy) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
// 返回菜单前清空当前栈板和候选项,避免keep-alive再次进入时回显旧数据 - rqrq |
|
|
|
|
|
this.resetPage(false) |
|
|
this.$router.back() |
|
|
this.$router.back() |
|
|
}, |
|
|
}, |
|
|
goHome () { |
|
|
goHome () { |
|
|
if (this.pageBusy) { |
|
|
if (this.pageBusy) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
// 返回首页前清理缓存表单,后续重新进入必须重新扫码 - rqrq |
|
|
|
|
|
this.resetPage(false) |
|
|
this.$router.push({ path: '/' }) |
|
|
this.$router.push({ path: '/' }) |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 统一重置扫码、表单、候选项与请求状态;递增序号使离开前的查询响应不能回填缓存页面 - rqrq |
|
|
|
|
|
resetPage (needFocus = true) { |
|
|
|
|
|
this.site = this.$store.state.user.site |
|
|
|
|
|
this.scanRequestSeq += 1 |
|
|
|
|
|
this.stationRequestSeq += 1 |
|
|
|
|
|
this.palletCode = '' |
|
|
|
|
|
this.clearScan() |
|
|
|
|
|
this.scanLoading = false |
|
|
|
|
|
this.saveLoading = false |
|
|
|
|
|
this.removeLoading = false |
|
|
|
|
|
this.stationLoading = false |
|
|
|
|
|
if (needFocus) { |
|
|
|
|
|
this.focusPalletInput() |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
// 区域下拉只显示名称,不展示A01这类编码 - rqrq |
|
|
// 区域下拉只显示名称,不展示A01这类编码 - rqrq |
|
|
formatAreaLabel (area) { |
|
|
formatAreaLabel (area) { |
|
|
if (!area || !area.areaDesc) { |
|
|
if (!area || !area.areaDesc) { |
|
|
@ -201,11 +215,16 @@ export default { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.site = this.$store.state.user.site |
|
|
this.site = this.$store.state.user.site |
|
|
|
|
|
const requestSeq = this.scanRequestSeq + 1 |
|
|
|
|
|
this.scanRequestSeq = requestSeq |
|
|
this.scanLoading = true |
|
|
this.scanLoading = true |
|
|
scanPalletForSpecialEdit({ |
|
|
scanPalletForSpecialEdit({ |
|
|
site: this.site, |
|
|
site: this.site, |
|
|
palletId: scannedCode |
|
|
palletId: scannedCode |
|
|
}).then(({ data }) => { |
|
|
}).then(({ data }) => { |
|
|
|
|
|
if (this.scanRequestSeq !== requestSeq) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (data && data.code === 0 && data.row) { |
|
|
if (data && data.code === 0 && data.row) { |
|
|
this.applyScanResult(data.row, scannedCode) |
|
|
this.applyScanResult(data.row, scannedCode) |
|
|
} else { |
|
|
} else { |
|
|
@ -214,11 +233,16 @@ export default { |
|
|
this.focusPalletInput() |
|
|
this.focusPalletInput() |
|
|
} |
|
|
} |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
|
|
|
if (this.scanRequestSeq !== requestSeq) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
this.clearScan() |
|
|
this.clearScan() |
|
|
this.$message.error((error && error.message) || '栈板扫描失败') |
|
|
this.$message.error((error && error.message) || '栈板扫描失败') |
|
|
this.focusPalletInput() |
|
|
this.focusPalletInput() |
|
|
}).finally(() => { |
|
|
}).finally(() => { |
|
|
|
|
|
if (this.scanRequestSeq === requestSeq) { |
|
|
this.scanLoading = false |
|
|
this.scanLoading = false |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 把扫描结果写进表单;区域列表为空时仍保留当前区域编码,避免下拉空白 - rqrq |
|
|
// 把扫描结果写进表单;区域列表为空时仍保留当前区域编码,避免下拉空白 - rqrq |
|
|
@ -316,6 +340,8 @@ export default { |
|
|
? '所在区域、位置和货架点位将置空' |
|
|
? '所在区域、位置和货架点位将置空' |
|
|
: (!areaId ? '所在区域和货架点位将置空' : (onShelfFlag === 'Y' ? '所在位置会同时写入货架点位' : '货架点位会被清空')) |
|
|
: (!areaId ? '所在区域和货架点位将置空' : (onShelfFlag === 'Y' ? '所在位置会同时写入货架点位' : '货架点位会被清空')) |
|
|
const batchWcsFlag = this.normalizeBatchWcsFlag() |
|
|
const batchWcsFlag = this.normalizeBatchWcsFlag() |
|
|
|
|
|
// 确认框跨越页面重进或重新扫码时不再提交旧栈板,避免使用已清空的表单发请求 - rqrq |
|
|
|
|
|
const requestSeq = this.scanRequestSeq |
|
|
if (batchWcsFlag === 0 || batchWcsFlag === 1) { |
|
|
if (batchWcsFlag === 0 || batchWcsFlag === 1) { |
|
|
const markText = batchWcsFlag === 1 ? '增量,表示未推送给立库' : '非增量,表示已经推送给立库' |
|
|
const markText = batchWcsFlag === 1 ? '增量,表示未推送给立库' : '非增量,表示已经推送给立库' |
|
|
this.$confirm( |
|
|
this.$confirm( |
|
|
@ -331,7 +357,9 @@ export default { |
|
|
closeOnPressEscape: false |
|
|
closeOnPressEscape: false |
|
|
} |
|
|
} |
|
|
).then(() => { |
|
|
).then(() => { |
|
|
|
|
|
if (this.scanRequestSeq === requestSeq) { |
|
|
this.submitSave(saveFields, batchWcsFlag) |
|
|
this.submitSave(saveFields, batchWcsFlag) |
|
|
|
|
|
} |
|
|
}).catch(() => {}) |
|
|
}).catch(() => {}) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
@ -340,7 +368,9 @@ export default { |
|
|
'栈板特殊修改', |
|
|
'栈板特殊修改', |
|
|
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' } |
|
|
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' } |
|
|
).then(() => { |
|
|
).then(() => { |
|
|
|
|
|
if (this.scanRequestSeq === requestSeq) { |
|
|
this.submitSave(saveFields, null) |
|
|
this.submitSave(saveFields, null) |
|
|
|
|
|
} |
|
|
}).catch(() => {}) |
|
|
}).catch(() => {}) |
|
|
}, |
|
|
}, |
|
|
// 空值不改明细;只接受增量1和非增量0 - rqrq |
|
|
// 空值不改明细;只接受增量1和非增量0 - rqrq |
|
|
@ -359,6 +389,7 @@ export default { |
|
|
// 使用确认时固定的区域、位置和货架标记提交,避免弹窗期间表单变化导致预览与落库不一致;失败不刷新 - rqrq |
|
|
// 使用确认时固定的区域、位置和货架标记提交,避免弹窗期间表单变化导致预览与落库不一致;失败不刷新 - rqrq |
|
|
submitSave (saveFields, batchWcsFlag) { |
|
|
submitSave (saveFields, batchWcsFlag) { |
|
|
this.site = this.$store.state.user.site |
|
|
this.site = this.$store.state.user.site |
|
|
|
|
|
const requestSeq = this.scanRequestSeq |
|
|
this.saveLoading = true |
|
|
this.saveLoading = true |
|
|
const payload = { |
|
|
const payload = { |
|
|
site: this.site, |
|
|
site: this.site, |
|
|
@ -372,6 +403,9 @@ export default { |
|
|
payload.batchWcsFlag = batchWcsFlag |
|
|
payload.batchWcsFlag = batchWcsFlag |
|
|
} |
|
|
} |
|
|
savePalletSpecialEdit(payload).then(({ data }) => { |
|
|
savePalletSpecialEdit(payload).then(({ data }) => { |
|
|
|
|
|
if (this.scanRequestSeq !== requestSeq) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.$message.success(data.msg || '保存成功') |
|
|
this.$message.success(data.msg || '保存成功') |
|
|
this.reloadAfterSave() |
|
|
this.reloadAfterSave() |
|
|
@ -379,9 +413,14 @@ export default { |
|
|
this.$alert((data && data.msg) || '保存失败', '错误', { confirmButtonText: '确定' }) |
|
|
this.$alert((data && data.msg) || '保存失败', '错误', { confirmButtonText: '确定' }) |
|
|
} |
|
|
} |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
|
|
|
if (this.scanRequestSeq !== requestSeq) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
this.$message.error((error && error.message) || '保存失败') |
|
|
this.$message.error((error && error.message) || '保存失败') |
|
|
}).finally(() => { |
|
|
}).finally(() => { |
|
|
|
|
|
if (this.scanRequestSeq === requestSeq) { |
|
|
this.saveLoading = false |
|
|
this.saveLoading = false |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 强制置空前确认托盘编号;请求只传site和palletId,货架占用由服务端实时判断,成功后重新回显任务标记 - rqrq |
|
|
// 强制置空前确认托盘编号;请求只传site和palletId,货架占用由服务端实时判断,成功后重新回显任务标记 - rqrq |
|
|
@ -389,6 +428,7 @@ export default { |
|
|
if (this.pageBusy || !this.scanned || !this.form.palletId || this.wcsOccupied) { |
|
|
if (this.pageBusy || !this.scanned || !this.form.palletId || this.wcsOccupied) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
const requestSeq = this.scanRequestSeq |
|
|
this.removeLoading = true |
|
|
this.removeLoading = true |
|
|
try { |
|
|
try { |
|
|
await this.$confirm('确认强制置空托盘【' + this.form.palletId + '】?此操作会清空区域、位置、货架点位及占用备注,并将任务标记改为N。', '强制置空托盘', { |
|
|
await this.$confirm('确认强制置空托盘【' + this.form.palletId + '】?此操作会清空区域、位置、货架点位及占用备注,并将任务标记改为N。', '强制置空托盘', { |
|
|
@ -397,16 +437,25 @@ export default { |
|
|
type: 'warning', |
|
|
type: 'warning', |
|
|
closeOnClickModal: false |
|
|
closeOnClickModal: false |
|
|
}) |
|
|
}) |
|
|
|
|
|
if (this.scanRequestSeq !== requestSeq) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
// 显式传登录工厂与扫码托盘;接口失败不刷新页面,避免误示操作已成功 - rqrq |
|
|
// 显式传登录工厂与扫码托盘;接口失败不刷新页面,避免误示操作已成功 - rqrq |
|
|
this.site = this.$store.state.user.site |
|
|
this.site = this.$store.state.user.site |
|
|
const { data } = await forceRemovePalletSpecialEdit({ |
|
|
const { data } = await forceRemovePalletSpecialEdit({ |
|
|
site: this.site, |
|
|
site: this.site, |
|
|
palletId: this.form.palletId |
|
|
palletId: this.form.palletId |
|
|
}) |
|
|
}) |
|
|
|
|
|
if (this.scanRequestSeq !== requestSeq) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
// 先把页面改成置空后的库位,再按立库同步结果弹窗;同步失败也不回滚本地置空 - rqrq |
|
|
// 先把页面改成置空后的库位,再按立库同步结果弹窗;同步失败也不回滚本地置空 - rqrq |
|
|
this.applyForceRemovedForm() |
|
|
this.applyForceRemovedForm() |
|
|
await this.reloadAfterSave('置空') |
|
|
await this.reloadAfterSave('置空') |
|
|
|
|
|
if (this.scanRequestSeq !== requestSeq) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
await this.$nextTick() |
|
|
await this.$nextTick() |
|
|
const wcsSyncSuccess = !!(data.row && data.row.wcsSyncSuccess) |
|
|
const wcsSyncSuccess = !!(data.row && data.row.wcsSyncSuccess) |
|
|
if (wcsSyncSuccess) { |
|
|
if (wcsSyncSuccess) { |
|
|
@ -432,12 +481,14 @@ export default { |
|
|
this.$alert((data && data.msg) || '强制置空托盘失败', '错误', { confirmButtonText: '确定' }) |
|
|
this.$alert((data && data.msg) || '强制置空托盘失败', '错误', { confirmButtonText: '确定' }) |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
if (error !== 'cancel' && error !== 'close') { |
|
|
|
|
|
|
|
|
if (this.scanRequestSeq === requestSeq && error !== 'cancel' && error !== 'close') { |
|
|
this.$message.error((error && error.message) || '强制置空托盘失败') |
|
|
this.$message.error((error && error.message) || '强制置空托盘失败') |
|
|
} |
|
|
} |
|
|
} finally { |
|
|
} finally { |
|
|
|
|
|
if (this.scanRequestSeq === requestSeq) { |
|
|
this.removeLoading = false |
|
|
this.removeLoading = false |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
// 强制置空成功后立刻清空页面库位,避免等重查才看到变化;区域和货架一并按已释放回显 - rqrq |
|
|
// 强制置空成功后立刻清空页面库位,避免等重查才看到变化;区域和货架一并按已释放回显 - rqrq |
|
|
applyForceRemovedForm () { |
|
|
applyForceRemovedForm () { |
|
|
@ -451,20 +502,29 @@ export default { |
|
|
}, |
|
|
}, |
|
|
// 保存或置空后重查同一托盘,页面回显数据库最新区域、位置和任务标记;刷新失败提示当前操作名称 - rqrq |
|
|
// 保存或置空后重查同一托盘,页面回显数据库最新区域、位置和任务标记;刷新失败提示当前操作名称 - rqrq |
|
|
async reloadAfterSave (operationName = '保存') { |
|
|
async reloadAfterSave (operationName = '保存') { |
|
|
|
|
|
const requestSeq = this.scanRequestSeq |
|
|
|
|
|
const palletId = this.form.palletId |
|
|
this.scanLoading = true |
|
|
this.scanLoading = true |
|
|
try { |
|
|
try { |
|
|
const { data } = await scanPalletForSpecialEdit({ |
|
|
const { data } = await scanPalletForSpecialEdit({ |
|
|
site: this.site, |
|
|
site: this.site, |
|
|
palletId: this.form.palletId |
|
|
|
|
|
|
|
|
palletId: palletId |
|
|
}) |
|
|
}) |
|
|
|
|
|
if (this.scanRequestSeq !== requestSeq) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (data && data.code === 0 && data.row) { |
|
|
if (data && data.code === 0 && data.row) { |
|
|
this.applyScanResult(data.row, this.form.palletId) |
|
|
|
|
|
|
|
|
this.applyScanResult(data.row, palletId) |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
|
|
|
if (this.scanRequestSeq === requestSeq) { |
|
|
this.$message.error(operationName + '后刷新栈板失败') |
|
|
this.$message.error(operationName + '后刷新栈板失败') |
|
|
|
|
|
} |
|
|
} finally { |
|
|
} finally { |
|
|
|
|
|
if (this.scanRequestSeq === requestSeq) { |
|
|
this.scanLoading = false |
|
|
this.scanLoading = false |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
clearScan () { |
|
|
clearScan () { |
|
|
this.scanned = false |
|
|
this.scanned = false |
|
|
@ -487,6 +547,18 @@ export default { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// keep-alive每次激活均回到待扫码状态,避免再次进入时展示上次栈板 - rqrq |
|
|
|
|
|
activated () { |
|
|
|
|
|
this.resetPage(true) |
|
|
|
|
|
}, |
|
|
|
|
|
// 离开页面时清理缓存并使未完成查询失效,防止旧响应在下次进入后回填 - rqrq |
|
|
|
|
|
beforeRouteLeave (to, from, next) { |
|
|
|
|
|
this.resetPage(false) |
|
|
|
|
|
next() |
|
|
|
|
|
}, |
|
|
|
|
|
mounted () { |
|
|
|
|
|
this.resetPage(true) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|