Compare commits
5 Commits
76a199028c
...
2f3fe17f52
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f3fe17f52 | |||
| c102f16720 | |||
| d3e77e1375 | |||
| 61631de3e7 | |||
| 1621d3f5b1 |
|
|
@ -90,6 +90,15 @@ export const requestInventory = (params) => {
|
|||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
export const batchRequestInventory = (params) => {
|
||||
return request({
|
||||
url: '/task/batchRequestInventory',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
// 获取盘点信息
|
||||
export const getInventoryConfirm = (params) => {
|
||||
return request({
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import axios from 'axios'
|
||||
|
||||
const request = axios.create({
|
||||
//baseURL: 'http://172.18.222.253:12315/wms',
|
||||
baseURL: 'http://localhost:12315/wms',
|
||||
baseURL: 'http://172.18.222.253:12315/wms',
|
||||
//baseURL: 'http://localhost:12315/wms',
|
||||
timeout: 5000
|
||||
})
|
||||
// 172.18.222.253
|
||||
|
|
|
|||
718
dev_wms_client/src/layout/batchInventory.vue
Normal file
718
dev_wms_client/src/layout/batchInventory.vue
Normal file
|
|
@ -0,0 +1,718 @@
|
|||
<template>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="stockQueryFormRef" :model="stockQuery" :label-position="labelPosition"
|
||||
label-width="auto" style="max-width: 100%" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="箱号">
|
||||
<el-input v-model="stockQuery.vehicleId" @keyup.enter="search()" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="stockQuery.goodsId" @keyup.enter="search()" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="未使用天数">
|
||||
<el-select-v2
|
||||
v-model="stockQuery.noUseDays"
|
||||
placeholder="请选择未使用天数"
|
||||
:options="noUseDaysOptions"
|
||||
@change="search()" style="width: 196px;">
|
||||
</el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="起始日期">
|
||||
<el-date-picker v-model="stockQuery.fromDate" type="date" placeholder="起始日期"
|
||||
:shortcuts="shortcuts" style="width: 196px;" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束日期">
|
||||
<el-date-picker v-model="stockQuery.toDate" type="date" placeholder="结束日期"
|
||||
:shortcuts="shortcuts" style="width: 196px;" clearable />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<div class="button-group">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="search()">
|
||||
查询库存
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
@click="clearQuery()">
|
||||
清除输入
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
@click="exportExcel()">
|
||||
导出Excel
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="selectedRows.length === 0"
|
||||
@click="handleBatchInventory"
|
||||
:class="{ 'disabled-batch-btn': selectedRows.length === 0 }">
|
||||
批量盘点({{ selectedRows.length }})
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<div class="table-area">
|
||||
<el-table :data="displayStocks" border v-loading="tableLoading" class="table-class"
|
||||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow" :row-style="rowStyle"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<!-- 添加多选框列 -->
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template #header>
|
||||
<el-checkbox
|
||||
v-model="isSelectAll"
|
||||
@change="handleSelectAllChange">
|
||||
|
||||
</el-checkbox>
|
||||
</template>
|
||||
<template v-slot="scope">
|
||||
<el-checkbox
|
||||
:label="scope.row.stockId"
|
||||
v-model="scope.row.checked"
|
||||
@change="handleSelectionChange(scope.row)">
|
||||
|
||||
</el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="stockId" label="库存编号" fixed="left" min-width="120px" sortable="custom"-->
|
||||
<!-- show-overflow-tooltip />-->
|
||||
<el-table-column prop="lastInventoryTime" label="最近盘点时间" fixed="left" sortable="custom" :formatter="timeFormat"
|
||||
min-width="140px" show-overflow-tooltip />
|
||||
<el-table-column prop="vehicleId" label="箱号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="goodsId" label="物料号" fixed="left" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="specialStock" label="特殊库存" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="specialStockNo" label="特殊库存号" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="specialStockItemNo" label="特殊库存item号" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="batchNo" label="批次号" min-width="120px" sortable="custom"
|
||||
show-overflow-tooltip />
|
||||
<el-table-column prop="goodsDesc" label="物料名称" min-width="120px" sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="locationId" label="库位" :formatter="locationFormat" min-width="120px"
|
||||
sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="totalNum" label="入库数量" sortable="custom" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="remainNum" label="剩余可用数量" sortable="custom" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="realNum" label="实际剩余数量" sortable="custom" min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="goodsStatus" label="物料状态" :formatter="goodsStatusFormat"
|
||||
min-width="120px" sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="stockStatus" label="库存状态" :formatter="stockStatusFormat" fixed="right"
|
||||
min-width="120px" sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="firstInTime" label="上架时间" sortable="custom" :formatter="timeFormat"
|
||||
min-width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="firstInUser" label="上架用户" min-width="120px" sortable="custom" show-overflow-tooltip />
|
||||
<el-table-column prop="lastUpdateTime" label="最近更新时间" sortable="custom" :formatter="timeFormat"
|
||||
min-width="140px" show-overflow-tooltip />
|
||||
<el-table-column prop="lastUpdateUser" label="最近更新用户" min-width="120px" show-overflow-tooltip />
|
||||
<!-- <el-table-column fixed="right" label="操作" width="120px">
|
||||
<template v-slot="scope">
|
||||
<el-button plain type="primary" @click="editCurrentRowStock(scope.row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
<br />
|
||||
<el-pagination v-model:current-page="baseTableQuery.currentPage"
|
||||
v-model:page-size="baseTableQuery.pageSize" :page-sizes="[10, 25, 50]" :small="false"
|
||||
:disabled="false" :background="false" :default-page-size="10" @size-change="search"
|
||||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total" />
|
||||
</div>
|
||||
<!-- 批量盘点确认对话框 -->
|
||||
<el-dialog
|
||||
v-model="showBatchInventoryDialog"
|
||||
title="确认批量盘点"
|
||||
width="500px"
|
||||
draggable
|
||||
center>
|
||||
<div class="dialog-content">
|
||||
<el-alert
|
||||
:title="`您确定要对以下 ${selectedRows.length} 条数据进行盘点操作吗?`"
|
||||
type="warning"
|
||||
show-icon
|
||||
:closable="false" style="margin-bottom: 20px;">
|
||||
</el-alert>
|
||||
|
||||
<div class="selected-summary">
|
||||
<h4>选中数据概览:</h4>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">料号种类:</span>
|
||||
<span>{{ [...new Set(selectedRows.map(item => item.goodsId))].length }} 种</span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">箱号数量:</span>
|
||||
<span>{{ selectedRows.length }} 个</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="selected-list">
|
||||
<h4>选中数据详情:</h4>
|
||||
<el-table
|
||||
:data="selectedRows.slice(0, 50)"
|
||||
max-height="250"
|
||||
size="small"
|
||||
border>
|
||||
<el-table-column prop="goodsId" label="料号" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="vehicleId" label="箱号" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="locationId" label="库位" width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="specialStock" label="特殊库存" width="100" show-overflow-tooltip />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="showBatchInventoryDialog = false" size="default">取消</el-button>
|
||||
<el-button type="primary" @click="confirmBatchInventory" size="default">确认盘点</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { queryStocksByPage } from '@/api/stock.js'
|
||||
import { exportStockExcel } from '@/api/excel.js'
|
||||
import { dateFormatter, locationFormatter, timeFormatter, yesOrNoFormatter } from '@/utils/formatter.js'
|
||||
import { ref, reactive, onMounted, nextTick, onBeforeUnmount } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { genTableRequest, addAllOptionOfOptions } from '@/utils/generator.js'
|
||||
import { labelPosition, shortcuts } from '@/constant/form'
|
||||
import { stockStatusOptions, goodsStatusOptions } from '@/constant/options'
|
||||
import {batchRequestInventory} from "@/api/task";
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
/**
|
||||
* 变量定义
|
||||
*/
|
||||
// 添加新的响应式变量
|
||||
let selectedRows = ref([]) // 存储选中的行
|
||||
let isSelectAll = ref(false) // 全选状态
|
||||
let showBatchInventoryDialog = ref(false) // 控制批量盘点对话框显示
|
||||
|
||||
let maxHeight = ref(window.innerHeight * 0.55)
|
||||
let tableLoading = ref(false)
|
||||
let displayStocks = ref([])
|
||||
let baseTableQuery = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
sortBy: new Map([['firstInTime', true]]),
|
||||
standId: store.getters.getStandId,
|
||||
userName: store.getters.getUserName
|
||||
})
|
||||
let stockQuery = reactive({
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
locationId: '',
|
||||
stockStatus: -99,
|
||||
goodsStatus: -99,
|
||||
fromDate: null,
|
||||
toDate: null,
|
||||
noUseDays: null // 新增未使用天数字段
|
||||
})
|
||||
let stockQueryFormRef = ref()
|
||||
let goodsIdList = ref([])
|
||||
let showStockEditFlag = ref(false)
|
||||
let stockId = ''
|
||||
let stockFormRef = ref()
|
||||
let stockFormEntity = reactive({})
|
||||
/**
|
||||
* 系统方法
|
||||
*/
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
window.addEventListener('resize', resizeHeight)
|
||||
search()
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
nextTick(() => {
|
||||
window.removeEventListener('resize', resizeHeight)
|
||||
})
|
||||
})
|
||||
const resizeHeight = () => {
|
||||
maxHeight.value = window.innerHeight * 0.55
|
||||
}
|
||||
/**
|
||||
* 自定义方法
|
||||
*/
|
||||
// 在变量定义部分添加
|
||||
const noUseDaysOptions = ref([
|
||||
{ label: '全部', value: null },
|
||||
{ label: '7天', value: 7 },
|
||||
{ label: '15天', value: 15 },
|
||||
{ label: '30天', value: 30 },
|
||||
{ label: '60天', value: 60 },
|
||||
{ label: '90天', value: 90 }
|
||||
])
|
||||
|
||||
// 处理选择变化
|
||||
const handleSelectionChange = (row) => {
|
||||
if (row.checked) {
|
||||
// 如果选中且不在列表中,则添加
|
||||
if (!selectedRows.value.some(item => item.stockId === row.stockId)) {
|
||||
selectedRows.value.push(row)
|
||||
}
|
||||
} else {
|
||||
// 如果取消选中,则从列表中移除
|
||||
selectedRows.value = selectedRows.value.filter(item => item.stockId !== row.stockId)
|
||||
// 取消全选状态
|
||||
isSelectAll.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 处理全选变化
|
||||
const handleSelectAllChange = (val) => {
|
||||
displayStocks.value.forEach(row => {
|
||||
row.checked = val
|
||||
})
|
||||
|
||||
if (val) {
|
||||
// 全选
|
||||
selectedRows.value = [...displayStocks.value]
|
||||
} else {
|
||||
// 取消全选
|
||||
selectedRows.value = []
|
||||
}
|
||||
}
|
||||
// 处理批量盘点按钮点击
|
||||
const handleBatchInventory = () => {
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请至少选择一条记录')
|
||||
return
|
||||
}
|
||||
showBatchInventoryDialog.value = true
|
||||
}
|
||||
|
||||
// 确认批量盘点操作
|
||||
const confirmBatchInventory = () => {
|
||||
// 构造发送到后端的数据,按照指定格式
|
||||
const requestData = {
|
||||
invUser: store.getters.getUserName, // 使用当前用户名
|
||||
invStand: store.getters.getStandId, // 使用当前站点ID
|
||||
items: selectedRows.value.map(row => ({
|
||||
goodsId: row.goodsId,
|
||||
vehicleId: row.vehicleId,
|
||||
specialStock: row.specialStock,
|
||||
specialStockNo: row.specialStockNo,
|
||||
specialStockItemNo: row.specialStockItemNo,
|
||||
batchNo: row.batchNo
|
||||
}))
|
||||
};
|
||||
|
||||
console.log('批量盘点数据:', requestData);
|
||||
|
||||
// 调用后端接口
|
||||
batchRequestInventory(requestData).then(res => {
|
||||
if (res.data.code === 0) {
|
||||
ElMessage.success('批量盘点成功');
|
||||
showBatchInventoryDialog.value = false;
|
||||
search(); // 刷新表格数据
|
||||
|
||||
// 清空选择
|
||||
selectedRows.value.forEach(row => {
|
||||
row.checked = false;
|
||||
});
|
||||
selectedRows.value = [];
|
||||
isSelectAll.value = false;
|
||||
} else {
|
||||
ElMessage.error(res.data.message);
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.error('批量盘点失败');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// 查询
|
||||
const search = () => {
|
||||
tableLoading.value = true
|
||||
let request = genTableRequest(baseTableQuery)
|
||||
// 设定查询参数
|
||||
request.vehicleId = stockQuery.vehicleId.trim()
|
||||
request.goodsId = stockQuery.goodsId.trim()
|
||||
request.locationId = stockQuery.locationId.trim()
|
||||
request.stockStatus = stockQuery.stockStatus === -99 ? null : stockQuery.stockStatus
|
||||
request.goodsStatus = stockQuery.goodsStatus === -99 ? null : stockQuery.goodsStatus
|
||||
request.fromDate = stockQuery.fromDate == null ? null : dateFormatter(stockQuery.fromDate)
|
||||
request.toDate = stockQuery.toDate == null ? null : dateFormatter(stockQuery.toDate)
|
||||
request.noUseDays = stockQuery.noUseDays // 添加未使用天数参数
|
||||
queryStocksByPage(request).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code === 0) {
|
||||
const data = response.data
|
||||
console.log(data)
|
||||
if (data != null) {
|
||||
displayStocks.value = data.lists
|
||||
baseTableQuery.total = data.total
|
||||
} else {
|
||||
displayStocks.value = []
|
||||
baseTableQuery.total = 0
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询库存信息异常。')
|
||||
}).finally(() => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
}
|
||||
const clearQuery = () => {
|
||||
stockQuery.vehicleId = '',
|
||||
stockQuery.goodsId = '',
|
||||
stockQuery.locationId = '',
|
||||
stockQuery.stockStatus = -99,
|
||||
stockQuery.goodsStatus = -99,
|
||||
stockQuery.fromDate = null,
|
||||
stockQuery.toDate = null,
|
||||
stockQuery.noUseDays = null
|
||||
}
|
||||
const loadAllGoodsInfo = () => {
|
||||
const request = {
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
getGoodsInfoByGoodsId(request).then(res => {
|
||||
const tableResponse = res.data
|
||||
if (tableResponse.code == 0) {
|
||||
this.goodsList = tableResponse.returnData
|
||||
} else {
|
||||
ElMessage.error(tableResponse.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询物料信息异常。')
|
||||
})
|
||||
}
|
||||
|
||||
const filterGoodsId = (queryString, cb) => {
|
||||
const results = queryString
|
||||
? this.goodsList.filter(this.createFilter(queryString))
|
||||
: this.goodsList
|
||||
// call callback function to return suggestion objects
|
||||
cb(results)
|
||||
}
|
||||
const createFilter = (queryString) => {
|
||||
return (restaurant) => {
|
||||
return (
|
||||
restaurant.goodsId.toLowerCase().indexOf(queryString.toLowerCase()) != -1
|
||||
)
|
||||
}
|
||||
}
|
||||
const handleSelectGoodsId = (item) => {
|
||||
this.goodsIdQuery = item.goodsId
|
||||
}
|
||||
const locationFormat = (row, column, cellValue, index) => {
|
||||
return locationFormatter(cellValue)
|
||||
}
|
||||
const dateFormat = (row, column, cellValue, index) => {
|
||||
return dateFormatter(cellValue)
|
||||
}
|
||||
const timeFormat = (row, column, cellValue, index) => {
|
||||
return timeFormatter(cellValue)
|
||||
}
|
||||
const goodsStatusFormat = (row, column, cellValue, index) => {
|
||||
if (cellValue === 0) {
|
||||
return '正常'
|
||||
} else if (cellValue === 1) {
|
||||
return '不合格'
|
||||
} else if (cellValue === 2) {
|
||||
return '延期'
|
||||
} else if (cellValue === 3) {
|
||||
return '过期'
|
||||
} else if (cellValue === 5) {
|
||||
return '长时间未使用'
|
||||
}
|
||||
}
|
||||
const stockStatusFormat = (row, column, cellValue, index) => {
|
||||
switch (cellValue) {
|
||||
case 0:
|
||||
return '在库中'
|
||||
case 1:
|
||||
return '出库中'
|
||||
case 2:
|
||||
return '已出库'
|
||||
case 3:
|
||||
return '回库中'
|
||||
case 4:
|
||||
return '盘点中'
|
||||
case 9:
|
||||
return '库存锁定'
|
||||
default:
|
||||
return '异常'
|
||||
}
|
||||
}
|
||||
const yesOrNoFormat = (row, column, cellValue, index) => {
|
||||
return yesOrNoFormatter(cellValue)
|
||||
}
|
||||
const rowStyle = ({ row, rowIndex }) => {
|
||||
const styles = {};
|
||||
|
||||
// 检查最近盘点时间是否小于30天
|
||||
if (row.lastInventoryTime) {
|
||||
const lastInventoryDate = new Date(row.lastInventoryTime);
|
||||
const currentDate = new Date();
|
||||
const timeDiff = currentDate - lastInventoryDate;
|
||||
const daysDiff = timeDiff / (1000 * 60 * 60 * 24);
|
||||
|
||||
if (daysDiff < 30) {
|
||||
styles.backgroundColor = "#e5f6fb"; // 淡绿色背景
|
||||
}
|
||||
}
|
||||
|
||||
// 根据goodsStatus设置字体颜色
|
||||
if (row.goodsStatus === 3) {
|
||||
styles.color = "red";
|
||||
} else if (row.goodsStatus === 5) {
|
||||
styles.color = "yellow";
|
||||
}
|
||||
|
||||
return Object.keys(styles).length > 0 ? styles : null;
|
||||
}
|
||||
|
||||
|
||||
const handleSortChange = (data) => {
|
||||
if (baseTableQuery.sortBy.has(data.prop)) {
|
||||
baseTableQuery.sortBy.delete(data.prop)
|
||||
}
|
||||
baseTableQuery.sortBy.set(data.prop, data.order == 'ascending')
|
||||
search()
|
||||
}
|
||||
const getCurrentRow = (row) => {
|
||||
stockId = row.stockId
|
||||
}
|
||||
const exportExcel = () => {
|
||||
const params = {
|
||||
vehicleId: stockQuery.vehicleId,
|
||||
goodsId: stockQuery.goodsId,
|
||||
locationId: stockQuery.locationId,
|
||||
stockStatus: stockQuery.stockStatus == -99 ? null : stockQuery.stockStatus,
|
||||
goodsStatus: stockQuery.goodsStatus == -99 ? null : stockQuery.goodsStatus,
|
||||
fromDate: stockQuery.fromDate,
|
||||
toDate: stockQuery.toDate
|
||||
}
|
||||
exportStockExcel(params).then(res => {
|
||||
const link = document.createElement('a');//创建a标签
|
||||
try {
|
||||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
let _fileName = "库存报表" + dateFormatter(new Date) + ".xlsx"
|
||||
link.style.display = 'none'//隐藏
|
||||
|
||||
// 兼容不同浏览器的URL对象
|
||||
const url = window.URL || window.webkitURL || window.moxURL
|
||||
link.href = url.createObjectURL(blob)
|
||||
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
url.revokeObjectURL(link.href)//移除url对象
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
ElMessage.error('下载文件失败')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('导出失败')
|
||||
})
|
||||
}
|
||||
const editCurrentRowStock = (row) => {
|
||||
this.stockFormEntity = {
|
||||
stockId: row.stockId,
|
||||
locationId: row.locationId,
|
||||
vehicleId: row.vehicleId,
|
||||
stockStatus: row.stockStatus,
|
||||
createTime: row.createTime,
|
||||
lastUpdateTime: row.lastUpdateTime,
|
||||
lastUpdateUser: row.lastUpdateUser,
|
||||
isInventory: row.isInventory,
|
||||
inventoryTaskId: row.inventoryTaskId,
|
||||
noUseDays: row.noUseDays,
|
||||
goodsId: row.goodsId,
|
||||
goodsName: row.goodsName,
|
||||
goodsStatus: row.goodsStatus,
|
||||
remainNum: row.remainNum,
|
||||
totalNum: row.totalNum
|
||||
}
|
||||
this.dialogVisible = true
|
||||
}
|
||||
const submitStockInfo = () => {
|
||||
const request = {
|
||||
stockId: this.stockFormEntity.stockId,
|
||||
locationId: this.stockFormEntity.locationId,
|
||||
vehicleId: this.stockFormEntity.vehicleId,
|
||||
stockStatus: this.stockFormEntity.stockStatus,
|
||||
goodsId: this.stockFormEntity.goodsId,
|
||||
goodsStatus: this.stockFormEntity.goodsStatus,
|
||||
remainNum: this.stockFormEntity.remainNum,
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
updateStockInfo(request).then(res => {
|
||||
if (res.data.code == 0) {
|
||||
this.dialogVisible = false
|
||||
ElMessage.success('更新库存成功')
|
||||
this.search()
|
||||
} else {
|
||||
errorBox(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('更新库存失败')
|
||||
})
|
||||
}
|
||||
</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;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.my-autocomplete li {
|
||||
width: 196px;
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_id {
|
||||
color: brown;
|
||||
}
|
||||
|
||||
.my-autocomplete li .goods_name {
|
||||
color: cornflowerblue;
|
||||
}
|
||||
/* 新增的弹窗样式 */
|
||||
.dialog-content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.selected-summary {
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.selected-list h4 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.more-info {
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
text-align: right;
|
||||
padding: 20px 0 0;
|
||||
}
|
||||
|
||||
.dialog-footer .el-button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.button-group {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.button-group .el-button {
|
||||
height: 32px;
|
||||
min-width: 80px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
|
@ -24,12 +24,20 @@
|
|||
</el-col>
|
||||
<el-col :span="22" :offset="1">
|
||||
<el-form-item label="本次实际拣选:" required>
|
||||
<el-input class="form-input large-center-input" v-model="bindingData.planPickQty" clearable readonly/>
|
||||
<el-input
|
||||
class="form-input large-center-input highlight-pick-qty"
|
||||
v-model="bindingData.planPickQty"
|
||||
clearable
|
||||
readonly/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="22" :offset="1">
|
||||
<el-form-item label="实际剩余数量:" required>
|
||||
<el-input class="form-input large-center-input" v-model="bindingData.realRemainQty" clearable readonly/>
|
||||
<el-input
|
||||
class="form-input small-remain-qty"
|
||||
v-model="bindingData.realRemainQty"
|
||||
clearable
|
||||
readonly/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="22" :offset="1">
|
||||
|
|
@ -480,4 +488,29 @@ export default {
|
|||
margin-top: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.highlight-pick-qty {
|
||||
background-color: #dbeeff !important; /* 淡蓝色背景 */
|
||||
font-weight: bold !important; /* 加粗 */
|
||||
font-size: 28px !important; /* 放大字体 */
|
||||
}
|
||||
|
||||
:deep(.highlight-pick-qty .el-input__inner) {
|
||||
background-color: #dbeeff !important; /* 淡蓝色背景 */
|
||||
font-weight: bold !important; /* 加粗 */
|
||||
font-size: 28px !important; /* 放大字体 */
|
||||
text-align: center;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
/* 新增样式:减小剩余数量字体 */
|
||||
.small-remain-qty {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
:deep(.small-remain-qty .el-input__inner) {
|
||||
font-size: 16px !important;
|
||||
text-align: center;
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -69,9 +69,22 @@
|
|||
:max-height="maxHeight" highlight-current-row @row-click="getCurrentRow" :row-style="rowStyle"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
@sort-change="handleSortChange">
|
||||
<!-- 添加多选框列 -->
|
||||
<el-table-column width="65px" fixed="left">
|
||||
<template #header>
|
||||
<el-checkbox
|
||||
v-model="isSelectAll"
|
||||
@change="handleSelectAllChange">
|
||||
|
||||
</el-checkbox>
|
||||
</template>
|
||||
<template v-slot="scope">
|
||||
<el-radio :label="scope.row.stockId" v-model="stockId"> </el-radio>
|
||||
<el-checkbox
|
||||
:label="scope.row.stockId"
|
||||
v-model="scope.row.checked"
|
||||
@change="handleSelectionChange(scope.row)">
|
||||
|
||||
</el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="stockId" label="库存编号" fixed="left" min-width="120px" sortable="custom"-->
|
||||
|
|
@ -117,6 +130,55 @@
|
|||
@current-change="search" layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="baseTableQuery.total" />
|
||||
</div>
|
||||
<!-- 批量盘点确认对话框 -->
|
||||
<el-dialog
|
||||
v-model="showBatchInventoryDialog"
|
||||
title="确认批量盘点"
|
||||
width="500px"
|
||||
draggable
|
||||
center>
|
||||
<div class="dialog-content">
|
||||
<el-alert
|
||||
:title="`您确定要对以下 ${selectedRows.length} 条数据进行盘点操作吗?`"
|
||||
type="warning"
|
||||
show-icon
|
||||
:closable="false" style="margin-bottom: 20px;">
|
||||
</el-alert>
|
||||
|
||||
<div class="selected-summary">
|
||||
<h4>选中数据概览:</h4>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">料号种类:</span>
|
||||
<span>{{ [...new Set(selectedRows.map(item => item.goodsId))].length }} 种</span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">箱号数量:</span>
|
||||
<span>{{ selectedRows.length }} 个</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="selected-list">
|
||||
<h4>选中数据详情:</h4>
|
||||
<el-table
|
||||
:data="selectedRows.slice(0, 50)"
|
||||
max-height="250"
|
||||
size="small"
|
||||
border>
|
||||
<el-table-column prop="goodsId" label="料号" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="vehicleId" label="箱号" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="locationId" label="库位" width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="specialStock" label="特殊库存" width="100" show-overflow-tooltip />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="showBatchInventoryDialog = false" size="default">取消</el-button>
|
||||
<el-button type="primary" @click="confirmBatchInventory" size="default">确认盘点</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- <el-dialog v-model="dialogVisible" title="库存信息" width="40%" draggable :show-close="false">
|
||||
<el-form ref="stockFormRef" :model="stockFormEntity" :label-position="labelPosition"
|
||||
label-width="100px" style="max-width: 100%" :rules="rules" status-icon>
|
||||
|
|
@ -242,12 +304,18 @@ import { ElMessage } from 'element-plus'
|
|||
import { genTableRequest, addAllOptionOfOptions } from '@/utils/generator.js'
|
||||
import { labelPosition, shortcuts } from '@/constant/form'
|
||||
import { stockStatusOptions, goodsStatusOptions } from '@/constant/options'
|
||||
import {batchRequestInventory} from "@/api/task";
|
||||
/**
|
||||
* 常量定义
|
||||
*/
|
||||
/**
|
||||
* 变量定义
|
||||
*/
|
||||
// 添加新的响应式变量
|
||||
let selectedRows = ref([]) // 存储选中的行
|
||||
let isSelectAll = ref(false) // 全选状态
|
||||
let showBatchInventoryDialog = ref(false) // 控制批量盘点对话框显示
|
||||
|
||||
let maxHeight = ref(window.innerHeight * 0.55)
|
||||
let tableLoading = ref(false)
|
||||
let displayStocks = ref([])
|
||||
|
|
@ -294,6 +362,84 @@ const resizeHeight = () => {
|
|||
/**
|
||||
* 自定义方法
|
||||
*/
|
||||
// 处理选择变化
|
||||
const handleSelectionChange = (row) => {
|
||||
if (row.checked) {
|
||||
// 如果选中且不在列表中,则添加
|
||||
if (!selectedRows.value.some(item => item.stockId === row.stockId)) {
|
||||
selectedRows.value.push(row)
|
||||
}
|
||||
} else {
|
||||
// 如果取消选中,则从列表中移除
|
||||
selectedRows.value = selectedRows.value.filter(item => item.stockId !== row.stockId)
|
||||
// 取消全选状态
|
||||
isSelectAll.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 处理全选变化
|
||||
const handleSelectAllChange = (val) => {
|
||||
displayStocks.value.forEach(row => {
|
||||
row.checked = val
|
||||
})
|
||||
|
||||
if (val) {
|
||||
// 全选
|
||||
selectedRows.value = [...displayStocks.value]
|
||||
} else {
|
||||
// 取消全选
|
||||
selectedRows.value = []
|
||||
}
|
||||
}
|
||||
// 处理批量盘点按钮点击
|
||||
const handleBatchInventory = () => {
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请至少选择一条记录')
|
||||
return
|
||||
}
|
||||
showBatchInventoryDialog.value = true
|
||||
}
|
||||
|
||||
// 确认批量盘点操作
|
||||
const confirmBatchInventory = () => {
|
||||
// 构造发送到后端的数据,按照指定格式
|
||||
const requestData = {
|
||||
invUser: store.getters.getUserName, // 使用当前用户名
|
||||
invStand: store.getters.getStandId, // 使用当前站点ID
|
||||
items: selectedRows.value.map(row => ({
|
||||
goodsId: row.goodsId,
|
||||
vehicleId: row.vehicleId,
|
||||
specialStock: row.specialStock,
|
||||
specialStockNo: row.specialStockNo,
|
||||
specialStockItemNo: row.specialStockItemNo,
|
||||
batchNo: row.batchNo
|
||||
}))
|
||||
};
|
||||
|
||||
console.log('批量盘点数据:', requestData);
|
||||
|
||||
// 调用后端接口
|
||||
batchRequestInventory(requestData).then(res => {
|
||||
if (res.data.code === 0) {
|
||||
ElMessage.success('批量盘点成功');
|
||||
showBatchInventoryDialog.value = false;
|
||||
search(); // 刷新表格数据
|
||||
|
||||
// 清空选择
|
||||
selectedRows.value.forEach(row => {
|
||||
row.checked = false;
|
||||
});
|
||||
selectedRows.value = [];
|
||||
isSelectAll.value = false;
|
||||
} else {
|
||||
ElMessage.error(res.data.message);
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.error('批量盘点失败');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// 查询
|
||||
const search = () => {
|
||||
tableLoading.value = true
|
||||
|
|
@ -594,4 +740,45 @@ const submitStockInfo = () => {
|
|||
.my-autocomplete li .goods_name {
|
||||
color: cornflowerblue;
|
||||
}
|
||||
/* 新增的弹窗样式 */
|
||||
.dialog-content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.selected-summary {
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.selected-list h4 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.more-info {
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
text-align: right;
|
||||
padding: 20px 0 0;
|
||||
}
|
||||
|
||||
.dialog-footer .el-button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -29,6 +29,7 @@ const routes = [
|
|||
{path: '/pickTask', component: () => import('@/layout/pickTaskMonitor.vue')},// 拣选任务
|
||||
{path: '/outsMonitor', component: () => import('@/layout/OutsMonitor.vue')},// 任务表单
|
||||
{path: '/clcKanban', component: () => import('@/layout/clcKanban.vue')},// 需求看板
|
||||
{path: '/batchInventory', component: () => import('@/layout/batchInventory.vue')},// 批量盘点
|
||||
{path: '/stockCompare', component: () => import('@/layout/stockCompare.vue')},
|
||||
{path: '/stockUpdateRecord', component: () => import('@/layout/stockUpdateRecord.vue')},// 库存更新记录
|
||||
{path: '/roleUser', component: () => import('@/layout/role_user.vue')},// 角色——用户列表
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import com.wms_main.service.controller.ITaskControllerService;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -136,69 +137,35 @@ public class TaskController {
|
|||
/**
|
||||
* test
|
||||
*/
|
||||
@PostMapping("/status")
|
||||
public EwmApiBackResponse test(@RequestBody StockConfirmEntity stockConfirm) {
|
||||
//return taskControllerService.ewmInformationBack(wcsVehicleInRequest);
|
||||
// return ewmApiService.getEwmStock(request);
|
||||
//return ewmApiService.sendWarehouseOutCompleted(request);
|
||||
//return ewmApiService.sendWarehouseInCompleted(new SendWarehouseInCompletedRequest());
|
||||
// 查询对应的库存信息
|
||||
List<TAppStock> stockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, stockConfirm.getVehicleId())
|
||||
.eq(TAppStock::getGoodsId, stockConfirm.getGoodsId())
|
||||
// 特殊库存字段精确匹配 - 根据传入值决定匹配条件
|
||||
.and(wrapper -> {
|
||||
if (StringUtils.isEmpty(stockConfirm.getSpecialStock())) {
|
||||
// 如果传入null或空字符串,匹配数据库中为null或空字符串的记录
|
||||
wrapper.isNull(TAppStock::getSpecialStock)
|
||||
.or()
|
||||
.eq(TAppStock::getSpecialStock, "");
|
||||
} else {
|
||||
// 如果传入有值,精确匹配该值
|
||||
wrapper.eq(TAppStock::getSpecialStock, stockConfirm.getSpecialStock());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
if (StringUtils.isEmpty(stockConfirm.getSpecialStockNo())) {
|
||||
// 如果传入null或空字符串,匹配数据库中为null或空字符串的记录
|
||||
wrapper.isNull(TAppStock::getSpecialStockNo)
|
||||
.or()
|
||||
.eq(TAppStock::getSpecialStockNo, "");
|
||||
} else {
|
||||
// 如果传入有值,精确匹配该值
|
||||
wrapper.eq(TAppStock::getSpecialStockNo, stockConfirm.getSpecialStockNo());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
if (StringUtils.isEmpty(stockConfirm.getSpecialStockItemNo())) {
|
||||
// 如果传入null或空字符串,匹配数据库中为null或空字符串的记录
|
||||
wrapper.isNull(TAppStock::getSpecialStockItemNo)
|
||||
.or()
|
||||
.eq(TAppStock::getSpecialStockItemNo, "");
|
||||
} else {
|
||||
// 如果传入有值,精确匹配该值
|
||||
wrapper.eq(TAppStock::getSpecialStockItemNo, stockConfirm.getSpecialStockItemNo());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
if (StringUtils.isEmpty(stockConfirm.getBatchNo())) {
|
||||
// 如果传入null或空字符串,匹配数据库中为null或空字符串的记录
|
||||
wrapper.isNull(TAppStock::getBatchNo)
|
||||
.or()
|
||||
.eq(TAppStock::getBatchNo, "");
|
||||
} else {
|
||||
// 如果传入有值,精确匹配该值
|
||||
wrapper.eq(TAppStock::getBatchNo, stockConfirm.getBatchNo());
|
||||
}
|
||||
})
|
||||
.orderByDesc(TAppStock::getFirstInTime)
|
||||
);
|
||||
|
||||
return EwmApiBackResponse.success(
|
||||
"查询成功",
|
||||
stockList
|
||||
);
|
||||
}
|
||||
// @PostMapping("/status")
|
||||
// public EwmApiBackResponse test(@RequestBody StockConfirmEntity stockConfirm) {
|
||||
// //return taskControllerService.ewmInformationBack(wcsVehicleInRequest);
|
||||
// // return ewmApiService.getEwmStock(request);
|
||||
// //return ewmApiService.sendWarehouseOutCompleted(request);
|
||||
// //return ewmApiService.sendWarehouseInCompleted(new SendWarehouseInCompletedRequest());
|
||||
// // 查询对应的库存信息
|
||||
//
|
||||
// }
|
||||
// private boolean test(String stand1, String stand2) {
|
||||
//
|
||||
// stand1 = "P22";
|
||||
// stand2 = "P18";
|
||||
//
|
||||
// // P11-P19为一组
|
||||
// boolean isStand1InP11ToP19 = stand1.compareTo("P11") >= 0 && stand1.compareTo("P19") <= 0;
|
||||
// boolean isStand2InP11ToP19 = stand2.compareTo("P11") >= 0 && stand2.compareTo("P19") <= 0;
|
||||
// if (isStand1InP11ToP19 && isStand2InP11ToP19) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// // P21-P23为一组
|
||||
// List<String> p21ToP23 = Arrays.asList("P21", "P22", "P23");
|
||||
// if (p21ToP23.contains(stand1) && p21ToP23.contains(stand2)) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
|
||||
/**
|
||||
* wcs请求载具入库
|
||||
|
|
@ -290,6 +257,17 @@ public class TaskController {
|
|||
return taskControllerService.requestInventory(inventoryRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量下发盘点请求
|
||||
* @param batchInventoryRequest 批量盘点请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
@PostMapping("/batchRequestInventory")
|
||||
public BaseWmsApiResponse batchRequestInventory(@RequestBody BatchInventoryRequest batchInventoryRequest) {
|
||||
return taskControllerService.batchRequestInventory(batchInventoryRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询盘点任务确认信息
|
||||
* @param inventoryConfirmRequest 请求
|
||||
|
|
|
|||
|
|
@ -57,4 +57,10 @@ public class StockQuery extends PageQuery{
|
|||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate toDate;
|
||||
|
||||
/**
|
||||
* 未使用天数
|
||||
*/
|
||||
@JsonProperty("noUseDays")
|
||||
private Integer noUseDays;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
// 在com.wms_main.model.dto.request.wms包下创建
|
||||
package com.wms_main.model.dto.request.wms;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BatchInventoryRequest {
|
||||
private List<InventoryItem> items;
|
||||
private String invUser; // 盘点用户
|
||||
private String invStand; // 盘点站台
|
||||
|
||||
@Data
|
||||
public static class InventoryItem {
|
||||
private String goodsId;
|
||||
private String vehicleId;
|
||||
private String specialStock;
|
||||
private String specialStockNo;
|
||||
private String specialStockItemNo;
|
||||
private String batchNo;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,6 +93,14 @@ public class StockVo {
|
|||
*/
|
||||
@JsonProperty("firstInUser")
|
||||
private String firstInUser;
|
||||
/**
|
||||
* 上次盘点时间
|
||||
*/
|
||||
@JsonProperty("lastInventoryTime")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastInventoryTime;
|
||||
|
||||
/**
|
||||
* 上次更新时间
|
||||
*/
|
||||
|
|
@ -150,6 +158,7 @@ public class StockVo {
|
|||
stockPo.getSled(),
|
||||
stockPo.getFirstInTime(),
|
||||
stockPo.getFirstInUser(),
|
||||
stockPo.getLastInventoryTime(),
|
||||
stockPo.getLastUpdateTime(),
|
||||
stockPo.getLastUpdateUser(),
|
||||
stockPo.getSpecialStock(),
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
|
|||
.eq(TAppStock::getStockStatus, WmsStockStatusEnums.OUTING.getCode())
|
||||
);
|
||||
// 更新当前载具到达当前点位的拣选任务为已到达
|
||||
//updateVehicleArriveStatus(targetPickTask);
|
||||
updateVehicleArriveStatus(targetPickTask);
|
||||
}
|
||||
// 更新拣选任务信息,添加拣选任务记录信息
|
||||
pickRecords.add(new TAppPickTaskBak(
|
||||
|
|
@ -304,38 +304,72 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
|
|||
* 更新载具到达状态,防止死锁
|
||||
* @param targetPickTask 目标拣选任务
|
||||
*/
|
||||
// private void updateVehicleArriveStatus(TAppPickTask targetPickTask) {
|
||||
// synchronized (targetPickTask.getVehicleId().intern()) {
|
||||
//
|
||||
// // 使用 last() 的方式虽然有效,但推荐使用 MyBatis Plus 内置方法保证兼容性
|
||||
// LambdaQueryWrapper<TAppPickTask> queryWrapper = new LambdaQueryWrapper<TAppPickTask>()
|
||||
// .eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
|
||||
// .eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.WAIT.getCode());
|
||||
//
|
||||
// // 设置最多查一条记录(替代 last("LIMIT 1"))
|
||||
// queryWrapper.last("LIMIT 1");
|
||||
//
|
||||
// TAppPickTask waitPickTask = appPickTaskService.getOne(queryWrapper);
|
||||
//
|
||||
// if (waitPickTask == null) {
|
||||
// log.error("没有找到符合条件的 WAIT 状态任务。载具号: {}", targetPickTask.getVehicleId());
|
||||
// return;
|
||||
// }
|
||||
// // 更新当前载具到达当前点位的拣选任务为已到达
|
||||
// appPickTaskService.update(new LambdaUpdateWrapper<TAppPickTask>()
|
||||
// .set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode())
|
||||
// .set(TAppPickTask::getArriveTime, LocalDateTime.now())
|
||||
// .set(TAppPickTask::getPickStand, targetPickTask.getPickStand())
|
||||
// .eq(TAppPickTask::getPickId, waitPickTask.getPickId())
|
||||
// );
|
||||
// appPickPlanService.update(new LambdaUpdateWrapper<TAppPickPlan>()
|
||||
// .set(TAppPickPlan::getStandId, targetPickTask.getPickStand())
|
||||
// .eq(TAppPickPlan::getVehicleId, targetPickTask.getVehicleId())
|
||||
// .last("LIMIT 1"));
|
||||
// }
|
||||
// }
|
||||
|
||||
private void updateVehicleArriveStatus(TAppPickTask targetPickTask) {
|
||||
synchronized (targetPickTask.getVehicleId().intern()) {
|
||||
|
||||
// 使用 last() 的方式虽然有效,但推荐使用 MyBatis Plus 内置方法保证兼容性
|
||||
LambdaQueryWrapper<TAppPickTask> queryWrapper = new LambdaQueryWrapper<TAppPickTask>()
|
||||
.eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
|
||||
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.WAIT.getCode());
|
||||
|
||||
// 设置最多查一条记录(替代 last("LIMIT 1"))
|
||||
queryWrapper.last("LIMIT 1");
|
||||
|
||||
TAppPickTask waitPickTask = appPickTaskService.getOne(queryWrapper);
|
||||
|
||||
if (waitPickTask == null) {
|
||||
log.error("没有找到符合条件的 WAIT 状态任务。载具号: {}", targetPickTask.getVehicleId());
|
||||
if (targetPickTask == null || StringUtils.isEmpty(targetPickTask.getVehicleId())) {
|
||||
log.warn("目标拣选任务或载具号为空");
|
||||
return;
|
||||
}
|
||||
// 更新当前载具到达当前点位的拣选任务为已到达
|
||||
appPickTaskService.update(new LambdaUpdateWrapper<TAppPickTask>()
|
||||
|
||||
synchronized ((targetPickTask.getVehicleId() + "_arrive").intern()) {
|
||||
// 使用链式更新,一次性完成多个更新操作
|
||||
boolean updated = appPickTaskService.update(
|
||||
new LambdaUpdateWrapper<TAppPickTask>()
|
||||
.set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode())
|
||||
.set(TAppPickTask::getArriveTime, LocalDateTime.now())
|
||||
.set(TAppPickTask::getPickStand, targetPickTask.getPickStand())
|
||||
.eq(TAppPickTask::getPickId, waitPickTask.getPickId())
|
||||
.eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
|
||||
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.WAIT.getCode())
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
appPickPlanService.update(new LambdaUpdateWrapper<TAppPickPlan>()
|
||||
|
||||
if (!updated) {
|
||||
log.warn("没有找到符合条件的 WAIT 状态任务。载具号: {}", targetPickTask.getVehicleId());
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新拣选计划
|
||||
appPickPlanService.update(
|
||||
new LambdaUpdateWrapper<TAppPickPlan>()
|
||||
.set(TAppPickPlan::getStandId, targetPickTask.getPickStand())
|
||||
.eq(TAppPickPlan::getVehicleId, targetPickTask.getVehicleId())
|
||||
.last("LIMIT 1"));
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获得对应库存的第一条工作
|
||||
*
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 库存数据服务实现
|
||||
|
|
@ -98,16 +99,24 @@ public class StockDataServiceImpl implements IStockDataService {
|
|||
.orderByDesc(TAppStock::getFirstInTime)
|
||||
);
|
||||
|
||||
// 添加查询相同载具号和料号但remainNum小于realNum的数据
|
||||
List<TAppStock> additionalStockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, stockConfirm.getVehicleId())
|
||||
.eq(TAppStock::getGoodsId, stockConfirm.getGoodsId())
|
||||
.apply("remain_num < real_num")
|
||||
);
|
||||
// 合并两个列表
|
||||
if (additionalStockList != null && !additionalStockList.isEmpty()) {
|
||||
stockList.addAll(additionalStockList);
|
||||
}
|
||||
// // 添加查询相同载具号和料号但remainNum小于realNum的数据
|
||||
// List<TAppStock> additionalStockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
// .eq(TAppStock::getVehicleId, stockConfirm.getVehicleId())
|
||||
// .eq(TAppStock::getGoodsId, stockConfirm.getGoodsId())
|
||||
// .apply("remain_num < real_num")
|
||||
// );
|
||||
// // 合并两个列表,避免重复添加
|
||||
// if (additionalStockList != null && !additionalStockList.isEmpty()) {
|
||||
// // 获取stockList中已存在的stockId集合
|
||||
// Set<String> existingStockIds = stockList.stream()
|
||||
// .map(TAppStock::getStockId)
|
||||
// .collect(Collectors.toSet());
|
||||
//
|
||||
// // 只添加不在existingStockIds中的记录
|
||||
// additionalStockList.stream()
|
||||
// .filter(stock -> !existingStockIds.contains(stock.getStockId()))
|
||||
// .forEach(stockList::add);
|
||||
// }
|
||||
|
||||
if (stockList == null || stockList.isEmpty()){
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -109,6 +109,14 @@ public interface ITaskControllerService {
|
|||
*/
|
||||
BaseWmsApiResponse requestInventory(InventoryRequest inventoryRequest);
|
||||
|
||||
/**
|
||||
* 批量下发盘点请求
|
||||
* @param batchInventoryRequest 批量盘点请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
BaseWmsApiResponse batchRequestInventory(BatchInventoryRequest batchInventoryRequest);
|
||||
|
||||
|
||||
/**
|
||||
* 查询盘点任务确认信息
|
||||
* @param inventoryConfirmRequest 请求
|
||||
|
|
|
|||
|
|
@ -53,6 +53,13 @@ public class StockControllerServiceImpl implements IStockControllerService {
|
|||
// toDate + 1天的凌晨。
|
||||
lambdaQueryWrapper.le(TAppStock::getFirstInTime, LocalDateTime.of(stockQuery.getToDate(), LocalDateTime.MAX.toLocalTime()));
|
||||
}
|
||||
// 新增:处理无使用天数查询
|
||||
if (stockQuery.getNoUseDays() != null && stockQuery.getNoUseDays() > 0) {
|
||||
LocalDateTime thresholdDate = LocalDateTime.now().minusDays(stockQuery.getNoUseDays());
|
||||
// 假设 TAppStock 中有 lastUpdateTime 字段记录最后更新时间
|
||||
lambdaQueryWrapper.le(TAppStock::getLastUpdateTime, thresholdDate);
|
||||
}
|
||||
|
||||
Page<TAppStock> stockPage = appStockService.page(page, lambdaQueryWrapper);
|
||||
|
||||
PageVo<StockVo> pageVo = PageVo.of(stockPage, StockVo::ofPo);
|
||||
|
|
|
|||
|
|
@ -2081,6 +2081,194 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
return BaseWmsApiResponse.success("创建盘点任务成功。");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseWmsApiResponse batchRequestInventory(BatchInventoryRequest batchInventoryRequest) {
|
||||
try {
|
||||
// 基本参数校验
|
||||
if (batchInventoryRequest == null) {
|
||||
return BaseWmsApiResponse.error("请求为NULL。");
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(batchInventoryRequest.getInvStand())) {
|
||||
return BaseWmsApiResponse.error("请求缺少信息,请输入站台号。");
|
||||
}
|
||||
|
||||
if (!appStandService.exists(new LambdaQueryWrapper<TAppStand>()
|
||||
.eq(TAppStand::getStandId, batchInventoryRequest.getInvStand())
|
||||
.eq(TAppStand::getStandType, 1))) {
|
||||
return BaseWmsApiResponse.error("非拣选站台不允许盘点。");
|
||||
}
|
||||
|
||||
if (batchInventoryRequest.getItems() == null || batchInventoryRequest.getItems().isEmpty()) {
|
||||
return BaseWmsApiResponse.error("请求缺少盘点项信息。");
|
||||
}
|
||||
|
||||
List<TAppInventory> inventoryList = new ArrayList<>();
|
||||
|
||||
// 处理每个盘点项
|
||||
for (BatchInventoryRequest.InventoryItem item : batchInventoryRequest.getItems()) {
|
||||
// 验证必填字段
|
||||
if (StringUtils.isEmpty(item.getGoodsId())) {
|
||||
return BaseWmsApiResponse.error("存在缺少料号的盘点项。");
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(item.getVehicleId())) {
|
||||
return BaseWmsApiResponse.error("存在缺少载具号的盘点项。");
|
||||
}
|
||||
|
||||
// 判断这个料和载具组合有没有还没盘点完的任务
|
||||
List<TAppInventory> existingInventoryList = appInventoryService.list(new LambdaQueryWrapper<TAppInventory>()
|
||||
.eq(TAppInventory::getGoodsId, item.getGoodsId())
|
||||
.eq(TAppInventory::getVehicleId, item.getVehicleId())
|
||||
.and(wrapper -> {
|
||||
// specialStock匹配逻辑
|
||||
if (StringUtils.isEmpty(item.getSpecialStock())) {
|
||||
// 传入空值,匹配数据库中的NULL或空字符串
|
||||
wrapper.isNull(TAppInventory::getSpecialStock)
|
||||
.or()
|
||||
.eq(TAppInventory::getSpecialStock, "");
|
||||
} else {
|
||||
// 传入具体值,精确匹配
|
||||
wrapper.eq(TAppInventory::getSpecialStock, item.getSpecialStock());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
// specialStockNo匹配逻辑
|
||||
if (StringUtils.isEmpty(item.getSpecialStockNo())) {
|
||||
// 传入空值,匹配数据库中的NULL或空字符串
|
||||
wrapper.isNull(TAppInventory::getSpecialStockNo)
|
||||
.or()
|
||||
.eq(TAppInventory::getSpecialStockNo, "");
|
||||
} else {
|
||||
// 传入具体值,精确匹配
|
||||
wrapper.eq(TAppInventory::getSpecialStockNo, item.getSpecialStockNo());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
// specialStockItemNo匹配逻辑
|
||||
if (StringUtils.isEmpty(item.getSpecialStockItemNo())) {
|
||||
// 传入空值,匹配数据库中的NULL或空字符串
|
||||
wrapper.isNull(TAppInventory::getSpecialStockItemNo)
|
||||
.or()
|
||||
.eq(TAppInventory::getSpecialStockItemNo, "");
|
||||
} else {
|
||||
// 传入具体值,精确匹配
|
||||
wrapper.eq(TAppInventory::getSpecialStockItemNo, item.getSpecialStockItemNo());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
// batchNo匹配逻辑
|
||||
if (StringUtils.isEmpty(item.getBatchNo())) {
|
||||
// 传入空值,匹配数据库中的NULL或空字符串
|
||||
wrapper.isNull(TAppInventory::getBatchNo)
|
||||
.or()
|
||||
.eq(TAppInventory::getBatchNo, "");
|
||||
} else {
|
||||
// 传入具体值,精确匹配
|
||||
wrapper.eq(TAppInventory::getBatchNo, item.getBatchNo());
|
||||
}
|
||||
}));
|
||||
|
||||
if (existingInventoryList != null && !existingInventoryList.isEmpty()) {
|
||||
return BaseWmsApiResponse.error("载具:" + item.getVehicleId() + " 料号:" + item.getGoodsId() + " 还有盘点任务未完成。");
|
||||
}
|
||||
|
||||
// 查询库存验证是否存在
|
||||
List<TAppStock> stockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getGoodsId, item.getGoodsId())
|
||||
.eq(TAppStock::getVehicleId, item.getVehicleId())
|
||||
.and(wrapper -> {
|
||||
// specialStock匹配逻辑
|
||||
if (StringUtils.isEmpty(item.getSpecialStock())) {
|
||||
// 传入空值,匹配数据库中的NULL或空字符串
|
||||
wrapper.isNull(TAppStock::getSpecialStock)
|
||||
.or()
|
||||
.eq(TAppStock::getSpecialStock, "");
|
||||
} else {
|
||||
// 传入具体值,精确匹配
|
||||
wrapper.eq(TAppStock::getSpecialStock, item.getSpecialStock());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
// specialStockNo匹配逻辑
|
||||
if (StringUtils.isEmpty(item.getSpecialStockNo())) {
|
||||
// 传入空值,匹配数据库中的NULL或空字符串
|
||||
wrapper.isNull(TAppStock::getSpecialStockNo)
|
||||
.or()
|
||||
.eq(TAppStock::getSpecialStockNo, "");
|
||||
} else {
|
||||
// 传入具体值,精确匹配
|
||||
wrapper.eq(TAppStock::getSpecialStockNo, item.getSpecialStockNo());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
// specialStockItemNo匹配逻辑
|
||||
if (StringUtils.isEmpty(item.getSpecialStockItemNo())) {
|
||||
// 传入空值,匹配数据库中的NULL或空字符串
|
||||
wrapper.isNull(TAppStock::getSpecialStockItemNo)
|
||||
.or()
|
||||
.eq(TAppStock::getSpecialStockItemNo, "");
|
||||
} else {
|
||||
// 传入具体值,精确匹配
|
||||
wrapper.eq(TAppStock::getSpecialStockItemNo, item.getSpecialStockItemNo());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
// batchNo匹配逻辑
|
||||
if (StringUtils.isEmpty(item.getBatchNo())) {
|
||||
// 传入空值,匹配数据库中的NULL或空字符串
|
||||
wrapper.isNull(TAppStock::getBatchNo)
|
||||
.or()
|
||||
.eq(TAppStock::getBatchNo, "");
|
||||
} else {
|
||||
// 传入具体值,精确匹配
|
||||
wrapper.eq(TAppStock::getBatchNo, item.getBatchNo());
|
||||
}
|
||||
}));
|
||||
|
||||
if (stockList == null || stockList.isEmpty()) {
|
||||
return BaseWmsApiResponse.error("载具:" + item.getVehicleId() + " 物料:" + item.getGoodsId() + " 没有库存。");
|
||||
}
|
||||
|
||||
// 创建盘点任务
|
||||
TAppInventory inventory = new TAppInventory(
|
||||
UUIDUtils.getNewUUID(),
|
||||
item.getGoodsId(),
|
||||
item.getVehicleId(),
|
||||
null,
|
||||
null,
|
||||
batchInventoryRequest.getInvStand(),
|
||||
batchInventoryRequest.getInvUser(),
|
||||
WmsInvTypeEnums.INV_TYPE_1.getCode(),
|
||||
WmsInvStatusEnums.INIT.getCode(),
|
||||
WmsInvResultEnums.NONE.getCode(),
|
||||
LocalDateTime.now(),
|
||||
null,
|
||||
UUIDUtils.getNewUUID(), // orderId
|
||||
item.getSpecialStock(),
|
||||
item.getSpecialStockNo(),
|
||||
item.getSpecialStockItemNo(),
|
||||
item.getBatchNo()
|
||||
);
|
||||
|
||||
inventoryList.add(inventory);
|
||||
}
|
||||
|
||||
// 批量保存盘点任务
|
||||
if (!inventoryList.isEmpty()) {
|
||||
appInventoryService.saveBatch(inventoryList);
|
||||
}
|
||||
|
||||
return BaseWmsApiResponse.success("批量盘点任务创建成功");
|
||||
} catch (Exception e) {
|
||||
log.error("批量盘点任务创建失败: {}", e.getMessage(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return BaseWmsApiResponse.error("批量盘点任务创建失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询盘点确认信息
|
||||
|
|
@ -2144,8 +2332,14 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
if (inventoryConfirmVo != null) {
|
||||
// 返回结果
|
||||
return WmsApiResponse.success("查询盘点确认信息成功。", inventoryConfirmVo);
|
||||
}else {
|
||||
if (thisPickTask.getPickType() == 1){
|
||||
return WmsApiResponse.instanceOf(WmsApiResponseCodeEnums.WARNING.getCode(),
|
||||
"当前箱子有拣选任务,请使用PDA拣选,箱号:" + thisPickTask.getVehicleId() + "。",
|
||||
null);
|
||||
}
|
||||
return WmsApiResponse.instanceOf(WmsApiResponseCodeEnums.WARNING.getCode(), "当前箱子没有要盘点的任务,请检查。", null);
|
||||
}
|
||||
return WmsApiResponse.instanceOf(WmsApiResponseCodeEnums.WARNING.getCode(), "当前箱子没有要盘点的任务,请放行。", null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2246,28 +2440,28 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
LambdaQueryWrapper<TAppStock> stockQueryWrapper = new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, thisPickTask.getVehicleId());
|
||||
List<TAppStock> stockList = appStockService.list(stockQueryWrapper);
|
||||
// 界面直接点击确认/放行
|
||||
if (!stockList.isEmpty()) {
|
||||
// 判断是否还有其他盘点任务
|
||||
List<TAppInventory> otherInventoryList = appInventoryService.list(new LambdaQueryWrapper<TAppInventory>()
|
||||
.eq(TAppInventory::getVehicleId, thisPickTask.getVehicleId())
|
||||
.ne(TAppInventory::getInventoryId, inventoryConfirmRequest.getInventoryId()));
|
||||
if (otherInventoryList != null && !otherInventoryList.isEmpty()) {
|
||||
return BaseWmsApiResponse.error("当前载具还有其他的盘点任务,请继续盘点。");
|
||||
}
|
||||
// 判断还有没有当前站台的其他拣选任务
|
||||
TaskConfirmVo taskConfirmVo = conveyTaskService.getCurrentStandTask(thisPickTask);
|
||||
if (taskConfirmVo != null) {
|
||||
return BaseWmsApiResponse.warn("当前载具还有紧急出库任务,请切换到出库界面信息进行拣配。");
|
||||
}
|
||||
WorkConfirmVo resultVo = conveyTaskService.getCurrentStandWork(thisPickTask);
|
||||
if (resultVo != null) {
|
||||
return BaseWmsApiResponse.warn("当前载具还有工作,请切换到拣配界面进行拣配。");
|
||||
}
|
||||
} else {
|
||||
// 取消后续拣选任务
|
||||
conveyTaskService.cancelOtherStandPickTasks(thisPickTask.getVehicleId(), thisPickTask.getPickStand());
|
||||
}
|
||||
// // 界面直接点击确认/放行
|
||||
// if (!stockList.isEmpty()) {
|
||||
// // 判断是否还有其他盘点任务
|
||||
//// List<TAppInventory> otherInventoryList = appInventoryService.list(new LambdaQueryWrapper<TAppInventory>()
|
||||
//// .eq(TAppInventory::getVehicleId, thisPickTask.getVehicleId())
|
||||
//// .ne(TAppInventory::getInventoryId, inventoryConfirmRequest.getInventoryId()));
|
||||
//// if (otherInventoryList != null && !otherInventoryList.isEmpty()) {
|
||||
//// return BaseWmsApiResponse.error("当前载具还有其他的盘点任务,请继续盘点。");
|
||||
//// }
|
||||
// // 判断还有没有当前站台的其他拣选任务
|
||||
// TaskConfirmVo taskConfirmVo = conveyTaskService.getCurrentStandTask(thisPickTask);
|
||||
// if (taskConfirmVo != null) {
|
||||
// return BaseWmsApiResponse.warn("当前载具还有拣选任务,请使用PDA进行拣配。");
|
||||
// }
|
||||
//// WorkConfirmVo resultVo = conveyTaskService.getCurrentStandWork(thisPickTask);
|
||||
//// if (resultVo != null) {
|
||||
//// return BaseWmsApiResponse.warn("当前载具还有工作,请切换到拣配界面进行拣配。");
|
||||
//// }
|
||||
// } else {
|
||||
// // 取消后续拣选任务
|
||||
// conveyTaskService.cancelOtherStandPickTasks(thisPickTask.getVehicleId(), thisPickTask.getPickStand());
|
||||
// }
|
||||
// 放行
|
||||
if (conveyTaskService.releaseStandVehicle(thisPickTask)) {
|
||||
return BaseWmsApiResponse.success("确认成功。");
|
||||
|
|
|
|||
|
|
@ -351,6 +351,35 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断两个站台是否属于同一组
|
||||
* @param stand1 站台1
|
||||
* @param stand2 站台2
|
||||
* @return 是否属于同一组
|
||||
*/
|
||||
private boolean isSameStandGroup(String stand1, String stand2) {
|
||||
if (stand1 == null || stand2 == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// P11-P19为一组
|
||||
boolean isStand1InP11ToP19 = stand1.compareTo("P11") >= 0 && stand1.compareTo("P19") <= 0;
|
||||
boolean isStand2InP11ToP19 = stand2.compareTo("P11") >= 0 && stand2.compareTo("P19") <= 0;
|
||||
if (isStand1InP11ToP19 && isStand2InP11ToP19) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// P21-P23为一组
|
||||
List<String> p21ToP23 = Arrays.asList("P21", "P22", "P23");
|
||||
if (p21ToP23.contains(stand1) && p21ToP23.contains(stand2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 处理紧急出库任务
|
||||
*
|
||||
|
|
@ -403,6 +432,25 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
// 当前堆垛机已经无法生成新的出库任务了
|
||||
continue;
|
||||
}
|
||||
if (!Objects.equals(stock.getStockStatus(), WmsStockStatusEnums.OK.getCode())) {
|
||||
// 需要判断对应的pickTask的终点
|
||||
List<TAppPickTask> pickTasksByJudge = appPickTaskService.list(
|
||||
new LambdaQueryWrapper<TAppPickTask>()
|
||||
.eq(TAppPickTask::getVehicleId, stock.getVehicleId())
|
||||
);
|
||||
|
||||
// 如果有拣选任务,检查是否为同一组站台
|
||||
if (!pickTasksByJudge.isEmpty()) {
|
||||
TAppPickTask firstPickTask = pickTasksByJudge.getFirst();
|
||||
String pickTaskDestination = firstPickTask.getPickStand();
|
||||
|
||||
// 如果不是同一组站台,则跳过
|
||||
if (!isSameStandGroup(pickTaskDestination, optimalDestination)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 如果没有拣选任务或为同一组站台,继续执行后续逻辑
|
||||
}
|
||||
// 判断当前的这条库存,当前站台是否需要
|
||||
int stockIsEmpty;
|
||||
int originNum = stock.getRemainNum();
|
||||
|
|
@ -1142,8 +1190,8 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
List<TAppPickTask> pickTasks = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
||||
.in(TAppPickTask::getVehicleId, vehicleIds));
|
||||
// 需要保存的信息
|
||||
List<TAppTask> newOutWmsTasks = new ArrayList<>();// 新的出库任务
|
||||
List<TAppPickTask> newPickTasks = new ArrayList<>();// 新的拣选任务
|
||||
List<TAppTask> newOutWmsTasks = new ArrayList<>(); // 新的出库任务
|
||||
List<TAppPickTask> newPickTasks = new ArrayList<>(); // 新的拣选任务
|
||||
List<String> thisTimeOutVehicleIds = new ArrayList<>();// 本次出库载具
|
||||
// 获取可用堆垛机
|
||||
List<TAppEquipment> usableStackers = appEquipmentService.list(new LambdaQueryWrapper<TAppEquipment>()
|
||||
|
|
@ -1192,6 +1240,25 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
// 当前堆垛机已经无法生成新的出库任务了
|
||||
continue;
|
||||
}
|
||||
if (!Objects.equals(stock.getStockStatus(), WmsStockStatusEnums.OK.getCode())) {
|
||||
// 需要判断对应的pickTask的终点
|
||||
List<TAppPickTask> pickTasksByJudge = appPickTaskService.list(
|
||||
new LambdaQueryWrapper<TAppPickTask>()
|
||||
.eq(TAppPickTask::getVehicleId, stock.getVehicleId())
|
||||
);
|
||||
|
||||
// 如果有拣选任务,检查是否为同一组站台
|
||||
if (!pickTasksByJudge.isEmpty()) {
|
||||
TAppPickTask firstPickTask = pickTasksByJudge.getFirst();
|
||||
String pickTaskDestination = firstPickTask.getPickStand();
|
||||
|
||||
// 如果不是同一组站台,则跳过
|
||||
if (!isSameStandGroup(pickTaskDestination, getOptimalSubStand(inventory.getInvStand()))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 如果没有拣选任务或为同一组站台,继续执行后续逻辑
|
||||
}
|
||||
// 拣选任务状态
|
||||
int pickTaskStatus = WmsPickTaskStatusEnum.TEMP.getCode();
|
||||
// 库存正常
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user