forked from BaoKaiWms/202501-Wms-Kate-Wuxi
Merge branch 'master' of http://112.4.208.194:3000/BaoKaiWms/202501-Wms-Kate-Wuxi
# Conflicts: # dev_wms_client/src/layout/goods.vue
This commit is contained in:
commit
ab09896da6
|
|
@ -83,6 +83,16 @@ export const exportKittingBomRelationWithExcel = (data) => {
|
|||
timeout: 600000
|
||||
})
|
||||
}
|
||||
// 导出物料
|
||||
export const exportGoodsExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/exportGoodsExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
// 导出库存
|
||||
export const exportStockExcel = (data) => {
|
||||
return request({
|
||||
|
|
@ -123,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,
|
||||
|
|
|
|||
|
|
@ -7,4 +7,20 @@ export const queryTasksByPage = (params) => {
|
|||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
// 分页查询入库记录
|
||||
export const queryInTaskRecordByPage = (params) => {
|
||||
return request({
|
||||
url: '/taskQuery/queryInTaskRecordByPage',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
// 分页查询出库记录
|
||||
export const queryOutTaskRecordByPage = (params) => {
|
||||
return request({
|
||||
url: '/taskQuery/queryOutTaskRecordByPage',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import axios from 'axios'
|
||||
|
||||
const request = axios.create({
|
||||
baseURL: 'http://localhost:12315/wms',
|
||||
baseURL: 'https://s4wwjasrsp01.ap.cat.com/wmsServer/wms',
|
||||
timeout: 5000
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -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="addBinding()">绑定物料</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,193 +1,318 @@
|
|||
<template>
|
||||
<div style="margin-bottom: 15px">
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-row>
|
||||
<el-input v-model="vehicleIdQuery" style="width: 158px; margin-right: 10px;" placeholder="箱号" />
|
||||
<el-input v-model="goodsIdQuery" style="width: 158px; margin-right: 10px;" placeholder="料号" />
|
||||
<el-date-picker v-model="createTimeQuery" type="date" placeholder="选择创建日期" :shortcuts="shortcuts"
|
||||
style="width: 158px; margin-right: 10px;" clearable />
|
||||
<el-date-picker v-model="finishTimeQuery" type="date" placeholder="选择完成日期" :shortcuts="shortcuts"
|
||||
style="width: 158px; margin-right: 10px;" clearable />
|
||||
<el-button type="primary" @click="search()">搜索</el-button>
|
||||
<el-button type="warning" @click="reset()">重置</el-button>
|
||||
<el-button type="success" @click="exportExcel()">导出记录</el-button>
|
||||
</el-row>
|
||||
<br />
|
||||
<el-table :data="tasks" stripe border v-loading="loading" style="width: 100%" max-height="684px"
|
||||
class="table-class" :header-cell-style="{ 'text-align': 'center' }"
|
||||
:cell-style="{ 'text-align': 'center' }">
|
||||
<el-table-column prop="taskId" label="任务号" fixed="left" show-overflow-tooltip min-width="120px" />
|
||||
<el-table-column prop="taskType" label="任务类型" fixed="left" :formatter="taskTypeFormat"
|
||||
min-width="120px" />
|
||||
<el-table-column prop="vehicleId" label="箱号" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="goodsRelated.goodsId" label="料号" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="goodsRelated.goodsName" label="料名" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="taskGroup" label="任务组" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="origin" label="起点" min-width="120px" />
|
||||
<el-table-column prop="destination" label="终点" min-width="120px" />
|
||||
<el-table-column prop="goodsRelated.opNum" label="操作数量" min-width="120px" />
|
||||
<el-table-column prop="goodsRelated.originNum" label="库存数量" min-width="120px" />
|
||||
<el-table-column prop="taskPriority" label="任务优先级" min-width="120px" />
|
||||
<el-table-column prop="preTask" label="前置任务" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" min-width="120px"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="finishTime" label="完成时间" :formatter="timeFormat" min-width="120px"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="userName" label="操作人员姓名" min-width="120px" />
|
||||
<el-table-column prop="taskStatus" label="任务状态" fixed="right" :formatter="taskStatusFormat"
|
||||
min-width="120px" />
|
||||
</el-table>
|
||||
<br />
|
||||
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 25, 50]"
|
||||
:small="false" :disabled="false" :background="false" :default-page-size="10"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="search"
|
||||
@current-change="search" />
|
||||
</el-config-provider>
|
||||
</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-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 { getTaskRecords } from '@/api/record.js'
|
||||
import { dateFormatter, taskStatusFormatter, timeFormatter } from '@/utils/formatter.js'
|
||||
import { downloadInRecordExcel } from '@/api/excel.js'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { errorBox } from '@/utils/myMessageBox.js'
|
||||
</script>
|
||||
<script>
|
||||
export default {
|
||||
name: 'inTaskRecord',
|
||||
data() {
|
||||
return {
|
||||
tasks: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
goodsIdQuery: '',
|
||||
vehicleIdQuery: '',
|
||||
loading: true,
|
||||
createTimeQuery: null,
|
||||
finishTimeQuery: null,
|
||||
shortcuts: [
|
||||
{
|
||||
text: '今天',
|
||||
value: new Date(),
|
||||
},
|
||||
{
|
||||
text: '昨天',
|
||||
value: () => {
|
||||
const date = new Date()
|
||||
date.setTime(date.getTime() - 3600 * 1000 * 24)
|
||||
return date
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
methods: {
|
||||
dateFormat: (row, column, cellValue, index) => {
|
||||
return dateFormatter(cellValue)
|
||||
},
|
||||
timeFormat: (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
},
|
||||
taskStatusFormat: (row, column, cellValue, index) => {
|
||||
return taskStatusFormatter(cellValue)
|
||||
},
|
||||
taskTypeFormat: (row, column, cellValue, index) => {
|
||||
switch (cellValue) {
|
||||
case 1: return '入库'
|
||||
case 2: return '出库'
|
||||
case 3: return '盘点'
|
||||
case 9: return '移库'
|
||||
default: return '未知'
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.loading = true
|
||||
const tableRequest = {
|
||||
pageNo: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
taskType: 1,
|
||||
goodsId: this.goodsIdQuery.trim(),
|
||||
vehicleId: this.vehicleIdQuery.trim(),
|
||||
createTime: timeFormatter(this.createTimeQuery),
|
||||
finishTime: timeFormatter(this.finishTimeQuery),
|
||||
}
|
||||
getTaskRecords(tableRequest).then(res => {
|
||||
const tableResponse = res.data
|
||||
if (tableResponse.code == 0) {
|
||||
this.tasks = tableResponse.returnData.lists
|
||||
this.total = tableResponse.returnData.total
|
||||
} else {
|
||||
errorBox(tableResponse.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('查询任务记录错误')
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
reset() {
|
||||
this.goodsIdQuery = ''
|
||||
this.vehicleIdQuery = ''
|
||||
this.createTimeQuery = null
|
||||
this.finishTimeQuery = null
|
||||
this.search()
|
||||
},
|
||||
exportExcel() {
|
||||
const params = {
|
||||
vehicleId: this.vehicleIdQuery.trim(),
|
||||
goodsId: this.goodsIdQuery.trim(),
|
||||
createTime: timeFormatter(this.createTimeQuery),
|
||||
finishTime: timeFormatter(this.finishTimeQuery),
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
downloadInRecordExcel(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'//隐藏
|
||||
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'
|
||||
|
||||
// 兼容不同浏览器的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)
|
||||
errorBox('下载文件失败')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('导出失败')
|
||||
})
|
||||
},
|
||||
},
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
const STAND_ID = store.getters.getStandId
|
||||
const USER_NAME = store.getters.getUserName
|
||||
/**
|
||||
* 变量定义
|
||||
*/
|
||||
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
|
||||
})
|
||||
let searchQueryFormEntity = reactive({
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
fromTime: null,
|
||||
toTime: null
|
||||
})
|
||||
let searchQueryFormRef = ref()
|
||||
let taskId = ''
|
||||
/**
|
||||
* 系统方法
|
||||
*/
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
})
|
||||
const resizeHeight = () => {
|
||||
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()
|
||||
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.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()
|
||||
}
|
||||
const getCurrentRow = (row) => {
|
||||
taskId = row.taskId
|
||||
}
|
||||
const timeFormat = (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
}
|
||||
const taskTypeFormat = (row, column, cellValue, index) => {
|
||||
return wmsTaskTypeFormatter(cellValue)
|
||||
}
|
||||
const taskStatusFormat = (row, column, cellValue, index) => {
|
||||
return wmsTaskStatusFormatter(cellValue)
|
||||
}
|
||||
const exportExcel = () => {
|
||||
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('导出失败')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.el-row .el-button {
|
||||
width: 72px;
|
||||
margin-left: 0px;
|
||||
margin-right: 5px;
|
||||
.work-area {
|
||||
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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input {
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input-number {
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-select-v2 {
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
width: 100%;
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.btn-search {
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
margin: auto 5px 5px auto;
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,192 +1,346 @@
|
|||
|
||||
<template>
|
||||
<div style="margin-bottom: 15px">
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-row>
|
||||
<el-input v-model="goodsIdQuery" style="width: 158px; margin-right: 10px;" placeholder="料号" />
|
||||
<el-input v-model="vehicleIdQuery" style="width: 158px; margin-right: 10px;" placeholder="箱号" />
|
||||
<el-date-picker v-model="createTimeQuery" type="date" placeholder="选择创建日期" :shortcuts="shortcuts"
|
||||
style="width: 158px; margin-right: 10px;" clearable />
|
||||
<el-date-picker v-model="finishTimeQuery" type="date" placeholder="选择完成日期" :shortcuts="shortcuts"
|
||||
style="width: 158px; margin-right: 10px;" clearable />
|
||||
<el-button type="primary" @click="search()">搜索</el-button>
|
||||
<el-button type="warning" @click="reset()">重置</el-button>
|
||||
<el-button type="success" @click="exportExcel()">导出记录</el-button>
|
||||
</el-row>
|
||||
<br />
|
||||
<el-table :data="tasks" stripe border v-loading="loading" style="width: 100%" max-height="684px"
|
||||
class="table-class" :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }">
|
||||
<el-table-column prop="taskId" label="任务号" fixed="left" show-overflow-tooltip min-width="120px" />
|
||||
<el-table-column prop="taskType" label="任务类型" fixed="left" :formatter="taskTypeFormat" min-width="120px" />
|
||||
<el-table-column prop="vehicleId" label="箱号" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="goodsRelated.goodsId" label="料号" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="goodsRelated.goodsName" label="料名" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="taskGroup" label="任务组" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="origin" label="起点" min-width="120px" />
|
||||
<el-table-column prop="destination" label="终点" min-width="120px" />
|
||||
<el-table-column prop="goodsRelated.opNum" label="操作数量" min-width="120px" />
|
||||
<el-table-column prop="goodsRelated.originNum" label="库存数量" min-width="120px" />
|
||||
<el-table-column prop="taskPriority" label="任务优先级" min-width="120px" />
|
||||
<el-table-column prop="preTask" label="前置任务" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="finishTime" label="完成时间" :formatter="timeFormat" min-width="120px"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="userName" label="操作人员姓名" min-width="120px" />
|
||||
<el-table-column prop="taskStatus" label="任务状态" fixed="right" :formatter="taskStatusFormat"
|
||||
min-width="120px" />
|
||||
</el-table>
|
||||
<br />
|
||||
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 25, 50]"
|
||||
:small="false" :disabled="false" :background="false" :default-page-size="10"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="search"
|
||||
@current-change="search" />
|
||||
</el-config-provider>
|
||||
</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-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 { getTaskRecords } from '@/api/record.js'
|
||||
import { dateFormatter, taskStatusFormatter, timeFormatter } from '@/utils/formatter.js'
|
||||
import { downloadOutRecordExcel } from '@/api/excel.js'
|
||||
import { errorBox } from '@/utils/myMessageBox.js'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import store from '@/store'
|
||||
</script>
|
||||
<script>
|
||||
export default {
|
||||
name: 'outTaskRecord',
|
||||
data() {
|
||||
return {
|
||||
tasks: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
goodsIdQuery: '',
|
||||
vehicleIdQuery: '',
|
||||
loading: true,
|
||||
createTimeQuery: null,
|
||||
finishTimeQuery: null,
|
||||
shortcuts: [
|
||||
{
|
||||
text: '今天',
|
||||
value: new Date(),
|
||||
},
|
||||
{
|
||||
text: '昨天',
|
||||
value: () => {
|
||||
const date = new Date()
|
||||
date.setTime(date.getTime() - 3600 * 1000 * 24)
|
||||
return date
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
methods: {
|
||||
dateFormat: (row, column, cellValue, index) => {
|
||||
return dateFormatter(cellValue)
|
||||
},
|
||||
timeFormat: (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
},
|
||||
taskStatusFormat: (row, column, cellValue, index) => {
|
||||
return taskStatusFormatter(cellValue)
|
||||
},
|
||||
taskTypeFormat: (row, column, cellValue, index) => {
|
||||
switch (cellValue) {
|
||||
case 1: return '入库'
|
||||
case 2: return '出库'
|
||||
case 3: return '盘点'
|
||||
case 9: return '移库'
|
||||
default: return '未知'
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.loading = true
|
||||
const tableRequest = {
|
||||
pageNo: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
taskType: 2,
|
||||
goodsId: this.goodsIdQuery.trim(),
|
||||
vehicleId: this.vehicleIdQuery.trim(),
|
||||
createTime: timeFormatter(this.createTimeQuery),
|
||||
finishTime: timeFormatter(this.finishTimeQuery),
|
||||
}
|
||||
getTaskRecords(tableRequest).then(res => {
|
||||
const tableResponse = res.data
|
||||
if (tableResponse.code == 0) {
|
||||
this.tasks = tableResponse.returnData.lists
|
||||
this.total = tableResponse.returnData.total
|
||||
} else {
|
||||
ElMessage.error(tableResponse.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('查询任务记录错误')
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
reset() {
|
||||
this.goodsIdQuery = ''
|
||||
this.vehicleIdQuery = ''
|
||||
this.createTimeQuery = null
|
||||
this.finishTimeQuery = null
|
||||
this.search()
|
||||
},
|
||||
exportExcel() {
|
||||
const params = {
|
||||
vehicleId: this.vehicleIdQuery.trim(),
|
||||
goodsId: this.goodsIdQuery.trim(),
|
||||
createTime: timeFormatter(this.createTimeQuery),
|
||||
finishTime: timeFormatter(this.finishTimeQuery),
|
||||
userName: store.getters.userName
|
||||
}
|
||||
downloadOutRecordExcel(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'//隐藏
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
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'
|
||||
|
||||
// 兼容不同浏览器的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)
|
||||
errorBox('下载文件失败')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('导出失败')
|
||||
})
|
||||
},
|
||||
},
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
const STAND_ID = store.getters.getStandId
|
||||
const USER_NAME = store.getters.getUserName
|
||||
/**
|
||||
* 变量定义
|
||||
*/
|
||||
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
|
||||
})
|
||||
let searchQueryFormEntity = reactive({
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
fromTime: null,
|
||||
toTime: null
|
||||
})
|
||||
let searchQueryFormRef = ref()
|
||||
let taskId = ''
|
||||
/**
|
||||
* 系统方法
|
||||
*/
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
})
|
||||
const resizeHeight = () => {
|
||||
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()
|
||||
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.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()
|
||||
}
|
||||
const getCurrentRow = (row) => {
|
||||
taskId = row.taskId
|
||||
}
|
||||
const timeFormat = (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
}
|
||||
const taskTypeFormat = (row, column, cellValue, index) => {
|
||||
return wmsTaskTypeFormatter(cellValue)
|
||||
}
|
||||
const taskStatusFormat = (row, column, cellValue, index) => {
|
||||
return wmsTaskStatusFormatter(cellValue)
|
||||
}
|
||||
const exportExcel = () => {
|
||||
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('导出失败')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.el-row .el-button {
|
||||
width: 72px;
|
||||
margin-left: 0px;
|
||||
margin-right: 5px;
|
||||
.work-area {
|
||||
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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input {
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input-number {
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-select-v2 {
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
width: 100%;
|
||||
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;
|
||||
}
|
||||
|
||||
.btn-search {
|
||||
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>
|
||||
|
|
@ -138,6 +138,15 @@ public class ExcelController {
|
|||
exportExcelEasyPoi.doExportStocks(stockQuery, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出物料基础信息
|
||||
* @param goodsQuery 请求
|
||||
*/
|
||||
@PostMapping("/exportGoodsExcel")
|
||||
public void exportGoodsExcel(@RequestBody GoodsQuery goodsQuery, HttpServletResponse response) throws IOException {
|
||||
exportExcelEasyPoi.doExportGoods(goodsQuery, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存更新记录
|
||||
* @param stockUpdateQuery 请求
|
||||
|
|
@ -153,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -162,6 +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 wmsTaskQuery 请求
|
||||
*/
|
||||
@PostMapping("/exportInTaskRecordExcel")
|
||||
public void exportInTaskRecordExcel(@RequestBody WmsTaskQuery wmsTaskQuery, HttpServletResponse response) throws IOException {
|
||||
exportExcelEasyPoi.doExportInTaskRecords(wmsTaskQuery, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出出库记录
|
||||
* @param wmsTaskQuery 请求
|
||||
*/
|
||||
@PostMapping("/exportOutTaskRecordExcel")
|
||||
public void exportOutTaskRecordExcel(@RequestBody WmsTaskQuery wmsTaskQuery, HttpServletResponse response) throws IOException {
|
||||
exportExcelEasyPoi.doExportOutTaskRecords(wmsTaskQuery, response);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.wms_main.controller.wms;
|
|||
import com.wms_main.model.dto.query.WmsTaskQuery;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.vo.wms.PageVo;
|
||||
import com.wms_main.model.vo.wms.TaskRecordVo;
|
||||
import com.wms_main.model.vo.wms.TaskVo;
|
||||
import com.wms_main.service.controller.ITaskQueryControllerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -30,4 +31,26 @@ public class TaskQueryController {
|
|||
{
|
||||
return taskQueryControllerService.queryTasksByPage(wmsTaskQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wms入库记录查询
|
||||
* @param wmsTaskQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
@PostMapping("/queryInTaskRecordByPage")
|
||||
public WmsApiResponse<PageVo<TaskRecordVo>> queryInTaskRecordByPage(@RequestBody WmsTaskQuery wmsTaskQuery)
|
||||
{
|
||||
return taskQueryControllerService.queryInTaskRecordByPage(wmsTaskQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wms出库记录查询
|
||||
* @param wmsTaskQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
@PostMapping("/queryOutTaskRecordByPage")
|
||||
public WmsApiResponse<PageVo<TaskRecordVo>> queryOutTaskRecordByPage(@RequestBody WmsTaskQuery wmsTaskQuery)
|
||||
{
|
||||
return taskQueryControllerService.queryOutTaskRecordByPage(wmsTaskQuery);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
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;
|
||||
|
||||
|
|
@ -22,4 +24,22 @@ public interface IBaseExportExcelEasyPoi {
|
|||
* @param stockUpdateQuery 查询条件
|
||||
*/
|
||||
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,15 +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;
|
||||
|
|
@ -34,6 +43,10 @@ public class BaseExportExcelEasyPoi implements IBaseExportExcelEasyPoi {
|
|||
protected ITAppStockService appStockService;// 库存服务
|
||||
@Autowired
|
||||
protected ITAppStockUpdateService appStockUpdateService;// 库存更新服务
|
||||
@Autowired
|
||||
protected ITAppGoodsService appGoodsService;// 物料服务
|
||||
@Autowired
|
||||
protected ITAppTaskBakService appTaskBakService;// 任务记录服务
|
||||
|
||||
public BaseExportExcelEasyPoi() {
|
||||
|
||||
|
|
@ -105,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<>();
|
||||
|
|
@ -132,6 +157,162 @@ public class BaseExportExcelEasyPoi implements IBaseExportExcelEasyPoi {
|
|||
doWriteExcel("库存更新记录", response, resultList, StockUpdateExcelTemplate.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出物料信息--实现
|
||||
* @param goodsQuery 查询
|
||||
*/
|
||||
@Override
|
||||
public void doExportGoods(GoodsQuery goodsQuery, HttpServletResponse response) throws IOException {
|
||||
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());
|
||||
List<TAppGoods> baseGoodsList = appGoodsService.list(lambdaQueryWrapper);
|
||||
// excel模版列表
|
||||
List<GoodsExcelTemplate> resultList = new ArrayList<>();
|
||||
if (!baseGoodsList.isEmpty()) {
|
||||
for (TAppGoods poData : baseGoodsList) {
|
||||
resultList.add(new GoodsExcelTemplate(
|
||||
poData.getPlant(),
|
||||
poData.getGoodsId(),
|
||||
poData.getGoodsDescription(),
|
||||
poData.getVendorName(),
|
||||
poData.getFeedingType(),
|
||||
poData.getMaxBoxNum(),
|
||||
poData.getBoxQty(),
|
||||
poData.getHotPoint(),
|
||||
poData.getPutArea(),
|
||||
poData.getIsSled(),
|
||||
poData.getSledDays()
|
||||
));
|
||||
}
|
||||
} else {
|
||||
resultList.add(new GoodsExcelTemplate());
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* wms任务查询
|
||||
|
|
@ -39,4 +43,18 @@ public class WmsTaskQuery extends PageQuery {
|
|||
*/
|
||||
@JsonProperty("taskStatus")
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
* 筛选时间-从
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.wms_main.model.vo.wms;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.wms_main.model.po.TAppTaskBak;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
@ -105,4 +106,34 @@ public class TaskRecordVo {
|
|||
*/
|
||||
@JsonProperty("goodsDesc")
|
||||
private String goodsDesc;
|
||||
|
||||
/**
|
||||
* 将po转换为vo
|
||||
* @param po po对象
|
||||
* @return vo对象
|
||||
*/
|
||||
public static TaskRecordVo of(TAppTaskBak po) {
|
||||
if (po == null) {
|
||||
return new TaskRecordVo();
|
||||
}
|
||||
return new TaskRecordVo(
|
||||
po.getTaskId(),
|
||||
po.getTaskType(),
|
||||
po.getTaskStatus(),
|
||||
po.getTaskPriority(),
|
||||
po.getVehicleId(),
|
||||
po.getOrigin(),
|
||||
po.getDestination(),
|
||||
po.getWcsTaskId(),
|
||||
po.getCreateTime(),
|
||||
po.getFinishTime(),
|
||||
po.getGoodsId(),
|
||||
po.getOpNum(),
|
||||
po.getStockNum(),
|
||||
po.getOpUser(),
|
||||
po.getRemark(),
|
||||
po.getCallStand(),
|
||||
po.getGoodsDesc()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
|||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.vo.wms.TaskConfirmVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 任务控制类 服务接口
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.wms_main.service.controller;
|
|||
import com.wms_main.model.dto.query.WmsTaskQuery;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.vo.wms.PageVo;
|
||||
import com.wms_main.model.vo.wms.TaskRecordVo;
|
||||
import com.wms_main.model.vo.wms.TaskVo;
|
||||
|
||||
/**
|
||||
|
|
@ -15,4 +16,18 @@ public interface ITaskQueryControllerService {
|
|||
* @return 查询结果---分页
|
||||
*/
|
||||
WmsApiResponse<PageVo<TaskVo>> queryTasksByPage(WmsTaskQuery wmsTaskQuery);
|
||||
|
||||
/**
|
||||
* 查询入库记录信息---分页
|
||||
* @param wmsTaskQuery 查询参数
|
||||
* @return 查询结果---分页
|
||||
*/
|
||||
WmsApiResponse<PageVo<TaskRecordVo>> queryInTaskRecordByPage(WmsTaskQuery wmsTaskQuery);
|
||||
|
||||
/**
|
||||
* 查询出库记录信息---分页
|
||||
* @param wmsTaskQuery 查询参数
|
||||
* @return 查询结果---分页
|
||||
*/
|
||||
WmsApiResponse<PageVo<TaskRecordVo>> queryOutTaskRecordByPage(WmsTaskQuery wmsTaskQuery);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
}
|
||||
// 当前站台到达的拣选任务
|
||||
TAppPickTask thisPickTask = pickTaskList.getFirst();
|
||||
if (confirmWorkRequest.getOrderConfirm() != null) {
|
||||
if (confirmWorkRequest.getOrderConfirm() != null && StringUtils.isNotEmpty(confirmWorkRequest.getOrderConfirm().getWorkIndex())) {
|
||||
// 更新工作信息
|
||||
String updateWorkResult = updateWorkInfo(confirmWorkRequest);
|
||||
if (StringUtils.isNotEmpty(updateWorkResult)) {
|
||||
|
|
@ -676,42 +676,43 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
Map<String, Map<String, Integer>> goodsRequireByProductMap = new HashMap<>();
|
||||
// 迭代计划表,获取
|
||||
for (TAppDbs dbs : dbsList) {
|
||||
Map<String, Integer> goodsRequireMap;
|
||||
Map<String, Integer> goodsRequireOfDbsMap = new HashMap<>();// 当前dbs的物料需求
|
||||
Map<String, Integer> goodsRequireOfProductMap;// 当前成品的物料需求
|
||||
// 获得物料需求
|
||||
if (dbs.getDbsStatus() == 0) {
|
||||
if (goodsRequireByProductMap.containsKey(dbs.getProductIdOrigin())) {
|
||||
// 包含原始成品号
|
||||
goodsRequireMap = goodsRequireByProductMap.get(dbs.getProductIdOrigin());
|
||||
goodsRequireOfProductMap = goodsRequireByProductMap.get(dbs.getProductIdOrigin());
|
||||
} else {
|
||||
goodsRequireMap = getGoodsRequireMapOfServiceProduct(dbs.getProductIdOrigin());
|
||||
if (!goodsRequireMap.isEmpty()) {
|
||||
goodsRequireOfProductMap = getGoodsRequireMapOfServiceProduct(dbs.getProductIdOrigin());
|
||||
if (!goodsRequireOfProductMap.isEmpty()) {
|
||||
// 存在服务件配料单,添加这个总成的Map
|
||||
goodsRequireByProductMap.put(dbs.getProductIdOrigin(), goodsRequireMap);
|
||||
goodsRequireByProductMap.put(dbs.getProductIdOrigin(), goodsRequireOfProductMap);
|
||||
} else {
|
||||
if (goodsRequireByProductMap.containsKey(dbs.getProductId())) {
|
||||
// 直接获得当前总成的物料需求
|
||||
goodsRequireMap = goodsRequireByProductMap.get(dbs.getProductId());
|
||||
goodsRequireOfProductMap = goodsRequireByProductMap.get(dbs.getProductId());
|
||||
} else {
|
||||
// 去查询非服务件配料单
|
||||
goodsRequireMap = getGoodsRequireMapOfNonServiceProduct(dbs.getProductId());
|
||||
if (goodsRequireMap.isEmpty()) {
|
||||
goodsRequireOfProductMap = getGoodsRequireMapOfNonServiceProduct(dbs.getProductId());
|
||||
if (goodsRequireOfProductMap.isEmpty()) {
|
||||
return BaseWmsApiResponse.error("工单" + dbs.getWorkOrder() + "的物料需求为空,请检查数据。");
|
||||
}
|
||||
// 添加这个非服务件配件清单的map
|
||||
goodsRequireByProductMap.put(dbs.getProductId(), goodsRequireMap);
|
||||
goodsRequireByProductMap.put(dbs.getProductId(), goodsRequireOfProductMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 需求*产量
|
||||
for (String goodsId : goodsRequireMap.keySet()) {
|
||||
goodsRequireMap.replace(goodsId, goodsRequireMap.get(goodsId) * dbs.getPlanProduction());
|
||||
for (String goodsId : goodsRequireOfProductMap.keySet()) {
|
||||
goodsRequireOfDbsMap.put(goodsId, goodsRequireOfProductMap.get(goodsId) * dbs.getPlanProduction());
|
||||
}
|
||||
} else {
|
||||
// 查询已经生成的工作清单里面的物料需求
|
||||
goodsRequireMap = getRemainRequireMapOfOrder(dbs.getWorkOrder());
|
||||
goodsRequireOfDbsMap = getRemainRequireMapOfOrder(dbs.getWorkOrder());
|
||||
}
|
||||
// 合并需求
|
||||
mergeRequire(totalGoodsRequireMap, goodsRequireMap);
|
||||
mergeRequire(totalGoodsRequireMap, goodsRequireOfDbsMap);
|
||||
}
|
||||
// 获取需要的物料的基本信息
|
||||
List<String> goodsIds = new ArrayList<>(totalGoodsRequireMap.keySet());
|
||||
|
|
@ -726,8 +727,8 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
// 所有的非库外料且看板维护的料
|
||||
List<TAppGoods> goodsList = appGoodsService.list(new LambdaQueryWrapper<TAppGoods>()
|
||||
.in(TAppGoods::getGoodsId, goodsIds)
|
||||
.eq(TAppGoods::getPutArea, "ASRS")
|
||||
.eq(TAppGoods::getFeedingType, "Kanban"));
|
||||
.like(TAppGoods::getPutArea, "ASRS")
|
||||
.like(TAppGoods::getFeedingType, "Kanban"));
|
||||
// 整合物料信息为map
|
||||
Map<String, TAppGoods> filterGoodsMap = goodsList.stream().collect(Collectors.toMap(TAppGoods::getGoodsId, goods -> goods));
|
||||
// 获取筛选过的需要的物料的库存信息
|
||||
|
|
@ -738,9 +739,9 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
Map<String, Integer> stockByGoodsMap = new HashMap<>();
|
||||
for (TAppStock stock : stockList) {
|
||||
if (stockByGoodsMap.containsKey(stock.getGoodsId())) {
|
||||
stockByGoodsMap.replace(stock.getGoodsId(), stockByGoodsMap.get(stock.getGoodsId()) + stock.getRealNum());
|
||||
stockByGoodsMap.replace(stock.getGoodsId(), stockByGoodsMap.get(stock.getGoodsId()) + stock.getRemainNum());
|
||||
} else {
|
||||
stockByGoodsMap.put(stock.getGoodsId(), stock.getRealNum());
|
||||
stockByGoodsMap.put(stock.getGoodsId(), stock.getRemainNum());
|
||||
}
|
||||
}
|
||||
// 生成看板需求
|
||||
|
|
|
|||
|
|
@ -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<>();
|
||||
// 循环物料生成入库任务
|
||||
|
|
@ -681,7 +702,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
}
|
||||
// 当前站台到达的拣选任务
|
||||
TAppPickTask thisPickTask = pickTaskList.getFirst();
|
||||
if (confirmTaskRequest.getTaskConfirm() != null) {
|
||||
if (confirmTaskRequest.getTaskConfirm() != null && StringUtils.isNotEmpty(confirmTaskRequest.getTaskConfirm().getTaskId())) {
|
||||
// 更新工作信息
|
||||
String updateTaskResult = updateTaskInfo(confirmTaskRequest);
|
||||
if (StringUtils.isNotEmpty(updateTaskResult)) {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,15 @@ package com.wms_main.service.controller.serviceImpl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms_main.constant.enums.wms.WmsTaskTypeEnums;
|
||||
import com.wms_main.dao.ITAppTaskBakService;
|
||||
import com.wms_main.dao.ITAppTaskService;
|
||||
import com.wms_main.model.dto.query.WmsTaskQuery;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.po.TAppTask;
|
||||
import com.wms_main.model.po.TAppTaskBak;
|
||||
import com.wms_main.model.vo.wms.PageVo;
|
||||
import com.wms_main.model.vo.wms.TaskRecordVo;
|
||||
import com.wms_main.model.vo.wms.TaskVo;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import com.wms_main.service.controller.ITaskQueryControllerService;
|
||||
|
|
@ -20,6 +24,7 @@ import org.springframework.stereotype.Service;
|
|||
@RequiredArgsConstructor
|
||||
public class TaskQueryControllerServiceImpl implements ITaskQueryControllerService {
|
||||
private final ITAppTaskService appTaskService;// 任务服务
|
||||
private final ITAppTaskBakService appTaskBakService;// 任务记录服务
|
||||
|
||||
/**
|
||||
* 查询wms任务监控---分页
|
||||
|
|
@ -43,4 +48,70 @@ public class TaskQueryControllerServiceImpl implements ITaskQueryControllerServi
|
|||
PageVo<TaskVo> pageVo = PageVo.of(tasksPage, TaskVo::of);
|
||||
return WmsApiResponse.success("查询任务成功。", pageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询入库记录(分页)---实现
|
||||
* @param wmsTaskQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public WmsApiResponse<PageVo<TaskRecordVo>> queryInTaskRecordByPage(WmsTaskQuery wmsTaskQuery) {
|
||||
if (wmsTaskQuery == null) {
|
||||
return WmsApiResponse.error("查询参数不能为NULL", null);
|
||||
}
|
||||
if (wmsTaskQuery.getFromTime() != null && wmsTaskQuery.getToTime() != null) {
|
||||
if (wmsTaskQuery.getFromTime().isAfter(wmsTaskQuery.getToTime())) {
|
||||
return WmsApiResponse.error("from时间不能晚于to时间。", null);
|
||||
}
|
||||
}
|
||||
Page<TAppTaskBak> page = wmsTaskQuery.toMpPage();
|
||||
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());
|
||||
}
|
||||
Page<TAppTaskBak> inTaskRecordsPage = appTaskBakService.page(page, lambdaQueryWrapper);
|
||||
|
||||
PageVo<TaskRecordVo> pageVo = PageVo.of(inTaskRecordsPage, TaskRecordVo::of);
|
||||
return WmsApiResponse.success("查询入库记录成功。", pageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询出库记录(分页)---实现
|
||||
* @param wmsTaskQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public WmsApiResponse<PageVo<TaskRecordVo>> queryOutTaskRecordByPage(WmsTaskQuery wmsTaskQuery) {
|
||||
if (wmsTaskQuery == null) {
|
||||
return WmsApiResponse.error("查询参数不能为NULL", null);
|
||||
}
|
||||
if (wmsTaskQuery.getFromTime() != null && wmsTaskQuery.getToTime() != null) {
|
||||
if (wmsTaskQuery.getFromTime().isAfter(wmsTaskQuery.getToTime())) {
|
||||
return WmsApiResponse.error("from时间不能晚于to时间。", null);
|
||||
}
|
||||
}
|
||||
Page<TAppTaskBak> page = wmsTaskQuery.toMpPage();
|
||||
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());
|
||||
}
|
||||
Page<TAppTaskBak> outTaskRecordsPage = appTaskBakService.page(page, lambdaQueryWrapper);
|
||||
|
||||
PageVo<TaskRecordVo> pageVo = PageVo.of(outTaskRecordsPage, TaskRecordVo::of);
|
||||
return WmsApiResponse.success("查询出库记录成功。", pageVo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -741,6 +741,11 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
workRecords.add(RecordOfWork(work));
|
||||
continue;
|
||||
}
|
||||
if (work.getWorkStatus() == 2 && work.getLackStatus() == 1) {
|
||||
// 缺料,添加记录
|
||||
workRecords.add(RecordOfWork(work));
|
||||
continue;
|
||||
}
|
||||
// 判断库内料分配的数量是否需要修正
|
||||
if (work.getIsOut() != 1) {
|
||||
List<TAppStock> thisGoodsOutStocks = allStocks.stream().filter(stock -> stock.getGoodsId().equals(work.getGoodsId())).toList();
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@ spring:
|
|||
# url: jdbc:mysql://112.4.208.194:3001/wms_kate_wuxi?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
# username: developer
|
||||
# password: developer
|
||||
# 本地
|
||||
# url: jdbc:mysql://localhost:3306/wms_kate_wuxi_test?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
# username: root
|
||||
# password: liangzhou
|
||||
# 卡特服务器
|
||||
url: jdbc:mysql://10.90.83.37:3306/wms_kate_wuxi?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
username: developer
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user