Browse Source

小修改

master
常熟吴彦祖 1 month ago
parent
commit
9983771ce7
  1. 4
      src/api/haianAutoWarehouse/palletSpecialEdit.js
  2. 74
      src/views/modules/haianAutoWarehouse/haianPalletSpecialEdit.vue

4
src/api/haianAutoWarehouse/palletSpecialEdit.js

@ -3,10 +3,10 @@ import { createAPI } from "@/utils/httpRequest.js";
// 海安栈板特殊修改:扫描托盘,回显任务标记、区域、位置和是否在货架 - rqrq
export const scanPalletForSpecialEdit = data => createAPI(`/haiAnWcsIntegration/scanPalletForSpecialEdit`, 'post', data)
// 海安栈板特殊修改:在货架为是时位置同时写入location_code和wcs_location,为否时清空wcs_location - rqrq
// 海安栈板特殊修改:位置为空时区域、位置及货架点位统一置NULL,其余有效字段交服务校验保存 - rqrq
export const savePalletSpecialEdit = data => createAPI(`/haiAnWcsIntegration/savePalletSpecialEdit`, 'post', data)
// 海安栈板特殊修改:强制移除非立库栈板,只清空区域和位置,货架点位有值时后端拒绝 - rqrq
// 海安栈板特殊修改:沿用既有接口路径执行强制置空,清空位置并将任务标记置N;货架占用由后端拒绝 - rqrq
export const forceRemovePalletSpecialEdit = data => createAPI(`/haiAnWcsIntegration/forceRemovePalletSpecialEdit`, 'post', data)
// 海安栈板特殊修改:非立库区域查询全部地面站点,供所在位置下拉 - rqrq

74
src/views/modules/haianAutoWarehouse/haianPalletSpecialEdit.vue

@ -41,7 +41,7 @@
</div>
<div class="form-row">
<label class="input-label">所在区域</label>
<el-select v-model="form.areaId" placeholder="请选择所在区域" filterable style="width: 100%;" :disabled="pageBusy" @change="handleAreaChange">
<el-select v-model="form.areaId" placeholder="请选择所在区域" filterable clearable style="width: 100%;" :disabled="pageBusy" @change="handleAreaChange">
<el-option
v-for="area in areaOptions"
:key="area.areaId"
@ -97,16 +97,17 @@
</div>
<!-- 保存前确认;成功后按同一栈板再查一次,回显数据库里的最新值 - rqrq -->
<div class="bottom-actions">
<button class="action-btn primary" :disabled="saveLoading || pageBusy" @click="handleSave">
{{ saveLoading ? '保存中...' : '保存' }}
</button>
<!-- 强制移除只清空所在区域与位置;扫描发现wcs_location有值时禁用,提交时后端再次校验 - rqrq -->
<!-- 强制置空清空区域、位置和货架点位并释放任务标记;扫描发现货架占用时禁用,后端再次校验 - rqrq -->
<button class="action-btn danger" :disabled="pageBusy || wcsOccupied" @click="handleForceRemove">
{{ removeLoading ? '移除中...' : '强制移除托盘' }}
{{ removeLoading ? '置空中...' : '强制置空托盘' }}
</button>
<div v-if="wcsOccupied" class="hint">托盘在立库货架内,不能强制移除。</div>
<div v-if="wcsOccupied" class="hint">托盘在立库货架内,不能强制置空。</div>
</div>
</div>
</div>
@ -128,7 +129,7 @@ export default {
scanned: false,
scanLoading: false,
saveLoading: false,
// 移除中锁定重复操作;wcsOccupied保存扫描时的真实货架状态,不受表单选择影响 - rqrq
// 置空中锁定重复操作;wcsOccupied保存扫描时的真实货架状态,不受表单选择影响 - rqrq
removeLoading: false,
wcsOccupied: false,
stationLoading: false,
@ -146,7 +147,7 @@ export default {
}
},
computed: {
// 扫描、保存和强制移除时锁整页;拉站点不锁整页,避免禁用其它字段 - rqrq
// 扫描、保存和强制置空时锁整页;拉站点不锁整页,避免禁用其它字段 - rqrq
pageBusy() {
return this.scanLoading || this.saveLoading || this.removeLoading
},
@ -229,7 +230,7 @@ export default {
},
// 把扫描结果写进表单;区域列表为空时仍保留当前区域编码,避免下拉空白 - rqrq
applyScanResult(row, scannedCode) {
// 货架占用由后端根据wcs_location生成,独立保存以免用户修改表单后误开放移除按钮 - rqrq
// 货架占用由后端根据wcs_location生成,独立保存以免用户修改表单后误开放强制置空按钮 - rqrq
this.wcsOccupied = row.onShelfFlag === 'Y'
this.form = {
palletId: row.palletId || scannedCode,
@ -292,34 +293,33 @@ export default {
}
})
},
// 保存前校验页面必填项;在货架为是时位置不能空,为否时允许位置为空 - rqrq
// 保存只要求已扫描栈板;位置留空时连同区域、货架点位置空,任务标记与货架选择空值按N提交 - rqrq
handleSave() {
if (this.pageBusy || !this.scanned || !this.form.palletId) {
return
}
if (this.form.callingFlag !== 'Y' && this.form.callingFlag !== 'N') {
const callingFlag = this.form.callingFlag || 'N'
if (callingFlag !== 'Y' && callingFlag !== 'N') {
this.$alert('任务标记只能选择Y或N', '错误', { confirmButtonText: '确定' })
return
}
if (!this.form.areaId) {
this.$alert('请选择所在区域', '错误', { confirmButtonText: '确定' })
return
}
const locationCode = (this.form.locationCode || '').trim()
if (this.form.onShelfFlag === 'Y' && !locationCode) {
this.$alert('选择在货架时,所在位置不能为空', '错误', { confirmButtonText: '确定' })
return
}
if (this.form.onShelfFlag !== 'Y' && this.form.onShelfFlag !== 'N') {
this.$alert('请选择是否在货架', '错误', { confirmButtonText: '确定' })
if (this.form.onShelfFlag && this.form.onShelfFlag !== 'Y' && this.form.onShelfFlag !== 'N') {
this.$alert('是否在货架只能选择是或否', '错误', { confirmButtonText: '确定' })
return
}
const shelfText = this.form.onShelfFlag === 'Y' ? '是,所在位置会同时写入货架点位' : '否,货架点位会被清空'
// 位置空时无论页面选了什么区域均以NULL保存;有位置但无区域时保留位置,货架标记固定N避免无区域占用货架 - rqrq
const areaId = locationCode ? ((this.form.areaId || '').trim() || null) : null
const onShelfFlag = locationCode && areaId && this.isStockArea && this.form.onShelfFlag === 'Y' ? 'Y' : 'N'
const saveFields = { callingFlag, areaId, locationCode: locationCode || null, onShelfFlag }
const saveText = !locationCode
? '所在区域、位置和货架点位将置空'
: (!areaId ? '所在区域和货架点位将置空' : (onShelfFlag === 'Y' ? '所在位置会同时写入货架点位' : '货架点位会被清空'))
const batchWcsFlag = this.normalizeBatchWcsFlag()
if (batchWcsFlag === 0 || batchWcsFlag === 1) {
const markText = batchWcsFlag === 1 ? '增量,表示未推送给立库' : '非增量,表示已经推送给立库'
this.$confirm(
'<div class="danger-mark-text">该标记请慎重修改,可能会影响武工那边库存</div><div class="danger-mark-sub">当前选择:' + markText + '</div>',
'<div class="danger-mark-text">该标记请慎重修改,可能会影响武工那边库存</div><div class="danger-mark-sub">当前选择:' + markText + ';' + saveText + '</div>',
'危险操作',
{
confirmButtonText: '已知晓',
@ -331,16 +331,16 @@ export default {
closeOnPressEscape: false
}
).then(() => {
this.submitSave(locationCode, batchWcsFlag)
this.submitSave(saveFields, batchWcsFlag)
}).catch(() => {})
return
}
this.$confirm(
'确定保存栈板【' + this.form.palletId + '】吗?是否在货架:' + shelfText + '。',
'确定保存栈板【' + this.form.palletId + '】吗?' + saveText + '。',
'栈板特殊修改',
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
).then(() => {
this.submitSave(locationCode, null)
this.submitSave(saveFields, null)
}).catch(() => {})
},
// 空值不改明细;只接受增量1和非增量0 - rqrq
@ -356,17 +356,17 @@ export default {
}
return null
},
// 保存成功后按同一栈板再查一次,确认页面和数据库一致 - rqrq
submitSave(locationCode, batchWcsFlag) {
// 使用确认时固定的区域、位置和货架标记提交,避免弹窗期间表单变化导致预览与落库不一致;失败不刷新 - rqrq
submitSave(saveFields, batchWcsFlag) {
this.site = this.$store.state.user.site
this.saveLoading = true
const payload = {
site: this.site,
palletId: this.form.palletId,
callingFlag: this.form.callingFlag,
areaId: this.form.areaId,
locationCode: locationCode,
onShelfFlag: this.form.onShelfFlag
callingFlag: saveFields.callingFlag,
areaId: saveFields.areaId,
locationCode: saveFields.locationCode,
onShelfFlag: saveFields.onShelfFlag
}
if (batchWcsFlag === 0 || batchWcsFlag === 1) {
payload.batchWcsFlag = batchWcsFlag
@ -384,14 +384,14 @@ export default {
this.saveLoading = false
})
},
// 强制移除前确认托盘编号;请求只传site和palletId,货架占用由服务端实时判断 - rqrq
// 强制置空前确认托盘编号;请求只传site和palletId,货架占用由服务端实时判断,成功后重新回显任务标记 - rqrq
async handleForceRemove () {
if (this.pageBusy || !this.scanned || !this.form.palletId || this.wcsOccupied) {
return
}
this.removeLoading = true
try {
await this.$confirm('确认强制移除托盘【' + this.form.palletId + '】?此操作会清空所在区域和位置。', '强制移除托盘', {
await this.$confirm('确认强制置空托盘【' + this.form.palletId + '】?此操作会清空区域、位置、货架点位及占用备注,并将任务标记改为N。', '强制置空托盘', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
@ -404,20 +404,20 @@ export default {
palletId: this.form.palletId
})
if (data && data.code === 0) {
this.$message.success(data.msg || '强制移除托盘成功')
this.reloadAfterSave('移除')
this.$message.success(data.msg || '强制置空托盘成功')
this.reloadAfterSave('置空')
} else {
this.$alert((data && data.msg) || '强制移除托盘失败', '错误', { confirmButtonText: '确定' })
this.$alert((data && data.msg) || '强制置空托盘失败', '错误', { confirmButtonText: '确定' })
}
} catch (error) {
if (error !== 'cancel' && error !== 'close') {
this.$message.error((error && error.message) || '强制移除托盘失败')
this.$message.error((error && error.message) || '强制置空托盘失败')
}
} finally {
this.removeLoading = false
}
},
// 保存或移除后重查同一托盘,页面回显数据库最新区域与位置;刷新失败提示当前操作名称 - rqrq
// 保存或置空后重查同一托盘,页面回显数据库最新区域、位置和任务标记;刷新失败提示当前操作名称 - rqrq
reloadAfterSave (operationName = '保存') {
this.scanLoading = true
scanPalletForSpecialEdit({

Loading…
Cancel
Save