4 changed files with 348 additions and 0 deletions
-
13src/api/haianAutoWarehouse/palletVerify.js
-
2src/router/index.js
-
6src/views/main.vue
-
327src/views/modules/haianAutoWarehouse/haianPalletVerify.vue
@ -0,0 +1,13 @@ |
|||
import { createAPI } from '@/utils/httpRequest.js' |
|||
|
|||
/** |
|||
* 海安手工复核:扫描托盘,没有未完成复核任务时后端拒绝 - rqrq |
|||
* @param {Object} data 必须包含 site、palletId - rqrq |
|||
*/ |
|||
export const scanPalletVerify = data => createAPI('/autoWareHourceHaian/haiAnPalletVerify/scan', 'post', data) |
|||
|
|||
/** |
|||
* 海安手工复核:通知回库。成功后这一托任务完成并释放占用 - rqrq |
|||
* @param {Object} data 必须包含 site、palletId - rqrq |
|||
*/ |
|||
export const notifyPalletVerifyReturn = data => createAPI('/autoWareHourceHaian/haiAnPalletVerify/notifyReturn', 'post', data) |
|||
@ -0,0 +1,327 @@ |
|||
<template> |
|||
<div> |
|||
<div class="pda-container"> |
|||
<div class="header-bar"> |
|||
<div class="header-left" :class="{ 'header-action-disabled': pageBusy }" @click="handleBack"> |
|||
<i class="el-icon-arrow-left"></i> |
|||
<span>手工复核托盘</span> |
|||
</div> |
|||
<div class="header-right" :class="{ 'header-action-disabled': pageBusy }" @click="goHome"> |
|||
首页 |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="table-body" style="max-height: 500px; overflow-y: auto;"> |
|||
<div class="main-content form-section"> |
|||
<!-- 扫描框与查看托盘、分拣组盘同一套表单样式。回车后没有未完成复核任务会清空并重新聚焦 - rqrq --> |
|||
<div class="input-group"> |
|||
<label class="input-label">栈板编码</label> |
|||
<el-input |
|||
v-model="palletCode" |
|||
placeholder="请扫描栈板编码" |
|||
class="form-input" |
|||
clearable |
|||
:disabled="pageBusy" |
|||
inputmode="none" |
|||
autocomplete="off" |
|||
autocorrect="off" |
|||
spellcheck="false" |
|||
@keyup.enter.native="handleScan" |
|||
ref="palletInput" |
|||
/> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 扫描成功后才展示托盘信息和明细。通知回库失败时保留当前结果,方便重试 - rqrq --> |
|||
<div v-if="scanResult" class="rma-list"> |
|||
<div class="verify-info"> |
|||
<div class="info-row"> |
|||
<span class="info-label">托盘号</span> |
|||
<span class="info-value">{{ scanResult.palletId || '' }}</span> |
|||
</div> |
|||
<div class="info-row"> |
|||
<span class="info-label">当前位置</span> |
|||
<span class="info-value">{{ scanResult.locationCode || '' }}</span> |
|||
</div> |
|||
<div class="info-row"> |
|||
<span class="info-label">任务号</span> |
|||
<span class="info-value">{{ scanResult.taskNo || '' }}</span> |
|||
</div> |
|||
</div> |
|||
<div class="list-title-row"> |
|||
<div class="list-title">条码数:{{ detailList.length }}</div> |
|||
<button |
|||
class="action-btn primary" |
|||
:disabled="pageBusy" |
|||
@click="handleReturn"> |
|||
{{ returnLoading ? '处理中...' : '通知回库' }} |
|||
</button> |
|||
</div> |
|||
<div class="detail-table"> |
|||
<div class="table-header"> |
|||
<div class="col-position">位置</div> |
|||
<div class="col-serial">条码号</div> |
|||
<div class="col-part">物料编码</div> |
|||
<div class="col-qty">数量</div> |
|||
</div> |
|||
<div |
|||
v-for="(detail, index) in detailList" |
|||
:key="index" |
|||
class="table-row"> |
|||
<div class="col-position">{{ detail.position }}</div> |
|||
<div class="col-serial">{{ detail.serialNo }}</div> |
|||
<div class="col-part">{{ detail.partNo }}</div> |
|||
<div class="col-qty">{{ formatQty(detail.qty) }}</div> |
|||
</div> |
|||
<div v-if="detailList.length === 0" class="table-row empty-row"> |
|||
<div class="empty-hint">暂无栈板明细数据</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { notifyPalletVerifyReturn, scanPalletVerify } from '@/api/haianAutoWarehouse/palletVerify' |
|||
|
|||
export default { |
|||
data () { |
|||
return { |
|||
site: '', |
|||
palletCode: '', |
|||
scanResult: null, |
|||
scanLoading: false, |
|||
returnLoading: false |
|||
} |
|||
}, |
|||
computed: { |
|||
pageBusy () { |
|||
return this.scanLoading || this.returnLoading |
|||
}, |
|||
// 明细来自扫描接口。空数组时表格显示暂无数据,不额外请求 - rqrq |
|||
detailList () { |
|||
return (this.scanResult && this.scanResult.details) || [] |
|||
} |
|||
}, |
|||
created () { |
|||
this.site = this.$store.state.user.site |
|||
this.focusPalletInput() |
|||
}, |
|||
methods: { |
|||
handleBack () { |
|||
if (this.pageBusy) { |
|||
return |
|||
} |
|||
this.$router.back() |
|||
}, |
|||
goHome () { |
|||
if (this.pageBusy) { |
|||
return |
|||
} |
|||
this.$router.push({ path: '/' }) |
|||
}, |
|||
focusPalletInput () { |
|||
this.$nextTick(() => { |
|||
if (this.$refs.palletInput) { |
|||
this.$refs.palletInput.focus() |
|||
} |
|||
}) |
|||
}, |
|||
// 扫描只展示明细。方向后缀由后台去掉后再找未完成复核任务 - rqrq |
|||
handleScan () { |
|||
const palletId = (this.palletCode || '').trim() |
|||
if (!this.site) { |
|||
this.$alert('当前工厂为空,无法扫描', '提示', { confirmButtonText: '确定' }) |
|||
return |
|||
} |
|||
if (!palletId) { |
|||
this.$message.error('请扫描托盘') |
|||
this.focusPalletInput() |
|||
return |
|||
} |
|||
this.scanLoading = true |
|||
scanPalletVerify({ |
|||
site: this.site, |
|||
palletId: palletId |
|||
}).then(({ data }) => { |
|||
if (data && data.code === 0) { |
|||
this.scanResult = data.row || null |
|||
this.palletCode = '' |
|||
} else { |
|||
this.scanResult = null |
|||
this.palletCode = '' |
|||
this.$alert((data && data.msg) || '该托盘没有托盘复核任务无法扫描', '提示', { confirmButtonText: '确定' }) |
|||
} |
|||
this.focusPalletInput() |
|||
}).catch(() => { |
|||
this.scanResult = null |
|||
this.palletCode = '' |
|||
this.$message.error('扫描失败') |
|||
this.focusPalletInput() |
|||
}).finally(() => { |
|||
this.scanLoading = false |
|||
}) |
|||
}, |
|||
// 回库使用扫描结果里的标准托盘号。成功后清掉页面,再次扫描应提示没有任务 - rqrq |
|||
handleReturn () { |
|||
if (!this.scanResult || !this.scanResult.palletId) { |
|||
this.$alert('请先扫描托盘', '提示', { confirmButtonText: '确定' }) |
|||
return |
|||
} |
|||
if (!this.site) { |
|||
this.$alert('当前工厂为空,无法通知回库', '提示', { confirmButtonText: '确定' }) |
|||
return |
|||
} |
|||
this.returnLoading = true |
|||
notifyPalletVerifyReturn({ |
|||
site: this.site, |
|||
palletId: this.scanResult.palletId |
|||
}).then(({ data }) => { |
|||
if (data && data.code === 0) { |
|||
this.$message.success('通知回库成功') |
|||
this.scanResult = null |
|||
this.palletCode = '' |
|||
this.focusPalletInput() |
|||
} else { |
|||
this.$alert((data && data.msg) || '通知回库失败', '提示', { confirmButtonText: '确定' }) |
|||
} |
|||
}).catch(() => { |
|||
this.$message.error('通知回库失败') |
|||
}).finally(() => { |
|||
this.returnLoading = false |
|||
}) |
|||
}, |
|||
formatQty (qty) { |
|||
if (qty === null || qty === undefined || qty === '') { |
|||
return '0' |
|||
} |
|||
const num = Number(qty) |
|||
if (Number.isNaN(num)) { |
|||
return '0' |
|||
} |
|||
return String(num) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
/* 请求进行中时拦截返回和首页,避免扫描或回库过程中离开页面 - rqrq */ |
|||
.header-action-disabled { |
|||
opacity: 0.5; |
|||
pointer-events: none; |
|||
} |
|||
|
|||
.verify-info { |
|||
background: #fff; |
|||
border-radius: 6px; |
|||
border: 1px solid #e0e0e0; |
|||
padding: 0 12px; |
|||
margin-bottom: 8px; |
|||
} |
|||
|
|||
.info-row { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: flex-start; |
|||
padding: 10px 0; |
|||
border-bottom: 1px solid #f0f0f0; |
|||
} |
|||
|
|||
.info-row:last-child { |
|||
border-bottom: none; |
|||
} |
|||
|
|||
.info-label { |
|||
font-size: 14px; |
|||
color: #666; |
|||
min-width: 72px; |
|||
flex-shrink: 0; |
|||
} |
|||
|
|||
.info-value { |
|||
font-size: 14px; |
|||
font-weight: 500; |
|||
color: #333; |
|||
flex: 1; |
|||
text-align: right; |
|||
word-break: break-all; |
|||
} |
|||
|
|||
.list-title-row { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
margin-bottom: 8px; |
|||
} |
|||
|
|||
.list-title-row .list-title { |
|||
margin: 0; |
|||
} |
|||
|
|||
.detail-table { |
|||
background: white; |
|||
border-radius: 6px; |
|||
overflow: hidden; |
|||
border: 1px solid #e0e0e0; |
|||
} |
|||
|
|||
.table-header, |
|||
.table-row { |
|||
display: flex; |
|||
align-items: center; |
|||
padding: 8px; |
|||
border-bottom: 1px solid #e0e0e0; |
|||
} |
|||
|
|||
.table-header { |
|||
background: #f5f5f5; |
|||
font-weight: bold; |
|||
font-size: 14px; |
|||
} |
|||
|
|||
.table-row { |
|||
font-size: 13px; |
|||
} |
|||
|
|||
.table-row:last-child { |
|||
border-bottom: none; |
|||
} |
|||
|
|||
.col-position { |
|||
flex: 1; |
|||
text-align: center; |
|||
} |
|||
|
|||
.col-serial { |
|||
flex: 3; |
|||
text-align: center; |
|||
word-break: break-all; |
|||
} |
|||
|
|||
.col-part { |
|||
flex: 2; |
|||
text-align: center; |
|||
word-break: break-all; |
|||
} |
|||
|
|||
.col-qty { |
|||
flex: 1; |
|||
text-align: center; |
|||
} |
|||
|
|||
.empty-row { |
|||
justify-content: center; |
|||
align-items: center; |
|||
padding: 20px; |
|||
border-bottom: none; |
|||
} |
|||
|
|||
.empty-hint { |
|||
text-align: center; |
|||
color: #999; |
|||
width: 100%; |
|||
} |
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue