forked from BaoKaiWms/202501-Wms-Kate-Wuxi
1. 暂时取消日志文件的数据库保存
2. 增加批量盘点的功能 3. 导出模版的日期格式化
This commit is contained in:
parent
1cef5ede55
commit
d35cf10f93
|
|
@ -53,6 +53,16 @@ export const uploadExcelProductExtend = (data) => {
|
|||
timeout: 600000
|
||||
})
|
||||
}
|
||||
// 上传盘点请求清单
|
||||
export const uploadExcelInventoryRequest = (data) => {
|
||||
return request({
|
||||
url: '/excel/importInventoryRequest',
|
||||
method: 'post',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
// 导出dbs
|
||||
export const exportDbsWithExcel = (data) => {
|
||||
return request({
|
||||
|
|
|
|||
|
|
@ -286,3 +286,22 @@ export const occupyOptions = [
|
|||
label: '占用'
|
||||
}
|
||||
]
|
||||
// 盘点结果枚举
|
||||
export const invResultOptions = [
|
||||
{
|
||||
value: -99,
|
||||
label: '未盘'
|
||||
},
|
||||
{
|
||||
value: -1,
|
||||
label: '盘亏'
|
||||
},
|
||||
{
|
||||
value: 0,
|
||||
label: '正常'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '盘盈'
|
||||
}
|
||||
]
|
||||
98
dev_wms_client/src/excel/UploadExcelInventory.vue
Normal file
98
dev_wms_client/src/excel/UploadExcelInventory.vue
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<el-upload ref="uploadRef" :on-preview="previewFile" :limit="1" :on-change="changeFile" :auto-upload="false"
|
||||
:data="uploadForm.data">
|
||||
<template #trigger>
|
||||
<el-button type="primary">选取盘点请求文件</el-button>
|
||||
</template>
|
||||
<el-button style="margin-left: 10px;" type="success" @click="uploadBaseGoods">上传盘点请求列表</el-button>
|
||||
</el-upload>
|
||||
</template>
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import {ref, reactive} from 'vue';
|
||||
import {uploadExcelBaseGoods, uploadExcelInventoryRequest} from '@/api/excel.js'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {errorBox} from '@/utils/myMessageBox';
|
||||
import {sizeFormatter} from '@/utils/formatter.js'
|
||||
import {loading} from '@/utils/loading.js'
|
||||
import {getHashString} from '@/utils/hashUtils.js'
|
||||
|
||||
var currentHash = ''
|
||||
const file = ref()
|
||||
const uploadForm = reactive({
|
||||
data: {
|
||||
fileId: '',
|
||||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName,
|
||||
standId: store.getters.getStandId
|
||||
}
|
||||
})
|
||||
const changeFile = (uploadFile) => {
|
||||
file.value = uploadFile
|
||||
uploadForm.data = {
|
||||
fileId: file.value.raw.uid,
|
||||
name: file.value.raw.name,
|
||||
type: file.value.raw.type,
|
||||
size: sizeFormatter(file.value.raw.size),
|
||||
hash: getHashString(uploadFile),
|
||||
userName: store.getters.getUserName,
|
||||
standId: store.getters.getStandId
|
||||
}
|
||||
}
|
||||
const uploadRef = ref()
|
||||
const uploadBaseGoods = () => {
|
||||
if (uploadForm === undefined || file.value === undefined) {
|
||||
errorBox('请选择文件之后再上传')
|
||||
return
|
||||
}
|
||||
if (currentHash !== '' && currentHash === uploadForm.data.hash) {
|
||||
errorBox('请勿重复上传')
|
||||
return
|
||||
}
|
||||
currentHash = uploadForm.data.hash
|
||||
const jsonStr = JSON.stringify(uploadForm.data);
|
||||
const blob = new Blob([jsonStr], {
|
||||
type: 'application/json'
|
||||
});
|
||||
let formData = new FormData();
|
||||
// 这里很重要 file.value.raw才是真实的file文件,file.value只是一个Proxy代理对象
|
||||
formData.append("fileVo", blob);
|
||||
formData.append("file", file.value.raw);
|
||||
loading.open('导入中...')
|
||||
uploadExcelInventoryRequest(formData).then(res => {
|
||||
if (res.data.code === 0) {
|
||||
ElMessage.success(res.data.message)
|
||||
clearFileInfos()
|
||||
} else {
|
||||
errorBox(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('上传错误')
|
||||
}).finally(() => {
|
||||
currentHash = ''
|
||||
loading.close()
|
||||
})
|
||||
}
|
||||
const clearFileInfos = () => {
|
||||
// 清空选择的文件项
|
||||
uploadRef.value.clearFiles()
|
||||
uploadForm.data = {
|
||||
fileId: '',
|
||||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName,
|
||||
standId: store.getters.getStandId
|
||||
}
|
||||
file.value = undefined
|
||||
}
|
||||
const previewFile = () => {
|
||||
|
||||
}
|
||||
</script>
|
||||
<style scoped></style>
|
||||
|
|
@ -24,6 +24,10 @@
|
|||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="clearInput()">清除输入
|
||||
</el-button>
|
||||
<el-button type="success"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="openUploadDialog()">批量盘点
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
|
|
@ -59,6 +63,12 @@
|
|||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<el-dialog v-model="showUploadDialog" title="上传盘点清单" width="40%" draggable :show-close="true">
|
||||
<fieldset class="search-area">
|
||||
<legend>上传盘点清单</legend>
|
||||
<UploadExcelInventory></UploadExcelInventory>
|
||||
</fieldset>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
|
|
@ -73,6 +83,7 @@ import {errorBox, warningBox} from "@/utils/myMessageBox";
|
|||
import {ElMessage} from "element-plus";
|
||||
import {confirmInventory, getInventoryConfirm, requestInventory} from "@/api/task";
|
||||
import {labelPosition} from "@/constant/form";
|
||||
import UploadExcelInventory from "@/excel/UploadExcelInventory.vue";
|
||||
|
||||
const STAND_ID = store.getters.getStandId
|
||||
const USER_NAME = store.getters.getUserName
|
||||
|
|
@ -94,6 +105,7 @@ let confirmEntity = reactive({
|
|||
})
|
||||
const confirmRules = reactive({})
|
||||
let pauseGetPickFlag = ref(false)
|
||||
let showUploadDialog = ref(false)
|
||||
// 系统
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
|
|
@ -224,6 +236,10 @@ const clearInput = () => {
|
|||
inventoryRequestFormEntity.goodsId = ''
|
||||
inventoryRequestFormEntity.vehicleId = ''
|
||||
}
|
||||
// 打开上传界面
|
||||
const openUploadDialog = () => {
|
||||
showUploadDialog.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
|||
|
|
@ -7,33 +7,28 @@
|
|||
label-width="158px" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="查询类型">
|
||||
<el-select-v2 style="width: 196px" v-model="searchQueryFormEntity.queryType" placeholder="查询类型"
|
||||
:options="queryTypeOptions"
|
||||
@change="search()"></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务类型">
|
||||
<el-select-v2 style="width: 196px" v-model="searchQueryFormEntity.invResult" placeholder="任务类型"
|
||||
:options="addAllOptionOfOptions(invResultOptions, DEFAULT_TOTAL_OPTIONS)"
|
||||
@change="search()"></el-select-v2>
|
||||
</el-form-item>
|
||||
<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>
|
||||
|
|
@ -50,42 +45,38 @@
|
|||
</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"
|
||||
<el-table-column prop="outType" label="任务类型" fixed="left" :formatter="outsTypeFormat" 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"
|
||||
<el-table-column prop="goodsId" label="料号" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="goodsDesc" label="物料描述"
|
||||
<el-table-column prop="needNum" label="需求数量"
|
||||
min-width="120px" sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="opNum" label="操作数量" min-width="120px" sortable="custom"
|
||||
<el-table-column prop="distributeNum" label="已分配数量" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="stockNum" label="库存数量" min-width="120px"
|
||||
<el-table-column prop="pickNum" label="已拣选数量" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="origin" label="起点" min-width="120px" sortable="custom"
|
||||
<el-table-column prop="destination" label="目标站台" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="destination" label="终点" min-width="120px"
|
||||
<el-table-column prop="userName" label="用户" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column prop="wcsTaskId" label="wcs任务号" min-width="120px" sortable="custom"
|
||||
<el-table-column prop="reason" label="原因" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" fixed="right" min-width="120px"
|
||||
<el-table-column prop="requestTime" label="请求时间" :formatter="timeFormat" 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-column fixed="right" label="操作" width="170px" v-if="searchQueryFormEntity.queryType === 1">
|
||||
<template v-slot="scope">
|
||||
<div style="display: inline-block; align-content: center;">
|
||||
<el-button type="danger"
|
||||
@click="cancelOuts(scope.row)">取消</el-button>
|
||||
<el-button type="success"
|
||||
@click="finishOuts(scope.row)">完成</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<br/>
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
|
|
@ -102,19 +93,23 @@
|
|||
<script setup>
|
||||
import store from '@/store'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import {queryInTaskRecordByPage} from '@/api/taskQuery.js'
|
||||
import {timeFormatter, wmsTaskTypeFormatter, wmsTaskStatusFormatter, dateFormatter} from '@/utils/formatter.js'
|
||||
import {queryOutsByPage} from '@/api/taskQuery.js'
|
||||
import {timeFormatter, outTaskTypeFormatter} 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'
|
||||
import {labelPosition} from '@/constant/form.js'
|
||||
import {invResultOptions, outTypeOptions} from '@/constant/options.js'
|
||||
import {addAllOptionOfOptions} from '@/utils/generator.js'
|
||||
import {loading} from '@/utils/loading'
|
||||
import {updateOutsTask} from "@/api/taskOperation";
|
||||
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
const STAND_ID = store.getters.getStandId
|
||||
const USER_NAME = store.getters.getUserName
|
||||
const DEFAULT_TOTAL_OPTIONS = 99
|
||||
/**
|
||||
* 变量定义
|
||||
*/
|
||||
|
|
@ -125,18 +120,28 @@ let baseTableQuery = reactive({
|
|||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['createTime', false]]),// 按照创建时间倒序
|
||||
sortBy: new Map([['invCreateTime', true]]),// 按照成品号顺序排序
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
})
|
||||
let searchQueryFormEntity = reactive({
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
fromTime: null,
|
||||
toTime: null
|
||||
invResult: DEFAULT_TOTAL_OPTIONS,
|
||||
queryType: 1
|
||||
})
|
||||
let searchQueryFormRef = ref()
|
||||
let taskId = ''
|
||||
const queryTypeOptions = [
|
||||
{
|
||||
label: '任务',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '记录',
|
||||
value: 2
|
||||
}
|
||||
]
|
||||
/**
|
||||
* 系统方法
|
||||
*/
|
||||
|
|
@ -164,9 +169,9 @@ const search = () => {
|
|||
// 设定查询参数
|
||||
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) => {
|
||||
request.outType = searchQueryFormEntity.outType === DEFAULT_TOTAL_OPTIONS ? null : searchQueryFormEntity.outType
|
||||
request.queryType = searchQueryFormEntity.queryType// 查询类型
|
||||
queryOutsByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code === 0) {
|
||||
const data = response.data
|
||||
|
|
@ -190,14 +195,12 @@ const search = () => {
|
|||
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')
|
||||
baseTableQuery.sortBy.set(data.prop, data.order === 'ascending')
|
||||
search()
|
||||
}
|
||||
const getCurrentRow = (row) => {
|
||||
|
|
@ -206,44 +209,55 @@ const getCurrentRow = (row) => {
|
|||
const timeFormat = (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
}
|
||||
const taskTypeFormat = (row, column, cellValue, index) => {
|
||||
return wmsTaskTypeFormatter(cellValue)
|
||||
const outsTypeFormat = (row, column, cellValue, index) => {
|
||||
return outTaskTypeFormatter(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
|
||||
// 取消出库单
|
||||
const cancelOuts = (row) => {
|
||||
const request = {
|
||||
taskId: row.taskId,
|
||||
updateType: 1,
|
||||
userName: USER_NAME,
|
||||
standId: STAND_ID
|
||||
}
|
||||
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('下载文件失败')
|
||||
loading.open('取消中...')
|
||||
updateOutsTask(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code === 0) {
|
||||
ElMessage.success(response.message)
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('导出失败')
|
||||
ElMessage.error('取消发生异常。')
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
search()
|
||||
})
|
||||
}
|
||||
// 完成出库单
|
||||
const finishOuts = (row) => {
|
||||
const request = {
|
||||
taskId: row.taskId,
|
||||
updateType: 2,
|
||||
userName: USER_NAME,
|
||||
standId: STAND_ID
|
||||
}
|
||||
loading.open('完成中...')
|
||||
updateOutsTask(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code === 0) {
|
||||
ElMessage.success(response.message)
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('完成发生异常。')
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
search()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
|
@ -305,6 +319,34 @@ const exportExcel = () => {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -21,12 +21,14 @@ export const genTableRequest = (baseTableQuery) => {
|
|||
/**
|
||||
* 向options中添加全部这个选项
|
||||
* @param {*} options
|
||||
* @param defaultValue
|
||||
* @returns
|
||||
*/
|
||||
export const addAllOptionOfOptions = (options) => {
|
||||
export const addAllOptionOfOptions = (options, defaultValue) => {
|
||||
console.log(defaultValue)
|
||||
const allOption = [
|
||||
{
|
||||
value: -99,
|
||||
value: defaultValue === undefined || defaultValue === null ? -99 : defaultValue,
|
||||
label: '全部'
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -42,6 +42,18 @@ public class ExcelController {
|
|||
return importExcelEasyPoi.doImportBaseGoods(file, fileVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入盘点清单
|
||||
* @param file 文件
|
||||
* @param fileVo 文件信息
|
||||
* @return 导入结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@PostMapping("/importInventoryRequest")
|
||||
public BaseWmsApiResponse importInventoryRequest(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception {
|
||||
return importExcelEasyPoi.doImportInventoryRequest(file, fileVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入看板数据
|
||||
* @param file 文件
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@ public class TaskController {
|
|||
return taskControllerService.requestInventory(inventoryRequest);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询盘点任务确认信息
|
||||
* @param inventoryConfirmRequest 请求
|
||||
|
|
|
|||
|
|
@ -57,6 +57,6 @@ public class ApiReceiveLogExcelTemplate {
|
|||
/**
|
||||
* 日志记录时间
|
||||
*/
|
||||
@Excel(name = "log_time")
|
||||
@Excel(name = "log_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime logTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class ApiSendLogExcelTemplate {
|
|||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
@Excel(name = "request_time")
|
||||
@Excel(name = "request_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime requestTime;
|
||||
/**
|
||||
* 响应时间
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* excel模板
|
||||
|
|
@ -80,4 +81,24 @@ public class DbsExcelTemplate {
|
|||
*/
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Excel(name = "状态", replace = {"未开始_0", "已开始_1", "已完成_2"})
|
||||
private Integer dbsStatus;
|
||||
/**
|
||||
* 工作站台
|
||||
*/
|
||||
@Excel(name = "工作站台")
|
||||
private String workStand;
|
||||
/**
|
||||
* 实际工作日期
|
||||
*/
|
||||
@Excel(name = "实际工作日期")
|
||||
private LocalDate realWorkDate;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "完成时间", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime finishTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class DbsRecordExcelTemplateForSave {
|
|||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "finish_time")
|
||||
@Excel(name = "finish_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* K料备注
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
package com.wms_main.excel.easypoi.excelTemplate;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 物料需求excel模版
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GoodsRequireExcelTemplate {
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
private String goodsId;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String goodsDesc;
|
||||
/**
|
||||
* 需求数量
|
||||
*/
|
||||
private Integer needQty;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer stockQty;
|
||||
/**
|
||||
* 缺少数量
|
||||
*/
|
||||
private Integer lackQty;
|
||||
/**
|
||||
* 物料类型
|
||||
* 1: 看板 2: MRP
|
||||
*/
|
||||
private String goodsType;
|
||||
/**
|
||||
* 库存类型
|
||||
* 1: 库内料 2:库外料
|
||||
*/
|
||||
private String stockType;
|
||||
}
|
||||
|
|
@ -75,12 +75,12 @@ public class InventoryRecordExcelTemplateForSave {
|
|||
/**
|
||||
* 盘点任务创建时间
|
||||
*/
|
||||
@Excel(name = "inv_create_time")
|
||||
@Excel(name = "inv_create_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime invCreateTime;
|
||||
/**
|
||||
* 盘点确认时间
|
||||
*/
|
||||
@Excel(name = "inv_confirm_time")
|
||||
@Excel(name = "inv_confirm_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime invConfirmTime;
|
||||
/**
|
||||
* 这个字段用于合并哪些任务是同一时间下发的
|
||||
|
|
|
|||
|
|
@ -5,15 +5,18 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 导入带图片的excel模板
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ImageTemplate {
|
||||
@Excel(name = "id")
|
||||
private String imageId;
|
||||
@Excel(name = "图片", type = 2, savePath = "D:\\image")
|
||||
private String imageTest;
|
||||
@NoArgsConstructor
|
||||
public class InventoryRequestExcelTemplate {
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@Excel(name = "料号")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 箱号
|
||||
*/
|
||||
@Excel(name = "箱号")
|
||||
private String vehicleId;
|
||||
}
|
||||
|
|
@ -84,12 +84,12 @@ public class KateWorkExcelTemplate {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "完成时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "完成时间", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 缺料状态
|
||||
|
|
|
|||
|
|
@ -68,6 +68,6 @@ public class OutsRecordExcelTemplateForSave {
|
|||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
@Excel(name = "request_time")
|
||||
@Excel(name = "request_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime requestTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,21 +37,21 @@ public class PickTaskBakExcelTemplate {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "create_time")
|
||||
@Excel(name = "create_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 发送时间
|
||||
*/
|
||||
@Excel(name = "send_time")
|
||||
@Excel(name = "send_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime sendTime;
|
||||
/**
|
||||
* 到达时间
|
||||
*/
|
||||
@Excel(name = "arrive_time")
|
||||
@Excel(name = "arrive_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime arriveTime;
|
||||
/**
|
||||
* 离开时间
|
||||
*/
|
||||
@Excel(name = "leave_time")
|
||||
@Excel(name = "leave_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime leaveTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class StockExcelTemplate {
|
|||
/**
|
||||
* 初次入库时间
|
||||
*/
|
||||
@Excel(name = "初次入库时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "初次入库时间", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime firstInTime;
|
||||
/**
|
||||
* 初次入库用户
|
||||
|
|
@ -58,7 +58,7 @@ public class StockExcelTemplate {
|
|||
/**
|
||||
* 上次更新时间
|
||||
*/
|
||||
@Excel(name = "上次更新时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "上次更新时间", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastUpdateTime;
|
||||
/**
|
||||
* 上次更新用户
|
||||
|
|
@ -88,7 +88,7 @@ public class StockExcelTemplate {
|
|||
/**
|
||||
* 有效期
|
||||
*/
|
||||
@Excel(name = "有限期止", format = "yyyy-MM-dd")
|
||||
@Excel(name = "有限期止", exportFormat = "yyyy-MM-dd")
|
||||
private LocalDate expireDate;
|
||||
/**
|
||||
* sled 天数
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class StockUpdateExcelTemplate {
|
|||
/**
|
||||
* 初次入库时间
|
||||
*/
|
||||
@Excel(name = "初次入库时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "初次入库时间", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime firstInTime;
|
||||
/**
|
||||
* 原数量
|
||||
|
|
@ -52,7 +52,7 @@ public class StockUpdateExcelTemplate {
|
|||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Excel(name = "更新时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "更新时间", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 更新用户
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class StockUpdateRecordExcelTemplateForSave {
|
|||
/**
|
||||
* 首次入库时间
|
||||
*/
|
||||
@Excel(name = "first_in_time")
|
||||
@Excel(name = "first_in_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime firstInTime;
|
||||
/**
|
||||
* 原数量
|
||||
|
|
@ -52,7 +52,7 @@ public class StockUpdateRecordExcelTemplateForSave {
|
|||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Excel(name = "update_time")
|
||||
@Excel(name = "update_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 更新用户
|
||||
|
|
|
|||
|
|
@ -57,12 +57,12 @@ public class TaskRecordExcelTemplate {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "完成时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "完成时间", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 料号
|
||||
|
|
|
|||
|
|
@ -52,17 +52,17 @@ public class WcsTaskBakExcelTemplate {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "create_time")
|
||||
@Excel(name = "create_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 发送时间
|
||||
*/
|
||||
@Excel(name = "send_time")
|
||||
@Excel(name = "send_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime sendTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "finish_time")
|
||||
@Excel(name = "finish_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 备注
|
||||
|
|
|
|||
|
|
@ -57,12 +57,12 @@ public class WmsTaskBakExcelTemplate {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "create_time")
|
||||
@Excel(name = "create_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "finish_time")
|
||||
@Excel(name = "finish_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 料号
|
||||
|
|
|
|||
|
|
@ -78,12 +78,12 @@ public class WorkRecordExcelTemplateForSave {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "create_time")
|
||||
@Excel(name = "create_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "finish_time")
|
||||
@Excel(name = "finish_time", exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 缺料状态
|
||||
|
|
|
|||
|
|
@ -6,13 +6,6 @@ import com.wms_main.model.vo.others.FileVo;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface IImportExcelEasyPoi extends IBaseImportExcelEasyPoi {
|
||||
/**
|
||||
* 执行道路
|
||||
* @param file 文件
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
BaseWmsApiResponse doImportExcel(MultipartFile file) throws Exception;
|
||||
|
||||
/**
|
||||
* 导入dbs
|
||||
|
|
@ -67,4 +60,13 @@ public interface IImportExcelEasyPoi extends IBaseImportExcelEasyPoi {
|
|||
* @throws Exception 异常
|
||||
*/
|
||||
BaseWmsApiResponse doImportKanban(MultipartFile file, FileVo fileVo) throws Exception;
|
||||
|
||||
/**
|
||||
* 导入盘点请求
|
||||
* @param file 文件
|
||||
* @param fileVo 文件信息
|
||||
* @return 导入结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
BaseWmsApiResponse doImportInventoryRequest(MultipartFile file, FileVo fileVo) throws Exception;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,11 @@ public class ExportExcelEasyPoi extends BaseExportExcelEasyPoi implements IExpor
|
|||
dbs.getFamily(),
|
||||
dbs.getTestNo(),
|
||||
dbs.getKittingRemark(),
|
||||
dbs.getRemark()
|
||||
dbs.getRemark(),
|
||||
dbs.getDbsStatus(),
|
||||
dbs.getWorkStand(),
|
||||
dbs.getRealWorkDate(),
|
||||
dbs.getFinishTime()
|
||||
));
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import cn.hutool.core.io.FileUtil;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.wms_main.app.AppCommon;
|
||||
import com.wms_main.constant.enums.others.DbsStatusEnums;
|
||||
import com.wms_main.constant.enums.wms.WmsInvResultEnums;
|
||||
import com.wms_main.constant.enums.wms.WmsInvStatusEnums;
|
||||
import com.wms_main.constant.enums.wms.WmsInvTypeEnums;
|
||||
import com.wms_main.dao.*;
|
||||
import com.wms_main.excel.easypoi.excelTemplate.*;
|
||||
import com.wms_main.excel.easypoi.service.IImportExcelEasyPoi;
|
||||
|
|
@ -22,7 +25,6 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -37,32 +39,10 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
|
|||
private final ITAppKanbanService tAppKanbanService;// 看板服务
|
||||
private final ITAppProductExtendService tAppProductExtendService;// 总成-单片对应关系服务
|
||||
private final ITAppSingleProductService tAppSingleProductService;// 单片服务
|
||||
private final ITAppInventoryService tAppInventoryService;// 盘点请求服务
|
||||
private final ITAppStockService tAppStockService;// 库存服务
|
||||
private final AppCommon appCommon;
|
||||
|
||||
@Override
|
||||
public BaseWmsApiResponse doImportExcel(MultipartFile file) throws Exception {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(1);
|
||||
params.setSheetNum(1);
|
||||
// params.setNeedSave(false);
|
||||
//解析后的图片字段存放的是图片的地址,需要在GoodsModel中配置图片存放路径
|
||||
List<ImageTemplate> result = ExcelImportUtil.importExcel(file.getInputStream(), ImageTemplate.class, params);
|
||||
for (ImageTemplate imageModel : result) {
|
||||
if (StringUtils.isNotEmpty(imageModel.getImageTest())) {
|
||||
//将图片文件转为base64图片
|
||||
File file1 = new File(imageModel.getImageTest());
|
||||
FileInputStream inputStream = new FileInputStream(file1);
|
||||
byte[] buffer = new byte[inputStream.available()];
|
||||
if (inputStream.read(buffer) == -1) {
|
||||
inputStream.close();
|
||||
}
|
||||
StringBuilder imageBase64 = new StringBuilder(Base64.getEncoder().encodeToString(buffer));
|
||||
imageModel.setImageTest(new String(imageBase64));
|
||||
}
|
||||
}
|
||||
return BaseWmsApiResponse.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入dbs的实现
|
||||
*
|
||||
|
|
@ -486,6 +466,175 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入盘点请求---实现
|
||||
* @param file 文件
|
||||
* @param fileVo 文件信息
|
||||
* @return 导入结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseWmsApiResponse doImportInventoryRequest(MultipartFile file, FileVo fileVo) throws Exception {
|
||||
// 设置解析条件
|
||||
ImportParams inventoryRequestImportparams = new ImportParams();
|
||||
inventoryRequestImportparams.setHeadRows(1);
|
||||
inventoryRequestImportparams.setSheetNum(1);
|
||||
// 解析excel文件
|
||||
List<InventoryRequestExcelTemplate> inventoryRequestRawDatas = ExcelImportUtil.importExcel(file.getInputStream(), InventoryRequestExcelTemplate.class, inventoryRequestImportparams);
|
||||
// 查询到目前已经存在的所有的盘点任务
|
||||
List<TAppInventory> existInventoryList = tAppInventoryService.list();
|
||||
// 生成料号为key,箱号列表为值的map
|
||||
Map<String, List<String>> goodsToVehicleListMap = new HashMap<>();
|
||||
// 根据载具号map一下
|
||||
Map<String, String> vehicleToGoodsMap = new HashMap<>();
|
||||
for (TAppInventory inventory : existInventoryList) {
|
||||
// 料号map
|
||||
if (goodsToVehicleListMap.containsKey(inventory.getGoodsId())) {
|
||||
List<String> oldVehicleList = new ArrayList<>(goodsToVehicleListMap.get(inventory.getGoodsId()));
|
||||
oldVehicleList.add(inventory.getVehicleId());
|
||||
goodsToVehicleListMap.replace(inventory.getGoodsId(), oldVehicleList);
|
||||
} else {
|
||||
goodsToVehicleListMap.put(inventory.getGoodsId(), List.of(inventory.getVehicleId()));
|
||||
}
|
||||
// 箱号map
|
||||
if (!vehicleToGoodsMap.containsKey(inventory.getVehicleId())) {
|
||||
vehicleToGoodsMap.put(inventory.getVehicleId(), inventory.getGoodsId());
|
||||
}
|
||||
}
|
||||
// 处理导入的数据,筛选出料号
|
||||
List<String> needInventoryGoodsIds = new ArrayList<>();
|
||||
for (InventoryRequestExcelTemplate inventoryRequestRawData : inventoryRequestRawDatas) {
|
||||
if (StringUtils.isEmpty(inventoryRequestRawData.getGoodsId())) {
|
||||
return BaseWmsApiResponse.error("存在数据行信息不全,料号必须输入。");
|
||||
}
|
||||
if (goodsToVehicleListMap.containsKey(inventoryRequestRawData.getGoodsId())) {
|
||||
// 存在料号,再判断是不是包含箱号
|
||||
if (StringUtils.isNotEmpty(inventoryRequestRawData.getVehicleId())) {
|
||||
// 获取到料箱列表值
|
||||
List<String> vehicleList = goodsToVehicleListMap.get(inventoryRequestRawData.getGoodsId());
|
||||
if (!vehicleList.contains(inventoryRequestRawData.getVehicleId())) {
|
||||
// 这个箱号没有被盘点过
|
||||
needInventoryGoodsIds.add(inventoryRequestRawData.getGoodsId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
needInventoryGoodsIds.add(inventoryRequestRawData.getGoodsId());
|
||||
}
|
||||
}
|
||||
if (needInventoryGoodsIds.isEmpty()) {
|
||||
return BaseWmsApiResponse.error("没有能够盘点的请求。");
|
||||
}
|
||||
// 查询库存
|
||||
List<TAppStock> stockList = tAppStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.in(TAppStock::getGoodsId, needInventoryGoodsIds));
|
||||
if (stockList == null || stockList.isEmpty()) {
|
||||
return BaseWmsApiResponse.error("没有库存能够满足盘点请求。");
|
||||
}
|
||||
// 新生成的盘点任务
|
||||
Map<String, TAppInventory> inventoryByVehicleMap = new HashMap<>();
|
||||
// 盘点单号
|
||||
String orderId = UUIDUtils.getNewUUID();
|
||||
// 生成盘点任务
|
||||
for (InventoryRequestExcelTemplate inventoryRequest : inventoryRequestRawDatas) {
|
||||
if (goodsToVehicleListMap.containsKey(inventoryRequest.getGoodsId())) {
|
||||
// 判断这个请求是否包含箱号
|
||||
if (StringUtils.isNotEmpty(inventoryRequest.getVehicleId())) {
|
||||
List<String> vehicleList = new ArrayList<>(goodsToVehicleListMap.get(inventoryRequest.getGoodsId()));
|
||||
if (!vehicleList.contains(inventoryRequest.getVehicleId())) {
|
||||
// 生成一个新的盘点任务
|
||||
for (TAppStock stock : stockList) {
|
||||
if (!Objects.equals(stock.getGoodsId(), inventoryRequest.getGoodsId())) {
|
||||
// 料号不对应
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(inventoryRequest.getVehicleId()) && !Objects.equals(stock.getVehicleId(), inventoryRequest.getVehicleId())) {
|
||||
// 箱号不对应
|
||||
continue;
|
||||
}
|
||||
if (!inventoryByVehicleMap.containsKey(stock.getVehicleId()) && !vehicleToGoodsMap.containsKey(stock.getVehicleId())) {
|
||||
// 添加盘点任务
|
||||
TAppInventory inventoryTask = new TAppInventory(
|
||||
UUIDUtils.getNewUUID(),
|
||||
inventoryRequest.getGoodsId(),
|
||||
stock.getVehicleId(),
|
||||
null,
|
||||
null,
|
||||
fileVo.getStandId(),
|
||||
fileVo.getUserName(),
|
||||
WmsInvTypeEnums.INV_TYPE_1.getCode(),
|
||||
WmsInvStatusEnums.INIT.getCode(),
|
||||
WmsInvResultEnums.NONE.getCode(),
|
||||
LocalDateTime.now(),
|
||||
null,
|
||||
orderId
|
||||
);
|
||||
inventoryByVehicleMap.put(stock.getVehicleId(), inventoryTask);
|
||||
vehicleList.add(stock.getVehicleId());
|
||||
if (StringUtils.isNotEmpty(inventoryRequest.getVehicleId()) && Objects.equals(stock.getVehicleId(), inventoryRequest.getVehicleId())) {
|
||||
// 已经生成了该箱号的盘点任务,那么跳出循环
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
goodsToVehicleListMap.put(inventoryRequest.getGoodsId(), vehicleList);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<String> thisTimeAddVehicleList = new ArrayList<>();
|
||||
// 那么要生成任务
|
||||
for (TAppStock stock : stockList) {
|
||||
if (!Objects.equals(stock.getGoodsId(), inventoryRequest.getGoodsId())) {
|
||||
// 料号不对应
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(inventoryRequest.getVehicleId()) && !Objects.equals(stock.getVehicleId(), inventoryRequest.getVehicleId())) {
|
||||
// 箱号不对应
|
||||
continue;
|
||||
}
|
||||
if (!inventoryByVehicleMap.containsKey(stock.getVehicleId()) && !vehicleToGoodsMap.containsKey(stock.getVehicleId())) {
|
||||
// 添加盘点任务
|
||||
TAppInventory inventoryTask = new TAppInventory(
|
||||
UUIDUtils.getNewUUID(),
|
||||
inventoryRequest.getGoodsId(),
|
||||
stock.getVehicleId(),
|
||||
null,
|
||||
null,
|
||||
fileVo.getStandId(),
|
||||
fileVo.getUserName(),
|
||||
WmsInvTypeEnums.INV_TYPE_1.getCode(),
|
||||
WmsInvStatusEnums.INIT.getCode(),
|
||||
WmsInvResultEnums.NONE.getCode(),
|
||||
LocalDateTime.now(),
|
||||
null,
|
||||
orderId
|
||||
);
|
||||
inventoryByVehicleMap.put(stock.getVehicleId(), inventoryTask);
|
||||
thisTimeAddVehicleList.add(stock.getVehicleId());
|
||||
if (StringUtils.isNotEmpty(inventoryRequest.getVehicleId()) && Objects.equals(stock.getVehicleId(), inventoryRequest.getVehicleId())) {
|
||||
// 已经生成了该箱号的盘点任务,那么跳出循环
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!thisTimeAddVehicleList.isEmpty()) {
|
||||
goodsToVehicleListMap.put(inventoryRequest.getGoodsId(), thisTimeAddVehicleList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 保存盘点任务信息
|
||||
if (!inventoryByVehicleMap.isEmpty()) {
|
||||
// 保存盘点任务
|
||||
tAppInventoryService.saveBatch(inventoryByVehicleMap.values());
|
||||
// 保存文件信息
|
||||
saveFileVo(fileVo);
|
||||
return BaseWmsApiResponse.success("处理批量盘点清单成功。");
|
||||
} else {
|
||||
return BaseWmsApiResponse.warn("未生成新的盘点任务,可能是之前的盘点任务仍未处理完。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存fileVo信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -58,24 +58,24 @@ public class RequestLogFilter extends HttpFilter {
|
|||
RequestLog logInfo = new RequestLog(method, uri, remoteHost, remoteAddr, requestContentString, String.valueOf(status), responseContentString);
|
||||
log.info(logInfo.toString());
|
||||
// 增加存储数据库的操作
|
||||
new Thread(() -> {
|
||||
try {
|
||||
TSysLog logForDb = new TSysLog(
|
||||
UUIDUtils.getNewUUID(),
|
||||
logInfo.getMethod(),
|
||||
logInfo.getUri(),
|
||||
logInfo.getRemoteHost(),
|
||||
logInfo.getRemoteAddr(),
|
||||
logInfo.getRequestContent(),
|
||||
logInfo.getStatus(),
|
||||
logInfo.getResponseContent(),
|
||||
LocalDateTime.now()
|
||||
);
|
||||
sysLogService.save(logForDb);
|
||||
} catch (Exception e) {
|
||||
log.error("记录日志失败。", e);
|
||||
}
|
||||
}).start();
|
||||
// new Thread(() -> {
|
||||
// try {
|
||||
// TSysLog logForDb = new TSysLog(
|
||||
// UUIDUtils.getNewUUID(),
|
||||
// logInfo.getMethod(),
|
||||
// logInfo.getUri(),
|
||||
// logInfo.getRemoteHost(),
|
||||
// logInfo.getRemoteAddr(),
|
||||
// logInfo.getRequestContent(),
|
||||
// logInfo.getStatus(),
|
||||
// logInfo.getResponseContent(),
|
||||
// LocalDateTime.now()
|
||||
// );
|
||||
// sysLogService.save(logForDb);
|
||||
// } catch (Exception e) {
|
||||
// log.error("记录日志失败。", e);
|
||||
// }
|
||||
// }).start();
|
||||
|
||||
// 把缓存的响应数据,响应给客户端
|
||||
responseWrapper.copyBodyToResponse();
|
||||
|
|
|
|||
|
|
@ -42,4 +42,9 @@ public class FileVo {
|
|||
*/
|
||||
@JsonProperty("userName")
|
||||
private String userName;
|
||||
/**
|
||||
* 站台号
|
||||
*/
|
||||
@JsonProperty("standId")
|
||||
private String standId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ public class TaskQueryControllerServiceImpl implements ITaskQueryControllerServi
|
|||
// 查询盘点请求
|
||||
Page<TAppInventory> page = inventoryQuery.toMpPage();
|
||||
LambdaQueryWrapper<TAppInventory> lambdaQueryWrapper = new LambdaQueryWrapper<TAppInventory>()
|
||||
.like(StringUtils.isNotEmpty(inventoryQuery.getInventoryId()), TAppInventory::getInventoryId, inventoryQuery.getInventoryId())
|
||||
.like(StringUtils.isNotEmpty(inventoryQuery.getGoodsId()), TAppInventory::getGoodsId, inventoryQuery.getGoodsId())
|
||||
.like(StringUtils.isNotEmpty(inventoryQuery.getVehicleId()), TAppInventory::getVehicleId, inventoryQuery.getVehicleId())
|
||||
.eq(inventoryQuery.getInvResult() != null, TAppInventory::getInvResult, inventoryQuery.getInvResult());
|
||||
|
|
@ -203,6 +204,7 @@ public class TaskQueryControllerServiceImpl implements ITaskQueryControllerServi
|
|||
// 默认;查询盘点记录
|
||||
Page<TAppInventoryRecord> page = inventoryQuery.toMpPage();
|
||||
LambdaQueryWrapper<TAppInventoryRecord> lambdaQueryWrapper = new LambdaQueryWrapper<TAppInventoryRecord>()
|
||||
.like(StringUtils.isNotEmpty(inventoryQuery.getInventoryId()), TAppInventoryRecord::getInventoryId, inventoryQuery.getInventoryId())
|
||||
.like(StringUtils.isNotEmpty(inventoryQuery.getGoodsId()), TAppInventoryRecord::getGoodsId, inventoryQuery.getGoodsId())
|
||||
.like(StringUtils.isNotEmpty(inventoryQuery.getVehicleId()), TAppInventoryRecord::getVehicleId, inventoryQuery.getVehicleId())
|
||||
.eq(inventoryQuery.getInvResult() != null, TAppInventoryRecord::getInvResult, inventoryQuery.getInvResult());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user