Browse Source

重打标签

master
han\hanst 4 months ago
parent
commit
51abae57ee
  1. 7
      src/api/warehouse/labelQuery.js
  2. 14
      src/views/modules/warehouse/ifsInventoryInit.vue
  3. 270
      src/views/modules/warehouse/labelQuery.vue

7
src/api/warehouse/labelQuery.js

@ -0,0 +1,7 @@
import { createAPI } from "@/utils/httpRequest.js";
// 分页查询HandlingUnit标签信息
export const getHandlingUnitLabelList = data => createAPI('/warehouse/labelQuery/getHandlingUnitLabelList', 'POST', data)
// 重打标签
export const reprintLabel = data => createAPI('/warehouse/labelQuery/reprintLabel', 'POST', data)

14
src/views/modules/warehouse/ifsInventoryInit.vue

@ -21,6 +21,7 @@
<el-table
:data="dataList"
border
:height="height"
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
@ -78,6 +79,12 @@
align="center"
label="现有库存">
</el-table-column>
<el-table-column
prop="printQty"
header-align="center"
align="center"
label="已打数量">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
@ -85,7 +92,7 @@
width="150"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="createHuHandle(scope.row)">创建HU</a>
<a type="text" @click="createHuHandle(scope.row)">创建HU</a>
</template>
</el-table-column>
</el-table>
@ -94,7 +101,7 @@
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-sizes="[ 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
@ -184,8 +191,9 @@ export default {
},
dataList: [],
pageIndex: 1,
pageSize: 10,
pageSize: 50,
totalPage: 0,
height: 500,
dataListLoading: false,
dataListSelections: [],
createHuVisible: false,

270
src/views/modules/warehouse/labelQuery.vue

@ -0,0 +1,270 @@
<template>
<div class="mod-config">
<el-form :inline="true" label-position="top">
<el-form-item label="入库状态">
<el-select v-model="queryHeaderData.inStockFlag" placeholder="请选择" style="width: 120px;">
<el-option label="全部" value=""></el-option>
<el-option label="未入库" value="X"></el-option>
<el-option label="已出库" value="N"></el-option>
<el-option label="在库" value="Y"></el-option>
</el-select>
</el-form-item>
<el-form-item label="物料编号">
<el-input style="width: 120px;" v-model="queryHeaderData.partNo" placeholder="请输入物料编号"></el-input>
</el-form-item>
<el-form-item label="批次号">
<el-input style="width: 120px;" v-model="queryHeaderData.batchNo" placeholder="请输入批次号"></el-input>
</el-form-item>
<el-form-item label="库位">
<el-input style="width: 120px;" v-model="queryHeaderData.locationId" placeholder="请输入库位"></el-input>
</el-form-item>
<el-form-item label="单元ID">
<el-input style="width: 120px;" v-model="queryHeaderData.unitId" placeholder="请输入单元ID"></el-input>
</el-form-item>
<el-form-item style="margin-top: 20px;">
<el-button @click="getDataList()" type="primary">查询</el-button>
<el-button @click="resetQuery()" type="default">重置</el-button>
</el-form-item>
</el-form>
<el-table
id="labelQueryTable"
:height="height"
:data="dataList"
border
v-loading="dataListLoading || printLoading"
:element-loading-text="loadingText"
style="width: 100%; margin-bottom: 15px;">
<el-table-column prop="unitId" label="单元ID" min-width="150" show-overflow-tooltip></el-table-column>
<el-table-column prop="partNo" label="物料编号" min-width="120" show-overflow-tooltip></el-table-column>
<el-table-column prop="partDesc" label="物料描述" min-width="150" show-overflow-tooltip></el-table-column>
<el-table-column prop="batchNo" label="批次号" min-width="120" show-overflow-tooltip></el-table-column>
<el-table-column prop="locationId" label="库位" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="warehouseId" label="仓库" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="qty" label="数量" min-width="80" align="right"></el-table-column>
<el-table-column prop="inStockFlag" label="入库状态" min-width="80" align="center">
<template slot-scope="scope">
<span v-if="scope.row.inStockFlag === 'Y'" type="success">在库</span>
<span v-else-if="scope.row.inStockFlag === 'N'" type="info">已出库</span>
<span v-else-if="scope.row.inStockFlag === 'X'" type="warning">未入库</span>
<span v-else>{{ scope.row.inStockFlag }}</span>
</template>
</el-table-column>
<el-table-column prop="printCount" label="打印次数" min-width="80" align="center"></el-table-column>
<el-table-column prop="lastPrintDate" label="最后打印时间" min-width="150" show-overflow-tooltip>
<template slot-scope="scope">
{{ formatDate(scope.row.lastPrintDate) }}
</template>
</el-table-column>
<el-table-column prop="createdDate" label="创建时间" min-width="150" show-overflow-tooltip>
<template slot-scope="scope">
{{ formatDate(scope.row.createdDate) }}
</template>
</el-table-column>
<el-table-column label="操作" min-width="100" fixed="right">
<template slot-scope="scope">
<a
v-if="scope.row.inStockFlag === 'X'"
@click="reprintLabel(scope.row)"
type="primary"
:loading="scope.row.printing">
重打标签
</a>
<span v-else style="color: #ccc;">-</span>
</template>
</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>
</template>
<script>
import { getHandlingUnitLabelList, reprintLabel } from '@/api/warehouse/labelQuery'
import { searchSysLanguagePackList, saveUserFavorite, searchUserFavorite } from '@/api/sysLanguage'
export default {
data() {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 50,
totalPage: 0,
dataListLoading: false,
printLoading: false,
loadingText: '加载中...',
dataListSelections: [],
favorite: false,
height: 500,
queryHeaderData: {
inStockFlag: '',
partNo: '',
batchNo: '',
locationId: '',
unitId: ''
},
//
reportId: 'HU_LABEL', // ID
zplCode: '', // ZPL
paperSize: 'A4',
orientation: 'portrait',
dpi: 203
}
},
activated() {
this.getDataList()
this.getHeight()
},
mounted() {
this.getDataList()
this.getHeight()
},
methods: {
//
getDataList() {
this.dataListLoading = true
const params = {
page: this.pageIndex,
size: this.pageSize,
site: localStorage.getItem('site'),
...this.queryHeaderData
}
getHandlingUnitLabelList(params).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list || []
this.totalPage = data.page.totalCount || 0
} else {
this.dataList = []
this.totalPage = 0
this.$message.error(data.msg || '查询失败')
}
this.dataListLoading = false
}).catch(() => {
this.dataList = []
this.totalPage = 0
this.dataListLoading = false
})
},
//
resetQuery() {
this.queryHeaderData = {
inStockFlag: '',
partNo: '',
batchNo: '',
locationId: '',
unitId: ''
}
this.pageIndex = 1
this.getDataList()
},
//
async reprintLabel(row) {
//
if (row.inStockFlag !== 'X') {
this.$message.warning('只有未入库状态的记录才能重打标签')
return
}
try {
//
this.printLoading = true
this.loadingText = `${row.unitId} 打印中...`
//
this.$set(row, 'printing', true)
const printRequest = {
reportId: this.reportId,
zplCode: this.zplCode,
paperSize: this.paperSize,
orientation: this.orientation,
dpi: this.dpi,
userId: localStorage.getItem('userName'),
username: localStorage.getItem('userName'),
site: localStorage.getItem('site'),
unitId: row.unitId
}
const { data } = await reprintLabel(printRequest)
if (data && data.code === 0) {
this.$message.success('打印任务已发送成功')
//
this.getDataList()
} else {
this.$message.error(data.msg || '打印失败')
}
} catch (error) {
this.$message.error('打印失败:' + error.message)
} finally {
//
this.printLoading = false
this.loadingText = '加载中...'
//
this.$set(row, 'printing', false)
}
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
formatDate(date) {
if (!date) return ''
const d = new Date(date)
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
const hours = String(d.getHours()).padStart(2, '0')
const minutes = String(d.getMinutes()).padStart(2, '0')
const seconds = String(d.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
},
//
getHeight() {
this.$nextTick(() => {
this.height = window.innerHeight - 280
})
}
}
}
</script>
<style>
.mod-config .el-form-item {
margin-bottom: 15px;
}
.sl-svg {
font-size: 20px;
cursor: pointer;
color: #409EFF;
}
</style>
Loading…
Cancel
Save