forked from BaoKaiWms/202501-Wms-Kate-Wuxi
Merge branch 'master' of http://112.4.208.194:3000/BaoKaiWms/202501-Wms-Kate-Wuxi
This commit is contained in:
commit
b8edbbdda0
|
|
@ -63,3 +63,14 @@ export const confirmInventory = (params) => {
|
|||
data: params
|
||||
})
|
||||
}
|
||||
// 获取缺料数量
|
||||
export const getGoodsLackQty = (params) => {
|
||||
return request({
|
||||
url: '/task/getGoodsLackQty',
|
||||
method: 'get',
|
||||
params: {
|
||||
goodsId: params.goodsId,
|
||||
workOrder: params.workOrder
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -17,3 +17,12 @@ export const updateWmsTask = (params) => {
|
|||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
// 更新出库单任务
|
||||
export const updateOutsTask = (params) => {
|
||||
return request({
|
||||
url: '/taskOperation/updateOutsTask',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,13 +1,19 @@
|
|||
import request from "@/http/request";
|
||||
|
||||
const queryLogs = (params) => {
|
||||
// 分页查询接收日志
|
||||
export const queryLogsByPage = (params) => {
|
||||
return request({
|
||||
url: '/log/queryWmsLog',
|
||||
url: '/log/queryLogsByPage',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
queryLogs
|
||||
// 分页查询发送日志
|
||||
export const queryApisByPage = (params) => {
|
||||
return request({
|
||||
url: '/log/queryApisByPage',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
import axios from 'axios'
|
||||
|
||||
const request = axios.create({
|
||||
baseURL: 'http://localhost:12315/wms',
|
||||
baseURL: 'https://s4wwjasrsp01.ap.cat.com/wmsServer/wms',
|
||||
timeout: 5000
|
||||
})
|
||||
|
||||
// axios.defaults.baseURL = 'http://10.90.83.39:443/wmsServer/wms'
|
||||
// axios.defaults.baseURL = 'http://localhost:12315/wms'
|
||||
// axios.defaults.baseURL = 'https://s4wwjasrsp01.ap.cat.com/wmsServer/wms'
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@
|
|||
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.outType" placeholder="任务类型"
|
||||
:options="addAllOptionOfOptions(outTypeOptions)"
|
||||
|
|
@ -62,11 +67,13 @@
|
|||
<el-table-column prop="requestTime" label="请求时间" :formatter="timeFormat" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column fixed="right" label="操作" width="170px">
|
||||
<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="primary"
|
||||
@click="editCurrentRowFormEntity(scope.row)">编辑</el-button>
|
||||
<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>
|
||||
|
|
@ -95,6 +102,7 @@ import {labelPosition} from '@/constant/form.js'
|
|||
import {outTypeOptions} from '@/constant/options.js'
|
||||
import {addAllOptionOfOptions} from '@/utils/generator.js'
|
||||
import {loading} from '@/utils/loading'
|
||||
import {updateOutsTask} from "@/api/taskOperation";
|
||||
|
||||
/**
|
||||
* 常量定义
|
||||
|
|
@ -118,10 +126,21 @@ let baseTableQuery = reactive({
|
|||
let searchQueryFormEntity = reactive({
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
outType: -99
|
||||
outType: -99,
|
||||
queryType: 1
|
||||
})
|
||||
let searchQueryFormRef = ref()
|
||||
let taskId = ''
|
||||
const queryTypeOptions = [
|
||||
{
|
||||
label: '未关闭',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '已关闭',
|
||||
value: 2
|
||||
}
|
||||
]
|
||||
/**
|
||||
* 系统方法
|
||||
*/
|
||||
|
|
@ -149,7 +168,8 @@ const search = () => {
|
|||
// 设定查询参数
|
||||
request.vehicleId = searchQueryFormEntity.vehicleId.trim()
|
||||
request.goodsId = searchQueryFormEntity.goodsId.trim()
|
||||
request.out = searchQueryFormEntity.outType === -99 ? null : searchQueryFormEntity.outType
|
||||
request.outType = searchQueryFormEntity.outType === -99 ? null : searchQueryFormEntity.outType
|
||||
request.queryType = searchQueryFormEntity.queryType// 查询类型
|
||||
queryOutsByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code === 0) {
|
||||
|
|
@ -191,6 +211,54 @@ const timeFormat = (row, column, cellValue, index) => {
|
|||
const outsTypeFormat = (row, column, cellValue, index) => {
|
||||
return outTaskTypeFormatter(cellValue)
|
||||
}
|
||||
// 取消出库单
|
||||
const cancelOuts = (row) => {
|
||||
const request = {
|
||||
taskId: row.taskId,
|
||||
updateType: 1,
|
||||
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()
|
||||
})
|
||||
}
|
||||
// 完成出库单
|
||||
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>
|
||||
<style scoped>
|
||||
.content {
|
||||
|
|
|
|||
|
|
@ -12,19 +12,22 @@
|
|||
:options="outTypeOptions"></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="料号" prop="goodsId">
|
||||
<el-input v-model="outTaskEntity.goodsId" ref="goodsId" clearable/>
|
||||
<el-input v-model="outTaskEntity.goodsId" @blur="getLackQty()" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱号" prop="vehicleId" v-if="outTaskEntity.outType != 9">
|
||||
<el-input v-model="outTaskEntity.vehicleId" ref="vehicleId" clearable/>
|
||||
<el-form-item label="箱号" prop="vehicleId" v-if="outTaskEntity.outType !== 9">
|
||||
<el-input v-model="outTaskEntity.vehicleId" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="needNum">
|
||||
<el-input-number style="width: 196px" v-model.number="outTaskEntity.needNum" ref="needNum"
|
||||
<el-input-number style="width: 196px" v-model.number="outTaskEntity.needNum"
|
||||
controls-position="right" :min="1" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="原因" prop="reason" v-if="outTaskEntity.outType == 9">
|
||||
<el-form-item label="原因" prop="reason" v-if="outTaskEntity.outType === 9">
|
||||
<el-select-v2 style="width: 196px" v-model="outTaskEntity.reason" placeholder="请选择紧急出库原因"
|
||||
:options="reasonOptions"></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="工单" prop="workOrder" v-if="outTaskEntity.reason === '缺料'">
|
||||
<el-input v-model="outTaskEntity.workOrder" @blur="getLackQty()" clearable/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="primary"
|
||||
|
|
@ -95,7 +98,7 @@
|
|||
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import {requireStockOut, getCurrentTask, confirmCurrentTask} from '@/api/task.js'
|
||||
import {requireStockOut, getCurrentTask, confirmCurrentTask, getGoodsLackQty} from '@/api/task.js'
|
||||
import {errorBox, warningBox} from '@/utils/myMessageBox.js'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {nextTick, onBeforeUnmount, onMounted, reactive, ref, watch} from 'vue'
|
||||
|
|
@ -113,6 +116,7 @@ let outTaskEntity = reactive({
|
|||
goodsId: '',
|
||||
vehicleId: '',
|
||||
reason: '',
|
||||
workOrder: '',
|
||||
needNum: null
|
||||
})
|
||||
const requestRules = reactive({
|
||||
|
|
@ -266,6 +270,10 @@ const confirmOut = () => {
|
|||
errorBox('紧急出库请选择原因。')
|
||||
return
|
||||
}
|
||||
if (outTaskEntity.reason === '缺料' && outTaskEntity.workOrder === '') {
|
||||
errorBox('缺料时必须输入工单号。')
|
||||
return
|
||||
}
|
||||
}
|
||||
const request = {
|
||||
outType: outTaskEntity.outType,
|
||||
|
|
@ -273,6 +281,7 @@ const confirmOut = () => {
|
|||
vehicleId: outTaskEntity.vehicleId.toUpperCase().trim(),
|
||||
needNum: outTaskEntity.needNum,
|
||||
reason: outTaskEntity.reason,
|
||||
workOrder: outTaskEntity.workOrder.trim(),
|
||||
destination: STAND_ID,
|
||||
userName: USER_NAME,
|
||||
standId: STAND_ID
|
||||
|
|
@ -362,6 +371,32 @@ const clearConfirmEntity = () => {
|
|||
confirmEntity.putArea = ''
|
||||
confirmEntity.warningQty = null
|
||||
}
|
||||
// 获取对应工单对应物料号的缺料数量
|
||||
const getLackQty = () => {
|
||||
if (outTaskEntity.outType !== 9 || outTaskEntity.reason !== '缺料') {
|
||||
// 非紧急出库且非缺料,则不处理
|
||||
return;
|
||||
}
|
||||
if (outTaskEntity.workOrder === '' || outTaskEntity.goodsId === '') {
|
||||
// 缺少工单号或者料号
|
||||
return
|
||||
}
|
||||
// 设置请求参数
|
||||
const request = {
|
||||
workOrder: outTaskEntity.workOrder.trim(),
|
||||
goodsId: outTaskEntity.goodsId.toUpperCase().trim()
|
||||
}
|
||||
loading.open('查询缺料缺料数量中...')
|
||||
getGoodsLackQty(request).then(res => {
|
||||
outTaskEntity.needNum = res.data
|
||||
}).catch(err => {
|
||||
// 异常,清空数量
|
||||
outTaskEntity.needNum = null
|
||||
console.log('获取缺料数量异常:' + err)
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
|||
|
|
@ -566,11 +566,13 @@ const ifNeedShowBoxSummary = () => {
|
|||
|| confirmEntity.productId !== storeKittingWork.productId
|
||||
|| confirmEntity.singleProductId !== storeKittingWork.singleProductId
|
||||
|| confirmEntity.boxNo !== storeKittingWork.boxNo) {
|
||||
printLacks(storeKittingWork.workOrder, storeKittingWork.productId, storeKittingWork.singleProductId, storeKittingWork.boxNo)
|
||||
if (confirmEntity.workOrder === '') {
|
||||
// 打印这个工单剩余缺料标签---整个料盒都缺料的标签
|
||||
printLacks(storeKittingWork.workOrder, storeKittingWork.productId, storeKittingWork.singleProductId, storeKittingWork.boxNo, '2')
|
||||
// 说明当前工单工作已完成,需要弹框提示工作已完成
|
||||
successBox('当前工单已完成。')
|
||||
} else if (confirmEntity.boxNo !== storeKittingWork.boxNo) {
|
||||
printLacks(storeKittingWork.workOrder, storeKittingWork.productId, storeKittingWork.singleProductId, storeKittingWork.boxNo, '1')
|
||||
// 前一个料盒已完成,需要弹框提示料盒已完成
|
||||
showBoxSummary()
|
||||
}
|
||||
|
|
@ -717,12 +719,14 @@ const handleSortChange = (data) => {
|
|||
searchKittingGoods()
|
||||
}
|
||||
// 打印上一个料盒的缺料信息
|
||||
const printLacks = (workOrder, productId, singleProductId, boxNo) => {
|
||||
// printLackType;1:当前料盒缺料标签,2:未完成料盒的缺料标签
|
||||
const printLacks = (workOrder, productId, singleProductId, boxNo, printLackType) => {
|
||||
const request = {
|
||||
workOrder: workOrder,
|
||||
productId: productId,
|
||||
singleProductId: singleProductId,
|
||||
boxNo: boxNo,
|
||||
bk1: printLackType,
|
||||
standId: standId,
|
||||
userName: userName
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,221 +1,350 @@
|
|||
<template>
|
||||
<div style="margin-bottom: 10px">
|
||||
<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-input v-model="queryKey" style="width: 256px; margin-right: 10px;" placeholder="请输入搜索信息" />
|
||||
<el-button type="primary" @click="search()">搜索</el-button>
|
||||
<el-button type="warning" @click="reset()">重置</el-button>
|
||||
<el-form-item label="任务类型">
|
||||
<el-select-v2 style="width: 196px" v-model="searchQueryFormEntity.logType" placeholder="任务类型"
|
||||
:options="logTypeOptions"
|
||||
@change="search()"></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="查询字符">
|
||||
<el-input v-model="searchQueryFormEntity.queryStr" @keyup.enter="search()" clearable/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<br />
|
||||
<el-table :data="wmsLogs" stripe border v-loading="loading" class="table-class" max-height="650px"
|
||||
highlight-current-row @row-click="getCurrentRow" :header-cell-style="{ 'text-align': 'center' }"
|
||||
:cell-style="{ 'text-align': 'center' }">
|
||||
<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>
|
||||
</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.logId" v-model="logId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="logId" label="请求id" fixed="left" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="logTitle" label="请求名称" fixed="left" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="logMethod" label="请求接口" fixed="left" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="logRequest" label="请求信息" :formatter="jsonFormat" min-width="180px"
|
||||
<el-table-column prop="logId" label="日志id" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="logResponse" label="响应信息" :formatter="jsonFormat" min-width="180px" show-overflow-tooltip />
|
||||
<el-table-column prop="logIp" label="请求ip" min-width="120px" />
|
||||
<el-table-column prop="logTime" label="请求时间" :formatter="timeFormat" show-overflow-tooltip
|
||||
min-width="120px" />
|
||||
<el-table-column prop="logUser" label="请求用户" min-width="120px" />
|
||||
<el-table-column fixed="right" label="操作" width="120px">
|
||||
<template v-slot="scope">
|
||||
<el-button plain type="primary" @click="detailCurrentRowLog(scope.row)">查看详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="logTime" label="记录时间" fixed="right" :formatter="timeFormat" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 1" prop="method" label="请求方式" fixed="left"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 1" prop="uri" label="请求地址" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 1" prop="remoteHost" label="客户端主机"
|
||||
fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 1" prop="remoteAddr" label="客户端地址"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 1" prop="requestContent" label="请求数据"
|
||||
fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 1" prop="status" label="响应状态" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 1" prop="responseContent" label="响应数据"
|
||||
fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="url" label="请求地址" fixed="left"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="timeout" label="超时时间"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="method" label="请求方式"
|
||||
min-width="120px" sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="contentType" label="数据类型"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="data" label="请求数据" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="token" label="token" fixed="left"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="success" label="是否成功"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="responseCode" label="响应码"
|
||||
min-width="120px" sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="requestMessage" label="请求信息"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="responseMessage" label="响应信息"
|
||||
min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="requestTime" label="请求时间" fixed="left"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="responseTime" label="响应时间"
|
||||
min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="useTime" label="耗时" min-width="120px"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column v-if="searchQueryFormEntity.logType === 2" prop="exceptionMessage" label="异常信息"
|
||||
min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip/>
|
||||
</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-dialog v-model="dialogVisible" title="日志详情" width="40%" draggable :show-close="false">
|
||||
<el-form ref="wmsLogFormRef" :model="wmsLogEntity" :label-position="labelPosition" label-width="100px"
|
||||
style="max-width: 100%" :rules="rules" status-icon>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="请求id" prop="logId">
|
||||
<el-input v-model="wmsLogEntity.logId" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="请求名称" prop="logTitle">
|
||||
<el-input v-model="wmsLogEntity.logTitle" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="请求接口" prop="logMethod">
|
||||
<el-input v-model="wmsLogEntity.logMethod" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="请求ip" prop="logIp">
|
||||
<el-input v-model="wmsLogEntity.logIp" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="请求信息" prop="logRequest">
|
||||
<el-input type="textarea" :rows="2" v-model="wmsLogEntity.logRequest" placeholder=""
|
||||
:maxlength="-1" :show-word-limit="false" :autosize="{ minRows: 2, maxRows: 4 }" readonly>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="响应信息" prop="logResponse">
|
||||
<el-input type="textarea" :rows="2" v-model="wmsLogEntity.logResponse" :maxlength="-1"
|
||||
:show-word-limit="false" :autosize="{ minRows: 2, maxRows: 4 }" readonly>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="请求时间" prop="logTime">
|
||||
<el-input v-model="wmsLogEntity.logTime" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="请求用户" prop="logUser">
|
||||
<el-input v-model="wmsLogEntity.logUser" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">关闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-config-provider>
|
||||
<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 { queryLogs } from '@/api/wmsLog.js'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { errorBox } from '@/utils/myMessageBox.js'
|
||||
import { timeFormatter, jsonFormatter } from '@/utils/formatter.js'
|
||||
import { ref, reactive } from 'vue'
|
||||
</script>
|
||||
<script>
|
||||
export default {
|
||||
name: 'wmsLog',
|
||||
data() {
|
||||
return {
|
||||
wmsLogs: [],
|
||||
pageInfo: {},
|
||||
import {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 {queryApisByPage, queryLogsByPage} from "@/api/wmsLog";
|
||||
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
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,
|
||||
queryKey: '',
|
||||
loading: true,
|
||||
dialogVisible: false,
|
||||
logId: '',
|
||||
wmsLogEntity: reactive({}),
|
||||
labelPosition: 'top',
|
||||
wmsLogFormRef: ref(),
|
||||
rules: reactive({})
|
||||
}
|
||||
sortBy: new Map([['logTime', false]]),// 按照日志时间倒序
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
})
|
||||
let searchQueryFormEntity = reactive({
|
||||
logType: 1,
|
||||
queryStr: ''
|
||||
})
|
||||
let searchQueryFormRef = ref()
|
||||
let logId = ''
|
||||
const logTypeOptions = [
|
||||
{
|
||||
label: '接收日志',
|
||||
value: 1
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.loading = true
|
||||
const tableRequest = {
|
||||
pageNo: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
queryParam: this.queryKey.trim(),
|
||||
userName: store.getters.getUserName
|
||||
{
|
||||
label: '发送日志',
|
||||
value: 2
|
||||
}
|
||||
queryLogs(tableRequest).then(res => {
|
||||
const tableResponse = res.data
|
||||
if (tableResponse.code == 0) {
|
||||
this.wmsLogs = tableResponse.returnData.lists
|
||||
this.total = tableResponse.returnData.total
|
||||
]
|
||||
/**
|
||||
* 系统方法
|
||||
*/
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
})
|
||||
const resizeHeight = () => {
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
}
|
||||
/**
|
||||
* 自定义方法
|
||||
*/
|
||||
// 查询
|
||||
const search = () => {
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.queryStr = searchQueryFormEntity.queryStr.trim()
|
||||
if (searchQueryFormEntity.logType === 1) {
|
||||
// 接收日志
|
||||
queryReceiveLog(request)
|
||||
} else {
|
||||
errorBox(tableResponse.message)
|
||||
// 发送日志
|
||||
querySendLog(request)
|
||||
}
|
||||
}
|
||||
const queryReceiveLog = (request) => {
|
||||
tableLoading.value = true
|
||||
queryLogsByPage(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)
|
||||
errorBox('查询日志错误')
|
||||
ElMessage.error('查询数据异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
timeFormat: (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
},
|
||||
jsonFormat: (row, column, cellValue, index) => {
|
||||
return jsonFormatter(cellValue)
|
||||
},
|
||||
reset() {
|
||||
this.queryKey = ''
|
||||
this.search
|
||||
},
|
||||
detailCurrentRowLog(row) {
|
||||
this.wmsLogEntity = {
|
||||
logId: row.logId,
|
||||
logTitle: row.logTitle,
|
||||
logMethod: row.logMethod,
|
||||
logRequest: jsonFormatter(row.logRequest),
|
||||
logResponse: jsonFormatter(row.logResponse),
|
||||
logTime: row.logTime,
|
||||
logUser: row.logUser,
|
||||
logIp: row.logIp,
|
||||
}
|
||||
this.dialogVisible = true
|
||||
},
|
||||
getCurrentRow(row) {
|
||||
this.logId = row.logId
|
||||
},
|
||||
},
|
||||
const querySendLog = (request) => {
|
||||
tableLoading.value = true
|
||||
queryApisByPage(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 = ''
|
||||
}
|
||||
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) => {
|
||||
logId = row.logId
|
||||
}
|
||||
const timeFormat = (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.el-row .el-button {
|
||||
width: 72px;
|
||||
margin-left: 0px;
|
||||
margin-right: 5px;
|
||||
.my-autocomplete li {
|
||||
width: 196px;
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
width: 100%;
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.el-row .el-form-item {
|
||||
width: 10% inherit;
|
||||
justify-content: center;
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
|
||||
.el-row .el-form-item .el-select-v2 {
|
||||
width: 100% !important;
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.el-row .el-form-item .el-input-number {
|
||||
width: 100% !important;
|
||||
.my-autocomplete li .goods_id {
|
||||
color: brown;
|
||||
}
|
||||
|
||||
.el-row .el-form-item .el-button {
|
||||
margin: auto;
|
||||
.my-autocomplete li .goods_name {
|
||||
color: cornflowerblue;
|
||||
}
|
||||
|
||||
.btn-search {
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
margin: auto 5px 5px auto;
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.wms_main.constant.enums.others;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum EmergencyOutReasonEnums {
|
||||
FEEDING("补料"),
|
||||
K_LACK("少K"),
|
||||
GOODS_LACK("缺料"),
|
||||
RETURN_ORDER("返工工单");
|
||||
private final String reason;
|
||||
}
|
||||
|
|
@ -16,7 +16,10 @@ public enum AppConfigKeyEnums {
|
|||
STAND_CAPACITY("StandCapacity", "站台容量"),
|
||||
IMAGE_IP("ImageIp", "图片存放ip"),
|
||||
EMPTY_BACK("EmptyBack", "空载具是否回库"),
|
||||
STOCK_WARNING_QTY("StockWarningQty", "库存预警数量");
|
||||
STOCK_WARNING_QTY("StockWarningQty", "库存预警数量"),
|
||||
LOG_CLEAR_INTERVAL("LogClearInterval", "日志清理间隔"),
|
||||
NORMAL_DATA_CLEAR_INTERVAL("NormalDataClearInterval", "正常数据清理间隔"),
|
||||
IMPORTANT_DATA_CLEAR_INTERVAL("ImportantDataClearInterval", "重要数据清理间隔");
|
||||
private final String key;
|
||||
private final String desc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package com.wms_main.controller.wms;
|
||||
|
||||
import com.wms_main.model.dto.query.SysApiQuery;
|
||||
import com.wms_main.model.dto.query.SysLogQuery;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.vo.wms.PageVo;
|
||||
import com.wms_main.model.vo.wms.SysApiVo;
|
||||
import com.wms_main.model.vo.wms.SysLogVo;
|
||||
import com.wms_main.service.controller.ILogControllerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 日志控制类
|
||||
*/
|
||||
@RestController
|
||||
@ResponseBody
|
||||
@CrossOrigin
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/wms/log")
|
||||
public class LogController {
|
||||
private final ILogControllerService logControllerService;
|
||||
|
||||
/**
|
||||
* 查询接口接收日志
|
||||
* @param logQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
@PostMapping("/queryLogsByPage")
|
||||
public WmsApiResponse<PageVo<SysLogVo>> queryLogsByPage(@RequestBody SysLogQuery logQuery) {
|
||||
return logControllerService.queryLogsByPage(logQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询接口发送日志
|
||||
* @param apiQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
@PostMapping("/queryApisByPage")
|
||||
public WmsApiResponse<PageVo<SysApiVo>> queryApisByPage(@RequestBody SysApiQuery apiQuery) {
|
||||
return logControllerService.queryApisByPage(apiQuery);
|
||||
}
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ public class TaskController {
|
|||
* @return 请求结果
|
||||
*/
|
||||
@PostMapping("/getInventoryConfirm")
|
||||
WmsApiResponse<InventoryConfirmVo> getInventoryConfirm(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
public WmsApiResponse<InventoryConfirmVo> getInventoryConfirm(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
return taskControllerService.getInventoryConfirm(inventoryConfirmRequest);
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +142,18 @@ public class TaskController {
|
|||
* @return 处理结果
|
||||
*/
|
||||
@PostMapping("/confirmInventory")
|
||||
BaseWmsApiResponse confirmInventory(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
public BaseWmsApiResponse confirmInventory(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
return taskControllerService.confirmInventory(inventoryConfirmRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缺料数量,当存在库存时,返回库存与需求的较小值
|
||||
* @param goodsId 料号
|
||||
* @param workOrder 工单号
|
||||
* @return 缺料数量
|
||||
*/
|
||||
@GetMapping("/getGoodsLackQty")
|
||||
public int getLackQty(@RequestParam("goodsId") String goodsId, @RequestParam("workOrder") String workOrder) {
|
||||
return taskControllerService.getLackQty(goodsId, workOrder);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.wms_main.controller.wms;
|
||||
|
||||
import com.wms_main.model.dto.request.wms.OutsUpdateRequest;
|
||||
import com.wms_main.model.dto.request.wms.WmsTaskRequest;
|
||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||
import com.wms_main.service.controller.ITaskOperationControllerService;
|
||||
|
|
@ -37,4 +38,14 @@ public class TaskOperationController {
|
|||
public BaseWmsApiResponse updateWmsTask(@RequestBody WmsTaskRequest wmsTaskRequest) {
|
||||
return taskOperationControllerService.updateWmsTask(wmsTaskRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新出库单信息
|
||||
* @param outsUpdateRequest 请求
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updateOutsTask")
|
||||
public BaseWmsApiResponse updateOutsTask(@RequestBody OutsUpdateRequest outsUpdateRequest) {
|
||||
return taskOperationControllerService.updateOutsTask(outsUpdateRequest);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wms_main.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wms_main.model.po.TSysApi;
|
||||
import com.wms_main.repository.http.entity.HttpRequest;
|
||||
import com.wms_main.repository.http.entity.HttpResponse;
|
||||
|
||||
/**
|
||||
* api表服务
|
||||
*/
|
||||
public interface ITSysApiService extends IService<TSysApi> {
|
||||
/**
|
||||
* 存储api接口请求日志
|
||||
* @param request 请求参数
|
||||
* @param response 响应参数
|
||||
*/
|
||||
void insertApiLog(HttpRequest request, HttpResponse response);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.wms_main.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wms_main.model.po.TSysLog;
|
||||
|
||||
/**
|
||||
* 日志服务接口
|
||||
*/
|
||||
public interface ITSysLogService extends IService<TSysLog> {
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.wms_main.dao.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wms_main.dao.ITSysApiService;
|
||||
import com.wms_main.mapper.SysApiMapper;
|
||||
import com.wms_main.model.po.TSysApi;
|
||||
import com.wms_main.repository.http.entity.HttpRequest;
|
||||
import com.wms_main.repository.http.entity.HttpResponse;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import com.wms_main.repository.utils.UUIDUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* api表服务实现
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class TSysApiServiceImpl extends ServiceImpl<SysApiMapper, TSysApi> implements ITSysApiService {
|
||||
/**
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @param response 响应参数
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertApiLog(HttpRequest request, HttpResponse response) {
|
||||
TSysApi apiLog = new TSysApi();
|
||||
apiLog.setLogId(UUIDUtils.getNewUUID());
|
||||
apiLog.setLogTime(LocalDateTime.now());
|
||||
// 设置请求相关信息
|
||||
if (request != null) {
|
||||
apiLog.setUrl(request.getUrl());
|
||||
apiLog.setTimeout(request.getTimeout());
|
||||
if (request.getMethod() != null) {
|
||||
apiLog.setMethod(request.getMethod().name());
|
||||
}
|
||||
apiLog.setContentType(request.getContentType());
|
||||
apiLog.setData(StringUtils.formatStringWithMaxLength(request.getData(), 2048));
|
||||
apiLog.setToken(StringUtils.formatStringWithMaxLength(request.getToken(), 2048));
|
||||
}
|
||||
// 设置响应相关信息
|
||||
if (response != null) {
|
||||
apiLog.setSuccess(response.isSuccess() ? "成功" : "失败");
|
||||
apiLog.setResponseCode(response.getResponseCode());
|
||||
apiLog.setRequestMessage(StringUtils.formatStringWithMaxLength(response.getRequestMessage(), 2048));
|
||||
apiLog.setResponseMessage(StringUtils.formatStringWithMaxLength(response.getResponseMessage(), 2048));
|
||||
apiLog.setRequestTime(response.getRequestTime());
|
||||
apiLog.setResponseTime(response.getResponseTime());
|
||||
apiLog.setRequestUrl(response.getRequestUrl());
|
||||
apiLog.setUseTime(response.getUseTime());
|
||||
if (response.getException() != null) {
|
||||
apiLog.setExceptionMessage(StringUtils.formatStringWithMaxLength(response.getException().getMessage(), 2048));
|
||||
}
|
||||
}
|
||||
// 保存api日志
|
||||
save(apiLog);
|
||||
// 记录文本日志
|
||||
log.info(logText(apiLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成日志文本
|
||||
* @param apiLog 日志对象
|
||||
* @return 字符串
|
||||
*/
|
||||
private String logText(TSysApi apiLog) {
|
||||
return "\n请求方式:" + apiLog.getMethod()
|
||||
+ "\n请求地址:" + apiLog.getUrl()
|
||||
+ "\n请求数据:" + apiLog.getData()
|
||||
+ "\n响应状态:" + apiLog.getSuccess()
|
||||
+ "\n响应数据:" + apiLog.getRequestMessage();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.wms_main.dao.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wms_main.dao.ITSysLogService;
|
||||
import com.wms_main.mapper.SysLogMapper;
|
||||
import com.wms_main.model.po.TSysLog;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 日志服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class TSysLogServiceImpl extends ServiceImpl<SysLogMapper, TSysLog> implements ITSysLogService {
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
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 ApiReceiveLogExcelTemplate {
|
||||
/**
|
||||
* 日志Id
|
||||
*/
|
||||
@Excel(name = "log_id")
|
||||
private String logId;
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
@Excel(name = "method")
|
||||
private String method;
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
@Excel(name = "uri")
|
||||
private String uri;
|
||||
/**
|
||||
* 客户端主机
|
||||
*/
|
||||
@Excel(name = "remote_host")
|
||||
private String remoteHost;
|
||||
/**
|
||||
* 客户端地址
|
||||
*/
|
||||
@Excel(name = "remote_addr")
|
||||
private String remoteAddr;
|
||||
/**
|
||||
* 请求数据
|
||||
*/
|
||||
@Excel(name = "request_content")
|
||||
private String requestContent;
|
||||
/**
|
||||
* 响应状态
|
||||
*/
|
||||
@Excel(name = "status")
|
||||
private String status;
|
||||
/**
|
||||
* 响应数据
|
||||
*/
|
||||
@Excel(name = "response_content")
|
||||
private String responseContent;
|
||||
/**
|
||||
* 日志记录时间
|
||||
*/
|
||||
@Excel(name = "log_time")
|
||||
private LocalDateTime logTime;
|
||||
}
|
||||
|
|
@ -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 ApiSendLogExcelTemplate {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Excel(name = "log_id")
|
||||
private String logId;
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
@Excel(name = "url")
|
||||
private String url;
|
||||
/**
|
||||
* 超时时长
|
||||
*/
|
||||
@Excel(name = "timeout")
|
||||
private Integer timeout;
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
@Excel(name = "method")
|
||||
private String method;
|
||||
/**
|
||||
* 请求头
|
||||
*/
|
||||
@Excel(name = "content_type")
|
||||
private String contentType;
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
@Excel(name = "data")
|
||||
private String data;
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
@Excel(name = "token")
|
||||
private String token;
|
||||
/**
|
||||
* 请求是否成功
|
||||
*/
|
||||
@Excel(name = "success")
|
||||
private String success;
|
||||
/**
|
||||
* 响应码
|
||||
*/
|
||||
@Excel(name = "response_code")
|
||||
private int responseCode;
|
||||
/**
|
||||
* 请求信息
|
||||
*/
|
||||
@Excel(name = "request_message")
|
||||
private String requestMessage;
|
||||
/**
|
||||
* 响应信息
|
||||
*/
|
||||
@Excel(name = "response_message")
|
||||
private String responseMessage;
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
@Excel(name = "request_time")
|
||||
private LocalDateTime requestTime;
|
||||
/**
|
||||
* 响应时间
|
||||
*/
|
||||
@Excel(name = "response_time")
|
||||
private LocalDateTime responseTime;
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
@Excel(name = "request_url")
|
||||
private String requestUrl;
|
||||
/**
|
||||
* 请求耗时
|
||||
*/
|
||||
@Excel(name = "use_time")
|
||||
private long useTime;
|
||||
/**
|
||||
* 异常
|
||||
*/
|
||||
@Excel(name = "exception_message")
|
||||
private String exceptionMessage;
|
||||
/**
|
||||
* 记录时间
|
||||
*/
|
||||
@Excel(name = "log_time")
|
||||
private LocalDateTime logTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
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.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* DBS完成记录模板
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DbsRecordExcelTemplateForSave {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@Excel(name = "dbs_id")
|
||||
private String dbsId;
|
||||
/**
|
||||
* 工单
|
||||
*/
|
||||
@Excel(name = "work_order")
|
||||
private String workOrder;
|
||||
/**
|
||||
* dbs原始未处理的零件号,成品号
|
||||
*/
|
||||
@Excel(name = "product_id_origin")
|
||||
private String productIdOrigin;
|
||||
/**
|
||||
* 零件号,成品号
|
||||
*/
|
||||
@Excel(name = "product_id")
|
||||
private String productId;
|
||||
/**
|
||||
* Test计划开始时间
|
||||
*/
|
||||
@Excel(name = "test_plan_start_date")
|
||||
private LocalDate testPlanStartDate;
|
||||
/**
|
||||
* Test计划完成时间
|
||||
*/
|
||||
@Excel(name = "test_plan_finish_date")
|
||||
private LocalDate testPlanFinishDate;
|
||||
/**
|
||||
* PNT计划开始时间
|
||||
*/
|
||||
@Excel(name = "pnt_plan_start_date")
|
||||
private LocalDate pntPlanStartDate;
|
||||
/**
|
||||
* PNT计划完成时间
|
||||
*/
|
||||
@Excel(name = "pnt_plan_finish_date")
|
||||
private LocalDate pntPlanFinishDate;
|
||||
/**
|
||||
* 计划产量/套
|
||||
*/
|
||||
@Excel(name = "plan_production")
|
||||
private Integer planProduction;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@Excel(name = "equipment_name")
|
||||
private String equipmentName;
|
||||
/**
|
||||
* 班次
|
||||
*/
|
||||
@Excel(name = "work_shift")
|
||||
private String workShift;
|
||||
/**
|
||||
* Family
|
||||
*/
|
||||
@Excel(name = "family")
|
||||
private String family;
|
||||
/**
|
||||
* Test No#
|
||||
*/
|
||||
@Excel(name = "test_no")
|
||||
private String testNo;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Excel(name = "dbs_status")
|
||||
private Integer dbsStatus;
|
||||
/**
|
||||
* 工作站台
|
||||
*/
|
||||
@Excel(name = "work_stand")
|
||||
private String workStand;
|
||||
/**
|
||||
* 实际工作日期
|
||||
*/
|
||||
@Excel(name = "real_work_date")
|
||||
private LocalDate realWorkDate;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "finish_time")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* K料备注
|
||||
*/
|
||||
@Excel(name = "kitting_remark")
|
||||
private String kittingRemark;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "remark")
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
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 InventoryRecordExcelTemplateForSave {
|
||||
/**
|
||||
* 盘点id
|
||||
*/
|
||||
@Excel(name = "inventory_id")
|
||||
private String inventoryId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@Excel(name = "goods_id")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@Excel(name = "vehicle_id")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 库存数量
|
||||
* 只记录盘点确认时间点
|
||||
*/
|
||||
@Excel(name = "stock_num")
|
||||
private Integer stockNum;
|
||||
/**
|
||||
* 确认数量
|
||||
*/
|
||||
@Excel(name = "confirm_num")
|
||||
private Integer confirmNum;
|
||||
/**
|
||||
* 盘点站台
|
||||
*/
|
||||
@Excel(name = "inv_stand")
|
||||
private String invStand;
|
||||
/**
|
||||
* 盘点人
|
||||
*/
|
||||
@Excel(name = "inv_user")
|
||||
private String invUser;
|
||||
/**
|
||||
* 盘点类型:1:明盘;2:盲盘
|
||||
*/
|
||||
@Excel(name = "inv_type")
|
||||
private Integer invType;
|
||||
/**
|
||||
* 盘点状态
|
||||
* 1. 初始化
|
||||
* 2. 已解析
|
||||
* 3. 数量确认
|
||||
* 4. 盘点关闭
|
||||
*/
|
||||
@Excel(name = "inv_status")
|
||||
private Integer invStatus;
|
||||
/**
|
||||
* 盘点结果
|
||||
* -1: 盘亏
|
||||
* 0: 正常
|
||||
* 1: 盘盈
|
||||
*/
|
||||
@Excel(name = "inv_result")
|
||||
private Integer invResult;
|
||||
/**
|
||||
* 盘点任务创建时间
|
||||
*/
|
||||
@Excel(name = "inv_create_time")
|
||||
private LocalDateTime invCreateTime;
|
||||
/**
|
||||
* 盘点确认时间
|
||||
*/
|
||||
@Excel(name = "inv_confirm_time")
|
||||
private LocalDateTime invConfirmTime;
|
||||
/**
|
||||
* 这个字段用于合并哪些任务是同一时间下发的
|
||||
*/
|
||||
@Excel(name = "inv_order_id")
|
||||
private String invOrderId;
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
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 OutsRecordExcelTemplateForSave {
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
@Excel(name = "task_id")
|
||||
private String taskId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@Excel(name = "goods_id")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@Excel(name = "vehicle_id")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 需求数量
|
||||
*/
|
||||
@Excel(name = "need_num")
|
||||
private Integer needNum;
|
||||
/**
|
||||
* 已分发数量
|
||||
*/
|
||||
@Excel(name = "distribute_num")
|
||||
private Integer distributeNum;
|
||||
/**
|
||||
* 已拣选数量
|
||||
*/
|
||||
@Excel(name = "pick_num")
|
||||
private Integer pickNum;
|
||||
/**
|
||||
* 出库类型
|
||||
*/
|
||||
@Excel(name = "out_type")
|
||||
private Integer outType;
|
||||
/**
|
||||
* 目的地
|
||||
*/
|
||||
@Excel(name = "destination")
|
||||
private String destination;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Excel(name = "user_name")
|
||||
private String userName;
|
||||
/**
|
||||
* 出库理由
|
||||
* 紧急出库必填
|
||||
*/
|
||||
@Excel(name = "reason")
|
||||
private String reason;
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
@Excel(name = "request_time")
|
||||
private LocalDateTime requestTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
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 PickTaskBakExcelTemplate {
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
@Excel(name = "pick_id")
|
||||
private String pickId;
|
||||
/**
|
||||
* 拣选站台
|
||||
*/
|
||||
@Excel(name = "pick_stand")
|
||||
private String pickStand;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@Excel(name = "vehicle_id")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
@Excel(name = "pick_status")
|
||||
private Integer pickStatus;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "create_time")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 发送时间
|
||||
*/
|
||||
@Excel(name = "send_time")
|
||||
private LocalDateTime sendTime;
|
||||
/**
|
||||
* 到达时间
|
||||
*/
|
||||
@Excel(name = "arrive_time")
|
||||
private LocalDateTime arriveTime;
|
||||
/**
|
||||
* 离开时间
|
||||
*/
|
||||
@Excel(name = "leave_time")
|
||||
private LocalDateTime leaveTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
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 StockUpdateRecordExcelTemplateForSave {
|
||||
/**
|
||||
* 库存更新记录id
|
||||
*/
|
||||
@Excel(name = "update_id")
|
||||
private String updateId;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@Excel(name = "vehicle_id")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@Excel(name = "goods_id")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 首次入库时间
|
||||
*/
|
||||
@Excel(name = "first_in_time")
|
||||
private LocalDateTime firstInTime;
|
||||
/**
|
||||
* 原数量
|
||||
*/
|
||||
@Excel(name = "before_num")
|
||||
private Integer beforeNum;
|
||||
/**
|
||||
* 新数量
|
||||
*/
|
||||
@Excel(name = "after_num")
|
||||
private Integer afterNum;
|
||||
/**
|
||||
* 更新理由
|
||||
*/
|
||||
@Excel(name = "reason")
|
||||
private String reason;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Excel(name = "update_time")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
@Excel(name = "update_user")
|
||||
private String updateUser;
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* Wcs任务记录模板
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WcsTaskBakExcelTemplate {
|
||||
/**
|
||||
* wcs任务id
|
||||
*/
|
||||
@Excel(name = "wcs_task_id")
|
||||
private String wcsTaskId;
|
||||
/**
|
||||
* wcs任务状态
|
||||
*/
|
||||
@Excel(name = "wcs_task_status")
|
||||
private Integer wcsTaskStatus;
|
||||
/**
|
||||
* wcs任务类型
|
||||
*/
|
||||
@Excel(name = "wcs_task_type")
|
||||
private Integer wcsTaskType;
|
||||
/**
|
||||
* wcs任务优先级
|
||||
*/
|
||||
@Excel(name = "task_priority")
|
||||
private Integer taskPriority;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@Excel(name = "vehicle_id")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 起点
|
||||
*/
|
||||
@Excel(name = "origin")
|
||||
private String origin;
|
||||
/**
|
||||
* 终点
|
||||
*/
|
||||
@Excel(name = "destination")
|
||||
private String destination;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "create_time")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 发送时间
|
||||
*/
|
||||
@Excel(name = "send_time")
|
||||
private LocalDateTime sendTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "finish_time")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "remark")
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* Wms任务记录模版
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WmsTaskBakExcelTemplate {
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
@Excel(name = "task_id")
|
||||
private String taskId;
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
@Excel(name = "task_type")
|
||||
private Integer taskType;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
@Excel(name = "task_status")
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
* 任务优先级
|
||||
*/
|
||||
@Excel(name = "task_priority")
|
||||
private Integer taskPriority;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@Excel(name = "vehicle_id")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 起点
|
||||
*/
|
||||
@Excel(name = "origin")
|
||||
private String origin;
|
||||
/**
|
||||
* 终点
|
||||
*/
|
||||
@Excel(name = "destination")
|
||||
private String destination;
|
||||
/**
|
||||
* wcs任务id
|
||||
*/
|
||||
@Excel(name = "wcs_task_id")
|
||||
private String wcsTaskId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "create_time")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "finish_time")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@Excel(name = "goods_id")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 操作数量
|
||||
*/
|
||||
@Excel(name = "op_num")
|
||||
private Integer opNum;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
@Excel(name = "stock_num")
|
||||
private Integer stockNum;
|
||||
/**
|
||||
* 操纵用户
|
||||
*/
|
||||
@Excel(name = "op_user")
|
||||
private String opUser;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "remark")
|
||||
private String remark;
|
||||
/**
|
||||
* 申请出库的站台
|
||||
*/
|
||||
@Excel(name = "call_stand")
|
||||
private String callStand;
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
@Excel(name = "goods_desc")
|
||||
private String goodsDesc;
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
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.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 工作记录缓存模版
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WorkRecordExcelTemplateForSave {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Excel(name = "work_index")
|
||||
private String workIndex;
|
||||
/**
|
||||
* plant
|
||||
*/
|
||||
@Excel(name = "work_order")
|
||||
private String workOrder;
|
||||
/**
|
||||
* 计划开工日期
|
||||
*/
|
||||
@Excel(name = "plan_start_date")
|
||||
private LocalDate planStartDate;
|
||||
/**
|
||||
* 成品号
|
||||
*/
|
||||
@Excel(name = "product_id")
|
||||
private String productId;
|
||||
/**
|
||||
* 单片号
|
||||
*/
|
||||
@Excel(name = "single_product_id")
|
||||
private String singleProductId;
|
||||
/**
|
||||
* 料盒号
|
||||
*/
|
||||
@Excel(name = "box_no")
|
||||
private String boxNo;
|
||||
/**
|
||||
* 原材料号
|
||||
*/
|
||||
@Excel(name = "goods_id")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 需求数量
|
||||
*/
|
||||
@Excel(name = "need_num")
|
||||
private Integer needNum;
|
||||
/**
|
||||
* 已完成数量
|
||||
*/
|
||||
@Excel(name = "finish_num")
|
||||
private Integer finishNum;
|
||||
/**
|
||||
* 工作站台
|
||||
*/
|
||||
@Excel(name = "work_stand")
|
||||
private String workStand;
|
||||
/**
|
||||
* 工作状态
|
||||
*/
|
||||
@Excel(name = "work_status")
|
||||
private Integer workStatus;
|
||||
/**
|
||||
* 工作用户
|
||||
*/
|
||||
@Excel(name = "work_user")
|
||||
private String workUser;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "create_time")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Excel(name = "finish_time")
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 缺料状态
|
||||
*/
|
||||
@Excel(name = "lack_status")
|
||||
private Integer lackStatus;
|
||||
/**
|
||||
* 是否是库外料
|
||||
*/
|
||||
@Excel(name = "is_out")
|
||||
private Integer isOut;
|
||||
/**
|
||||
* 产品类型
|
||||
* 1:非服务件
|
||||
* 2:服务件
|
||||
*/
|
||||
@Excel(name = "product_type")
|
||||
private Integer productType;
|
||||
/**
|
||||
* 备注
|
||||
* 用于ECN相关
|
||||
*/
|
||||
@Excel(name = "kitting_remark")
|
||||
private String kittingRemark;
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.wms_main.excel.easypoi.service;
|
||||
|
||||
import com.wms_main.model.po.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保存数据服务接口
|
||||
*/
|
||||
public interface ISaveExcelEasyPoi {
|
||||
/**
|
||||
* 保存接口接收日志
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param logList 数据列表
|
||||
*/
|
||||
void saveApiReceiveLogs(String fileSuffix, List<TSysLog> logList);
|
||||
|
||||
/**
|
||||
* 保存接口发送日志
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param apiLogList 数据列表
|
||||
*/
|
||||
void saveApiSendLogs(String fileSuffix, List<TSysApi> apiLogList);
|
||||
|
||||
/**
|
||||
* 保存Wms任务记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param wmsTaskBakList 数据列表
|
||||
*/
|
||||
void saveWmsTaskBak(String fileSuffix, List<TAppTaskBak> wmsTaskBakList);
|
||||
|
||||
/**
|
||||
* 保存Wcs任务记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param wcsTaskBakList 数据列表
|
||||
*/
|
||||
void saveWcsTaskBak(String fileSuffix, List<TAppWcsTaskBak> wcsTaskBakList);
|
||||
|
||||
/**
|
||||
* 保存拣选任务记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param pickTaskBakList 数据列表
|
||||
*/
|
||||
void savePickTaskBak(String fileSuffix, List<TAppPickTaskBak> pickTaskBakList);
|
||||
|
||||
/**
|
||||
* 保存Dbs记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param dbsRecordList 数据列表
|
||||
*/
|
||||
void saveDbsRecord(String fileSuffix, List<TAppDbs> dbsRecordList);
|
||||
|
||||
/**
|
||||
* 保存出库单记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param outsRecordList 数据列表
|
||||
*/
|
||||
void saveOutsRecord(String fileSuffix, List<TAppOutsRecord> outsRecordList);
|
||||
|
||||
/**
|
||||
* 保存库存流水记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param stockUpdateList 数据列表
|
||||
*/
|
||||
void saveStockUpdateRecord(String fileSuffix, List<TAppStockUpdate> stockUpdateList);
|
||||
|
||||
/**
|
||||
* 保存盘点记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param inventoryList 数据列表
|
||||
*/
|
||||
void saveInventoryRecord(String fileSuffix, List<TAppInventoryRecord> inventoryList);
|
||||
|
||||
/**
|
||||
* 保存工作记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param workRecordList 数据列表
|
||||
*/
|
||||
void saveWorkRecord(String fileSuffix, List<TAppWorkRecord> workRecordList);
|
||||
}
|
||||
|
|
@ -0,0 +1,441 @@
|
|||
package com.wms_main.excel.easypoi.service.serviceImpl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import com.wms_main.excel.easypoi.excelTemplate.*;
|
||||
import com.wms_main.excel.easypoi.service.ISaveExcelEasyPoi;
|
||||
import com.wms_main.model.po.*;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保存数据服务实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SaveExcelEasyPoi implements ISaveExcelEasyPoi {
|
||||
private final String ROOT_PATH = "./file";
|
||||
|
||||
/**
|
||||
* 写入excel
|
||||
*
|
||||
* @param fileDesc 文件描述,不需要文件类型的后缀
|
||||
* @param filePath 文件路径,最后一位不需要添加文件分割符
|
||||
* @param sheetName 页名
|
||||
* @param list 数据列表
|
||||
* @param clazz 泛型类
|
||||
* @param <T> 泛型
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
public <T> void doWriteExcel(String fileDesc, String filePath, String sheetName, List<T> list, Class<T> clazz) throws IOException {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setSheetName(sheetName);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, clazz, list);
|
||||
File file = new File(filePath + File.separator + fileDesc + ".xlsx");
|
||||
createFile(file);// 新建文件
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
workbook.write(fos);
|
||||
fos.close();
|
||||
workbook.close();
|
||||
log.info("保存文件成功:{}。", fileDesc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文件
|
||||
*
|
||||
* @param file 目标文件
|
||||
*/
|
||||
public void createFile(File file) {
|
||||
if (!file.exists()) {
|
||||
// 文件不存在
|
||||
if (!file.getParentFile().exists()) {
|
||||
// 目录不存在,创建上级目录
|
||||
boolean createDirectSuccessFlag = file.getParentFile().mkdirs();
|
||||
if (!createDirectSuccessFlag) {
|
||||
log.error("创建目录失败。");
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
// 在上级目录里创建文件
|
||||
boolean createFileSuccessFlag = file.createNewFile();
|
||||
if (!createFileSuccessFlag) {
|
||||
log.error("创建文件失败。");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("创建文件异常。{}", StringUtils.objectToString(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存api接收日志
|
||||
*
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param logList 数据列表
|
||||
*/
|
||||
@Override
|
||||
public void saveApiReceiveLogs(String fileSuffix, List<TSysLog> logList) {
|
||||
if (logList == null || logList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<ApiReceiveLogExcelTemplate> logExcelTemplateList = new ArrayList<>(logList.stream().map(log -> new ApiReceiveLogExcelTemplate(
|
||||
log.getLogId(),
|
||||
log.getMethod(),
|
||||
log.getUri(),
|
||||
log.getRemoteHost(),
|
||||
log.getRemoteAddr(),
|
||||
log.getRequestContent(),
|
||||
log.getStatus(),
|
||||
log.getResponseContent(),
|
||||
log.getLogTime()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_sys_log_" + fileSuffix, ROOT_PATH + "/t_sys_log", "t_sys_log", logExcelTemplateList, ApiReceiveLogExcelTemplate.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存过期接口接收日志异常。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存api发送日志
|
||||
*
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param apiLogList 数据列表
|
||||
*/
|
||||
@Override
|
||||
public void saveApiSendLogs(String fileSuffix, List<TSysApi> apiLogList) {
|
||||
if (apiLogList == null || apiLogList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<ApiSendLogExcelTemplate> logExcelTemplateList = new ArrayList<>(apiLogList.stream().map(log -> new ApiSendLogExcelTemplate(
|
||||
log.getLogId(),
|
||||
log.getUrl(),
|
||||
log.getTimeout(),
|
||||
log.getMethod(),
|
||||
log.getContentType(),
|
||||
log.getData(),
|
||||
log.getToken(),
|
||||
log.getSuccess(),
|
||||
log.getResponseCode(),
|
||||
log.getRequestMessage(),
|
||||
log.getResponseMessage(),
|
||||
log.getRequestTime(),
|
||||
log.getResponseTime(),
|
||||
log.getRequestUrl(),
|
||||
log.getUseTime(),
|
||||
log.getExceptionMessage(),
|
||||
log.getLogTime()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_sys_api_" + fileSuffix, ROOT_PATH + "/t_sys_api", "t_sys_api", logExcelTemplateList, ApiSendLogExcelTemplate.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存过期接口发送日志异常。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存Wms任务记录
|
||||
*
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param wmsTaskBakList 数据列表
|
||||
*/
|
||||
@Override
|
||||
public void saveWmsTaskBak(String fileSuffix, List<TAppTaskBak> wmsTaskBakList) {
|
||||
if (wmsTaskBakList == null || wmsTaskBakList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<WmsTaskBakExcelTemplate> wmsTaskBakExcelTemplateList = new ArrayList<>(wmsTaskBakList.stream().map(wmsTaskBak -> new WmsTaskBakExcelTemplate(
|
||||
wmsTaskBak.getTaskId(),
|
||||
wmsTaskBak.getTaskType(),
|
||||
wmsTaskBak.getTaskStatus(),
|
||||
wmsTaskBak.getTaskPriority(),
|
||||
wmsTaskBak.getVehicleId(),
|
||||
wmsTaskBak.getOrigin(),
|
||||
wmsTaskBak.getDestination(),
|
||||
wmsTaskBak.getWcsTaskId(),
|
||||
wmsTaskBak.getCreateTime(),
|
||||
wmsTaskBak.getFinishTime(),
|
||||
wmsTaskBak.getGoodsId(),
|
||||
wmsTaskBak.getOpNum(),
|
||||
wmsTaskBak.getStockNum(),
|
||||
wmsTaskBak.getOpUser(),
|
||||
wmsTaskBak.getRemark(),
|
||||
wmsTaskBak.getCallStand(),
|
||||
wmsTaskBak.getGoodsDesc()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_app_task_bak_" + fileSuffix, ROOT_PATH + "/t_app_task_bak", "t_app_task_bak", wmsTaskBakExcelTemplateList, WmsTaskBakExcelTemplate.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存过期Wms任务记录异常。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存wcs任务记录
|
||||
*
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param wcsTaskBakList 数据记录
|
||||
*/
|
||||
@Override
|
||||
public void saveWcsTaskBak(String fileSuffix, List<TAppWcsTaskBak> wcsTaskBakList) {
|
||||
if (wcsTaskBakList == null || wcsTaskBakList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<WcsTaskBakExcelTemplate> wcsTaskBakExcelTemplateList = new ArrayList<>(wcsTaskBakList.stream().map(wcsTaskBak -> new WcsTaskBakExcelTemplate(
|
||||
wcsTaskBak.getWcsTaskId(),
|
||||
wcsTaskBak.getWcsTaskStatus(),
|
||||
wcsTaskBak.getWcsTaskType(),
|
||||
wcsTaskBak.getTaskPriority(),
|
||||
wcsTaskBak.getVehicleId(),
|
||||
wcsTaskBak.getOrigin(),
|
||||
wcsTaskBak.getDestination(),
|
||||
wcsTaskBak.getCreateTime(),
|
||||
wcsTaskBak.getSendTime(),
|
||||
wcsTaskBak.getFinishTime(),
|
||||
wcsTaskBak.getRemark()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_app_wcs_task_bak_" + fileSuffix, ROOT_PATH + "/t_app_wcs_task_bak", "t_app_wcs_task_bak", wcsTaskBakExcelTemplateList, WcsTaskBakExcelTemplate.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存过期Wcs任务记录异常。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存拣选任务记录
|
||||
*
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param pickTaskBakList 数据记录
|
||||
*/
|
||||
@Override
|
||||
public void savePickTaskBak(String fileSuffix, List<TAppPickTaskBak> pickTaskBakList) {
|
||||
if (pickTaskBakList == null || pickTaskBakList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<PickTaskBakExcelTemplate> pickTaskExcelTemplateList = new ArrayList<>(pickTaskBakList.stream().map(log -> new PickTaskBakExcelTemplate(
|
||||
log.getPickId(),
|
||||
log.getPickStand(),
|
||||
log.getVehicleId(),
|
||||
log.getPickStatus(),
|
||||
log.getCreateTime(),
|
||||
log.getSendTime(),
|
||||
log.getArriveTime(),
|
||||
log.getLeaveTime()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_app_pick_task_bak_" + fileSuffix, ROOT_PATH + "/t_app_pick_task_bak", "t_app_pick_task_bak", pickTaskExcelTemplateList, PickTaskBakExcelTemplate.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存过期拣选任务记录异常。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存DBS记录
|
||||
*
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param dbsRecordList 数据列表
|
||||
*/
|
||||
@Override
|
||||
public void saveDbsRecord(String fileSuffix, List<TAppDbs> dbsRecordList) {
|
||||
if (dbsRecordList == null || dbsRecordList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<DbsRecordExcelTemplateForSave> dbsRecordExcelTemplateList = new ArrayList<>(dbsRecordList.stream().map(dbsRecord -> new DbsRecordExcelTemplateForSave(
|
||||
dbsRecord.getDbsId(),
|
||||
dbsRecord.getWorkOrder(),
|
||||
dbsRecord.getProductIdOrigin(),
|
||||
dbsRecord.getProductId(),
|
||||
dbsRecord.getTestPlanStartDate(),
|
||||
dbsRecord.getTestPlanFinishDate(),
|
||||
dbsRecord.getPntPlanStartDate(),
|
||||
dbsRecord.getPntPlanFinishDate(),
|
||||
dbsRecord.getPlanProduction(),
|
||||
dbsRecord.getEquipmentName(),
|
||||
dbsRecord.getWorkShift(),
|
||||
dbsRecord.getFamily(),
|
||||
dbsRecord.getTestNo(),
|
||||
dbsRecord.getDbsStatus(),
|
||||
dbsRecord.getWorkStand(),
|
||||
dbsRecord.getRealWorkDate(),
|
||||
dbsRecord.getFinishTime(),
|
||||
dbsRecord.getKittingRemark(),
|
||||
dbsRecord.getRemark()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_app_dbs_" + fileSuffix, ROOT_PATH + "/t_app_dbs", "t_app_dbs", dbsRecordExcelTemplateList, DbsRecordExcelTemplateForSave.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存Dbs记录异常。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存出库单记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param outsRecordList 数据列表
|
||||
*/
|
||||
@Override
|
||||
public void saveOutsRecord(String fileSuffix, List<TAppOutsRecord> outsRecordList) {
|
||||
if (outsRecordList == null || outsRecordList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<OutsRecordExcelTemplateForSave> outsRecordExcelTemplateList = new ArrayList<>(outsRecordList.stream().map(outsRecord -> new OutsRecordExcelTemplateForSave(
|
||||
outsRecord.getTaskId(),
|
||||
outsRecord.getGoodsId(),
|
||||
outsRecord.getVehicleId(),
|
||||
outsRecord.getNeedNum(),
|
||||
outsRecord.getDistributeNum(),
|
||||
outsRecord.getPickNum(),
|
||||
outsRecord.getOutType(),
|
||||
outsRecord.getDestination(),
|
||||
outsRecord.getUserName(),
|
||||
outsRecord.getReason(),
|
||||
outsRecord.getRequestTime()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_app_outs_record_" + fileSuffix, ROOT_PATH + "/t_app_outs_record", "t_app_outs_record", outsRecordExcelTemplateList, OutsRecordExcelTemplateForSave.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存出库单记录异常。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存库存流水记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param stockUpdateList 数据列表
|
||||
*/
|
||||
@Override
|
||||
public void saveStockUpdateRecord(String fileSuffix, List<TAppStockUpdate> stockUpdateList) {
|
||||
if (stockUpdateList == null || stockUpdateList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<StockUpdateRecordExcelTemplateForSave> stockUpdateExcelTemplateList = new ArrayList<>(stockUpdateList.stream().map(stockUpdate -> new StockUpdateRecordExcelTemplateForSave(
|
||||
stockUpdate.getUpdateId(),
|
||||
stockUpdate.getVehicleId(),
|
||||
stockUpdate.getGoodsId(),
|
||||
stockUpdate.getFirstInTime(),
|
||||
stockUpdate.getBeforeNum(),
|
||||
stockUpdate.getAfterNum(),
|
||||
stockUpdate.getReason(),
|
||||
stockUpdate.getUpdateTime(),
|
||||
stockUpdate.getUpdateUser()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_app_stock_update_" + fileSuffix, ROOT_PATH + "/t_app_stock_update", "t_app_stock_update", stockUpdateExcelTemplateList, StockUpdateRecordExcelTemplateForSave.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存库存流水记录异常。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存盘点记录
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param inventoryList 数据列表
|
||||
*/
|
||||
@Override
|
||||
public void saveInventoryRecord(String fileSuffix, List<TAppInventoryRecord> inventoryList) {
|
||||
if (inventoryList == null || inventoryList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<InventoryRecordExcelTemplateForSave> inventoryRecordExcelTemplateList = new ArrayList<>(inventoryList.stream().map(inventoryRecord -> new InventoryRecordExcelTemplateForSave(
|
||||
inventoryRecord.getInventoryId(),
|
||||
inventoryRecord.getGoodsId(),
|
||||
inventoryRecord.getVehicleId(),
|
||||
inventoryRecord.getStockNum(),
|
||||
inventoryRecord.getConfirmNum(),
|
||||
inventoryRecord.getInvStand(),
|
||||
inventoryRecord.getInvUser(),
|
||||
inventoryRecord.getInvType(),
|
||||
inventoryRecord.getInvStatus(),
|
||||
inventoryRecord.getInvResult(),
|
||||
inventoryRecord.getInvCreateTime(),
|
||||
inventoryRecord.getInvConfirmTime(),
|
||||
inventoryRecord.getInvOrderId()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_app_inventory_" + fileSuffix, ROOT_PATH + "/t_app_inventory", "t_app_inventory", inventoryRecordExcelTemplateList, InventoryRecordExcelTemplateForSave.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存盘点记录异常。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存工作记录
|
||||
*
|
||||
* @param fileSuffix 文件后缀
|
||||
* @param workRecordList 数据列表
|
||||
*/
|
||||
@Override
|
||||
public void saveWorkRecord(String fileSuffix, List<TAppWorkRecord> workRecordList) {
|
||||
if (workRecordList == null || workRecordList.isEmpty()) {
|
||||
// 空数据体,不做处理
|
||||
return;
|
||||
}
|
||||
// 将数据转化为excel Template
|
||||
List<WorkRecordExcelTemplateForSave> workRecordExcelTemplateList = new ArrayList<>(workRecordList.stream().map(workRecord -> new WorkRecordExcelTemplateForSave(
|
||||
workRecord.getWorkIndex(),
|
||||
workRecord.getWorkOrder(),
|
||||
workRecord.getPlanStartDate(),
|
||||
workRecord.getProductId(),
|
||||
workRecord.getSingleProductId(),
|
||||
workRecord.getBoxNo(),
|
||||
workRecord.getGoodsId(),
|
||||
workRecord.getNeedNum(),
|
||||
workRecord.getFinishNum(),
|
||||
workRecord.getWorkStand(),
|
||||
workRecord.getWorkStatus(),
|
||||
workRecord.getWorkUser(),
|
||||
workRecord.getCreateTime(),
|
||||
workRecord.getFinishTime(),
|
||||
workRecord.getLackStatus(),
|
||||
workRecord.getIsOut(),
|
||||
workRecord.getProductType(),
|
||||
workRecord.getKittingRemark()
|
||||
)).toList());
|
||||
try {
|
||||
// 写入excel
|
||||
doWriteExcel("t_app_work_record_" + fileSuffix, ROOT_PATH + "/t_app_work_record", "t_app_work_record", workRecordExcelTemplateList, WorkRecordExcelTemplateForSave.class);
|
||||
} catch (IOException e) {
|
||||
log.error("缓存工作记录异常。");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +1,36 @@
|
|||
package com.wms_main.filter;
|
||||
|
||||
import com.wms_main.dao.ITSysLogService;
|
||||
import com.wms_main.model.po.TSysLog;
|
||||
import com.wms_main.model.pojo.log.RequestLog;
|
||||
import com.wms_main.repository.utils.UUIDUtils;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebFilter;
|
||||
import jakarta.servlet.http.HttpFilter;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.util.ContentCachingRequestWrapper;
|
||||
import org.springframework.web.util.ContentCachingResponseWrapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.wms_main.repository.utils.StringUtils.formatStringWithMaxLength;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@WebFilter(filterName = "requestLogFilter", urlPatterns = "/*")
|
||||
@RequiredArgsConstructor
|
||||
public class RequestLogFilter extends HttpFilter {
|
||||
/**
|
||||
* 日志服务
|
||||
*/
|
||||
private final ITSysLogService sysLogService;
|
||||
|
||||
@Override
|
||||
protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
// Wrapper封装request和response
|
||||
|
|
@ -40,26 +53,31 @@ public class RequestLogFilter extends HttpFilter {
|
|||
// 响应体
|
||||
byte[] responseContent = responseWrapper.getContentAsByteArray();
|
||||
// 记录日志信息
|
||||
String requestContentString = formatContentString(new String(requestContent));
|
||||
String responseContentString = formatContentString(new String(responseContent));
|
||||
String requestContentString = formatStringWithMaxLength(new String(requestContent), 2048);
|
||||
String responseContentString = formatStringWithMaxLength(new String(responseContent), 2048);
|
||||
RequestLog logInfo = new RequestLog(method, uri, remoteHost, remoteAddr, requestContentString, String.valueOf(status), responseContentString);
|
||||
log.info(logInfo.toString());
|
||||
// TODO 增加存储数据库的操作
|
||||
// 增加存储数据库的操作
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化内容string
|
||||
* @param contentString 原始字符串
|
||||
* @return 格式化之后的字符串
|
||||
*/
|
||||
private String formatContentString (String contentString) {
|
||||
String newContentString = contentString.replaceAll("\\s*", "");
|
||||
if (newContentString.length() > 1024) {
|
||||
newContentString = newContentString.substring(0, 1024) + "...";
|
||||
}
|
||||
return newContentString;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.wms_main.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.wms_main.model.po.TSysApi;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* api表映射mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysApiMapper extends BaseMapper<TSysApi> {
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.wms_main.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.wms_main.model.po.TSysLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 日志mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysLogMapper extends BaseMapper<TSysLog> {
|
||||
}
|
||||
|
|
@ -46,4 +46,9 @@ public class KateWorksQuery extends PageQuery{
|
|||
*/
|
||||
@JsonProperty("planStartDate")
|
||||
private LocalDate planStartDate;
|
||||
/**
|
||||
* 预留字段
|
||||
*/
|
||||
@JsonProperty("bk1")
|
||||
private String bk1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,13 @@ import java.time.LocalDateTime;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OutsQuery extends PageQuery {
|
||||
/**
|
||||
* 查询类型
|
||||
* 1. 未关闭
|
||||
* 2. 已关闭
|
||||
*/
|
||||
@JsonProperty("queryType")
|
||||
private Integer queryType;
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.wms_main.model.dto.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 接口发送日志查询参数
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysApiQuery extends PageQuery {
|
||||
/**
|
||||
* 查询字符串
|
||||
*/
|
||||
@JsonProperty("queryStr")
|
||||
private String queryStr;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.wms_main.model.dto.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 接口接收日志查询参数
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysLogQuery extends PageQuery {
|
||||
/**
|
||||
* 查询字符串
|
||||
*/
|
||||
@JsonProperty("queryStr")
|
||||
private String queryStr;
|
||||
}
|
||||
|
|
@ -44,4 +44,9 @@ public class StockOutRequest extends BaseWmsRequest {
|
|||
*/
|
||||
@JsonProperty("reason")
|
||||
private String reason;
|
||||
/**
|
||||
* 工单号
|
||||
*/
|
||||
@JsonProperty("workOrder")
|
||||
private String workOrder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,4 +73,9 @@ public class TAppOuts {
|
|||
*/
|
||||
@TableField(value = "request_time")
|
||||
private LocalDateTime requestTime;
|
||||
/**
|
||||
* 工单号
|
||||
*/
|
||||
@TableField(value = "work_order")
|
||||
private String workOrder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,4 +73,9 @@ public class TAppOutsRecord {
|
|||
*/
|
||||
@TableField(value = "request_time")
|
||||
private LocalDateTime requestTime;
|
||||
/**
|
||||
* 工单号
|
||||
*/
|
||||
@TableField(value = "work_order")
|
||||
private String workOrder;
|
||||
}
|
||||
|
|
|
|||
105
dev_wms_serve/src/main/java/com/wms_main/model/po/TSysApi.java
Normal file
105
dev_wms_serve/src/main/java/com/wms_main/model/po/TSysApi.java
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
package com.wms_main.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 数据库Api表映射
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "t_sys_api", autoResultMap = true)
|
||||
public class TSysApi {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "log_id")
|
||||
private String logId;
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
@TableField(value = "url")
|
||||
private String url;
|
||||
/**
|
||||
* 超时时长
|
||||
*/
|
||||
@TableField(value = "timeout")
|
||||
private Integer timeout;
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
@TableField(value = "method")
|
||||
private String method;
|
||||
/**
|
||||
* 请求头
|
||||
*/
|
||||
@TableField(value = "content_type")
|
||||
private String contentType;
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
@TableField(value = "data")
|
||||
private String data;
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
@TableField(value = "token")
|
||||
private String token;
|
||||
/**
|
||||
* 请求是否成功
|
||||
*/
|
||||
@TableField(value = "success")
|
||||
private String success;
|
||||
/**
|
||||
* 响应码
|
||||
*/
|
||||
@TableField(value = "response_code")
|
||||
private int responseCode;
|
||||
/**
|
||||
* 请求信息
|
||||
*/
|
||||
@TableField(value = "request_message")
|
||||
private String requestMessage;
|
||||
/**
|
||||
* 响应信息
|
||||
*/
|
||||
@TableField(value = "response_message")
|
||||
private String responseMessage;
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
@TableField(value = "request_time")
|
||||
private LocalDateTime requestTime;
|
||||
/**
|
||||
* 响应时间
|
||||
*/
|
||||
@TableField(value = "response_time")
|
||||
private LocalDateTime responseTime;
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
@TableField(value = "request_url")
|
||||
private String requestUrl;
|
||||
/**
|
||||
* 请求耗时
|
||||
*/
|
||||
@TableField(value = "use_time")
|
||||
private long useTime;
|
||||
/**
|
||||
* 异常
|
||||
*/
|
||||
@TableField(value = "exception_message")
|
||||
private String exceptionMessage;
|
||||
/**
|
||||
* 记录时间
|
||||
*/
|
||||
@TableField(value = "log_time")
|
||||
private LocalDateTime logTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.wms_main.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 数据库Log表映射
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "t_sys_log", autoResultMap = true)
|
||||
public class TSysLog {
|
||||
/**
|
||||
* 日志Id
|
||||
*/
|
||||
@TableId(value = "log_id")
|
||||
private String logId;
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
@TableField(value = "method")
|
||||
private String method;
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
@TableField(value = "uri")
|
||||
private String uri;
|
||||
/**
|
||||
* 客户端主机
|
||||
*/
|
||||
@TableField(value = "remote_host")
|
||||
private String remoteHost;
|
||||
/**
|
||||
* 客户端地址
|
||||
*/
|
||||
@TableField(value = "remote_addr")
|
||||
private String remoteAddr;
|
||||
/**
|
||||
* 请求数据
|
||||
*/
|
||||
@TableField(value = "request_content")
|
||||
private String requestContent;
|
||||
/**
|
||||
* 响应状态
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private String status;
|
||||
/**
|
||||
* 响应数据
|
||||
*/
|
||||
@TableField(value = "response_content")
|
||||
private String responseContent;
|
||||
/**
|
||||
* 日志记录时间
|
||||
*/
|
||||
@TableField(value = "log_time")
|
||||
private LocalDateTime logTime;
|
||||
}
|
||||
|
|
@ -3,6 +3,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.TAppOuts;
|
||||
import com.wms_main.model.po.TAppOutsRecord;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
@ -99,4 +100,28 @@ public class OutsVo {
|
|||
po.getRequestTime()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将记录po转换为vo
|
||||
* @param po 数据库实体
|
||||
* @return 转化结果
|
||||
*/
|
||||
public static OutsVo ofRecord(TAppOutsRecord po) {
|
||||
if (po == null) {
|
||||
return new OutsVo();
|
||||
}
|
||||
return new OutsVo(
|
||||
po.getTaskId(),
|
||||
po.getGoodsId(),
|
||||
po.getVehicleId(),
|
||||
po.getNeedNum(),
|
||||
po.getDistributeNum(),
|
||||
po.getPickNum(),
|
||||
po.getOutType(),
|
||||
po.getDestination(),
|
||||
po.getUserName(),
|
||||
po.getReason(),
|
||||
po.getRequestTime()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,102 @@
|
|||
package com.wms_main.model.vo.wms;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 接口发送日志
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysApiVo {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@JsonProperty("logId")
|
||||
private String logId;
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
@JsonProperty("url")
|
||||
private String url;
|
||||
/**
|
||||
* 超时时长
|
||||
*/
|
||||
@JsonProperty("timeout")
|
||||
private Integer timeout;
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
@JsonProperty("method")
|
||||
private String method;
|
||||
/**
|
||||
* 请求头
|
||||
*/
|
||||
@JsonProperty("contentType")
|
||||
private String contentType;
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
@JsonProperty("data")
|
||||
private String data;
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
@JsonProperty("token")
|
||||
private String token;
|
||||
/**
|
||||
* 请求是否成功
|
||||
*/
|
||||
@JsonProperty("success")
|
||||
private String success;
|
||||
/**
|
||||
* 响应码
|
||||
*/
|
||||
@JsonProperty("responseCode")
|
||||
private int responseCode;
|
||||
/**
|
||||
* 请求信息
|
||||
*/
|
||||
@JsonProperty("requestMessage")
|
||||
private String requestMessage;
|
||||
/**
|
||||
* 响应信息
|
||||
*/
|
||||
@JsonProperty("responseMessage")
|
||||
private String responseMessage;
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
@JsonProperty("requestTime")
|
||||
private LocalDateTime requestTime;
|
||||
/**
|
||||
* 响应时间
|
||||
*/
|
||||
@JsonProperty("responseTime")
|
||||
private LocalDateTime responseTime;
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
@JsonProperty("requestUrl")
|
||||
private String requestUrl;
|
||||
/**
|
||||
* 请求耗时
|
||||
*/
|
||||
@JsonProperty("useTime")
|
||||
private long useTime;
|
||||
/**
|
||||
* 异常
|
||||
*/
|
||||
@JsonProperty("exceptionMessage")
|
||||
private String exceptionMessage;
|
||||
/**
|
||||
* 记录时间
|
||||
*/
|
||||
@JsonProperty("logTime")
|
||||
private LocalDateTime logTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.wms_main.model.vo.wms;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 接口接收日志
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysLogVo {
|
||||
/**
|
||||
* 日志Id
|
||||
*/
|
||||
@JsonProperty("logId")
|
||||
private String logId;
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
@JsonProperty("method")
|
||||
private String method;
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
@JsonProperty("uri")
|
||||
private String uri;
|
||||
/**
|
||||
* 客户端主机
|
||||
*/
|
||||
@JsonProperty("remoteHost")
|
||||
private String remoteHost;
|
||||
/**
|
||||
* 客户端地址
|
||||
*/
|
||||
@JsonProperty("remoteAddr")
|
||||
private String remoteAddr;
|
||||
/**
|
||||
* 请求数据
|
||||
*/
|
||||
@JsonProperty("requestContent")
|
||||
private String requestContent;
|
||||
/**
|
||||
* 响应状态
|
||||
*/
|
||||
@JsonProperty("status")
|
||||
private String status;
|
||||
/**
|
||||
* 响应数据
|
||||
*/
|
||||
@JsonProperty("responseContent")
|
||||
private String responseContent;
|
||||
/**
|
||||
* 日志记录时间
|
||||
*/
|
||||
@JsonProperty("logTime")
|
||||
private LocalDateTime logTime;
|
||||
}
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
package com.wms_main.repository.http;
|
||||
|
||||
import com.wms_main.dao.ITSysApiService;
|
||||
import com.wms_main.repository.http.entity.HttpRequest;
|
||||
import com.wms_main.repository.http.entity.HttpResponse;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
|
|
@ -24,7 +26,9 @@ import java.time.LocalDateTime;
|
|||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class HttpClient {
|
||||
private final ITSysApiService sysApiService;
|
||||
|
||||
/**
|
||||
* 发送一个 Get 请求
|
||||
|
|
@ -39,6 +43,8 @@ public class HttpClient {
|
|||
response.setSuccess(false);
|
||||
response.setResponseCode(999);
|
||||
response.setException(new Exception("请求地址为空"));
|
||||
// 增加存储数据库的操作 TODO 后续想办法增加多线程执行存储数据库
|
||||
insertApiLogToDb(request, response);
|
||||
return response;
|
||||
}
|
||||
if(StringUtils.isNotEmpty(request.getData())) {
|
||||
|
|
@ -74,16 +80,19 @@ public class HttpClient {
|
|||
httpClient.close();
|
||||
response.setSuccess(true);
|
||||
response.setResponseMessage(result.toString());
|
||||
// 增加存储数据库的操作 TODO 后续想办法增加多线程执行存储数据库
|
||||
insertApiLogToDb(request, response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
response.setSuccess(false);
|
||||
response.setResponseCode(999);
|
||||
response.setException(e);
|
||||
// 增加存储数据库的操作 TODO 后续想办法增加多线程执行存储数据库
|
||||
insertApiLogToDb(request, response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送一个 Post 请求
|
||||
* @param request 请求数据
|
||||
|
|
@ -98,6 +107,8 @@ public class HttpClient {
|
|||
response.setSuccess(false);
|
||||
response.setResponseCode(999);
|
||||
response.setException(new Exception("请求地址为空"));
|
||||
// 增加存储数据库的操作 TODO 后续想办法增加多线程执行存储数据库
|
||||
insertApiLogToDb(request, response);
|
||||
return response;
|
||||
}
|
||||
if(StringUtils.isEmpty(request.getData())) {
|
||||
|
|
@ -134,11 +145,15 @@ public class HttpClient {
|
|||
httpClient.close();
|
||||
response.setSuccess(true);
|
||||
response.setResponseMessage(result.toString());
|
||||
// 增加存储数据库的操作 TODO 后续想办法增加多线程执行存储数据库
|
||||
insertApiLogToDb(request, response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
response.setSuccess(false);
|
||||
response.setResponseCode(999);
|
||||
response.setException(e);
|
||||
// 增加存储数据库的操作 TODO 后续想办法增加多线程执行存储数据库
|
||||
insertApiLogToDb(request, response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
@ -156,6 +171,8 @@ public class HttpClient {
|
|||
response.setSuccess(false);
|
||||
response.setResponseCode(999);
|
||||
response.setException(new Exception("请求地址为空"));
|
||||
// 增加存储数据库的操作 TODO 后续想办法增加多线程执行存储数据库
|
||||
insertApiLogToDb(request, response);
|
||||
return response;
|
||||
}
|
||||
if(!StringUtils.isEmpty(request.getData())) {
|
||||
|
|
@ -191,12 +208,30 @@ public class HttpClient {
|
|||
httpClient.close();
|
||||
response.setSuccess(true);
|
||||
response.setResponseMessage(result.toString());
|
||||
// 增加存储数据库的操作 TODO 后续想办法增加多线程执行存储数据库
|
||||
insertApiLogToDb(request, response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
response.setSuccess(false);
|
||||
response.setResponseCode(999);
|
||||
response.setException(e);
|
||||
// 增加存储数据库的操作 TODO 后续想办法增加多线程执行存储数据库
|
||||
insertApiLogToDb(request, response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储api日志信息
|
||||
* @param request 请求信息
|
||||
* @param response 响应信息
|
||||
*/
|
||||
void insertApiLogToDb(HttpRequest request, HttpResponse response) {
|
||||
try {
|
||||
sysApiService.insertApiLog(request, response);
|
||||
} catch (Exception e) {
|
||||
log.error("插入日志失败{}", StringUtils.objectToString(e));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
package com.wms_main.repository.http.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* http请求方式
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum HttpMethodEnum {
|
||||
|
||||
GET("GET"),
|
||||
|
|
@ -13,9 +15,5 @@ public enum HttpMethodEnum {
|
|||
PUT("PUT"),
|
||||
DELETE("DELETE");
|
||||
|
||||
private String method;
|
||||
|
||||
HttpMethodEnum(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
private final String method;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,11 @@ public class StringUtils {
|
|||
return str.matches("^\\d+$");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个字符串是否为小数
|
||||
* @param str 要判断的字符串
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean isDecimal(String str) {
|
||||
if (isEmpty(str)) return false;
|
||||
return str.matches("^\\d+\\.?\\d*$");
|
||||
|
|
@ -245,4 +250,22 @@ public class StringUtils {
|
|||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取字符串---依据最大程度,并去除空白与换行符
|
||||
* @param originStr 原始字符串
|
||||
* @param maxLength 最大长度
|
||||
* @return 格式化之后的字符串
|
||||
*/
|
||||
public static String formatStringWithMaxLength(String originStr, int maxLength) {
|
||||
if (StringUtils.isEmpty(originStr)) {
|
||||
// 防止NULL异常
|
||||
return "";
|
||||
}
|
||||
String newContentString = originStr.replaceAll("\\s*", "");
|
||||
if (newContentString.length() > maxLength) {
|
||||
newContentString = newContentString.substring(0, maxLength) + "...";
|
||||
}
|
||||
return newContentString;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.wms_main.service.controller;
|
||||
|
||||
import com.wms_main.model.dto.query.SysApiQuery;
|
||||
import com.wms_main.model.dto.query.SysLogQuery;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.vo.wms.PageVo;
|
||||
import com.wms_main.model.vo.wms.SysApiVo;
|
||||
import com.wms_main.model.vo.wms.SysLogVo;
|
||||
|
||||
/**
|
||||
* 日志控制类服务
|
||||
*/
|
||||
public interface ILogControllerService {
|
||||
/**
|
||||
* 查询接口接收日志数据---分页
|
||||
* @param logQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
WmsApiResponse<PageVo<SysLogVo>> queryLogsByPage(SysLogQuery logQuery);
|
||||
|
||||
/**
|
||||
* 查询接口发送日志数据---分页
|
||||
* @param apiQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
WmsApiResponse<PageVo<SysApiVo>> queryApisByPage(SysApiQuery apiQuery);
|
||||
}
|
||||
|
|
@ -99,4 +99,13 @@ public interface ITaskControllerService {
|
|||
* @return 处理结果
|
||||
*/
|
||||
BaseWmsApiResponse confirmInventory(InventoryConfirmRequest inventoryConfirmRequest);
|
||||
|
||||
/**
|
||||
* 获取对应工单的缺料数量
|
||||
* 最小值为0,最大值为库存数量
|
||||
* @param goodsId 料号
|
||||
* @param workOrder 工单号
|
||||
* @return 缺料数量
|
||||
*/
|
||||
int getLackQty(String goodsId, String workOrder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,7 +163,13 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
// 根据查询条件筛选出对应的暂存数据
|
||||
List<TAppWork> filterWorks = currentWorkOrderWorkList.stream()
|
||||
.filter(work -> {
|
||||
boolean result = work.getWorkStatus() == -1;
|
||||
boolean result;
|
||||
if (work.getWorkStatus() == -1) {
|
||||
result = true;
|
||||
} else {
|
||||
// 缺料,可以下发
|
||||
result = work.getWorkStatus() == 2 && work.getLackStatus() == 1;
|
||||
}
|
||||
// 料盒号
|
||||
if (StringUtils.isNotEmpty(initKateWorkRequest.getBoxNo())) {
|
||||
result = result && Objects.equals(work.getBoxNo(), initKateWorkRequest.getBoxNo());
|
||||
|
|
@ -182,10 +188,12 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
appWorkService.update(
|
||||
new LambdaUpdateWrapper<TAppWork>()
|
||||
.set(TAppWork::getWorkStatus, 0)
|
||||
.set(TAppWork::getLackStatus, 0)
|
||||
.set(TAppWork::getWorkStand, initKateWorkRequest.getStandId())
|
||||
.in(TAppWork::getWorkIndex, filterWorks.stream().map(TAppWork::getWorkIndex).toList())
|
||||
.setSql("distribute_num = finish_num")
|
||||
.in(TAppWork::getWorkIndex, filterWorks.stream().map(TAppWork::getWorkIndex).distinct().toList())
|
||||
);
|
||||
return BaseWmsApiResponse.success("创建工作成功。");
|
||||
return BaseWmsApiResponse.success("重新下发工作成功。");
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
@ -666,6 +674,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
|
||||
/**
|
||||
* 生成需求看板
|
||||
*
|
||||
* @param genRequest 请求参数
|
||||
* @return 生成结果
|
||||
*/
|
||||
|
|
@ -764,6 +773,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
|
||||
/**
|
||||
* 获取物料需求
|
||||
*
|
||||
* @param goodsRequireRequest 请求参数
|
||||
* @return 响应结果
|
||||
*/
|
||||
|
|
@ -929,6 +939,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
|
||||
/**
|
||||
* 查询图纸列表(分页)---实现
|
||||
*
|
||||
* @param imageQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
|
|
@ -1050,6 +1061,42 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
if (kateWorksQuery == null) {
|
||||
return WmsApiResponse.error("查询参数为空。", null);
|
||||
}
|
||||
if (StringUtils.isEmpty(kateWorksQuery.getWorkOrder())) {
|
||||
return WmsApiResponse.error("请求参数缺少工单号。", null);
|
||||
}
|
||||
if (Objects.equals(kateWorksQuery.getBk1(), "2")) {
|
||||
// 查询当前工单下,特定条件下整个料盒缺料的标签且包含当前料盒
|
||||
LambdaQueryWrapper<TAppWork> lambdaQueryWrapper_sp = new LambdaQueryWrapper<TAppWork>()
|
||||
.eq(TAppWork::getWorkOrder, kateWorksQuery.getWorkOrder())
|
||||
.eq(StringUtils.isNotEmpty(kateWorksQuery.getProductId()), TAppWork::getProductId, kateWorksQuery.getProductId())
|
||||
.eq(StringUtils.isNotEmpty(kateWorksQuery.getSingleProductId()), TAppWork::getSingleProductId, kateWorksQuery.getSingleProductId())
|
||||
.ne(TAppWork::getLackStatus, -1);// 非暂存任务
|
||||
List<TAppWork> poListForCompletelyLack = appWorkService.list(lambdaQueryWrapper_sp);
|
||||
Map<String, Integer> completelyLackBoxMap = new HashMap<>();
|
||||
// 添加当前料盒
|
||||
completelyLackBoxMap.put(kateWorksQuery.getBoxNo(), 1);
|
||||
for (TAppWork po : poListForCompletelyLack) {
|
||||
if (Objects.equals(po.getBoxNo(), kateWorksQuery.getBoxNo())) {
|
||||
// 当前料盒不做处理
|
||||
continue;
|
||||
}
|
||||
// 处理缺料事宜
|
||||
if (po.getLackStatus() == 1) {
|
||||
completelyLackBoxMap.put(po.getBoxNo(), 1);
|
||||
} else {
|
||||
completelyLackBoxMap.remove(po.getBoxNo());
|
||||
}
|
||||
}
|
||||
// 处理缺料返回
|
||||
List<TAppWork> poListOfCompletelyLack = new ArrayList<>();
|
||||
for (String boxNo : completelyLackBoxMap.keySet()) {
|
||||
List<TAppWork> filterAppWorks = poListForCompletelyLack.stream().filter(appWork -> appWork.getBoxNo().equals(boxNo)).toList();
|
||||
poListOfCompletelyLack.addAll(filterAppWorks);
|
||||
}
|
||||
List<KateWorkVo> resultList = poListOfCompletelyLack.stream().map(KateWorkVo::ofWork).toList();
|
||||
return WmsApiResponse.success("查询缺料信息成功。", resultList);
|
||||
} else {
|
||||
// 普通查询
|
||||
LambdaQueryWrapper<TAppWork> lambdaQueryWrapper = new LambdaQueryWrapper<TAppWork>()
|
||||
.eq(TAppWork::getWorkOrder, kateWorksQuery.getWorkOrder())
|
||||
.eq(StringUtils.isNotEmpty(kateWorksQuery.getProductId()), TAppWork::getProductId, kateWorksQuery.getProductId())
|
||||
|
|
@ -1063,6 +1110,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
List<KateWorkVo> resultList = poList.stream().map(KateWorkVo::ofWork).toList();
|
||||
return WmsApiResponse.success("查询缺料信息成功。", resultList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工作信息---实现
|
||||
|
|
@ -1141,6 +1189,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
|
||||
/**
|
||||
* 获取料盒打印标签数量
|
||||
*
|
||||
* @param kateWorksQuery 查询参数
|
||||
* @return 标签信息
|
||||
*/
|
||||
|
|
@ -1251,6 +1300,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
|
||||
/**
|
||||
* 删除dbs计划---实现
|
||||
*
|
||||
* @param dbsRequest 删除请求
|
||||
* @return 删除结果
|
||||
*/
|
||||
|
|
@ -1820,6 +1870,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
|
||||
/**
|
||||
* 获取所有物料需求
|
||||
*
|
||||
* @param dbsList dbs计划
|
||||
* @return getGoodsRequireMap 结果
|
||||
* @throws Exception 异常
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
package com.wms_main.service.controller.serviceImpl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms_main.dao.ITSysApiService;
|
||||
import com.wms_main.dao.ITSysLogService;
|
||||
import com.wms_main.model.dto.query.SysApiQuery;
|
||||
import com.wms_main.model.dto.query.SysLogQuery;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.po.TSysApi;
|
||||
import com.wms_main.model.po.TSysLog;
|
||||
import com.wms_main.model.vo.wms.PageVo;
|
||||
import com.wms_main.model.vo.wms.SysApiVo;
|
||||
import com.wms_main.model.vo.wms.SysLogVo;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import com.wms_main.service.controller.ILogControllerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 日志服务类接口实现
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LogControllerServiceImpl implements ILogControllerService {
|
||||
private final ITSysLogService sysLogService;// 接口接收日志服务
|
||||
private final ITSysApiService sysApiService;// 接口发送日志服务
|
||||
|
||||
|
||||
/**
|
||||
* 查询接口接收日志---实现
|
||||
* @param logQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public WmsApiResponse<PageVo<SysLogVo>> queryLogsByPage(SysLogQuery logQuery) {
|
||||
if (logQuery == null) {
|
||||
return WmsApiResponse.error("查询参数不能为NULL", null);
|
||||
}
|
||||
Page<TSysLog> page = logQuery.toMpPage();
|
||||
LambdaQueryWrapper<TSysLog> lambdaQueryWrapper = new LambdaQueryWrapper<TSysLog>()
|
||||
.like(StringUtils.isNotEmpty(logQuery.getQueryStr()), TSysLog::getMethod, logQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(logQuery.getQueryStr()), TSysLog::getUri, logQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(logQuery.getQueryStr()), TSysLog::getRemoteHost, logQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(logQuery.getQueryStr()), TSysLog::getRemoteAddr, logQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(logQuery.getQueryStr()), TSysLog::getRequestContent, logQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(logQuery.getQueryStr()), TSysLog::getStatus, logQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(logQuery.getQueryStr()), TSysLog::getResponseContent, logQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(logQuery.getQueryStr()), TSysLog::getLogTime, logQuery.getQueryStr());
|
||||
Page<TSysLog> logsPage = sysLogService.page(page, lambdaQueryWrapper);
|
||||
|
||||
PageVo<SysLogVo> pageVo = PageVo.of(logsPage, logPo -> BeanUtil.toBean(logPo, SysLogVo.class));
|
||||
return WmsApiResponse.success("查询接口接收日志成功。", pageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询接口发送日志---实现
|
||||
* @param apiQuery 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public WmsApiResponse<PageVo<SysApiVo>> queryApisByPage(SysApiQuery apiQuery) {
|
||||
if (apiQuery == null) {
|
||||
return WmsApiResponse.error("查询参数不能为NULL", null);
|
||||
}
|
||||
Page<TSysApi> page = apiQuery.toMpPage();
|
||||
LambdaQueryWrapper<TSysApi> lambdaQueryWrapper = new LambdaQueryWrapper<TSysApi>()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getUrl, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getTimeout, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getMethod, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getContentType, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getData, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getToken, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getSuccess, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getResponseCode, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getRequestMessage, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getResponseMessage, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getRequestTime, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getResponseTime, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getRequestUrl, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getUseTime, apiQuery.getQueryStr()).or()
|
||||
.like(StringUtils.isNotEmpty(apiQuery.getQueryStr()), TSysApi::getExceptionMessage, apiQuery.getQueryStr());
|
||||
Page<TSysApi> logsPage = sysApiService.page(page, lambdaQueryWrapper);
|
||||
|
||||
PageVo<SysApiVo> pageVo = PageVo.of(logsPage, logPo -> BeanUtil.toBean(logPo, SysApiVo.class));
|
||||
return WmsApiResponse.success("查询接口发送日志成功。", pageVo);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.wms_main.app.AppCommon;
|
||||
import com.wms_main.constant.AppConstant;
|
||||
import com.wms_main.constant.enums.others.EmergencyOutReasonEnums;
|
||||
import com.wms_main.constant.enums.wcs.WcsStackerTaskStatusEnums;
|
||||
import com.wms_main.constant.enums.wcs.WcsStackerTaskTypeEnums;
|
||||
import com.wms_main.constant.enums.wms.*;
|
||||
|
|
@ -64,6 +65,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
private final ITAppPickPlanService appPickPlanService;// 拣选计划服务
|
||||
private final ITAppInventoryService appInventoryService;// 盘点任务服务
|
||||
private final ITAppInventoryRecordService appInventoryRecordService;// 盘点记录服务
|
||||
private final ITAppWorkService appWorkService;// 工作详情服务
|
||||
private final AppCommon appCommon;
|
||||
|
||||
/**
|
||||
|
|
@ -286,6 +288,10 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
if (stockOutRequest.getNeedNum() == null || stockOutRequest.getNeedNum() <= 0) {
|
||||
return BaseWmsApiResponse.error("请求错误:紧急出库必须输入有效数量。");
|
||||
}
|
||||
// 判断原因是缺料的时候,需判断工单号是否输入
|
||||
if (stockOutRequest.getReason().contains("缺料") && StringUtils.isEmpty(stockOutRequest.getWorkOrder())) {
|
||||
return BaseWmsApiResponse.error("请求错误:缺料时必须输入工单号。");
|
||||
}
|
||||
// 判断请求的料号是不是库外料
|
||||
TAppGoods thisGoods = appCommon.getInstantGoodsByGoodsId(stockOutRequest.getGoodsId());
|
||||
if (thisGoods == null || !thisGoods.getPutArea().contains("ASRS")) {
|
||||
|
|
@ -325,7 +331,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
stockOutRequest.getDestination(),
|
||||
stockOutRequest.getUserName(),
|
||||
stockOutRequest.getReason(),
|
||||
LocalDateTime.now()
|
||||
LocalDateTime.now(),
|
||||
stockOutRequest.getWorkOrder()
|
||||
);
|
||||
appOutsService.save(task);
|
||||
return BaseWmsApiResponse.success("添加出库请求成功。");
|
||||
|
|
@ -333,6 +340,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
|
||||
/**
|
||||
* 入库用出库---实现
|
||||
*
|
||||
* @param voiRequest 请求信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
|
|
@ -391,7 +399,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
"R1",
|
||||
voiRequest.getUserName(),
|
||||
"",
|
||||
LocalDateTime.now()
|
||||
LocalDateTime.now(),
|
||||
""
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -761,6 +770,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
|
||||
/**
|
||||
* 请求盘点---实现
|
||||
*
|
||||
* @param inventoryRequest 盘点请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
|
|
@ -829,6 +839,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
|
||||
/**
|
||||
* 查询盘点确认信息
|
||||
*
|
||||
* @param inventoryConfirmRequest 请求
|
||||
* @return 查询结果
|
||||
*/
|
||||
|
|
@ -863,6 +874,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
|
||||
/**
|
||||
* 确认盘点信息
|
||||
*
|
||||
* @param inventoryConfirmRequest 确认请求
|
||||
* @return 处理结果
|
||||
*/
|
||||
|
|
@ -980,8 +992,50 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应工单对应物料的缺料数量---实现
|
||||
* @param goodsId 料号
|
||||
* @param workOrder 工单号
|
||||
* @return 缺料数量
|
||||
*/
|
||||
@Override
|
||||
public int getLackQty(String goodsId, String workOrder) {
|
||||
// 判断是否缺少料号和工单
|
||||
if (StringUtils.isEmpty(goodsId) || StringUtils.isEmpty(workOrder)) {
|
||||
return 0;
|
||||
}
|
||||
// 查询这个工单里面关于这个工单的缺料
|
||||
List<TAppWork> lackWorks = appWorkService.list(new LambdaQueryWrapper<TAppWork>()
|
||||
.eq(TAppWork::getWorkOrder, workOrder)
|
||||
.eq(TAppWork::getGoodsId, goodsId)
|
||||
.eq(TAppWork::getLackStatus, 1)
|
||||
.eq(TAppWork::getWorkStatus, 2));
|
||||
if (lackWorks == null || lackWorks.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
// 计算数量的总数
|
||||
int sumLack = lackWorks.stream().mapToInt(work -> {
|
||||
if (work.getFinishNum() < work.getNeedNum()) {
|
||||
// 只有确实缺少数量时,才可以计算缺料数量
|
||||
return work.getNeedNum() - work.getFinishNum();
|
||||
}
|
||||
return 0;
|
||||
}).sum();
|
||||
// 查询这个物料的库存
|
||||
List<TAppStock> thisGoodsStocks = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getGoodsId, goodsId));
|
||||
if (thisGoodsStocks != null && !thisGoodsStocks.isEmpty()) {
|
||||
// 如果库存存在,则取库存数量与需求数量的最小值
|
||||
int goodsStockNum = thisGoodsStocks.stream().mapToInt(TAppStock::getRemainNum).sum();
|
||||
return Math.min(goodsStockNum, sumLack);
|
||||
}
|
||||
// 没有库存的情况下,直接返回需求数量
|
||||
return sumLack;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新出库单信息
|
||||
*
|
||||
* @param confirmTaskRequest 确认信息
|
||||
*/
|
||||
private String updateTaskInfo(ConfirmTaskRequest confirmTaskRequest) {
|
||||
|
|
@ -1013,7 +1067,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
outs.getDestination(),
|
||||
outs.getUserName(),
|
||||
outs.getReason(),
|
||||
outs.getRequestTime()
|
||||
outs.getRequestTime(),
|
||||
outs.getWorkOrder()
|
||||
);
|
||||
// 删除出库单
|
||||
appOutsService.removeById(outs.getTaskId());
|
||||
|
|
@ -1023,6 +1078,38 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
// 更新出库单
|
||||
appOutsService.updateById(outs);
|
||||
}
|
||||
// 判断是否是紧急出库且是缺料
|
||||
if (Objects.equals(outs.getOutType(), WmsOutTypeEnums.EMERGE.getCode())
|
||||
&& outs.getReason().contains(EmergencyOutReasonEnums.GOODS_LACK.getReason()) && StringUtils.isNotEmpty(outs.getWorkOrder())) {
|
||||
// 查询此工单下缺料的工作
|
||||
List<TAppWork> lackGoodsWorks = appWorkService.list(new LambdaQueryWrapper<TAppWork>()
|
||||
.eq(TAppWork::getWorkOrder, outs.getWorkOrder())
|
||||
.eq(TAppWork::getWorkStatus, 2)
|
||||
.eq(TAppWork::getLackStatus, 1));
|
||||
int canDistributeNum = taskConfirm.getRealPickQty();
|
||||
List<TAppWork> needUpdateWorks = new ArrayList<>();
|
||||
for (TAppWork lackGoodsWork : lackGoodsWorks) {
|
||||
if (canDistributeNum == 0) {
|
||||
// 本次拣选数量不够分了
|
||||
break;
|
||||
}
|
||||
if (lackGoodsWork.getFinishNum() >= lackGoodsWork.getNeedNum()) {
|
||||
continue;
|
||||
}
|
||||
int remainNeedNum = lackGoodsWork.getNeedNum() - lackGoodsWork.getFinishNum();
|
||||
// 这里需要重新设置完成数量。
|
||||
if (remainNeedNum >= canDistributeNum) {
|
||||
canDistributeNum = 0;
|
||||
lackGoodsWork.setFinishNum(lackGoodsWork.getFinishNum() + canDistributeNum);
|
||||
} else {
|
||||
canDistributeNum -= remainNeedNum;
|
||||
lackGoodsWork.setFinishNum(lackGoodsWork.getNeedNum());
|
||||
lackGoodsWork.setLackStatus(0);
|
||||
}
|
||||
needUpdateWorks.add(lackGoodsWork);
|
||||
}
|
||||
appWorkService.updateBatchById(needUpdateWorks);
|
||||
}
|
||||
// 清除拣选计划
|
||||
LambdaQueryWrapper<TAppPickPlan> pickPlanQueryWrapper = new LambdaQueryWrapper<TAppPickPlan>()
|
||||
.eq(TAppPickPlan::getWorkIndex, confirmTaskRequest.getTaskConfirm().getTaskId());
|
||||
|
|
|
|||
|
|
@ -234,7 +234,8 @@ public class TaskOperationControllerServiceImpl implements ITaskOperationControl
|
|||
targetOuts.getDestination(),
|
||||
targetOuts.getUserName(),
|
||||
targetOuts.getReason(),
|
||||
targetOuts.getRequestTime()
|
||||
targetOuts.getRequestTime(),
|
||||
targetOuts.getWorkOrder()
|
||||
));
|
||||
appPickPlanService.remove(new LambdaQueryWrapper<TAppPickPlan>()
|
||||
.eq(TAppPickPlan::getWorkIndex, targetOuts.getTaskId()));
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public class TaskQueryControllerServiceImpl implements ITaskQueryControllerServi
|
|||
private final ITAppTaskBakService appTaskBakService;// 任务记录服务
|
||||
private final ITAppPickTaskService appPickTaskService;// 拣选任务服务
|
||||
private final ITAppOutsService appOutsService;// 出库单服务
|
||||
private final ITAppOutsRecordService appOutsRecordService;// 出库单记录服务
|
||||
private final ITAppInventoryService appInventoryService;// 盘点请求服务
|
||||
private final ITAppInventoryRecordService appInventoryRecordService;// 盘点记录服务
|
||||
|
||||
|
|
@ -150,6 +151,8 @@ public class TaskQueryControllerServiceImpl implements ITaskQueryControllerServi
|
|||
if (outsQuery == null) {
|
||||
return WmsApiResponse.error("查询参数不能为NULL", null);
|
||||
}
|
||||
if (outsQuery.getQueryType() == 1) {
|
||||
// 查询未关闭
|
||||
Page<TAppOuts> page = outsQuery.toMpPage();
|
||||
LambdaQueryWrapper<TAppOuts> lambdaQueryWrapper = new LambdaQueryWrapper<TAppOuts>()
|
||||
.like(StringUtils.isNotEmpty(outsQuery.getTaskId()), TAppOuts::getTaskId, outsQuery.getTaskId())
|
||||
|
|
@ -160,6 +163,20 @@ public class TaskQueryControllerServiceImpl implements ITaskQueryControllerServi
|
|||
|
||||
PageVo<OutsVo> pageVo = PageVo.of(outsPage, OutsVo::of);
|
||||
return WmsApiResponse.success("查询出库单成功。", pageVo);
|
||||
} else {
|
||||
// 查询已关闭的记录
|
||||
Page<TAppOutsRecord> page = outsQuery.toMpPage();
|
||||
LambdaQueryWrapper<TAppOutsRecord> lambdaQueryWrapper = new LambdaQueryWrapper<TAppOutsRecord>()
|
||||
.like(StringUtils.isNotEmpty(outsQuery.getTaskId()), TAppOutsRecord::getTaskId, outsQuery.getTaskId())
|
||||
.like(StringUtils.isNotEmpty(outsQuery.getGoodsId()), TAppOutsRecord::getGoodsId, outsQuery.getGoodsId())
|
||||
.like(StringUtils.isNotEmpty(outsQuery.getVehicleId()), TAppOutsRecord::getVehicleId, outsQuery.getVehicleId())
|
||||
.eq(outsQuery.getOutType() != null, TAppOutsRecord::getOutType, outsQuery.getOutType());
|
||||
Page<TAppOutsRecord> outsPage = appOutsRecordService.page(page, lambdaQueryWrapper);
|
||||
|
||||
PageVo<OutsVo> pageVo = PageVo.of(outsPage, OutsVo::ofRecord);
|
||||
return WmsApiResponse.success("查询出库单记录成功。", pageVo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.wms_main.service.quartz_job;
|
||||
|
||||
/**
|
||||
* 数据处理类 服务接口
|
||||
*/
|
||||
public interface IDataSolverService {
|
||||
/**
|
||||
* 清理日志数据
|
||||
*/
|
||||
void clearLogData();
|
||||
|
||||
/**
|
||||
* 清理普通记录
|
||||
*/
|
||||
void clearNormalRecord();
|
||||
|
||||
/**
|
||||
* 清理重要记录
|
||||
*/
|
||||
void clearImportantRecord();
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.wms_main.service.quartz_job.job_executor;
|
||||
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import com.wms_main.service.quartz_job.IDataSolverService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.*;
|
||||
|
|
@ -12,6 +14,8 @@ import org.quartz.*;
|
|||
@DisallowConcurrentExecution
|
||||
@RequiredArgsConstructor
|
||||
public class DataSolver implements Job {
|
||||
private final IDataSolverService dataSolverService;// 数据处理服务
|
||||
|
||||
/**
|
||||
* 运行定时任务
|
||||
*
|
||||
|
|
@ -19,9 +23,20 @@ public class DataSolver implements Job {
|
|||
*/
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) {
|
||||
// 获取定时配置信息
|
||||
|
||||
// 获取各种需要处理的数据
|
||||
|
||||
try {
|
||||
dataSolverService.clearLogData();
|
||||
} catch (Exception e) {
|
||||
log.error("清除日志数据失败{}", StringUtils.objectToString(e));
|
||||
}
|
||||
try {
|
||||
dataSolverService.clearNormalRecord();
|
||||
} catch (Exception e) {
|
||||
log.error("清除普通记录失败{}", StringUtils.objectToString(e));
|
||||
}
|
||||
try {
|
||||
dataSolverService.clearImportantRecord();
|
||||
} catch (Exception e) {
|
||||
log.error("清除重要记录失败{}", StringUtils.objectToString(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ import org.quartz.PersistJobDataAfterExecution;
|
|||
// 以下注解用于实现fixed_delay
|
||||
@DisallowConcurrentExecution
|
||||
@RequiredArgsConstructor
|
||||
public class OutsRepair implements Job {
|
||||
public class
|
||||
OutsRepair implements Job {
|
||||
private final IOutsExecutorService outsExecutorService;// 出库单解析服务
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,197 @@
|
|||
package com.wms_main.service.quartz_job.serviceImpl;
|
||||
|
||||
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.AppConfigKeyEnums;
|
||||
import com.wms_main.dao.*;
|
||||
import com.wms_main.excel.easypoi.service.ISaveExcelEasyPoi;
|
||||
import com.wms_main.model.po.*;
|
||||
import com.wms_main.service.quartz_job.IDataSolverService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据处理类 服务实现
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DataSolverServiceImpl implements IDataSolverService {
|
||||
private final AppCommon appCommon;// 应用共同数据
|
||||
private final ITSysApiService sysApiService;// 接口发送日志服务
|
||||
private final ITSysLogService sysLogService;// 接口接收日志服务
|
||||
private final ITAppTaskBakService appTaskBakService;// Wms任务记录服务
|
||||
private final ITAppWcsTaskBakService appWcsTaskBakService;// Wcs任务记录服务
|
||||
private final ITAppPickTaskBakService appPickTaskBakService;// 拣选任务记录服务
|
||||
private final ISaveExcelEasyPoi saveExcelEasyPoi;// 记录保存excel服务
|
||||
private final ITAppStockUpdateService appStockUpdateService;// 库存流水服务
|
||||
private final ITAppInventoryRecordService appInventoryRecordService;// 盘点记录服务
|
||||
private final ITAppOutsRecordService appOutsRecordService;// 出库单记录服务
|
||||
private final ITAppWorkRecordService appWorkRecordService;// 工作记录服务
|
||||
private final ITAppDbsService appDbsService;// Dbs服务
|
||||
|
||||
/**
|
||||
* 清理日志文件 实现
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void clearLogData() {
|
||||
// 日志清理间隔,默认7天
|
||||
int logClearInterval = 7;
|
||||
// 获取日志清理间隔
|
||||
String logClearIntervalStr = appCommon.getConfigByKey(AppConfigKeyEnums.LOG_CLEAR_INTERVAL.getKey());
|
||||
try {
|
||||
logClearInterval = Integer.parseInt(logClearIntervalStr);
|
||||
} catch (Exception e) {
|
||||
log.warn("获取日志清理间隔失败,使用默认值7天。");
|
||||
}
|
||||
// 获取删除时间
|
||||
LocalDateTime deleteTime = LocalDateTime.now().minusDays(logClearInterval);
|
||||
|
||||
// 获取过期接口接收日志
|
||||
List<TSysLog> logList = sysLogService.list(new LambdaQueryWrapper<TSysLog>().lt(TSysLog::getLogTime, deleteTime));
|
||||
if (logList != null && !logList.isEmpty()) {
|
||||
// 缓存接收记录
|
||||
saveExcelEasyPoi.saveApiReceiveLogs(getSuffixFromDate(deleteTime, logClearInterval), logList);
|
||||
// 删除接收记录
|
||||
sysLogService.removeBatchByIds(logList);
|
||||
log.info("清理日志文件成功,清理了{}条接口接收日志。", logList.size());
|
||||
}
|
||||
|
||||
// 获取过期接口发送日志
|
||||
List<TSysApi> apiList = sysApiService.list(new LambdaQueryWrapper<TSysApi>().lt(TSysApi::getLogTime, deleteTime));
|
||||
if (apiList != null && !apiList.isEmpty()) {
|
||||
// 缓存发送记录
|
||||
saveExcelEasyPoi.saveApiSendLogs(getSuffixFromDate(deleteTime, logClearInterval), apiList);
|
||||
// 删除发送记录
|
||||
sysApiService.removeBatchByIds(apiList);
|
||||
log.info("清理日志文件成功,清理了{}条接口发送日志。", apiList.size());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理普通记录文件 实现
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void clearNormalRecord() {
|
||||
// 普通记录清理间隔,默认180天
|
||||
int normalRecordClearInterval = 180;
|
||||
// 获取普通记录清理间隔
|
||||
String normalRecordClearIntervalStr = appCommon.getConfigByKey(AppConfigKeyEnums.NORMAL_DATA_CLEAR_INTERVAL.getKey());
|
||||
try {
|
||||
normalRecordClearInterval = Integer.parseInt(normalRecordClearIntervalStr);
|
||||
} catch (Exception e) {
|
||||
log.warn("获取普通记录清理间隔失败,使用默认值180天。");
|
||||
}
|
||||
// 获取删除时间
|
||||
LocalDateTime deleteTime = LocalDateTime.now().minusDays(normalRecordClearInterval);
|
||||
|
||||
// 查询Wms任务记录
|
||||
List<TAppTaskBak> wmsTaskBakList = appTaskBakService.list(new LambdaQueryWrapper<TAppTaskBak>().lt(TAppTaskBak::getCreateTime, deleteTime));
|
||||
if (wmsTaskBakList != null && !wmsTaskBakList.isEmpty()) {
|
||||
// 备份数据
|
||||
saveExcelEasyPoi.saveWmsTaskBak(getSuffixFromDate(deleteTime, normalRecordClearInterval), wmsTaskBakList);
|
||||
// 删除记录
|
||||
appTaskBakService.removeBatchByIds(wmsTaskBakList);
|
||||
log.info("清理普通记录文件成功,清理了{}条Wms任务记录。", wmsTaskBakList.size());
|
||||
}
|
||||
// 查询Wcs任务记录
|
||||
List<TAppWcsTaskBak> wcsTaskBakList = appWcsTaskBakService.list(new LambdaQueryWrapper<TAppWcsTaskBak>().lt(TAppWcsTaskBak::getCreateTime, deleteTime));
|
||||
if (wcsTaskBakList != null && !wcsTaskBakList.isEmpty()) {
|
||||
// 备份数据
|
||||
saveExcelEasyPoi.saveWcsTaskBak(getSuffixFromDate(deleteTime, normalRecordClearInterval), wcsTaskBakList);
|
||||
// 删除记录
|
||||
appWcsTaskBakService.removeBatchByIds(wcsTaskBakList);
|
||||
log.info("清理普通记录文件成功,清理了{}条Wcs任务记录。", wcsTaskBakList.size());
|
||||
}
|
||||
// 查询拣选任务记录
|
||||
List<TAppPickTaskBak> pickTaskBakList = appPickTaskBakService.list(new LambdaQueryWrapper<TAppPickTaskBak>().lt(TAppPickTaskBak::getCreateTime, deleteTime));
|
||||
if (pickTaskBakList != null && !pickTaskBakList.isEmpty()) {
|
||||
// 备份数据
|
||||
saveExcelEasyPoi.savePickTaskBak(getSuffixFromDate(deleteTime, normalRecordClearInterval), pickTaskBakList);
|
||||
// 删除记录
|
||||
appPickTaskBakService.removeBatchByIds(pickTaskBakList);
|
||||
log.info("清理普通记录文件成功,清理了{}条拣选任务记录。", pickTaskBakList.size());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理重要记录文件 实现
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void clearImportantRecord() {
|
||||
// 重要记录清理间隔,默认365天
|
||||
int importantRecordClearInterval = 365;
|
||||
// 获取重要记录清理间隔
|
||||
String importantRecordClearIntervalStr = appCommon.getConfigByKey(AppConfigKeyEnums.IMPORTANT_DATA_CLEAR_INTERVAL.getKey());
|
||||
try {
|
||||
importantRecordClearInterval = Integer.parseInt(importantRecordClearIntervalStr);
|
||||
} catch (Exception e) {
|
||||
log.warn("获取重要记录清理间隔失败,使用默认值365天。");
|
||||
}
|
||||
// 获取删除时间
|
||||
LocalDateTime deleteTime = LocalDateTime.now().minusDays(importantRecordClearInterval);
|
||||
|
||||
// 查询过期库存流水记录
|
||||
List<TAppStockUpdate> stockUpdateList = appStockUpdateService.list(new LambdaQueryWrapper<TAppStockUpdate>().lt(TAppStockUpdate::getUpdateTime, deleteTime));
|
||||
if (stockUpdateList != null && !stockUpdateList.isEmpty()) {
|
||||
// 备份过期数据
|
||||
saveExcelEasyPoi.saveStockUpdateRecord(getSuffixFromDate(deleteTime, importantRecordClearInterval), stockUpdateList);
|
||||
// 清理过期数据
|
||||
appStockUpdateService.removeBatchByIds(stockUpdateList);
|
||||
}
|
||||
// 查询过期盘点记录
|
||||
List<TAppInventoryRecord> inventoryRecordList = appInventoryRecordService.list(new LambdaQueryWrapper<TAppInventoryRecord>().lt(TAppInventoryRecord::getInvConfirmTime, deleteTime));
|
||||
if (inventoryRecordList != null && !inventoryRecordList.isEmpty()) {
|
||||
// 缓存过期数据
|
||||
saveExcelEasyPoi.saveInventoryRecord(getSuffixFromDate(deleteTime, importantRecordClearInterval), inventoryRecordList);
|
||||
// 删除过期数据
|
||||
appInventoryRecordService.removeBatchByIds(inventoryRecordList);
|
||||
}
|
||||
// 查询过期出库单请求记录
|
||||
List<TAppOutsRecord> outsRecordList = appOutsRecordService.list(new LambdaQueryWrapper<TAppOutsRecord>().lt(TAppOutsRecord::getRequestTime, deleteTime));
|
||||
if (outsRecordList != null && !outsRecordList.isEmpty()) {
|
||||
// 缓存过期数据
|
||||
saveExcelEasyPoi.saveOutsRecord(getSuffixFromDate(deleteTime, importantRecordClearInterval), outsRecordList);
|
||||
// 删除过期数据
|
||||
appOutsRecordService.removeBatchByIds(outsRecordList);
|
||||
}
|
||||
// 查询过期工作记录
|
||||
List<TAppWorkRecord> workRecordList = appWorkRecordService.list(new LambdaQueryWrapper<TAppWorkRecord>().lt(TAppWorkRecord::getFinishTime, deleteTime));
|
||||
if (workRecordList != null && !workRecordList.isEmpty()) {
|
||||
// 缓存过期数据
|
||||
saveExcelEasyPoi.saveWorkRecord(getSuffixFromDate(deleteTime, importantRecordClearInterval), workRecordList);
|
||||
// 删除过期数据
|
||||
appWorkRecordService.removeBatchByIds(workRecordList);
|
||||
}
|
||||
// 查询过期dbs数据
|
||||
List<TAppDbs> dbsRecordList = appDbsService.list(new LambdaQueryWrapper<TAppDbs>().lt(TAppDbs::getFinishTime, deleteTime).eq(TAppDbs::getDbsStatus, DbsStatusEnums.FINISH.getValue()));
|
||||
if (dbsRecordList != null && !dbsRecordList.isEmpty()) {
|
||||
// 缓存过期数据
|
||||
saveExcelEasyPoi.saveDbsRecord(getSuffixFromDate(deleteTime, importantRecordClearInterval), dbsRecordList);
|
||||
// 删除过期数据
|
||||
appDbsService.removeBatchByIds(dbsRecordList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取到文件的时间后缀
|
||||
* @param deleteTime 删除临界时间
|
||||
* @return 后缀字符串
|
||||
*/
|
||||
private String getSuffixFromDate(LocalDateTime deleteTime, int clearInterval) {
|
||||
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
String fromDateStr = dateFormat.format(deleteTime.minusDays(clearInterval));
|
||||
String toDateStr = dateFormat.format(deleteTime);
|
||||
return fromDateStr + "~" + toDateStr;
|
||||
}
|
||||
}
|
||||
|
|
@ -922,18 +922,56 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
List<TAppOuts> emergeOuts = allOuts.stream().filter(appOuts -> appOuts.getOutType().equals(WmsOutTypeEnums.EMERGE.getCode())).toList();
|
||||
List<String> emergeGoodsIds = emergeOuts.stream().map(TAppOuts::getGoodsId).distinct().toList();
|
||||
if (!emergeGoodsIds.isEmpty()) {
|
||||
// 查询库存
|
||||
List<TAppStock> emergeStocks = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.in(TAppStock::getGoodsId, emergeGoodsIds));
|
||||
// 查询拣选计划
|
||||
List<TAppPickPlan> emergePlans = appPickPlanService.list(new LambdaQueryWrapper<TAppPickPlan>()
|
||||
.in(TAppPickPlan::getWorkIndex, emergeOuts.stream().map(TAppOuts::getTaskId).distinct().toList()));
|
||||
// 查询到拣选任务
|
||||
List<TAppPickTask> emergePickTasks = new ArrayList<>();
|
||||
if (emergePlans != null && !emergePlans.isEmpty()) {
|
||||
emergePickTasks = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
||||
.in(TAppPickTask::getVehicleId, emergePlans.stream().map(TAppPickPlan::getVehicleId).distinct().toList()));
|
||||
}
|
||||
for (TAppOuts emergeOut : emergeOuts) {
|
||||
List<TAppStock> emergeStocksOfThisGoodsId = emergeStocks.stream().filter(stock -> stock.getGoodsId().equals(emergeOut.getGoodsId())).toList();
|
||||
// 库存不足之后移除该任务
|
||||
if (emergeStocksOfThisGoodsId.isEmpty()) {
|
||||
addRemovingOutsAndRecord(needRemoveOutIds, emergeOut, needAddOutRecords);
|
||||
continue;
|
||||
}
|
||||
// 当拣选完之后也要判断是否要移除
|
||||
if (emergeOut.getDistributeNum() >= emergeOut.getNeedNum()) {
|
||||
if (emergePlans == null || emergePlans.isEmpty()) {
|
||||
// 没有拣选计划,直接移除
|
||||
addRemovingOutsAndRecord(needRemoveOutIds, emergeOut, needAddOutRecords);
|
||||
continue;
|
||||
}
|
||||
// 根据拣选计划+拣选任务来判断
|
||||
List<TAppPickPlan> thisOutsPickPlans = emergePlans.stream().filter(pickPlan -> pickPlan.getWorkIndex().equals(emergeOut.getTaskId())).toList();
|
||||
if (thisOutsPickPlans.isEmpty()) {
|
||||
// 没有拣选计划,直接移除
|
||||
addRemovingOutsAndRecord(needRemoveOutIds, emergeOut, needAddOutRecords);
|
||||
continue;
|
||||
}
|
||||
// 待拣选的载具列表
|
||||
List<String> vehicleIdsOfPlans = thisOutsPickPlans.stream().map(TAppPickPlan::getVehicleId).distinct().toList();
|
||||
// 判断是否还有去这个站台的拣选任务
|
||||
List<TAppPickTask> thisOutsPickTasks = emergePickTasks.stream().filter(pickTask -> vehicleIdsOfPlans.contains(pickTask.getVehicleId()) && Objects.equals(pickTask.getPickStand(), emergeOut.getDestination())).toList();
|
||||
if (thisOutsPickTasks.isEmpty()) {
|
||||
// 没有拣选任务,直接移除
|
||||
addRemovingOutsAndRecord(needRemoveOutIds, emergeOut, needAddOutRecords);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 移除任务
|
||||
if (!needRemoveOutIds.isEmpty()) {
|
||||
appOutsService.removeBatchByIds(needRemoveOutIds);
|
||||
// 需要移除pickPlan
|
||||
appPickPlanService.remove(new LambdaQueryWrapper<TAppPickPlan>()
|
||||
.in(TAppPickPlan::getWorkIndex, needRemoveOutIds));
|
||||
}
|
||||
// 添加任务记录
|
||||
if (!needAddOutRecords.isEmpty()) {
|
||||
|
|
@ -1345,7 +1383,8 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
thisOuts.getDestination(),
|
||||
thisOuts.getUserName(),
|
||||
thisOuts.getReason(),
|
||||
thisOuts.getRequestTime()
|
||||
thisOuts.getRequestTime(),
|
||||
thisOuts.getWorkOrder()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ spring:
|
|||
# username: developer
|
||||
# password: developer
|
||||
# 本地
|
||||
url: jdbc:mysql://localhost:3306/wms_kate_wuxi?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
username: root
|
||||
password: liangzhou
|
||||
# url: jdbc:mysql://localhost:3306/wms_kate_wuxi?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
|
||||
# password: baokai
|
||||
url: jdbc:mysql://10.90.83.37:3306/wms_kate_wuxi?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
username: developer
|
||||
password: baokai
|
||||
|
||||
profiles:
|
||||
active: online
|
||||
|
|
|
|||
4
dev_wms_serve/src/main/resources/mapper/SysApiMapper.xml
Normal file
4
dev_wms_serve/src/main/resources/mapper/SysApiMapper.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wms_main.mapper.SysApiMapper">
|
||||
</mapper>
|
||||
4
dev_wms_serve/src/main/resources/mapper/SysLogMapper.xml
Normal file
4
dev_wms_serve/src/main/resources/mapper/SysLogMapper.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wms_main.mapper.SysLogMapper">
|
||||
</mapper>
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user