2 changed files with 330 additions and 0 deletions
-
10src/api/haianWarehouse/palletVerify.js
-
320src/views/modules/haianWarehouse/warehouse/palletVerify54.vue
@ -0,0 +1,10 @@ |
|||
import { createAPI } from '@/utils/httpRequest.js' |
|||
|
|||
// 海安托盘核对:查询当前大site货架上的托盘 - rqrq
|
|||
export const haiAnPalletVerifyList = data => createAPI('/autoWareHourceHaian/haiAnPalletVerify/list', 'post', data) |
|||
|
|||
// 海安托盘核对:点中托盘后查 haian_pallet_detail - rqrq
|
|||
export const haiAnPalletVerifyDetails = data => createAPI('/autoWareHourceHaian/haiAnPalletVerify/details', 'post', data) |
|||
|
|||
// 海安托盘核对:勾选在架空闲托盘后下达一张复核任务 - rqrq
|
|||
export const haiAnPalletVerifyDispatch = data => createAPI('/autoWareHourceHaian/haiAnPalletVerify/dispatch', 'post', data) |
|||
@ -0,0 +1,320 @@ |
|||
<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-select v-model="queryData.hasTask" style="width: 120px" :disabled="dataListLoading || dispatchLoading"> |
|||
<el-option label="是" value="Y"></el-option> |
|||
<el-option label="否" value="N"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="托盘大分类"> |
|||
<el-select v-model="queryData.palletFamily" style="width: 140px" clearable placeholder="全部" :disabled="dataListLoading || dispatchLoading"> |
|||
<el-option label="钢托盘" value="A01"></el-option> |
|||
<el-option label="围托盘" value="A02"></el-option> |
|||
<el-option label="平托盘" value="A03"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="托盘编码"> |
|||
<el-input v-model="queryData.searchPalletId" style="width: 160px" clearable placeholder="请输入托盘编码" :disabled="dataListLoading || dispatchLoading"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="托盘上物料编码"> |
|||
<el-input v-model="queryData.partNo" style="width: 160px" clearable placeholder="请输入物料编码" :disabled="dataListLoading || dispatchLoading"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label=" "> |
|||
<el-button type="primary" :disabled="dataListLoading || dispatchLoading" @click="searchTable">查询</el-button> |
|||
<el-button :disabled="dataListLoading || dispatchLoading" @click="resetQuery">重置</el-button> |
|||
<el-button type="primary" :loading="dispatchLoading" :disabled="dataListLoading || dispatchLoading" @click="dispatchTask">下达任务</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<div class="section-title">在货架托盘</div> |
|||
<el-table |
|||
ref="palletTable" |
|||
:data="dataList" |
|||
:height="palletHeight" |
|||
border |
|||
highlight-current-row |
|||
row-key="palletId" |
|||
v-loading="dataListLoading" |
|||
style="width: 100%;" |
|||
@row-click="handlePalletClick" |
|||
@selection-change="handleSelectionChange"> |
|||
<el-table-column type="selection" header-align="center" align="center" width="55" :selectable="canSelect"></el-table-column> |
|||
<el-table-column prop="palletId" label="托盘号" min-width="160" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="palletFamily" label="托盘大分类" min-width="110" header-align="center" align="center"> |
|||
<template slot-scope="scope">{{ formatFamily(scope.row.palletFamily) }}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="typeDesc" label="托盘类型名称" min-width="140" header-align="center" align="center" show-overflow-tooltip></el-table-column> |
|||
<el-table-column prop="emptyFlag" label="是否空托盘" min-width="110" header-align="center" align="center"> |
|||
<template slot-scope="scope">{{ formatYesNo(scope.row.emptyFlag) }}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="callingFlag" label="是否有任务" min-width="110" header-align="center" align="center"> |
|||
<template slot-scope="scope">{{ formatYesNo(scope.row.callingFlag) }}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="wcsLocation" label="货架位置" min-width="140" header-align="center" align="center" show-overflow-tooltip></el-table-column> |
|||
<el-table-column prop="locationCode" label="当前位置" min-width="140" header-align="center" align="center" show-overflow-tooltip></el-table-column> |
|||
<el-table-column prop="remark" label="占用备注" min-width="220" header-align="center" align="left" show-overflow-tooltip></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> |
|||
|
|||
<!-- 下表跟着上表点中的托盘走,数据只来自 haian_pallet_detail - rqrq --> |
|||
<div class="section-title">托盘明细{{ currentPalletId ? '(' + currentPalletId + ')' : '' }}</div> |
|||
<el-table :data="detailList" :height="detailHeight" border v-loading="detailLoading" style="width: 100%;"> |
|||
<el-table-column prop="subSite" label="子工厂" min-width="100" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="position" label="位置" min-width="80" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="partNo" label="物料编码" min-width="140" 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="serialNo" label="标签码" min-width="160" header-align="center" align="center" 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="batchNo" label="批次号" min-width="140" header-align="center" align="center" show-overflow-tooltip></el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { haiAnPalletVerifyDetails, haiAnPalletVerifyDispatch, haiAnPalletVerifyList } from '@/api/haianWarehouse/palletVerify' |
|||
|
|||
// 与后端 HaiAnTaskSourceStaticData.PALLET_VERIFY_MAX_COUNT 保持一致 - rqrq |
|||
const MAX_DISPATCH_COUNT = 10 |
|||
|
|||
export default { |
|||
data () { |
|||
return { |
|||
palletHeight: 280, |
|||
detailHeight: 240, |
|||
dataListLoading: false, |
|||
detailLoading: false, |
|||
dispatchLoading: false, |
|||
dataList: [], |
|||
detailList: [], |
|||
currentPalletId: '', |
|||
detailRequestSeq: 0, |
|||
selectedRows: [], |
|||
pageIndex: 1, |
|||
pageSize: 20, |
|||
totalPage: 0, |
|||
queryData: { |
|||
site: '', |
|||
hasTask: 'N', |
|||
palletFamily: '', |
|||
searchPalletId: '', |
|||
partNo: '' |
|||
} |
|||
} |
|||
}, |
|||
activated () { |
|||
this.initSiteAndQuery() |
|||
this.getHeight() |
|||
}, |
|||
mounted () { |
|||
this.initSiteAndQuery() |
|||
this.getHeight() |
|||
}, |
|||
methods: { |
|||
// 先写入登录大site再查,避免空site把其它工厂托盘查出来 - rqrq |
|||
initSiteAndQuery () { |
|||
this.queryData.site = this.$store.state.user.site |
|||
this.getDataList() |
|||
}, |
|||
getHeight () { |
|||
this.$nextTick(() => { |
|||
const usable = window.innerHeight - 280 |
|||
const half = usable > 320 ? Math.floor(usable / 2) : 220 |
|||
this.palletHeight = half |
|||
this.detailHeight = half |
|||
}) |
|||
}, |
|||
searchTable () { |
|||
this.pageIndex = 1 |
|||
this.clearPalletSelection() |
|||
this.getDataList() |
|||
}, |
|||
// 重置回到当前默认“无任务”,并清掉大分类、托盘编码和物料编码 - rqrq |
|||
resetQuery () { |
|||
this.queryData.hasTask = 'N' |
|||
this.queryData.palletFamily = '' |
|||
this.queryData.searchPalletId = '' |
|||
this.queryData.partNo = '' |
|||
this.pageIndex = 1 |
|||
this.clearPalletSelection() |
|||
this.clearDetails() |
|||
this.getDataList() |
|||
}, |
|||
sizeChangeHandle (val) { |
|||
this.pageSize = val |
|||
this.pageIndex = 1 |
|||
this.getDataList() |
|||
}, |
|||
currentChangeHandle (val) { |
|||
this.pageIndex = val |
|||
this.getDataList() |
|||
}, |
|||
clearPalletSelection () { |
|||
this.selectedRows = [] |
|||
if (this.$refs.palletTable) { |
|||
this.$refs.palletTable.clearSelection() |
|||
} |
|||
}, |
|||
getDataList () { |
|||
if (!this.queryData.site) { |
|||
this.$alert('当前工厂为空,无法查询在架托盘', '错误', { confirmButtonText: '确定' }) |
|||
return |
|||
} |
|||
this.dataListLoading = true |
|||
this.clearPalletSelection() |
|||
this.clearDetails() |
|||
haiAnPalletVerifyList({ |
|||
site: this.queryData.site, |
|||
hasTask: this.queryData.hasTask, |
|||
palletFamily: this.queryData.palletFamily, |
|||
searchPalletId: (this.queryData.searchPalletId || '').trim(), |
|||
partNo: (this.queryData.partNo || '').trim(), |
|||
page: this.pageIndex, |
|||
limit: this.pageSize |
|||
}).then(({ data }) => { |
|||
if (data && data.code === 0) { |
|||
this.dataList = (data.page && data.page.list) || [] |
|||
this.totalPage = (data.page && data.page.totalCount) || 0 |
|||
} 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 |
|||
}) |
|||
}, |
|||
// 点上表某一托,下表只显示这托在 haian_pallet_detail 里的标签 - rqrq |
|||
handlePalletClick (row) { |
|||
if (!row || !row.palletId || this.detailLoading) { |
|||
return |
|||
} |
|||
this.loadDetails(row.palletId) |
|||
}, |
|||
loadDetails (palletId) { |
|||
this.currentPalletId = palletId |
|||
this.detailRequestSeq += 1 |
|||
const requestSeq = this.detailRequestSeq |
|||
this.detailLoading = true |
|||
haiAnPalletVerifyDetails({ |
|||
site: this.queryData.site, |
|||
palletId: palletId |
|||
}).then(({ data }) => { |
|||
if (requestSeq !== this.detailRequestSeq || this.currentPalletId !== palletId) { |
|||
return |
|||
} |
|||
if (data && data.code === 0) { |
|||
this.detailList = data.rows || [] |
|||
} else { |
|||
this.detailList = [] |
|||
this.$alert((data && data.msg) || '查询托盘明细失败', '错误', { confirmButtonText: '确定' }) |
|||
} |
|||
}).catch(() => { |
|||
if (requestSeq !== this.detailRequestSeq) { |
|||
return |
|||
} |
|||
this.detailList = [] |
|||
this.$message.error('查询托盘明细失败') |
|||
}).finally(() => { |
|||
if (requestSeq === this.detailRequestSeq) { |
|||
this.detailLoading = false |
|||
} |
|||
}) |
|||
}, |
|||
clearDetails () { |
|||
this.detailRequestSeq += 1 |
|||
this.currentPalletId = '' |
|||
this.detailList = [] |
|||
this.detailLoading = false |
|||
}, |
|||
formatQty (qty) { |
|||
if (qty === null || qty === undefined || qty === '') { |
|||
return '0' |
|||
} |
|||
const num = Number(qty) |
|||
return Number.isNaN(num) ? '0' : String(num) |
|||
}, |
|||
// 已被任务占用的托盘不能再下达,避免和立库里已有任务抢同一托 - rqrq |
|||
canSelect (row) { |
|||
return row && row.callingFlag !== 'Y' |
|||
}, |
|||
handleSelectionChange (rows) { |
|||
this.selectedRows = rows || [] |
|||
}, |
|||
formatYesNo (flag) { |
|||
return flag === 'Y' ? '是' : '否' |
|||
}, |
|||
formatFamily (family) { |
|||
if (family === 'A01') { |
|||
return '钢托盘' |
|||
} |
|||
if (family === 'A02') { |
|||
return '围托盘' |
|||
} |
|||
if (family === 'A03') { |
|||
return '平托盘' |
|||
} |
|||
return family || '' |
|||
}, |
|||
// 前端先卡住10托,后端会再校验占用和货架。失败不刷新成已下达 - rqrq |
|||
dispatchTask () { |
|||
if (!this.queryData.site) { |
|||
this.$alert('当前工厂为空,无法下达', '错误', { confirmButtonText: '确定' }) |
|||
return |
|||
} |
|||
const palletIds = (this.selectedRows || []).map(row => row.palletId).filter(id => !!id) |
|||
if (palletIds.length === 0) { |
|||
this.$alert('请选择没有任务的在架托盘', '提示', { confirmButtonText: '确定' }) |
|||
return |
|||
} |
|||
if (palletIds.length > MAX_DISPATCH_COUNT) { |
|||
this.$alert('一次最多下达' + MAX_DISPATCH_COUNT + '个托盘', '提示', { confirmButtonText: '确定' }) |
|||
return |
|||
} |
|||
this.dispatchLoading = true |
|||
haiAnPalletVerifyDispatch({ |
|||
site: this.queryData.site, |
|||
palletIds: palletIds |
|||
}).then(({ data }) => { |
|||
if (data && data.code === 0) { |
|||
const taskNo = data.row && data.row.taskNo ? data.row.taskNo : '' |
|||
this.$alert(taskNo ? ('下达成功,任务号' + taskNo) : '下达成功', '提示', { confirmButtonText: '确定' }) |
|||
this.getDataList() |
|||
} else { |
|||
this.$alert((data && data.msg) || '下达失败', '错误', { confirmButtonText: '确定' }) |
|||
} |
|||
}).catch(() => { |
|||
this.$message.error('下达失败') |
|||
}).finally(() => { |
|||
this.dispatchLoading = false |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.query-form { |
|||
margin-top: 1px; |
|||
margin-left: 0; |
|||
} |
|||
.section-title { |
|||
margin: 6px 0; |
|||
font-weight: bold; |
|||
} |
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue