|
|
|
@ -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"> |
|
|
|
<el-select v-model="form.areaId" placeholder="请选择所在区域" filterable style="width: 100%;" :disabled="pageBusy" @change="handleAreaChange"> |
|
|
|
<el-option |
|
|
|
v-for="area in areaOptions" |
|
|
|
:key="area.areaId" |
|
|
|
@ -52,22 +52,50 @@ |
|
|
|
</div> |
|
|
|
<div class="form-row"> |
|
|
|
<label class="input-label">所在位置</label> |
|
|
|
<!-- 立库用手输货架或点位;其它区域改成该区域全部站点下拉 - rqrq --> |
|
|
|
<el-input |
|
|
|
v-if="isStockArea" |
|
|
|
v-model="form.locationCode" |
|
|
|
placeholder="请输入所在位置" |
|
|
|
class="form-input" |
|
|
|
clearable |
|
|
|
:disabled="pageBusy" |
|
|
|
/> |
|
|
|
<el-select |
|
|
|
v-else |
|
|
|
v-model="form.locationCode" |
|
|
|
:placeholder="stationLoading ? '站点加载中' : '请选择所在位置'" |
|
|
|
filterable |
|
|
|
clearable |
|
|
|
style="width: 100%;" |
|
|
|
:loading="stationLoading" |
|
|
|
:disabled="pageBusy" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="station in stationOptions" |
|
|
|
:key="station.locationCode" |
|
|
|
:label="station.locationCode" |
|
|
|
:value="station.locationCode" |
|
|
|
></el-option> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
<div class="form-row"> |
|
|
|
<label class="input-label">是否在货架</label> |
|
|
|
<el-select v-model="form.onShelfFlag" placeholder="请选择是否在货架" style="width: 100%;" :disabled="pageBusy"> |
|
|
|
<!-- 只有立库可以改是否在货架;其它区域固定否并禁用,避免车间站点被写成货架点位 - rqrq --> |
|
|
|
<el-select v-model="form.onShelfFlag" placeholder="请选择是否在货架" style="width: 100%;" :disabled="pageBusy || !isStockArea"> |
|
|
|
<el-option label="是" value="Y"></el-option> |
|
|
|
<el-option label="否" value="N"></el-option> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
<div class="hint">选择是时,所在位置会同时写入地面点位和货架点位。选择否时,只清空货架点位,所在位置仍按输入框保存。</div> |
|
|
|
<div v-if="!isStockArea" class="form-row"> |
|
|
|
<label class="input-label">一键改增量(没事别点)</label> |
|
|
|
<!-- 扫描默认空,可清空。有值时保存前先弹红色确认,确认后才把整盘明细wcs_flag改成1或0 - rqrq --> |
|
|
|
<el-select v-model="form.batchWcsFlag" placeholder="不修改" clearable style="width: 100%;" :disabled="pageBusy"> |
|
|
|
<el-option label="增量" :value="1"></el-option> |
|
|
|
<el-option label="非增量" :value="0"></el-option> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 保存前确认;成功后按同一栈板再查一次,回显数据库里的最新值 - rqrq --> |
|
|
|
<div class="bottom-actions"> |
|
|
|
@ -83,7 +111,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { scanPalletForSpecialEdit, savePalletSpecialEdit } from '../../../api/haianAutoWarehouse/palletSpecialEdit' |
|
|
|
import { scanPalletForSpecialEdit, savePalletSpecialEdit, listStationsForSpecialEdit } from '../../../api/haianAutoWarehouse/palletSpecialEdit' |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'haianPalletSpecialEdit', |
|
|
|
@ -95,20 +123,29 @@ export default { |
|
|
|
scanned: false, |
|
|
|
scanLoading: false, |
|
|
|
saveLoading: false, |
|
|
|
stationLoading: false, |
|
|
|
stationRequestSeq: 0, |
|
|
|
areaOptions: [], |
|
|
|
stationOptions: [], |
|
|
|
form: { |
|
|
|
palletId: '', |
|
|
|
callingFlag: 'N', |
|
|
|
areaId: '', |
|
|
|
locationCode: '', |
|
|
|
onShelfFlag: 'N' |
|
|
|
onShelfFlag: 'N', |
|
|
|
batchWcsFlag: null |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
// 扫描和保存互斥,避免回车和按钮同时打到后台 - rqrq |
|
|
|
// 只在扫描和保存时锁整页。拉站点不能锁整页,否则非立库区域一选中,任务标记和区域也会被禁用 - rqrq |
|
|
|
pageBusy() { |
|
|
|
return this.scanLoading || this.saveLoading |
|
|
|
}, |
|
|
|
// 立库区域所在位置用手输,其它区域用站点下拉。标记来自扫描结果里的stockArea - rqrq |
|
|
|
isStockArea() { |
|
|
|
const area = (this.areaOptions || []).find(item => item && item.areaId === this.form.areaId) |
|
|
|
return !!(area && area.stockArea) |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
@ -131,15 +168,24 @@ export default { |
|
|
|
} |
|
|
|
this.$router.push({ path: '/' }) |
|
|
|
}, |
|
|
|
// 区域下拉同时展示描述和编码,避免同名区域选错 - rqrq |
|
|
|
// 区域下拉只显示名称,不展示A01这类编码 - rqrq |
|
|
|
formatAreaLabel(area) { |
|
|
|
if (!area) { |
|
|
|
return '' |
|
|
|
if (!area || !area.areaDesc) { |
|
|
|
return '未命名区域' |
|
|
|
} |
|
|
|
if (area.areaDesc && area.areaDesc !== area.areaId) { |
|
|
|
return area.areaDesc + '(' + area.areaId + ')' |
|
|
|
return area.areaDesc |
|
|
|
}, |
|
|
|
// 换成立库时保留输入框里的位置,是否在货架可再选;换成其它区域时固定为否并清空位置,再拉该区域全部站点 - rqrq |
|
|
|
handleAreaChange() { |
|
|
|
if (this.isStockArea) { |
|
|
|
this.stationOptions = [] |
|
|
|
this.form.batchWcsFlag = null |
|
|
|
return |
|
|
|
} |
|
|
|
return area.areaId || '' |
|
|
|
this.form.onShelfFlag = 'N' |
|
|
|
this.form.batchWcsFlag = null |
|
|
|
this.form.locationCode = '' |
|
|
|
this.loadStations(false) |
|
|
|
}, |
|
|
|
// 扫描栈板:后端按wcs_location是否为空回显是否在货架 - rqrq |
|
|
|
handlePalletScan() { |
|
|
|
@ -180,11 +226,61 @@ export default { |
|
|
|
callingFlag: row.callingFlag === 'Y' ? 'Y' : 'N', |
|
|
|
areaId: row.areaId || '', |
|
|
|
locationCode: row.locationCode || '', |
|
|
|
onShelfFlag: row.onShelfFlag === 'Y' ? 'Y' : 'N' |
|
|
|
onShelfFlag: row.onShelfFlag === 'Y' ? 'Y' : 'N', |
|
|
|
batchWcsFlag: null |
|
|
|
} |
|
|
|
this.areaOptions = row.areaOptions || [] |
|
|
|
this.palletCode = this.form.palletId |
|
|
|
this.scanned = true |
|
|
|
if (this.isStockArea) { |
|
|
|
this.stationOptions = [] |
|
|
|
} else { |
|
|
|
// 非立库没有货架占用,即使原来wcs_location有值也按否回显,并且下拉禁用 - rqrq |
|
|
|
this.form.onShelfFlag = 'N' |
|
|
|
this.loadStations(true) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 非立库区域拉取全部站点。keepCurrent为真时保留扫描回显的位置,清单里没有也补进下拉。加载中只转所在位置,不锁其它字段 - rqrq |
|
|
|
loadStations(keepCurrent) { |
|
|
|
const areaId = this.form.areaId |
|
|
|
const currentLocation = keepCurrent ? (this.form.locationCode || '').trim() : '' |
|
|
|
if (!areaId || this.isStockArea) { |
|
|
|
this.stationOptions = [] |
|
|
|
this.stationLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
const requestSeq = this.stationRequestSeq + 1 |
|
|
|
this.stationRequestSeq = requestSeq |
|
|
|
this.site = this.$store.state.user.site |
|
|
|
this.stationLoading = true |
|
|
|
listStationsForSpecialEdit({ |
|
|
|
site: this.site, |
|
|
|
areaId: areaId |
|
|
|
}).then(({ data }) => { |
|
|
|
if (this.stationRequestSeq !== requestSeq || this.form.areaId !== areaId) { |
|
|
|
return |
|
|
|
} |
|
|
|
if (data && data.code === 0) { |
|
|
|
const rows = data.rows || [] |
|
|
|
if (currentLocation && !rows.some(item => item && item.locationCode === currentLocation)) { |
|
|
|
rows.unshift({ locationCode: currentLocation, stationCode: currentLocation }) |
|
|
|
} |
|
|
|
this.stationOptions = rows |
|
|
|
this.form.locationCode = currentLocation |
|
|
|
} else { |
|
|
|
this.stationOptions = [] |
|
|
|
this.$alert((data && data.msg) || '查询区域站点失败', '错误', { confirmButtonText: '确定' }) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
if (this.stationRequestSeq === requestSeq && this.form.areaId === areaId) { |
|
|
|
this.stationOptions = [] |
|
|
|
this.$message.error((error && error.message) || '查询区域站点失败') |
|
|
|
} |
|
|
|
}).finally(() => { |
|
|
|
if (this.stationRequestSeq === requestSeq) { |
|
|
|
this.stationLoading = false |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 保存前校验页面必填项;在货架为是时位置不能空,为否时允许位置为空 - rqrq |
|
|
|
handleSave() { |
|
|
|
@ -209,26 +305,63 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
const shelfText = this.form.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>', |
|
|
|
'危险操作', |
|
|
|
{ |
|
|
|
confirmButtonText: '已知晓', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'error', |
|
|
|
dangerouslyUseHTMLString: true, |
|
|
|
customClass: 'special-edit-danger-alert', |
|
|
|
closeOnClickModal: false, |
|
|
|
closeOnPressEscape: false |
|
|
|
} |
|
|
|
).then(() => { |
|
|
|
this.submitSave(locationCode, batchWcsFlag) |
|
|
|
}).catch(() => {}) |
|
|
|
return |
|
|
|
} |
|
|
|
this.$confirm( |
|
|
|
'确定保存栈板【' + this.form.palletId + '】吗?是否在货架:' + shelfText + '。', |
|
|
|
'栈板特殊修改', |
|
|
|
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' } |
|
|
|
).then(() => { |
|
|
|
this.submitSave(locationCode) |
|
|
|
this.submitSave(locationCode, null) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
// 空值不改明细;只接受增量1和非增量0 - rqrq |
|
|
|
normalizeBatchWcsFlag() { |
|
|
|
if (this.isStockArea) { |
|
|
|
return null |
|
|
|
} |
|
|
|
if (this.form.batchWcsFlag === 1 || this.form.batchWcsFlag === '1') { |
|
|
|
return 1 |
|
|
|
} |
|
|
|
if (this.form.batchWcsFlag === 0 || this.form.batchWcsFlag === '0') { |
|
|
|
return 0 |
|
|
|
} |
|
|
|
return null |
|
|
|
}, |
|
|
|
// 保存成功后按同一栈板再查一次,确认页面和数据库一致 - rqrq |
|
|
|
submitSave(locationCode) { |
|
|
|
submitSave(locationCode, batchWcsFlag) { |
|
|
|
this.site = this.$store.state.user.site |
|
|
|
this.saveLoading = true |
|
|
|
savePalletSpecialEdit({ |
|
|
|
const payload = { |
|
|
|
site: this.site, |
|
|
|
palletId: this.form.palletId, |
|
|
|
callingFlag: this.form.callingFlag, |
|
|
|
areaId: this.form.areaId, |
|
|
|
locationCode: locationCode, |
|
|
|
onShelfFlag: this.form.onShelfFlag |
|
|
|
}).then(({ data }) => { |
|
|
|
} |
|
|
|
if (batchWcsFlag === 0 || batchWcsFlag === 1) { |
|
|
|
payload.batchWcsFlag = batchWcsFlag |
|
|
|
} |
|
|
|
savePalletSpecialEdit(payload).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.$message.success(data.msg || '保存成功') |
|
|
|
this.reloadAfterSave() |
|
|
|
@ -259,12 +392,14 @@ export default { |
|
|
|
clearScan() { |
|
|
|
this.scanned = false |
|
|
|
this.areaOptions = [] |
|
|
|
this.stationOptions = [] |
|
|
|
this.form = { |
|
|
|
palletId: '', |
|
|
|
callingFlag: 'N', |
|
|
|
areaId: '', |
|
|
|
locationCode: '', |
|
|
|
onShelfFlag: 'N' |
|
|
|
onShelfFlag: 'N', |
|
|
|
batchWcsFlag: null |
|
|
|
} |
|
|
|
}, |
|
|
|
focusPalletInput() { |
|
|
|
@ -353,3 +488,37 @@ export default { |
|
|
|
opacity: 0.6; |
|
|
|
} |
|
|
|
</style> |
|
|
|
|
|
|
|
<style> |
|
|
|
.special-edit-danger-alert { |
|
|
|
border: 4px solid #ff1a1a; |
|
|
|
background: #3a0000; |
|
|
|
width: 92%; |
|
|
|
} |
|
|
|
.special-edit-danger-alert .el-message-box__title { |
|
|
|
color: #ff2a2a; |
|
|
|
font-size: 22px; |
|
|
|
font-weight: 800; |
|
|
|
} |
|
|
|
.special-edit-danger-alert .el-message-box__message { |
|
|
|
color: #ff4d4d; |
|
|
|
} |
|
|
|
.danger-mark-text { |
|
|
|
color: #ff1a1a; |
|
|
|
font-size: 22px; |
|
|
|
font-weight: 800; |
|
|
|
line-height: 1.5; |
|
|
|
} |
|
|
|
.danger-mark-sub { |
|
|
|
margin-top: 12px; |
|
|
|
color: #ffd0d0; |
|
|
|
font-size: 16px; |
|
|
|
font-weight: 700; |
|
|
|
} |
|
|
|
.special-edit-danger-alert .el-message-box__btns .el-button--primary { |
|
|
|
background: #ff1a1a; |
|
|
|
border-color: #ff1a1a; |
|
|
|
font-size: 18px; |
|
|
|
font-weight: 800; |
|
|
|
} |
|
|
|
</style> |