Browse Source

托盘明细

master
常熟吴彦祖 2 weeks ago
parent
commit
c29b55a1b5
  1. 19
      src/api/haianWarehouse/palletLocationMismatch.js
  2. 294
      src/views/modules/haianWarehouse/warehouse/palletLocationMismatch54.vue

19
src/api/haianWarehouse/palletLocationMismatch.js

@ -0,0 +1,19 @@
import { createAPI } from '@/utils/httpRequest.js'
/**
* 分页查询库位与托盘区域不一致的托盘 - rqrq
* @param {Object} data site必填,page/limit/searchPalletId可选 - rqrq
*/
export const searchPalletLocationMismatch = data => createAPI('/autoWareHourceHaian/haiAnPalletLocationMismatch/search', 'post', data)
/**
* 复用PDA栈板重移库扫描,取出该托盘的差异标签 - rqrq
* @param {Object} data site、palletId - rqrq
*/
export const scanPalletForRelocate = data => createAPI('/haiAnWcsIntegration/scanPalletForRelocate', 'post', data)
/**
* 复用PDA栈板重移库提交,按托盘当前区域重试差异标签 - rqrq
* @param {Object} data site、palletId - rqrq
*/
export const retryPalletRelocate = data => createAPI('/haiAnWcsIntegration/retryPalletRelocate', 'post', data)

294
src/views/modules/haianWarehouse/warehouse/palletLocationMismatch54.vue

@ -0,0 +1,294 @@
<template>
<div class="mod-config">
<!-- 查询区:只查当前登录工厂里,有区域且标签库位和区域库位不一致的托盘 - rqrq -->
<el-form :inline="true" label-position="top" class="query-form" @keyup.enter.native="searchTable">
<el-form-item label="工厂编码">
<el-input v-model="queryData.site" style="width: 100px" disabled></el-input>
</el-form-item>
<el-form-item label="托盘号">
<el-input v-model="queryData.searchPalletId" style="width: 160px" clearable placeholder="请输入托盘号"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" :disabled="dataListLoading" @click="searchTable">查询</el-button>
<el-button :disabled="dataListLoading" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="section-title">差异托盘</div>
<el-table
:data="dataList"
:height="palletHeight"
border
highlight-current-row
v-loading="dataListLoading"
style="width: 100%;"
@row-click="handlePalletClick">
<!-- 左侧操作沿用海安托盘清单和角色管理的绿色文字链接;移库进行中置灰,避免连点 - rqrq -->
<el-table-column fixed="left" header-align="center" align="center" width="120" label="操作">
<template slot-scope="scope">
<a
v-if="!relocatePalletId"
type="text"
@click.stop="handleRelocate(scope.row)"
>托盘重移库</a>
<a
v-else
type="text"
style="color: #c0c4cc; cursor: not-allowed;"
@click.prevent.stop
>{{ relocatePalletId === scope.row.palletId ? '移库中' : '托盘重移库' }}</a>
</template>
</el-table-column>
<el-table-column prop="palletId" label="托盘号" min-width="140" header-align="center" align="center"></el-table-column>
<el-table-column prop="areaId" label="区域" min-width="90" header-align="center" align="center"></el-table-column>
<el-table-column prop="areaDesc" label="区域名称" min-width="140" header-align="center" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="warehouseId" label="区域仓库" min-width="110" header-align="center" align="center"></el-table-column>
<el-table-column prop="locationId" label="区域库位" min-width="110" header-align="center" align="center"></el-table-column>
<el-table-column prop="locationCode" label="托盘站点" min-width="120" header-align="center" align="center"></el-table-column>
<el-table-column prop="mismatchCount" label="差异标签数" min-width="110" header-align="center" align="right"></el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<div class="section-title">差异标签{{ currentPalletId ? '(' + currentPalletId + ')' : '' }}</div>
<el-table :data="labelList" :height="labelHeight" border v-loading="labelLoading" style="width: 100%;">
<el-table-column prop="serialNo" label="标签号" min-width="160" header-align="center" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="subSite" label="子工厂" min-width="90" header-align="center" align="center"></el-table-column>
<el-table-column prop="partNo" label="物料编码" min-width="130" header-align="center" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="partDesc" label="物料描述" min-width="180" header-align="center" align="left" show-overflow-tooltip></el-table-column>
<el-table-column prop="qty" label="数量" min-width="90" header-align="center" align="right">
<template slot-scope="scope">{{ formatQty(scope.row.qty) }}</template>
</el-table-column>
<el-table-column prop="warehouseId" label="标签仓库" min-width="110" header-align="center" align="center"></el-table-column>
<el-table-column prop="locationId" label="标签库位" min-width="110" header-align="center" align="center"></el-table-column>
<el-table-column prop="inStockFlag" label="在库" min-width="70" header-align="center" align="center"></el-table-column>
<el-table-column prop="labelMissing" label="主数据缺失" min-width="100" header-align="center" align="center"></el-table-column>
<el-table-column label="本次是否移库" min-width="110" header-align="center" align="center">
<template slot-scope="scope">{{ scope.row.willTransfer ? '是' : '否' }}</template>
</el-table-column>
<el-table-column prop="skipReason" label="不移库原因" min-width="220" header-align="center" align="left" show-overflow-tooltip></el-table-column>
</el-table>
</div>
</template>
<script>
import {
retryPalletRelocate,
scanPalletForRelocate,
searchPalletLocationMismatch
} from '@/api/haianWarehouse/palletLocationMismatch.js'
export default {
name: 'palletLocationMismatch54',
data () {
return {
queryData: {
site: this.$store.state.user.site,
searchPalletId: ''
},
dataList: [],
pageIndex: 1,
pageSize: 20,
totalPage: 0,
dataListLoading: false,
palletHeight: 280,
labelHeight: 240,
currentPalletId: '',
labelList: [],
labelLoading: false,
// 正在重移库的托盘号。有值时全部重移库按钮禁用,避免连点入队 - rqrq
relocatePalletId: '',
relocateRefreshTimers: [],
labelRequestSeq: 0
}
},
mounted () {
this.$nextTick(() => {
const remain = window.innerHeight - 280
this.palletHeight = Math.max(220, Math.floor(remain * 0.48))
this.labelHeight = Math.max(180, remain - this.palletHeight)
})
},
activated () {
this.queryData.site = this.$store.state.user.site
this.getDataList()
},
beforeDestroy () {
this.clearRelocateRefreshTimers()
},
methods: {
// 数量去尾零,空值显示0 - rqrq
formatQty (qty) {
if (qty === null || qty === undefined || qty === '') {
return '0'
}
const numberValue = Number(qty)
if (Number.isNaN(numberValue)) {
return String(qty)
}
return String(numberValue)
},
searchTable () {
this.pageIndex = 1
this.getDataList()
},
// 查询差异托盘。site每次用登录工厂覆盖,避免查询框被改成其它厂 - rqrq
getDataList () {
this.dataListLoading = true
const params = {
site: this.$store.state.user.site,
searchPalletId: this.queryData.searchPalletId,
page: this.pageIndex,
limit: this.pageSize
}
searchPalletLocationMismatch(params).then(({ data }) => {
if (data && data.code === 0 && data.page) {
this.dataList = data.page.list || []
this.pageIndex = data.page.currPage
this.totalPage = data.page.totalCount
this.queryData.site = this.$store.state.user.site
const stillVisible = this.dataList.some(row => row.palletId === this.currentPalletId)
if (!stillVisible) {
this.currentPalletId = ''
this.labelList = []
}
} else {
this.dataList = []
this.totalPage = 0
this.$alert((data && data.msg) || '查询失败', '错误', { confirmButtonText: '确定' })
}
}).catch(() => {
this.dataList = []
this.totalPage = 0
this.$message.error('查询失败,请稍后重试')
}).finally(() => {
this.dataListLoading = false
})
},
resetQuery () {
this.queryData = {
site: this.$store.state.user.site,
searchPalletId: ''
}
this.currentPalletId = ''
this.labelList = []
this.searchTable()
},
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 点托盘行加载差异标签,复用PDA重移库扫描,口径和点重移库时一致 - rqrq
handlePalletClick (row) {
if (!row || !row.palletId) {
return
}
this.loadLabels(row.palletId, false)
},
loadLabels (palletId, quiet) {
this.currentPalletId = palletId
this.labelRequestSeq += 1
const requestSeq = this.labelRequestSeq
if (!quiet) {
this.labelLoading = true
}
scanPalletForRelocate({
site: this.$store.state.user.site,
palletId: palletId
}).then(({ data }) => {
if (requestSeq !== this.labelRequestSeq || this.currentPalletId !== palletId) {
return
}
if (data && data.code === 0 && data.row) {
this.labelList = data.row.mismatchRows || []
} else if (!quiet) {
this.labelList = []
this.$alert((data && data.msg) || '查询差异标签失败', '错误', { confirmButtonText: '确定' })
}
}).catch(() => {
if (requestSeq !== this.labelRequestSeq || quiet) {
return
}
this.labelList = []
this.$message.error('查询差异标签失败,请稍后重试')
}).finally(() => {
if (requestSeq === this.labelRequestSeq) {
this.labelLoading = false
}
})
},
// 托盘重移库:确认后调用PDA同一提交接口。成功只是入队,5秒和10秒后再刷新 - rqrq
handleRelocate (row) {
if (this.relocatePalletId || !row || !row.palletId) {
return
}
const areaText = row.areaDesc || row.areaId || ''
this.$confirm(
'确定按区域【' + areaText + '】的仓库库位,重新移库托盘 ' + row.palletId + ' 的不一致标签吗?',
'托盘重移库',
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
).then(() => {
this.relocatePalletId = row.palletId
retryPalletRelocate({
site: this.$store.state.user.site,
palletId: row.palletId
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success(data.msg || '重新移库已提交')
this.currentPalletId = row.palletId
this.getDataList()
this.loadLabels(row.palletId, false)
this.scheduleRelocateRefresh(row.palletId)
} else {
this.$alert((data && data.msg) || '重新移库失败', '错误', { confirmButtonText: '确定' })
}
}).catch(() => {
this.$message.error('重新移库失败,请稍后重试')
}).finally(() => {
this.relocatePalletId = ''
})
}).catch(() => {})
},
clearRelocateRefreshTimers () {
;(this.relocateRefreshTimers || []).forEach(timerId => clearTimeout(timerId))
this.relocateRefreshTimers = []
},
// 移库入队后标签库位不会立刻变,到点刷新上表和当前托盘的差异标签 - rqrq
scheduleRelocateRefresh (palletId) {
this.clearRelocateRefreshTimers()
;[5000, 10000].forEach(delay => {
const timerId = setTimeout(() => {
this.getDataList()
if (this.currentPalletId === palletId) {
this.loadLabels(palletId, true)
}
}, delay)
this.relocateRefreshTimers.push(timerId)
})
}
}
}
</script>
<style scoped>
.query-form {
margin-top: 1px;
margin-left: 0;
}
.section-title {
margin: 6px 0;
font-weight: bold;
}
</style>
Loading…
Cancel
Save