forked from BaoKaiWms/202501-Wms-Kate-Wuxi
1. 增加入出库报表的查询和导出功能。
This commit is contained in:
parent
bee587c278
commit
3868180fee
|
|
@ -133,90 +133,20 @@ export const exportKanbanExcel = (data) => {
|
|||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
// 以下待废弃
|
||||
export const downloadInRecordExcel = (data) => {
|
||||
// 导出入库记录
|
||||
export const exportInTaskRecordExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/downloadInRecordExcel',
|
||||
url: '/excel/exportInTaskRecordExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
export const downloadOutRecordExcel = (data) => {
|
||||
// 导出出库记录
|
||||
export const exportOutTaskRecordExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/downloadOutRecordExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
export const downloadInventoryRecordExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/downloadInventoryRecordExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
export const downloadGoodsExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/exportBaseGoods',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
export const downloadVehicleExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/downloadVehicleExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
export const downloadLocationsExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/downloadLocationsExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
export const queryUploadRecord = (data) => {
|
||||
return request({
|
||||
url: '/excel/queryUploadRecord',
|
||||
method: 'post',
|
||||
data: data,
|
||||
timeout: 100000
|
||||
})
|
||||
}
|
||||
|
||||
export const downloadClcKanbanRequirementExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/downloadClcKanbanRequirementExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
export const downloadWorkSummaryExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/downloadWorkSummaryExcel',
|
||||
url: '/excel/exportOutTaskRecordExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
|
|
|
|||
|
|
@ -1,96 +1,105 @@
|
|||
<template>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="kanbanQueryFormRef" :model="kanbanQuery" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="kanbanQuery.goodsId" placeholder="料号" @keyup.enter="search()" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="看板Id">
|
||||
<el-input v-model="kanbanQuery.kanbanId" placeholder="看板Id" @keyup.enter="search()" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="看板状态">
|
||||
<el-select-v2 v-model="kanbanQuery.kanbanStatus" placeholder="看板状态"
|
||||
:options="addAllOptionOfOptions(kanbanStatusOptions)"
|
||||
@change="search()"></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="工单日期开始(生成看板用)">
|
||||
<el-date-picker v-model="kanbanQuery.planStartDateFrom" type="date"
|
||||
placeholder="请选择开始日期" :shortcuts="shortcuts" style="width: 196px;" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="工单日期结束(生成看板用)">
|
||||
<el-date-picker v-model="kanbanQuery.planStartDateTo" type="date"
|
||||
placeholder="请选择结束日期" :shortcuts="shortcuts" style="width: 196px;" clearable />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<div style="align-content: center;">
|
||||
<el-row>
|
||||
<el-button type="primary"
|
||||
style="height: 30px; width: 80px; margin: auto 5px 5px auto; color: black;"
|
||||
@click="search()">查询</el-button>
|
||||
<el-button type="warning"
|
||||
style="height: 30px; width: 80px; margin: auto 5px 5px auto; color: black;"
|
||||
@click="clearQuery()">清空</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button
|
||||
style="height: 30px; width: 80px; margin: auto 5px 5px auto; background-color: #20B2AA; color: #000;"
|
||||
@click="genKanban()">生成看板</el-button>
|
||||
<el-button
|
||||
style="height: 30px; width: 80px; margin: auto 5px 5px auto; background-color: #32CD32; color: #000;"
|
||||
@click="exportExcel()">导出看板</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<div class="table-area">
|
||||
<el-table :data="kanbanList" stripe border v-loading="tableLoading" class="table-class"
|
||||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template v-slot="scope">
|
||||
<el-radio :label="scope.row.recordId" v-model="recordId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="recordId" label="id" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="goodsId" label="料号" show-overflow-tooltip sortable="custom"
|
||||
min-width="120px" />
|
||||
<el-table-column prop="kanbanId" label="看板id" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="kanbanStatus" label="看板状态" sortable="custom"
|
||||
:formatter="kanbanStatusFormat" min-width="120px" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<br />
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
v-model:page-size="baseTableQuery.pageSize" :page-sizes="[10, 25, 50]" :small="false"
|
||||
:disabled="false" :background="false" :default-page-size="10" @size-change="search"
|
||||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total" />
|
||||
</div>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="kanbanQueryFormRef" :model="kanbanQuery" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="kanbanQuery.goodsId" placeholder="料号" @keyup.enter="search()"
|
||||
clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="看板Id">
|
||||
<el-input v-model="kanbanQuery.kanbanId" placeholder="看板Id"
|
||||
@keyup.enter="search()" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="看板状态">
|
||||
<el-select-v2 v-model="kanbanQuery.kanbanStatus" placeholder="看板状态"
|
||||
:options="addAllOptionOfOptions(kanbanStatusOptions)"
|
||||
@change="search()"></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="工单日期开始(生成看板用)">
|
||||
<el-date-picker v-model="kanbanQuery.planStartDateFrom" type="date"
|
||||
placeholder="请选择开始日期" :shortcuts="shortcuts"
|
||||
style="width: 196px;" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工单日期结束(生成看板用)">
|
||||
<el-date-picker v-model="kanbanQuery.planStartDateTo" type="date"
|
||||
placeholder="请选择结束日期" :shortcuts="shortcuts"
|
||||
style="width: 196px;" clearable/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<div style="align-content: center;">
|
||||
<el-row>
|
||||
<el-button type="primary"
|
||||
style="height: 30px; width: 80px; margin: auto 5px 5px auto; color: black;"
|
||||
@click="search()">查询
|
||||
</el-button>
|
||||
<el-button type="warning"
|
||||
style="height: 30px; width: 80px; margin: auto 5px 5px auto; color: black;"
|
||||
@click="clearQuery()">清空
|
||||
</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button
|
||||
style="height: 30px; width: 80px; margin: auto 5px 5px auto; background-color: #20B2AA; color: #000;"
|
||||
@click="genKanban()">生成看板
|
||||
</el-button>
|
||||
<el-button
|
||||
style="height: 30px; width: 80px; margin: auto 5px 5px auto; background-color: #32CD32; color: #000;"
|
||||
@click="exportExcel()">导出看板
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<div class="table-area">
|
||||
<el-table :data="kanbanList" stripe border v-loading="tableLoading" class="table-class"
|
||||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template v-slot="scope">
|
||||
<el-radio :label="scope.row.recordId" v-model="recordId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="recordId" label="id" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="goodsId" label="料号" show-overflow-tooltip sortable="custom"
|
||||
min-width="120px"/>
|
||||
<el-table-column prop="kanbanId" label="看板id" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="kanbanStatus" label="看板状态" sortable="custom"
|
||||
:formatter="kanbanStatusFormat" min-width="120px" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
<br/>
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
v-model:page-size="baseTableQuery.pageSize" :page-sizes="[10, 25, 50]" :small="false"
|
||||
:disabled="false" :background="false" :default-page-size="10" @size-change="search"
|
||||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { queryKanbanByPage, genClcKanbanRequirement } from '@/api/kateWork.js'
|
||||
import { ref, reactive, onMounted, nextTick, onBeforeUnmount } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { genTableRequest, addAllOptionOfOptions } from '@/utils/generator.js'
|
||||
import { labelPosition, shortcuts } from '@/constant/form'
|
||||
import { kanbanStatusOptions } from '@/constant/options'
|
||||
import { loading } from '@/utils/loading.js'
|
||||
import { dateFormatter } from '@/utils/formatter.js'
|
||||
import { exportKanbanExcel } from '@/api/excel.js'
|
||||
import {queryKanbanByPage, genClcKanbanRequirement} from '@/api/kateWork.js'
|
||||
import {ref, reactive, onMounted, nextTick, onBeforeUnmount} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {genTableRequest, addAllOptionOfOptions} from '@/utils/generator.js'
|
||||
import {labelPosition, shortcuts} from '@/constant/form'
|
||||
import {kanbanStatusOptions} from '@/constant/options'
|
||||
import {loading} from '@/utils/loading.js'
|
||||
import {dateFormatter} from '@/utils/formatter.js'
|
||||
import {exportKanbanExcel} from '@/api/excel.js'
|
||||
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
|
|
@ -103,19 +112,19 @@ let maxHeight = ref(window.innerHeight * 0.55)
|
|||
let tableLoading = ref(false)
|
||||
let kanbanList = ref([])
|
||||
let baseTableQuery = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['goodsId', true]]),
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['goodsId', true]]),
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
})
|
||||
let kanbanQuery = reactive({
|
||||
goodsId: '',
|
||||
kanbanId: '',
|
||||
kanbanStatus: -99,
|
||||
planStartDateFrom: null,
|
||||
planStartDateTo: null
|
||||
goodsId: '',
|
||||
kanbanId: '',
|
||||
kanbanStatus: -99,
|
||||
planStartDateFrom: null,
|
||||
planStartDateTo: null
|
||||
})
|
||||
let kanbanQueryFormRef = ref()
|
||||
let recordId = ''
|
||||
|
|
@ -123,221 +132,221 @@ let recordId = ''
|
|||
* 系统方法
|
||||
*/
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
})
|
||||
const resizeHeight = () => {
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
}
|
||||
/**
|
||||
* 自定义方法
|
||||
*/
|
||||
// 查询
|
||||
const search = () => {
|
||||
tableLoading.value = true
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.goodsId = kanbanQuery.goodsId
|
||||
request.kanbanId = kanbanQuery.kanbanId
|
||||
request.kanbanStatus = kanbanQuery.kanbanStatus == -99 ? null : kanbanQuery.kanbanStatus
|
||||
queryKanbanByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
const data = response.data
|
||||
if (data != null) {
|
||||
kanbanList.value = data.lists
|
||||
baseTableQuery.total = data.total
|
||||
} else {
|
||||
kanbanList.value = []
|
||||
baseTableQuery.total = 0
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询看板信息异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
tableLoading.value = true
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.goodsId = kanbanQuery.goodsId
|
||||
request.kanbanId = kanbanQuery.kanbanId
|
||||
request.kanbanStatus = kanbanQuery.kanbanStatus == -99 ? null : kanbanQuery.kanbanStatus
|
||||
queryKanbanByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
const data = response.data
|
||||
if (data != null) {
|
||||
kanbanList.value = data.lists
|
||||
baseTableQuery.total = data.total
|
||||
} else {
|
||||
kanbanList.value = []
|
||||
baseTableQuery.total = 0
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询看板信息异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
}
|
||||
// 清空查询
|
||||
const clearQuery = () => {
|
||||
kanbanQuery.goodsId = ''
|
||||
kanbanQuery.kanbanId = ''
|
||||
kanbanQuery.kanbanStatus = -99
|
||||
kanbanQuery.goodsId = ''
|
||||
kanbanQuery.kanbanId = ''
|
||||
kanbanQuery.kanbanStatus = -99
|
||||
}
|
||||
// 处理排序
|
||||
const handleSortChange = (data) => {
|
||||
if (baseTableQuery.sortBy.has(data.prop)) {
|
||||
baseTableQuery.sortBy.delete(data.prop)
|
||||
}
|
||||
baseTableQuery.sortBy.set(data.prop, data.order == 'ascending')
|
||||
search()
|
||||
if (baseTableQuery.sortBy.has(data.prop)) {
|
||||
baseTableQuery.sortBy.delete(data.prop)
|
||||
}
|
||||
baseTableQuery.sortBy.set(data.prop, data.order == 'ascending')
|
||||
search()
|
||||
}
|
||||
const getCurrentRow = (row) => {
|
||||
recordId = row.recordId
|
||||
recordId = row.recordId
|
||||
}
|
||||
// 看板状态格式化
|
||||
const kanbanStatusFormat = (row, column, cellValue, index) => {
|
||||
switch (cellValue) {
|
||||
case 0:
|
||||
return '空'
|
||||
case 1:
|
||||
return '满'
|
||||
default:
|
||||
return '异常'
|
||||
}
|
||||
switch (cellValue) {
|
||||
case 0:
|
||||
return '空'
|
||||
case 1:
|
||||
return '满'
|
||||
default:
|
||||
return '异常'
|
||||
}
|
||||
}
|
||||
const genKanban = () => {
|
||||
const request = {
|
||||
planStartDateFrom: dateFormatter(kanbanQuery.planStartDateFrom),
|
||||
planStartDateTo: dateFormatter(kanbanQuery.planStartDateTo),
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
const request = {
|
||||
planStartDateFrom: dateFormatter(kanbanQuery.planStartDateFrom),
|
||||
planStartDateTo: dateFormatter(kanbanQuery.planStartDateTo),
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
}
|
||||
loading.open('生成中...')
|
||||
genClcKanbanRequirement(request).then(res => {
|
||||
loading.close()
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
ElMessage.success('生成看板需求成功。')
|
||||
search()
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
loading.open('生成中...')
|
||||
genClcKanbanRequirement(request).then(res => {
|
||||
loading.close()
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
ElMessage.success('生成看板需求成功。')
|
||||
search()
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
loading.close()
|
||||
console.log(err)
|
||||
ElMessage.error('生成看板需求异常。')
|
||||
})
|
||||
}).catch(err => {
|
||||
loading.close()
|
||||
console.log(err)
|
||||
ElMessage.error('生成看板需求异常。')
|
||||
})
|
||||
}
|
||||
// 导出看板
|
||||
const exportExcel = () => {
|
||||
const params = {
|
||||
goodsId: kanbanQuery.goodsId,
|
||||
kanbanId: kanbanQuery.kanbanId,
|
||||
kanbanStatus: kanbanQuery.kanbanStatus == -99 ? null : kanbanQuery.kanbanStatus,
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
}
|
||||
exportKanbanExcel(params).then(res => {
|
||||
const link = document.createElement('a');//创建a标签
|
||||
try {
|
||||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
let _fileName = '看板需求' + dateFormatter(new Date) + '.xlsx'
|
||||
link.style.display = 'none'//隐藏
|
||||
const params = {
|
||||
goodsId: kanbanQuery.goodsId,
|
||||
kanbanId: kanbanQuery.kanbanId,
|
||||
kanbanStatus: kanbanQuery.kanbanStatus == -99 ? null : kanbanQuery.kanbanStatus,
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
}
|
||||
exportKanbanExcel(params).then(res => {
|
||||
const link = document.createElement('a');//创建a标签
|
||||
try {
|
||||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
let _fileName = '看板需求' + dateFormatter(new Date) + '.xlsx'
|
||||
link.style.display = 'none'//隐藏
|
||||
|
||||
// 兼容不同浏览器的URL对象
|
||||
const url = window.URL || window.webkitURL || window.moxURL
|
||||
link.href = url.createObjectURL(blob)
|
||||
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
url.revokeObjectURL(link.href)//移除url对象
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
ElMessage.error('下载文件失败')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('导出失败')
|
||||
})
|
||||
// 兼容不同浏览器的URL对象
|
||||
const url = window.URL || window.webkitURL || window.moxURL
|
||||
link.href = url.createObjectURL(blob)
|
||||
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
url.revokeObjectURL(link.href)//移除url对象
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
ElMessage.error('下载文件失败')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('导出失败')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.work-area {
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
}
|
||||
|
||||
.search-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 40%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 40%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.table-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 60%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 60%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin: 5px 5px 5px 5px;
|
||||
margin: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-select-v2 {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.my-autocomplete li {
|
||||
width: 196px;
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
width: 196px;
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_id {
|
||||
color: brown;
|
||||
color: brown;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_name {
|
||||
color: cornflowerblue;
|
||||
color: cornflowerblue;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -334,7 +334,7 @@ const timeFormat = (row, column, cellValue, index) => {
|
|||
}
|
||||
const rowStyle = ({ row, rowIndex }) => {
|
||||
if (row.dbsStatus == 2) {
|
||||
return { "color": "red" }
|
||||
return { "color": "green" }
|
||||
}
|
||||
}
|
||||
const handleSortChange = (data) => {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<el-row>
|
||||
<el-button type="success"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="handleEnter()">绑定物料</el-button>
|
||||
@click="confirmBinding()">绑定物料</el-button>
|
||||
<el-button type="warning"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="clearInput()">清除输入</el-button>
|
||||
|
|
@ -70,8 +70,8 @@
|
|||
<el-table-column prop="goodsId" label="零件号" fixed="left" />
|
||||
<el-table-column prop="opNum" label="数量" />
|
||||
<el-table-column fixed="right" label="操作">
|
||||
<template #default>
|
||||
<el-button plain type="warning" @click="removeThisRow(row)">删除</el-button>
|
||||
<template v-slot="scope">
|
||||
<el-button plain type="warning" @click="removeThisRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -79,7 +79,8 @@
|
|||
<el-dialog v-model="showInOutDialog" title="入库清单扫码" width="70%" draggable>
|
||||
<fieldset class="main-area">
|
||||
<el-form ref="outForInRef" :model="outForInEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" :rules="outForInRules" status-icon @submit.native.prevent>
|
||||
label-width="158px" style="max-width: 100%" :rules="outForInRules" status-icon
|
||||
@submit.native.prevent>
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="料号">
|
||||
|
|
@ -106,12 +107,12 @@
|
|||
:cell-style="{ 'text-align': 'center' }">
|
||||
<el-table-column prop="goodsId" label="料号" fixed="left" />
|
||||
<el-table-column fixed="right" label="操作">
|
||||
<template #default>
|
||||
<el-button plain type="warning" @click="popThisGoodsId(row)">删除</el-button>
|
||||
<template v-slot="scope">
|
||||
<el-button plain type="warning" @click="popThisGoodsId(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</el-container>
|
||||
|
|
@ -271,6 +272,27 @@ const clearInput = () => {
|
|||
}
|
||||
}
|
||||
}
|
||||
// 绑定前确认
|
||||
const confirmBinding = () => {
|
||||
// 判断是否是非空箱入库时,未输入料号和数量
|
||||
if (!inTaskEntity.emptyTask && inTaskEntity.goodsId == '') {
|
||||
ElMessageBox.confirm(
|
||||
'非空箱入库未输入料号。\n是否继续绑定',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
addBinding()
|
||||
}).catch(() => {
|
||||
ElMessage.info('操作取消')
|
||||
})
|
||||
} else {
|
||||
handleEnter()
|
||||
}
|
||||
}
|
||||
// 添加绑定关系
|
||||
const addBinding = () => {
|
||||
if (taskRequestEntity.vehicleId != '' && taskRequestEntity.vehicleId != inTaskEntity.vehicleId) {
|
||||
|
|
@ -431,10 +453,10 @@ const confirmCallVehicles = () => {
|
|||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
successBox(response.message)
|
||||
outForInRequestEntity.goodsIds = []
|
||||
} else {
|
||||
errorBox(response.message)
|
||||
}
|
||||
outForInRequestEntity.goodsIds = []
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('请求错误。')
|
||||
|
|
|
|||
|
|
@ -1,98 +1,115 @@
|
|||
<template>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="searchQueryFormRef" :model="searchQueryFormEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="箱号">
|
||||
<el-input v-model="searchQueryFormEntity.vehicleId" @keyup.enter="search()" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="searchQueryFormEntity.goodsId" @keyup.enter="search()" clearable />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<div style="align-content: center;">
|
||||
<el-row>
|
||||
<el-button type="primary" class="btn-search" @click="search()">查询</el-button>
|
||||
<el-button type="warning" class="btn-search" @click="clearQuery()">清除输入</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success" class="btn-search"
|
||||
@click="exportExcel()">导出excel</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<div class="table-area">
|
||||
<el-table :data="tableData" stripe border v-loading="tableLoading" class="table-class"
|
||||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template v-slot="scope">
|
||||
<el-radio :label="scope.row.taskId" v-model="taskId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="taskId" label="任务号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="taskType" label="任务类型" :formatter="taskTypeFormat" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="taskStatus" label="任务状态" :formatter="taskStatusFormat" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="taskPriority" label="优先级" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="vehicleId" label="箱号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="goodsId" label="料号" min-width="120px" fixed="left" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="goodsDesc" label="物料描述"
|
||||
min-width="120px" sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="opNum" label="操作数量" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="stockNum" label="库存数量" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="origin" label="起点" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="destination" label="终点" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="wcsTaskId" label="wcs任务号" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" fixed="right" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="finishTime" label="完成时间" :formatter="timeFormat" fixed="right" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="opUser" label="操作用户" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="remark" label="备注" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="callStand" label="呼叫站台" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<br />
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
v-model:page-size="baseTableQuery.pageSize" :page-sizes="[10, 25, 50]" :small="false"
|
||||
:disabled="false" :background="false" :default-page-size="10" @size-change="search"
|
||||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total" />
|
||||
</div>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="searchQueryFormRef" :model="searchQueryFormEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="箱号">
|
||||
<el-input v-model="searchQueryFormEntity.vehicleId" @keyup.enter="search()" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="searchQueryFormEntity.goodsId" @keyup.enter="search()" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间from">
|
||||
<el-date-picker v-model="searchQueryFormEntity.fromTime" type="datetime"
|
||||
placeholder="请选择from时间" :shortcuts="shortcuts"
|
||||
style="width: 196px;" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间to">
|
||||
<el-date-picker v-model="searchQueryFormEntity.toTime" type="datetime"
|
||||
placeholder="请选择to时间" :shortcuts="shortcuts"
|
||||
style="width: 196px;" clearable/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<div style="align-content: center;">
|
||||
<el-row>
|
||||
<el-button type="primary" class="btn-search" @click="search()">查询</el-button>
|
||||
<el-button type="warning" class="btn-search" @click="clearQuery()">清除输入</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success" class="btn-search"
|
||||
@click="exportExcel()">导出excel
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<div class="table-area">
|
||||
<el-table :data="tableData" stripe border v-loading="tableLoading" class="table-class"
|
||||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template v-slot="scope">
|
||||
<el-radio :label="scope.row.taskId" v-model="taskId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="taskId" label="任务号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="taskType" label="任务类型" :formatter="taskTypeFormat" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="taskStatus" label="任务状态" :formatter="taskStatusFormat" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="taskPriority" label="优先级" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="vehicleId" label="箱号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="goodsId" label="料号" min-width="120px" fixed="left" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="goodsDesc" label="物料描述"
|
||||
min-width="120px" sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="opNum" label="操作数量" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="stockNum" label="库存数量" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="origin" label="起点" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="destination" label="终点" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="wcsTaskId" label="wcs任务号" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" fixed="right" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="finishTime" label="完成时间" :formatter="timeFormat" fixed="right" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="opUser" label="操作用户" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="remark" label="备注" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="callStand" label="呼叫站台" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
<br/>
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
v-model:page-size="baseTableQuery.pageSize" :page-sizes="[10, 25, 50]" :small="false"
|
||||
:disabled="false" :background="false" :default-page-size="10" @size-change="search"
|
||||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { queryInTaskRecordByPage } from '@/api/taskQuery.js'
|
||||
import { timeFormatter, wmsTaskTypeFormatter, wmsTaskStatusFormatter } from '@/utils/formatter.js'
|
||||
import { ref, reactive, onMounted, nextTick, onBeforeUnmount } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { genTableRequest } from '@/utils/generator.js'
|
||||
import { labelPosition } from '@/constant/form.js'
|
||||
import {queryInTaskRecordByPage} from '@/api/taskQuery.js'
|
||||
import {timeFormatter, wmsTaskTypeFormatter, wmsTaskStatusFormatter, dateFormatter} from '@/utils/formatter.js'
|
||||
import {ref, reactive, onMounted, nextTick, onBeforeUnmount} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {genTableRequest} from '@/utils/generator.js'
|
||||
import {labelPosition, shortcuts} from '@/constant/form.js'
|
||||
import {exportInTaskRecordExcel} from '@/api/excel.js'
|
||||
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
|
|
@ -105,16 +122,18 @@ let maxHeight = ref(window.innerHeight * 0.55)
|
|||
let tableLoading = ref(false)
|
||||
let tableData = ref([])
|
||||
let baseTableQuery = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['createTime', false]]),// 按照创建时间倒序
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['createTime', false]]),// 按照创建时间倒序
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
})
|
||||
let searchQueryFormEntity = reactive({
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
fromTime: null,
|
||||
toTime: null
|
||||
})
|
||||
let searchQueryFormRef = ref()
|
||||
let taskId = ''
|
||||
|
|
@ -122,201 +141,178 @@ let taskId = ''
|
|||
* 系统方法
|
||||
*/
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
})
|
||||
const resizeHeight = () => {
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
}
|
||||
/**
|
||||
* 自定义方法
|
||||
*/
|
||||
// 查询
|
||||
const search = () => {
|
||||
tableLoading.value = true
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.vehicleId = searchQueryFormEntity.vehicleId.trim()
|
||||
request.goodsId = searchQueryFormEntity.goodsId.trim()
|
||||
queryInTaskRecordByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
const data = response.data
|
||||
if (data != null) {
|
||||
tableData.value = data.lists
|
||||
baseTableQuery.total = data.total
|
||||
} else {
|
||||
tableData.value = []
|
||||
baseTableQuery.total = 0
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询数据异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
tableLoading.value = true
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.vehicleId = searchQueryFormEntity.vehicleId.trim()
|
||||
request.goodsId = searchQueryFormEntity.goodsId.trim()
|
||||
request.fromTime = searchQueryFormEntity.fromTime == null ? null : timeFormatter(searchQueryFormEntity.fromTime)
|
||||
request.toTime = searchQueryFormEntity.toTime == null ? null : timeFormatter(searchQueryFormEntity.toTime)
|
||||
queryInTaskRecordByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code === 0) {
|
||||
const data = response.data
|
||||
if (data != null) {
|
||||
tableData.value = data.lists
|
||||
baseTableQuery.total = data.total
|
||||
} else {
|
||||
tableData.value = []
|
||||
baseTableQuery.total = 0
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询数据异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
}
|
||||
const clearQuery = () => {
|
||||
searchQueryFormEntity.vehicleId = ''
|
||||
searchQueryFormEntity.goodsId = ''
|
||||
searchQueryFormEntity.vehicleId = ''
|
||||
searchQueryFormEntity.goodsId = ''
|
||||
searchQueryFormEntity.fromTime = null
|
||||
searchQueryFormEntity.toTime = null
|
||||
}
|
||||
const handleSortChange = (data) => {
|
||||
if (baseTableQuery.sortBy.has(data.prop)) {
|
||||
baseTableQuery.sortBy.delete(data.prop)
|
||||
}
|
||||
baseTableQuery.sortBy.set(data.prop, data.order == 'ascending')
|
||||
search()
|
||||
if (baseTableQuery.sortBy.has(data.prop)) {
|
||||
baseTableQuery.sortBy.delete(data.prop)
|
||||
}
|
||||
baseTableQuery.sortBy.set(data.prop, data.order == 'ascending')
|
||||
search()
|
||||
}
|
||||
const getCurrentRow = (row) => {
|
||||
taskId = row.taskId
|
||||
taskId = row.taskId
|
||||
}
|
||||
const timeFormat = (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
return timeFormatter(cellValue)
|
||||
}
|
||||
const taskTypeFormat = (row, column, cellValue, index) => {
|
||||
return wmsTaskTypeFormatter(cellValue)
|
||||
return wmsTaskTypeFormatter(cellValue)
|
||||
}
|
||||
const taskStatusFormat = (row, column, cellValue, index) => {
|
||||
return wmsTaskStatusFormatter(cellValue)
|
||||
return wmsTaskStatusFormatter(cellValue)
|
||||
}
|
||||
const exportExcel = () => {
|
||||
ElMessage.warning('导出功能暂未开放。')
|
||||
const params = {
|
||||
goodsId: searchQueryFormEntity.goodsId,
|
||||
goodsDesc: searchQueryFormEntity.goodsDesc,
|
||||
userName: USER_NAME
|
||||
}
|
||||
// exportGoodsExcel(params).then(res => {
|
||||
// const link = document.createElement('a');//创建a标签
|
||||
// try {
|
||||
// // let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
// let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// // let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
// let _fileName = '物料基础信息' + dateFormatter(new Date) + '.xlsx'
|
||||
// link.style.display = 'none'//隐藏
|
||||
const params = {
|
||||
goodsId: searchQueryFormEntity.goodsId,
|
||||
vehicleId: searchQueryFormEntity.vehicleId,
|
||||
fromTime: searchQueryFormEntity.fromTime == null ? null : timeFormatter(searchQueryFormEntity.fromTime),
|
||||
toTime: searchQueryFormEntity.toTime == null ? null : timeFormatter(searchQueryFormEntity.toTime),
|
||||
userName: USER_NAME
|
||||
}
|
||||
exportInTaskRecordExcel(params).then(res => {
|
||||
const link = document.createElement('a');//创建a标签
|
||||
try {
|
||||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
let _fileName = '入库记录' + dateFormatter(new Date) + '.xlsx'
|
||||
link.style.display = 'none'//隐藏
|
||||
|
||||
// // 兼容不同浏览器的URL对象
|
||||
// const url = window.URL || window.webkitURL || window.moxURL
|
||||
// link.href = url.createObjectURL(blob)
|
||||
// link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
// document.body.appendChild(link)
|
||||
// link.click()
|
||||
// document.body.removeChild(link)
|
||||
// url.revokeObjectURL(link.href)//移除url对象
|
||||
// } catch (e) {
|
||||
// console.log(e)
|
||||
// ElMessage.error('下载文件失败')
|
||||
// }
|
||||
// }).catch(err => {
|
||||
// console.log(err)
|
||||
// ElMessage.error('导出失败')
|
||||
// })
|
||||
// 兼容不同浏览器的URL对象
|
||||
const url = window.URL || window.webkitURL || window.moxURL
|
||||
link.href = url.createObjectURL(blob)
|
||||
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
url.revokeObjectURL(link.href)//移除url对象
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
ElMessage.error('下载文件失败')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('导出失败')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.work-area {
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
}
|
||||
|
||||
.search-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 40%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 40%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.table-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 60%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 60%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin: 5px 5px 5px 5px;
|
||||
margin: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input-number {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-select-v2 {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.my-autocomplete li {
|
||||
width: 196px;
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_id {
|
||||
color: brown;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_name {
|
||||
color: cornflowerblue;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.btn-search {
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
margin: auto 5px 5px auto;
|
||||
color: black;
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
margin: auto 5px 5px auto;
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,98 +1,115 @@
|
|||
<template>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="searchQueryFormRef" :model="searchQueryFormEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="箱号">
|
||||
<el-input v-model="searchQueryFormEntity.vehicleId" @keyup.enter="search()" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="searchQueryFormEntity.goodsId" @keyup.enter="search()" clearable />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<div style="align-content: center;">
|
||||
<el-row>
|
||||
<el-button type="primary" class="btn-search" @click="search()">查询</el-button>
|
||||
<el-button type="warning" class="btn-search" @click="clearQuery()">清除输入</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success" class="btn-search"
|
||||
@click="exportExcel()">导出excel</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<div class="table-area">
|
||||
<el-table :data="tableData" stripe border v-loading="tableLoading" class="table-class"
|
||||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template v-slot="scope">
|
||||
<el-radio :label="scope.row.taskId" v-model="taskId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="taskId" label="任务号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="taskType" label="任务类型" :formatter="taskTypeFormat" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="taskStatus" label="任务状态" :formatter="taskStatusFormat" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="taskPriority" label="优先级" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="vehicleId" label="箱号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="goodsId" label="料号" min-width="120px" fixed="left" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="goodsDesc" label="物料描述"
|
||||
min-width="120px" sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="opNum" label="操作数量" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="stockNum" label="库存数量" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="origin" label="起点" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="destination" label="终点" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="wcsTaskId" label="wcs任务号" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" fixed="right" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="finishTime" label="完成时间" :formatter="timeFormat" fixed="right" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="opUser" label="操作用户" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="remark" label="备注" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="callStand" label="呼叫站台" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<br />
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
v-model:page-size="baseTableQuery.pageSize" :page-sizes="[10, 25, 50]" :small="false"
|
||||
:disabled="false" :background="false" :default-page-size="10" @size-change="search"
|
||||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total" />
|
||||
</div>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="searchQueryFormRef" :model="searchQueryFormEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="箱号">
|
||||
<el-input v-model="searchQueryFormEntity.vehicleId" @keyup.enter="search()" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="searchQueryFormEntity.goodsId" @keyup.enter="search()" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间from">
|
||||
<el-date-picker v-model="searchQueryFormEntity.fromTime" type="datetime"
|
||||
placeholder="请选择from时间" :shortcuts="shortcuts"
|
||||
style="width: 196px;" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间to">
|
||||
<el-date-picker v-model="searchQueryFormEntity.toTime" type="datetime"
|
||||
placeholder="请选择to时间" :shortcuts="shortcuts"
|
||||
style="width: 196px;" clearable/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<div style="align-content: center;">
|
||||
<el-row>
|
||||
<el-button type="primary" class="btn-search" @click="search()">查询</el-button>
|
||||
<el-button type="warning" class="btn-search" @click="clearQuery()">清除输入</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success" class="btn-search"
|
||||
@click="exportExcel()">导出excel
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<div class="table-area">
|
||||
<el-table :data="tableData" stripe border v-loading="tableLoading" class="table-class"
|
||||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template v-slot="scope">
|
||||
<el-radio :label="scope.row.taskId" v-model="taskId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="taskId" label="任务号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="taskType" label="任务类型" :formatter="taskTypeFormat" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="taskStatus" label="任务状态" :formatter="taskStatusFormat" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="taskPriority" label="优先级" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="vehicleId" label="箱号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="goodsId" label="料号" min-width="120px" fixed="left" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="goodsDesc" label="物料描述"
|
||||
min-width="120px" sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="opNum" label="操作数量" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="stockNum" label="库存数量" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="origin" label="起点" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="destination" label="终点" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="wcsTaskId" label="wcs任务号" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" fixed="right" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="finishTime" label="完成时间" :formatter="timeFormat" fixed="right" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="opUser" label="操作用户" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="remark" label="备注" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="callStand" label="呼叫站台" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
<br/>
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
v-model:page-size="baseTableQuery.pageSize" :page-sizes="[10, 25, 50]" :small="false"
|
||||
:disabled="false" :background="false" :default-page-size="10" @size-change="search"
|
||||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { queryOutTaskRecordByPage } from '@/api/taskQuery.js'
|
||||
import { timeFormatter, wmsTaskTypeFormatter, wmsTaskStatusFormatter } from '@/utils/formatter.js'
|
||||
import { ref, reactive, onMounted, nextTick, onBeforeUnmount } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { genTableRequest } from '@/utils/generator.js'
|
||||
import { labelPosition } from '@/constant/form.js'
|
||||
import {queryOutTaskRecordByPage} from '@/api/taskQuery.js'
|
||||
import {exportOutTaskRecordExcel} from "@/api/excel"
|
||||
import {timeFormatter, wmsTaskTypeFormatter, wmsTaskStatusFormatter, dateFormatter} from '@/utils/formatter.js'
|
||||
import {ref, reactive, onMounted, nextTick, onBeforeUnmount} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {genTableRequest} from '@/utils/generator.js'
|
||||
import {labelPosition, shortcuts} from '@/constant/form.js'
|
||||
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
|
|
@ -105,16 +122,18 @@ let maxHeight = ref(window.innerHeight * 0.55)
|
|||
let tableLoading = ref(false)
|
||||
let tableData = ref([])
|
||||
let baseTableQuery = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['createTime', false]]),// 按创建时间倒序
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['createTime', false]]),// 按创建时间倒序
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
})
|
||||
let searchQueryFormEntity = reactive({
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
fromTime: null,
|
||||
toTime: null
|
||||
})
|
||||
let searchQueryFormRef = ref()
|
||||
let taskId = ''
|
||||
|
|
@ -122,201 +141,206 @@ let taskId = ''
|
|||
* 系统方法
|
||||
*/
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
})
|
||||
const resizeHeight = () => {
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
}
|
||||
/**
|
||||
* 自定义方法
|
||||
*/
|
||||
// 查询
|
||||
const search = () => {
|
||||
tableLoading.value = true
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.vehicleId = searchQueryFormEntity.vehicleId.trim()
|
||||
request.goodsId = searchQueryFormEntity.goodsId.trim()
|
||||
queryOutTaskRecordByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
const data = response.data
|
||||
if (data != null) {
|
||||
tableData.value = data.lists
|
||||
baseTableQuery.total = data.total
|
||||
} else {
|
||||
tableData.value = []
|
||||
baseTableQuery.total = 0
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询数据异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
tableLoading.value = true
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.vehicleId = searchQueryFormEntity.vehicleId.trim()
|
||||
request.goodsId = searchQueryFormEntity.goodsId.trim()
|
||||
request.fromTime = searchQueryFormEntity.fromTime == null ? null : timeFormatter(searchQueryFormEntity.fromTime)
|
||||
request.toTime = searchQueryFormEntity.toTime == null ? null : timeFormatter(searchQueryFormEntity.toTime)
|
||||
queryOutTaskRecordByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code === 0) {
|
||||
const data = response.data
|
||||
if (data != null) {
|
||||
tableData.value = data.lists
|
||||
baseTableQuery.total = data.total
|
||||
} else {
|
||||
tableData.value = []
|
||||
baseTableQuery.total = 0
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询数据异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
}
|
||||
const clearQuery = () => {
|
||||
searchQueryFormEntity.vehicleId = ''
|
||||
searchQueryFormEntity.goodsId = ''
|
||||
searchQueryFormEntity.vehicleId = ''
|
||||
searchQueryFormEntity.goodsId = ''
|
||||
searchQueryFormEntity.fromTime = null
|
||||
searchQueryFormEntity.toTime = null
|
||||
}
|
||||
const handleSortChange = (data) => {
|
||||
if (baseTableQuery.sortBy.has(data.prop)) {
|
||||
baseTableQuery.sortBy.delete(data.prop)
|
||||
}
|
||||
baseTableQuery.sortBy.set(data.prop, data.order == 'ascending')
|
||||
search()
|
||||
if (baseTableQuery.sortBy.has(data.prop)) {
|
||||
baseTableQuery.sortBy.delete(data.prop)
|
||||
}
|
||||
baseTableQuery.sortBy.set(data.prop, data.order == 'ascending')
|
||||
search()
|
||||
}
|
||||
const getCurrentRow = (row) => {
|
||||
taskId = row.taskId
|
||||
taskId = row.taskId
|
||||
}
|
||||
const timeFormat = (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
return timeFormatter(cellValue)
|
||||
}
|
||||
const taskTypeFormat = (row, column, cellValue, index) => {
|
||||
return wmsTaskTypeFormatter(cellValue)
|
||||
return wmsTaskTypeFormatter(cellValue)
|
||||
}
|
||||
const taskStatusFormat = (row, column, cellValue, index) => {
|
||||
return wmsTaskStatusFormatter(cellValue)
|
||||
return wmsTaskStatusFormatter(cellValue)
|
||||
}
|
||||
const exportExcel = () => {
|
||||
ElMessage.warning('导出功能暂未开放。')
|
||||
const params = {
|
||||
goodsId: searchQueryFormEntity.goodsId,
|
||||
goodsDesc: searchQueryFormEntity.goodsDesc,
|
||||
userName: USER_NAME
|
||||
}
|
||||
// exportGoodsExcel(params).then(res => {
|
||||
// const link = document.createElement('a');//创建a标签
|
||||
// try {
|
||||
// // let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
// let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// // let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
// let _fileName = '物料基础信息' + dateFormatter(new Date) + '.xlsx'
|
||||
// link.style.display = 'none'//隐藏
|
||||
const params = {
|
||||
goodsId: searchQueryFormEntity.goodsId,
|
||||
vehicleId: searchQueryFormEntity.vehicleId,
|
||||
fromTime: searchQueryFormEntity.fromTime == null ? null : timeFormatter(searchQueryFormEntity.fromTime),
|
||||
toTime: searchQueryFormEntity.toTime == null ? null : timeFormatter(searchQueryFormEntity.toTime),
|
||||
userName: USER_NAME
|
||||
}
|
||||
exportOutTaskRecordExcel(params).then(res => {
|
||||
const link = document.createElement('a');//创建a标签
|
||||
try {
|
||||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
let _fileName = '出库记录' + dateFormatter(new Date) + '.xlsx'
|
||||
link.style.display = 'none'//隐藏
|
||||
|
||||
// // 兼容不同浏览器的URL对象
|
||||
// const url = window.URL || window.webkitURL || window.moxURL
|
||||
// link.href = url.createObjectURL(blob)
|
||||
// link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
// document.body.appendChild(link)
|
||||
// link.click()
|
||||
// document.body.removeChild(link)
|
||||
// url.revokeObjectURL(link.href)//移除url对象
|
||||
// } catch (e) {
|
||||
// console.log(e)
|
||||
// ElMessage.error('下载文件失败')
|
||||
// }
|
||||
// }).catch(err => {
|
||||
// console.log(err)
|
||||
// ElMessage.error('导出失败')
|
||||
// })
|
||||
// 兼容不同浏览器的URL对象
|
||||
const url = window.URL || window.webkitURL || window.moxURL
|
||||
link.href = url.createObjectURL(blob)
|
||||
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
url.revokeObjectURL(link.href)//移除url对象
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
ElMessage.error('下载文件失败')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('导出失败')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.work-area {
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
}
|
||||
|
||||
.search-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 40%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 40%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.table-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 60%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 60%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin: 5px 5px 5px 5px;
|
||||
margin: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input-number {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-select-v2 {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.my-autocomplete li {
|
||||
width: 196px;
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
width: 196px;
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_id {
|
||||
color: brown;
|
||||
color: brown;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_name {
|
||||
color: cornflowerblue;
|
||||
color: cornflowerblue;
|
||||
}
|
||||
|
||||
.btn-search {
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
margin: auto 5px 5px auto;
|
||||
color: black;
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
margin: auto 5px 5px auto;
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,84 +1,95 @@
|
|||
<template>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="searchQueryFormRef" :model="searchQueryFormEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="searchQueryFormEntity.goodsId" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="载具号">
|
||||
<el-input v-model="searchQueryFormEntity.vehicleId" clearable />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<div style="align-content: center;">
|
||||
<el-row>
|
||||
<el-button type="primary" class="btn-search" @click="search()">查询</el-button>
|
||||
<el-button type="warning" class="btn-search" @click="clearQuery()">清除输入</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success" class="btn-search"
|
||||
@click="exportExcel()">导出excel</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<div class="table-area">
|
||||
<el-table :data="tableData" stripe border v-loading="tableLoading" class="table-class"
|
||||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template v-slot="scope">
|
||||
<el-radio :label="scope.row.updateId" v-model="updateId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="updateId" label="数据编号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="goodsId" label="料号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="vehicleId" label="箱号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="firstInTime" label="初次入库时间" :formatter="timeFormat" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="beforeNum" label="原数量" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="afterNum" label="新数量" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="reason" label="原因" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="updateTime" label="更新时间" :formatter="timeFormat" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="updateUser" label="更新用户" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
</el-table>
|
||||
<br />
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
v-model:page-size="baseTableQuery.pageSize" :page-sizes="[10, 25, 50]" :small="false"
|
||||
:disabled="false" :background="false" :default-page-size="10" @size-change="search"
|
||||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total" />
|
||||
</div>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="searchQueryFormRef" :model="searchQueryFormEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="searchQueryFormEntity.goodsId" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="载具号">
|
||||
<el-input v-model="searchQueryFormEntity.vehicleId" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间from">
|
||||
<el-date-picker v-model="searchQueryFormEntity.fromTime" type="datetime"
|
||||
placeholder="请选择from时间" :shortcuts="shortcuts"
|
||||
style="width: 196px;" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间to">
|
||||
<el-date-picker v-model="searchQueryFormEntity.toTime" type="datetime"
|
||||
placeholder="请选择to时间" :shortcuts="shortcuts"
|
||||
style="width: 196px;" clearable/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<div style="align-content: center;">
|
||||
<el-row>
|
||||
<el-button type="primary" class="btn-search" @click="search()">查询</el-button>
|
||||
<el-button type="warning" class="btn-search" @click="clearQuery()">清除输入</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success" class="btn-search"
|
||||
@click="exportExcel()">导出excel
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<div class="table-area">
|
||||
<el-table :data="tableData" stripe border v-loading="tableLoading" class="table-class"
|
||||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template v-slot="scope">
|
||||
<el-radio :label="scope.row.updateId" v-model="updateId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="updateId" label="数据编号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="goodsId" label="料号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="vehicleId" label="箱号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="firstInTime" label="初次入库时间" :formatter="timeFormat" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="beforeNum" label="原数量" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="afterNum" label="新数量" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="reason" label="原因" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="updateTime" label="更新时间" :formatter="timeFormat" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="updateUser" label="更新用户" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
</el-table>
|
||||
<br/>
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
v-model:page-size="baseTableQuery.pageSize" :page-sizes="[10, 25, 50]" :small="false"
|
||||
:disabled="false" :background="false" :default-page-size="10" @size-change="search"
|
||||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { queryStockUpdateByPage } from '@/api/stock.js'
|
||||
import { dateFormatter, timeFormatter } from '@/utils/formatter.js'
|
||||
import { ref, reactive, onMounted, nextTick, onBeforeUnmount } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { genTableRequest } from '@/utils/generator.js'
|
||||
import { labelPosition } from '@/constant/form.js'
|
||||
import { loading } from '@/utils/loading'
|
||||
import { exportStockUpdateExcel } from '@/api/excel.js'
|
||||
import {queryStockUpdateByPage} from '@/api/stock.js'
|
||||
import {dateFormatter, timeFormatter} from '@/utils/formatter.js'
|
||||
import {ref, reactive, onMounted, nextTick, onBeforeUnmount} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {genTableRequest} from '@/utils/generator.js'
|
||||
import {labelPosition, shortcuts} from '@/constant/form.js'
|
||||
import {exportStockUpdateExcel} from '@/api/excel.js'
|
||||
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
|
|
@ -91,16 +102,18 @@ let maxHeight = ref(window.innerHeight * 0.55)
|
|||
let tableLoading = ref(false)
|
||||
let tableData = ref([])
|
||||
let baseTableQuery = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['updateTime', false]]),// 按照成品号顺序排序
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['updateTime', false]]),// 按照成品号顺序排序
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
})
|
||||
let searchQueryFormEntity = reactive({
|
||||
vehicleId: '',
|
||||
goodsId: ''
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
fromTime: null,
|
||||
toTime: null
|
||||
})
|
||||
let searchQueryFormRef = ref()
|
||||
let updateId = ''
|
||||
|
|
@ -108,262 +121,199 @@ let updateId = ''
|
|||
* 系统方法
|
||||
*/
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
})
|
||||
const resizeHeight = () => {
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
}
|
||||
/**
|
||||
* 自定义方法
|
||||
*/
|
||||
// 查询
|
||||
const search = () => {
|
||||
tableLoading.value = true
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.goodsId = searchQueryFormEntity.goodsId.trim()
|
||||
request.vehicleId = searchQueryFormEntity.vehicleId.trim()
|
||||
queryStockUpdateByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
const data = response.data
|
||||
if (data != null) {
|
||||
tableData.value = data.lists
|
||||
baseTableQuery.total = data.total
|
||||
} else {
|
||||
tableData.value = []
|
||||
baseTableQuery.total = 0
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询数据异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
tableLoading.value = true
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.goodsId = searchQueryFormEntity.goodsId.trim()
|
||||
request.vehicleId = searchQueryFormEntity.vehicleId.trim()
|
||||
request.fromTime = searchQueryFormEntity.fromTime == null ? null : timeFormatter(searchQueryFormEntity.fromTime)
|
||||
request.toTime = searchQueryFormEntity.toTime == null ? null : timeFormatter(searchQueryFormEntity.toTime)
|
||||
queryStockUpdateByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code === 0) {
|
||||
const data = response.data
|
||||
if (data != null) {
|
||||
tableData.value = data.lists
|
||||
baseTableQuery.total = data.total
|
||||
} else {
|
||||
tableData.value = []
|
||||
baseTableQuery.total = 0
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询数据异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
}
|
||||
const clearQuery = () => {
|
||||
searchQueryFormEntity.goodsId = ''
|
||||
searchQueryFormEntity.vehicleId = ''
|
||||
searchQueryFormEntity.goodsId = ''
|
||||
searchQueryFormEntity.vehicleId = ''
|
||||
}
|
||||
const handleSortChange = (data) => {
|
||||
if (baseTableQuery.sortBy.has(data.prop)) {
|
||||
baseTableQuery.sortBy.delete(data.prop)
|
||||
}
|
||||
baseTableQuery.sortBy.set(data.prop, data.order == 'ascending')
|
||||
search()
|
||||
if (baseTableQuery.sortBy.has(data.prop)) {
|
||||
baseTableQuery.sortBy.delete(data.prop)
|
||||
}
|
||||
baseTableQuery.sortBy.set(data.prop, data.order == 'ascending')
|
||||
search()
|
||||
}
|
||||
const getCurrentRow = (row) => {
|
||||
updateId = row.updateId
|
||||
updateId = row.updateId
|
||||
}
|
||||
const timeFormat = (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
return timeFormatter(cellValue)
|
||||
}
|
||||
const exportExcel = () => {
|
||||
const params = {
|
||||
goodsId: searchQueryFormEntity.goodsId.trim(),
|
||||
vehicleId: searchQueryFormEntity.vehicleId.trim(),
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
}
|
||||
exportStockUpdateExcel(params).then(res => {
|
||||
const link = document.createElement('a');//创建a标签
|
||||
try {
|
||||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
let _fileName = '库存更新记录' + dateFormatter(new Date) + '.xlsx'
|
||||
link.style.display = 'none'//隐藏
|
||||
const params = {
|
||||
goodsId: searchQueryFormEntity.goodsId.trim(),
|
||||
vehicleId: searchQueryFormEntity.vehicleId.trim(),
|
||||
fromTime: searchQueryFormEntity.fromTime == null ? null : timeFormatter(searchQueryFormEntity.fromTime),
|
||||
toTime: searchQueryFormEntity.toTime == null ? null : timeFormatter(searchQueryFormEntity.toTime),
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
}
|
||||
exportStockUpdateExcel(params).then(res => {
|
||||
const link = document.createElement('a');//创建a标签
|
||||
try {
|
||||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
let _fileName = '库存更新记录' + dateFormatter(new Date) + '.xlsx'
|
||||
link.style.display = 'none'//隐藏
|
||||
|
||||
// 兼容不同浏览器的URL对象
|
||||
const url = window.URL || window.webkitURL || window.moxURL
|
||||
link.href = url.createObjectURL(blob)
|
||||
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
url.revokeObjectURL(link.href)//移除url对象
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
ElMessage.error('下载文件失败')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('导出失败')
|
||||
})
|
||||
}
|
||||
// 编辑弹框
|
||||
const editCurrentRowFormEntity = (row) => {
|
||||
// 设置form值
|
||||
rowFormEntity.workIndex = row.workIndex
|
||||
rowFormEntity.workOrder = row.workOrder
|
||||
rowFormEntity.productId = row.productId
|
||||
rowFormEntity.singleProductId = row.singleProductId
|
||||
rowFormEntity.boxNo = row.boxNo
|
||||
rowFormEntity.goodsId = row.goodsId
|
||||
rowFormEntity.needNum = row.needNum
|
||||
rowFormEntity.distributeNum = row.distributeNum
|
||||
rowFormEntity.finishNum = row.finishNum
|
||||
rowFormEntity.workStatus = row.workStatus
|
||||
rowFormEntity.lackStatus = row.lackStatus
|
||||
// 弹出框
|
||||
rowEditFlag.value = true
|
||||
}
|
||||
// 关闭当前缺料工作
|
||||
const closeLackWork = (row) => {
|
||||
const request = {
|
||||
workIndex: row.workIndex,
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
// 兼容不同浏览器的URL对象
|
||||
const url = window.URL || window.webkitURL || window.moxURL
|
||||
link.href = url.createObjectURL(blob)
|
||||
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
url.revokeObjectURL(link.href)//移除url对象
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
ElMessage.error('下载文件失败')
|
||||
}
|
||||
loading.open('关闭中...')
|
||||
closeCurrentWorks(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
ElMessage.success(response.message)
|
||||
search()
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('请求异常。')
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
}
|
||||
// 更新当前行数据
|
||||
const submitUpdateRow = (rowFormEntity) => {
|
||||
const request = {
|
||||
workIndex: rowFormEntity.workIndex,
|
||||
distributeNum: rowFormEntity.distributeNum,
|
||||
finishNum: rowFormEntity.finishNum,
|
||||
workStatus: rowFormEntity.workStatus,
|
||||
lackStatus: rowFormEntity.lackStatus,
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
}
|
||||
loading.open('更新中...')
|
||||
updateKateWorks(request).then(res => {
|
||||
if (res.data.code == 0) {
|
||||
ElMessage.success('更新数据成功。')
|
||||
rowEditFlag.value = false
|
||||
search()
|
||||
} else {
|
||||
ElMessage.error('更新数据失败。')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('更新数据异常。')
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('导出失败')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.work-area {
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
}
|
||||
|
||||
.search-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 40%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 40%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.table-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 60%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 60%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin: 5px 5px 5px 5px;
|
||||
margin: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input-number {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-select-v2 {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.my-autocomplete li {
|
||||
width: 196px;
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
width: 196px;
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_id {
|
||||
color: brown;
|
||||
color: brown;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_name {
|
||||
color: cornflowerblue;
|
||||
color: cornflowerblue;
|
||||
}
|
||||
|
||||
.btn-search {
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
margin: auto 5px 5px auto;
|
||||
color: black;
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
margin: auto 5px 5px auto;
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -162,7 +162,7 @@ public class ExcelController {
|
|||
*/
|
||||
@PostMapping("/exportWorkSummaryExcel")
|
||||
public void exportWorkSummaryExcel(@RequestBody WorkSummaryQuery workSummaryQuery, HttpServletResponse response) throws IOException {
|
||||
exportExcelEasyPoi.exportWorkSummaryExcel(workSummaryQuery, response);
|
||||
exportExcelEasyPoi.doExportWorkSummaryExcel(workSummaryQuery, response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -171,15 +171,24 @@ public class ExcelController {
|
|||
*/
|
||||
@PostMapping("/exportKanbanExcel")
|
||||
public void exportKanbanExcel(@RequestBody KanbanQuery kanbanQuery, HttpServletResponse response) throws IOException {
|
||||
exportExcelEasyPoi.exportKanbanExcel(kanbanQuery, response);
|
||||
exportExcelEasyPoi.doExportKanbanExcel(kanbanQuery, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出看板需求
|
||||
* @param kanbanQuery 请求
|
||||
* 导出入库记录
|
||||
* @param wmsTaskQuery 请求
|
||||
*/
|
||||
@PostMapping("/exportInTaskRecordExcel")
|
||||
public void exportInTaskRecordExcel(@RequestBody WmsTaskQuery wmsTaskQuery, HttpServletResponse response) throws IOException {
|
||||
exportExcelEasyPoi.exportKanbanExcel(kanbanQuery, response);
|
||||
exportExcelEasyPoi.doExportInTaskRecords(wmsTaskQuery, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出出库记录
|
||||
* @param wmsTaskQuery 请求
|
||||
*/
|
||||
@PostMapping("/exportOutTaskRecordExcel")
|
||||
public void exportOutTaskRecordExcel(@RequestBody WmsTaskQuery wmsTaskQuery, HttpServletResponse response) throws IOException {
|
||||
exportExcelEasyPoi.doExportOutTaskRecords(wmsTaskQuery, response);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,102 @@
|
|||
package com.wms_main.excel.easypoi.excelTemplate;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务记录模版
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TaskRecordExcelTemplate {
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
@Excel(name = "任务Id")
|
||||
private String taskId;
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
@Excel(name = "任务类型")
|
||||
private Integer taskType;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
@Excel(name = "任务状态")
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
* 任务优先级
|
||||
*/
|
||||
@Excel(name = "任务优先级")
|
||||
private Integer taskPriority;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@Excel(name = "载具号")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 起点
|
||||
*/
|
||||
@Excel(name = "起点")
|
||||
private String origin;
|
||||
/**
|
||||
* 终点
|
||||
*/
|
||||
@Excel(name = "终点")
|
||||
private String destination;
|
||||
/**
|
||||
* wcs任务id
|
||||
*/
|
||||
@Excel(name = "wcs任务Id")
|
||||
private String wcsTaskId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "完成时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@Excel(name = "料号")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 操作数量
|
||||
*/
|
||||
@Excel(name = "操作数量")
|
||||
private Integer opNum;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
@Excel(name = "库存数量")
|
||||
private Integer stockNum;
|
||||
/**
|
||||
* 操纵用户
|
||||
*/
|
||||
@Excel(name = "操作用户")
|
||||
private String opUser;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
/**
|
||||
* 申请出库的站台
|
||||
*/
|
||||
@Excel(name = "申请站台")
|
||||
private String callStand;
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
@Excel(name = "物料描述")
|
||||
private String goodsDesc;
|
||||
}
|
||||
|
|
@ -33,11 +33,11 @@ public interface IExportExcelEasyPoi extends IBaseExportExcelEasyPoi {
|
|||
* 导出工作详情
|
||||
* @param workSummaryQuery 查询条件
|
||||
*/
|
||||
void exportWorkSummaryExcel(@RequestBody WorkSummaryQuery workSummaryQuery, HttpServletResponse response) throws IOException;
|
||||
void doExportWorkSummaryExcel(@RequestBody WorkSummaryQuery workSummaryQuery, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 导出看板需求
|
||||
* @param kanbanQuery 查询条件
|
||||
*/
|
||||
void exportKanbanExcel(@RequestBody KanbanQuery kanbanQuery, HttpServletResponse response) throws IOException;
|
||||
void doExportKanbanExcel(@RequestBody KanbanQuery kanbanQuery, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.wms_main.excel.easypoi.service.base;
|
|||
import com.wms_main.model.dto.query.GoodsQuery;
|
||||
import com.wms_main.model.dto.query.StockQuery;
|
||||
import com.wms_main.model.dto.query.StockUpdateQuery;
|
||||
import com.wms_main.model.dto.query.WmsTaskQuery;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
|
|
@ -25,8 +26,20 @@ public interface IBaseExportExcelEasyPoi {
|
|||
void doExportStockUpdate(@RequestBody StockUpdateQuery stockUpdateQuery, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 到处物料信息
|
||||
* 导出物料信息
|
||||
* @param goodsQuery 查询
|
||||
*/
|
||||
void doExportGoods(@RequestBody GoodsQuery goodsQuery, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 导出入库记录
|
||||
* @param wmsTaskQuery 查询
|
||||
*/
|
||||
void doExportInTaskRecords(@RequestBody WmsTaskQuery wmsTaskQuery, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 导出出库记录
|
||||
* @param wmsTaskQuery 查询
|
||||
*/
|
||||
void doExportOutTaskRecords(@RequestBody WmsTaskQuery wmsTaskQuery, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,24 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.wms_main.constant.enums.wms.WmsTaskTypeEnums;
|
||||
import com.wms_main.dao.ITAppGoodsService;
|
||||
import com.wms_main.dao.ITAppStockService;
|
||||
import com.wms_main.dao.ITAppStockUpdateService;
|
||||
import com.wms_main.dao.ITAppTaskBakService;
|
||||
import com.wms_main.excel.easypoi.excelTemplate.GoodsExcelTemplate;
|
||||
import com.wms_main.excel.easypoi.excelTemplate.StockExcelTemplate;
|
||||
import com.wms_main.excel.easypoi.excelTemplate.StockUpdateExcelTemplate;
|
||||
import com.wms_main.excel.easypoi.excelTemplate.TaskRecordExcelTemplate;
|
||||
import com.wms_main.excel.easypoi.service.base.IBaseExportExcelEasyPoi;
|
||||
import com.wms_main.model.dto.query.GoodsQuery;
|
||||
import com.wms_main.model.dto.query.StockQuery;
|
||||
import com.wms_main.model.dto.query.StockUpdateQuery;
|
||||
import com.wms_main.model.dto.query.WmsTaskQuery;
|
||||
import com.wms_main.model.po.TAppGoods;
|
||||
import com.wms_main.model.po.TAppStock;
|
||||
import com.wms_main.model.po.TAppStockUpdate;
|
||||
import com.wms_main.model.po.TAppTaskBak;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -40,6 +45,8 @@ public class BaseExportExcelEasyPoi implements IBaseExportExcelEasyPoi {
|
|||
protected ITAppStockUpdateService appStockUpdateService;// 库存更新服务
|
||||
@Autowired
|
||||
protected ITAppGoodsService appGoodsService;// 物料服务
|
||||
@Autowired
|
||||
protected ITAppTaskBakService appTaskBakService;// 任务记录服务
|
||||
|
||||
public BaseExportExcelEasyPoi() {
|
||||
|
||||
|
|
@ -111,10 +118,22 @@ public class BaseExportExcelEasyPoi implements IBaseExportExcelEasyPoi {
|
|||
if (stockUpdateQuery == null) {
|
||||
throw new IOException("查询参数不能为NULL");
|
||||
}
|
||||
// 查询参数
|
||||
if (stockUpdateQuery.getFromTime() != null && stockUpdateQuery.getToTime() != null) {
|
||||
if (stockUpdateQuery.getFromTime().isAfter(stockUpdateQuery.getToTime())) {
|
||||
throw new IOException("from时间不能晚于to时间");
|
||||
}
|
||||
}
|
||||
// 库存更新记录查询参数
|
||||
LambdaQueryWrapper<TAppStockUpdate> lambdaQueryWrapper = new LambdaQueryWrapper<TAppStockUpdate>()
|
||||
.like(StringUtils.isNotEmpty(stockUpdateQuery.getGoodsId()), TAppStockUpdate::getGoodsId, stockUpdateQuery.getGoodsId())
|
||||
.like(StringUtils.isNotEmpty(stockUpdateQuery.getVehicleId()), TAppStockUpdate::getVehicleId, stockUpdateQuery.getVehicleId());
|
||||
if (stockUpdateQuery.getFromTime() != null) {
|
||||
lambdaQueryWrapper.ge(TAppStockUpdate::getUpdateTime, stockUpdateQuery.getFromTime());
|
||||
}
|
||||
if (stockUpdateQuery.getToTime() != null) {
|
||||
lambdaQueryWrapper.le(TAppStockUpdate::getUpdateTime, stockUpdateQuery.getToTime());
|
||||
}
|
||||
List<TAppStockUpdate> stockUpdateList = appStockUpdateService.list(lambdaQueryWrapper);
|
||||
// excel模版列表
|
||||
List<StockUpdateExcelTemplate> resultList = new ArrayList<>();
|
||||
|
|
@ -147,7 +166,7 @@ public class BaseExportExcelEasyPoi implements IBaseExportExcelEasyPoi {
|
|||
if (goodsQuery == null) {
|
||||
throw new IOException("查询参数不能为NULL");
|
||||
}
|
||||
// 库存更新记录查询参数
|
||||
// 查询参数
|
||||
LambdaQueryWrapper<TAppGoods> lambdaQueryWrapper = new LambdaQueryWrapper<TAppGoods>()
|
||||
.like(StringUtils.isNotEmpty(goodsQuery.getGoodsId()), TAppGoods::getGoodsId, goodsQuery.getGoodsId())
|
||||
.like(StringUtils.isNotEmpty(goodsQuery.getGoodsDesc()), TAppGoods::getGoodsDescription, goodsQuery.getGoodsDesc());
|
||||
|
|
@ -176,6 +195,124 @@ public class BaseExportExcelEasyPoi implements IBaseExportExcelEasyPoi {
|
|||
doWriteExcel("物料基础信息", response, resultList, GoodsExcelTemplate.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出入库记录
|
||||
* @param wmsTaskQuery 查询
|
||||
* @param response 响应
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
@Override
|
||||
public void doExportInTaskRecords(WmsTaskQuery wmsTaskQuery, HttpServletResponse response) throws IOException {
|
||||
if (wmsTaskQuery == null) {
|
||||
throw new IOException("查询参数不能为NULL");
|
||||
}
|
||||
// 查询参数
|
||||
if (wmsTaskQuery.getFromTime() != null && wmsTaskQuery.getToTime() != null) {
|
||||
if (wmsTaskQuery.getFromTime().isAfter(wmsTaskQuery.getToTime())) {
|
||||
throw new IOException("from时间不能晚于to时间");
|
||||
}
|
||||
}
|
||||
LambdaQueryWrapper<TAppTaskBak> lambdaQueryWrapper = new LambdaQueryWrapper<TAppTaskBak>()
|
||||
.like(StringUtils.isNotEmpty(wmsTaskQuery.getTaskId()), TAppTaskBak::getTaskId, wmsTaskQuery.getTaskId())
|
||||
.like(StringUtils.isNotEmpty(wmsTaskQuery.getGoodsId()), TAppTaskBak::getGoodsId, wmsTaskQuery.getGoodsId())
|
||||
.like(StringUtils.isNotEmpty(wmsTaskQuery.getVehicleId()), TAppTaskBak::getVehicleId, wmsTaskQuery.getVehicleId())
|
||||
.eq(TAppTaskBak::getTaskType, WmsTaskTypeEnums.IN.getCode());
|
||||
if (wmsTaskQuery.getFromTime() != null) {
|
||||
lambdaQueryWrapper.ge(TAppTaskBak::getCreateTime, wmsTaskQuery.getFromTime());
|
||||
}
|
||||
if (wmsTaskQuery.getToTime() != null) {
|
||||
lambdaQueryWrapper.le(TAppTaskBak::getCreateTime, wmsTaskQuery.getToTime());
|
||||
}
|
||||
List<TAppTaskBak> inTaskRecordList = appTaskBakService.list(lambdaQueryWrapper);
|
||||
// excel模版列表
|
||||
List<TaskRecordExcelTemplate> resultList = new ArrayList<>();
|
||||
if (!inTaskRecordList.isEmpty()) {
|
||||
for (TAppTaskBak poData : inTaskRecordList) {
|
||||
resultList.add(new TaskRecordExcelTemplate(
|
||||
poData.getTaskId(),
|
||||
poData.getTaskType(),
|
||||
poData.getTaskStatus(),
|
||||
poData.getTaskPriority(),
|
||||
poData.getVehicleId(),
|
||||
poData.getOrigin(),
|
||||
poData.getDestination(),
|
||||
poData.getWcsTaskId(),
|
||||
poData.getCreateTime(),
|
||||
poData.getFinishTime(),
|
||||
poData.getGoodsId(),
|
||||
poData.getOpNum(),
|
||||
poData.getStockNum(),
|
||||
poData.getOpUser(),
|
||||
poData.getRemark(),
|
||||
poData.getCallStand(),
|
||||
poData.getGoodsDesc()
|
||||
));
|
||||
}
|
||||
} else {
|
||||
resultList.add(new TaskRecordExcelTemplate());
|
||||
}
|
||||
doWriteExcel("入库记录", response, resultList, TaskRecordExcelTemplate.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出出库任务记录--实现
|
||||
* @param wmsTaskQuery 查询
|
||||
* @param response 响应
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
@Override
|
||||
public void doExportOutTaskRecords(WmsTaskQuery wmsTaskQuery, HttpServletResponse response) throws IOException {
|
||||
if (wmsTaskQuery == null) {
|
||||
throw new IOException("查询参数不能为NULL");
|
||||
}
|
||||
// 查询参数
|
||||
if (wmsTaskQuery.getFromTime() != null && wmsTaskQuery.getToTime() != null) {
|
||||
if (wmsTaskQuery.getFromTime().isAfter(wmsTaskQuery.getToTime())) {
|
||||
throw new IOException("from时间不能晚于to时间");
|
||||
}
|
||||
}
|
||||
LambdaQueryWrapper<TAppTaskBak> lambdaQueryWrapper = new LambdaQueryWrapper<TAppTaskBak>()
|
||||
.like(StringUtils.isNotEmpty(wmsTaskQuery.getTaskId()), TAppTaskBak::getTaskId, wmsTaskQuery.getTaskId())
|
||||
.like(StringUtils.isNotEmpty(wmsTaskQuery.getGoodsId()), TAppTaskBak::getGoodsId, wmsTaskQuery.getGoodsId())
|
||||
.like(StringUtils.isNotEmpty(wmsTaskQuery.getVehicleId()), TAppTaskBak::getVehicleId, wmsTaskQuery.getVehicleId())
|
||||
.eq(TAppTaskBak::getTaskType, WmsTaskTypeEnums.OUT.getCode());
|
||||
if (wmsTaskQuery.getFromTime() != null) {
|
||||
lambdaQueryWrapper.ge(TAppTaskBak::getCreateTime, wmsTaskQuery.getFromTime());
|
||||
}
|
||||
if (wmsTaskQuery.getToTime() != null) {
|
||||
lambdaQueryWrapper.le(TAppTaskBak::getCreateTime, wmsTaskQuery.getToTime());
|
||||
}
|
||||
List<TAppTaskBak> outTaskRecordList = appTaskBakService.list(lambdaQueryWrapper);
|
||||
// excel模版列表
|
||||
List<TaskRecordExcelTemplate> resultList = new ArrayList<>();
|
||||
if (!outTaskRecordList.isEmpty()) {
|
||||
for (TAppTaskBak poData : outTaskRecordList) {
|
||||
resultList.add(new TaskRecordExcelTemplate(
|
||||
poData.getTaskId(),
|
||||
poData.getTaskType(),
|
||||
poData.getTaskStatus(),
|
||||
poData.getTaskPriority(),
|
||||
poData.getVehicleId(),
|
||||
poData.getOrigin(),
|
||||
poData.getDestination(),
|
||||
poData.getWcsTaskId(),
|
||||
poData.getCreateTime(),
|
||||
poData.getFinishTime(),
|
||||
poData.getGoodsId(),
|
||||
poData.getOpNum(),
|
||||
poData.getStockNum(),
|
||||
poData.getOpUser(),
|
||||
poData.getRemark(),
|
||||
poData.getCallStand(),
|
||||
poData.getGoodsDesc()
|
||||
));
|
||||
}
|
||||
} else {
|
||||
resultList.add(new TaskRecordExcelTemplate());
|
||||
}
|
||||
doWriteExcel("出库记录", response, resultList, TaskRecordExcelTemplate.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入excel
|
||||
* @param fileDesc 文件描述
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ public class ExportExcelEasyPoi extends BaseExportExcelEasyPoi implements IExpor
|
|||
* @throws IOException 异常
|
||||
*/
|
||||
@Override
|
||||
public void exportWorkSummaryExcel(WorkSummaryQuery workSummaryQuery, HttpServletResponse response) throws IOException {
|
||||
public void doExportWorkSummaryExcel(WorkSummaryQuery workSummaryQuery, HttpServletResponse response) throws IOException {
|
||||
if (workSummaryQuery == null || workSummaryQuery.getSummaryType() == null) {
|
||||
throw new IOException("查询参数为空,数据类型必须。");
|
||||
}
|
||||
|
|
@ -258,7 +258,7 @@ public class ExportExcelEasyPoi extends BaseExportExcelEasyPoi implements IExpor
|
|||
* @throws IOException 异常
|
||||
*/
|
||||
@Override
|
||||
public void exportKanbanExcel(KanbanQuery kanbanQuery, HttpServletResponse response) throws IOException {
|
||||
public void doExportKanbanExcel(KanbanQuery kanbanQuery, HttpServletResponse response) throws IOException {
|
||||
if (kanbanQuery == null) {
|
||||
throw new IOException("参数不能为空");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
package com.wms_main.model.dto.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 库存更新查询
|
||||
|
|
@ -24,4 +28,18 @@ public class StockUpdateQuery extends PageQuery {
|
|||
*/
|
||||
@JsonProperty("vehicleId")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 筛选时间从
|
||||
*/
|
||||
@JsonProperty("fromTime")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime fromTime;
|
||||
/**
|
||||
* 筛选时间-至
|
||||
*/
|
||||
@JsonProperty("toTime")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime toTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,12 +67,24 @@ public class StockControllerServiceImpl implements IStockControllerService {
|
|||
if (stockUpdateQuery == null) {
|
||||
return WmsApiResponse.error("查询参数不能为NULL", null);
|
||||
}
|
||||
if (stockUpdateQuery.getFromTime() != null && stockUpdateQuery.getToTime() != null) {
|
||||
if (stockUpdateQuery.getFromTime().isAfter(stockUpdateQuery.getToTime())) {
|
||||
return WmsApiResponse.error("from时间不能晚于to时间。", null);
|
||||
}
|
||||
}
|
||||
Page<TAppStockUpdate> page = stockUpdateQuery.toMpPage();
|
||||
LambdaQueryWrapper<TAppStockUpdate> lambdaQueryWrapper = new LambdaQueryWrapper<TAppStockUpdate>()
|
||||
.like(StringUtils.isNotEmpty(stockUpdateQuery.getGoodsId()), TAppStockUpdate::getGoodsId, stockUpdateQuery.getGoodsId())
|
||||
.like(StringUtils.isNotEmpty(stockUpdateQuery.getVehicleId()), TAppStockUpdate::getVehicleId, stockUpdateQuery.getVehicleId());
|
||||
// 时间范围查询
|
||||
if (stockUpdateQuery.getFromTime() != null) {
|
||||
lambdaQueryWrapper.ge(TAppStockUpdate::getUpdateTime, stockUpdateQuery.getFromTime());
|
||||
}
|
||||
if (stockUpdateQuery.getToTime() != null) {
|
||||
lambdaQueryWrapper.le(TAppStockUpdate::getUpdateTime, stockUpdateQuery.getToTime());
|
||||
}
|
||||
// 查询库存更新记录
|
||||
Page<TAppStockUpdate> stockUpdatePage = appStockUpdateService.page(page, lambdaQueryWrapper);
|
||||
|
||||
PageVo<StockUpdateVo> pageVo = PageVo.of(stockUpdatePage, StockUpdateVo::of);
|
||||
return WmsApiResponse.success("查询库存更新记录成功", pageVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,10 +99,19 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
if (stockInRequest.isEmptyTask() && stockInRequest.getGoodsInfo() != null && !stockInRequest.getGoodsInfo().isEmpty()) {
|
||||
stockInRequest.setEmptyTask(false);
|
||||
}
|
||||
// 查询当前载具的库存信息
|
||||
List<TAppStock> thisVehicleStocks = appStockService.list(
|
||||
new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, stockInRequest.getVehicleId()));
|
||||
// 判断是否同种类料入库
|
||||
String thisTimeInGoodsId = "";// 本次入库物料
|
||||
if (stockInRequest.getGoodsInfo() != null && !stockInRequest.getGoodsInfo().isEmpty()) {
|
||||
for (GoodsInfoForTask goodsInfoForTask : stockInRequest.getGoodsInfo()) {
|
||||
if (StringUtils.isEmpty(thisTimeInGoodsId)) {
|
||||
thisTimeInGoodsId = goodsInfoForTask.getGoodsId();
|
||||
} else {
|
||||
if (!thisTimeInGoodsId.equals(goodsInfoForTask.getGoodsId())) {
|
||||
return BaseWmsApiResponse.error("一个载具中只能入一种料。");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stockInRequest.isEmptyTask()) {
|
||||
// 创建空载具入库任务
|
||||
TAppTask task = new TAppTask(
|
||||
|
|
@ -131,6 +140,18 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
return BaseWmsApiResponse.error("创建空载具入库任务失败。");
|
||||
}
|
||||
} else {
|
||||
// 查询当前载具的库存信息
|
||||
List<TAppStock> thisVehicleStocks = appStockService.list(
|
||||
new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, stockInRequest.getVehicleId()));
|
||||
// 判断入库物料是否在库存中
|
||||
if (StringUtils.isNotEmpty(thisTimeInGoodsId) && thisVehicleStocks != null && !thisVehicleStocks.isEmpty()) {
|
||||
for (TAppStock stock : thisVehicleStocks) {
|
||||
if (!Objects.equals(stock.getGoodsId(), thisTimeInGoodsId)) {
|
||||
return BaseWmsApiResponse.error("当前载具已经绑定其他种类物料。");
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, TAppTask> goodsIdTaskMap = new HashMap<>();
|
||||
Map<String, TAppGoods> goodsMap = new HashMap<>();
|
||||
// 循环物料生成入库任务
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user