Compare commits

...

2 Commits

Author SHA1 Message Date
Yxq
7e201dd001 10月22日现场最新版本 2025-10-22 11:39:18 +08:00
Yxq
204bda118b 最新版本 2025-10-18 21:10:09 +08:00
39 changed files with 25349 additions and 11474 deletions

View File

@ -3,20 +3,20 @@
<header class="navbar"> <header class="navbar">
<div class="brand">{{ dynamicTitle }}</div> <div class="brand">{{ dynamicTitle }}</div>
<div class="control-buttons"> <div class="control-buttons">
<button <!-- <button -->
v-show="!isFullscreenState" <!-- v-show="!isFullscreenState" -->
@click="enterFullscreen" <!-- @click="enterFullscreen" -->
class="hidBtn fullscreen-btn" <!-- class="hidBtn fullscreen-btn"-->
> <!-- >-->
全屏 <!-- 全屏-->
</button> <!-- </button>-->
<button <!-- <button -->
v-show="isFullscreenState" <!-- v-show="isFullscreenState" -->
@click="exitFullscreen" <!-- @click="exitFullscreen" -->
class="hidBtn exit-btn" <!-- class="hidBtn exit-btn"-->
> <!-- >-->
退出 <!-- 退出-->
</button> <!-- </button>-->
</div> </div>
</header> </header>
<main class="content"> <main class="content">
@ -34,6 +34,8 @@ import PickP1 from './views/PickP1.vue';
import Stacker from "@/views/Stacker.vue"; import Stacker from "@/views/Stacker.vue";
import PickP2 from "@/views/PickP2.vue"; import PickP2 from "@/views/PickP2.vue";
import PickP3 from "@/views/PickP3.vue"; import PickP3 from "@/views/PickP3.vue";
import InboundP2 from "@/views/InboundP2.vue";
import InboundP3 from "@/views/InboundP3.vue";
const debounce = (fn, delay) => { const debounce = (fn, delay) => {
let timer = null; let timer = null;
@ -58,8 +60,8 @@ export default {
name: 'App', name: 'App',
components: { components: {
Inbound, Inbound,
Outbound, InboundP2,
Stacker, InboundP3,
PickP1, PickP1,
PickP2, PickP2,
PickP3 PickP3
@ -76,9 +78,9 @@ export default {
// //
const titleMapping = { const titleMapping = {
'1': '入库', '1': ' 1 号入库',
'2': '库', '2': ' 2 号入库',
'3': '堆垛机', '3': ' 3 号入库',
'4': 'P1 站台拣选', '4': 'P1 站台拣选',
'5': 'P2 站台拣选', '5': 'P2 站台拣选',
'6': 'P3 站台拣选', '6': 'P3 站台拣选',
@ -103,8 +105,8 @@ export default {
const currentComponent = computed(() => { const currentComponent = computed(() => {
const standId = currentStandId.value; const standId = currentStandId.value;
if (standId === '1') return 'Inbound'; if (standId === '1') return 'Inbound';
if (standId === '2') return 'Outbound'; if (standId === '2') return 'InboundP2';
if (standId === '3') return 'Stacker'; if (standId === '3') return 'InboundP3';
if (standId === '4') return 'PickP1'; if (standId === '4') return 'PickP1';
if (standId === '5') return 'PickP2'; if (standId === '5') return 'PickP2';
if (standId === '6') return 'PickP3'; if (standId === '6') return 'PickP3';
@ -180,6 +182,8 @@ export default {
<style> <style>
@import './assets/board-styles.css'; @import './assets/board-styles.css';
/* 增大标题字体大小 */ /* 增大标题字体大小 */
.navbar .brand { .navbar .brand {
font-size: 50px !important; font-size: 50px !important;
@ -188,6 +192,7 @@ export default {
/* 增加标题与内容区域的间距 */ /* 增加标题与内容区域的间距 */
.navbar { .navbar {
color: #000000; /* 黑色字体 */
margin-bottom: 30px; margin-bottom: 30px;
} }
@ -197,10 +202,16 @@ export default {
/* 或者增加品牌标题的上下边距 */ /* 或者增加品牌标题的上下边距 */
.navbar .brand { .navbar .brand {
color: #000000; /* 黑色字体 */
font-size: 50px !important; font-size: 50px !important;
font-weight: 700; font-weight: 700;
margin: 0 35px; margin: 0 35px;
white-space: nowrap; /* 防止换行 */
width: fit-content; /* 根据内容调整宽度 */
min-width: 800px; /* 设置最小宽度确保足够显示 */
text-align: center; /* 居中对齐 */
} }
</style> </style>

View File

@ -56,7 +56,7 @@ function getCellClass(col, row) {
.table-wrapper { .table-wrapper {
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
border: 1px solid #20315e; border: 1px solid #000000;
box-shadow: 0 4px 16px rgba(0,0,0,.35); box-shadow: 0 4px 16px rgba(0,0,0,.35);
} }
@ -67,8 +67,8 @@ table {
} }
thead th { thead th {
background: #142357; background: #ff9b00;
color: #fff; color: #000000;
padding: 12px 10px; padding: 12px 10px;
font-weight: 700; font-weight: 700;
font-size: 18px; font-size: 18px;
@ -93,7 +93,7 @@ tbody td:last-child {
} }
.empty-row td { .empty-row td {
color: #8fa3d6; color: #000000;
padding: 24px 0; padding: 24px 0;
} }

View File

@ -7,14 +7,14 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from 'vue'; import { ref, onMounted, onUnmounted } from 'vue';
import DataTable from '../components/DataTable.vue'; import DataTable from '../components/DataTable.vue';
import { getTaskTypInData } from '../services/api'; import { getTaskTypInData } from '@/services/api';
// //
const columns = [ const columns = [
{ key: 'vehicleId', title: '料箱号' }, { key: 'vehicleId', title: '料箱号' },
{ key: 'origin', title: '起点' }, { key: 'origin', title: '起点' },
{ key: 'destination', title: '终点' }, { key: 'destination', title: '终点' },
{ key: 'taskPriority', title: '优先级' }, //{ key: 'taskPriority', title: '' },
{ key: 'taskStatus', title: '状态' }, { key: 'taskStatus', title: '状态' },
]; ];
@ -40,7 +40,7 @@ function mapStatus(status) {
async function load() { async function load() {
try { try {
const data = await getTaskTypInData({ pageNum: 1, pageSize: 200 }); const data = await getTaskTypInData({ pageNum: 1, pageSize: 200, standId: 1 });
const list = data || []; const list = data || [];
rows.value = list.map((t) => ({ rows.value = list.map((t) => ({
vehicleId: t?.vehicleId ?? '', vehicleId: t?.vehicleId ?? '',
@ -90,4 +90,28 @@ onUnmounted(() => {
font-size: 40px; /* 表格内容字体 */ font-size: 40px; /* 表格内容字体 */
padding: 16px 12px; /* 同时增加内边距使布局更舒适 */ padding: 16px 12px; /* 同时增加内边距使布局更舒适 */
} }
/* 设置第一列料箱号宽度为30% */
:deep(th:nth-child(1)),
:deep(td:nth-child(1)) {
width: 48%;
}
/* 设置第二列起点宽度为10% */
:deep(th:nth-child(2)),
:deep(td:nth-child(2)) {
width: 12%;
}
/* 设置第三列(终点)宽度 */
:deep(th:nth-child(3)),
:deep(td:nth-child(3)) {
width: 20%;
}
/* 设置第四列(优先级)宽度 */
:deep(th:nth-child(4)),
:deep(td:nth-child(4)) {
width: 20%;
}
</style> </style>

View File

@ -0,0 +1,117 @@
<template>
<div>
<DataTable :columns="columns" :data="rows" />
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import DataTable from '../components/DataTable.vue';
import { getTaskTypInData } from '@/services/api';
//
const columns = [
{ key: 'vehicleId', title: '料箱号' },
{ key: 'origin', title: '起点' },
{ key: 'destination', title: '终点' },
//{ key: 'taskPriority', title: '' },
{ key: 'taskStatus', title: '状态' },
];
const rows = ref([]);
let timer = null;
function mapStatus(status) {
const code = Number(status);
// WmsStackerTaskStatusEnums
switch (code) {
case -2: return '定时器用';
case -1: return '暂存';
case 0: return '初始化';
case 1: return '已解析';
case 2: return '已下发';
case 3: return '正在执行';
case 4: return '执行完成';
case 98: return '已取消';
case 99: return '执行异常';
default: return String(status ?? '');
}
}
async function load() {
try {
const data = await getTaskTypInData({ pageNum: 1, pageSize: 200, standId: 2 });
const list = data || [];
rows.value = list.map((t) => ({
vehicleId: t?.vehicleId ?? '',
origin: t?.origin ?? t?.startPoint ?? '',
destination: t?.destination ?? t?.endPoint ?? '',
taskPriority: (
t?.task_priority ??
t?.taskPriority ??
t?.priority ??
t?.priorityLevel ??
''
),
taskStatus: mapStatus(t?.taskStatus ?? t?.status),
}));
} catch (error) {
console.error('加载入库数据失败:', error);
}
}
onMounted(() => {
load();
timer = setInterval(load, 5000);
});
onUnmounted(() => {
if (timer) {
clearInterval(timer);
}
});
</script>
<style scoped>
.title-center {
text-align: center;
}
/* 增大表格整体字体 */
:deep(.table-wrapper) {
font-size: 40px;
}
:deep(thead th) {
font-size: 40px; /* 表头字体稍大 */
}
:deep(tbody td) {
font-size: 40px; /* 表格内容字体 */
padding: 16px 12px; /* 同时增加内边距使布局更舒适 */
}
/* 设置第一列料箱号宽度为30% */
:deep(th:nth-child(1)),
:deep(td:nth-child(1)) {
width: 48%;
}
/* 设置第二列起点宽度为10% */
:deep(th:nth-child(2)),
:deep(td:nth-child(2)) {
width: 12%;
}
/* 设置第三列(终点)宽度 */
:deep(th:nth-child(3)),
:deep(td:nth-child(3)) {
width: 20%;
}
/* 设置第四列(优先级)宽度 */
:deep(th:nth-child(4)),
:deep(td:nth-child(4)) {
width: 20%;
}
</style>

View File

@ -0,0 +1,117 @@
<template>
<div>
<DataTable :columns="columns" :data="rows" />
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import DataTable from '../components/DataTable.vue';
import { getTaskTypInData } from '@/services/api';
//
const columns = [
{ key: 'vehicleId', title: '料箱号' },
{ key: 'origin', title: '起点' },
{ key: 'destination', title: '终点' },
//{ key: 'taskPriority', title: '' },
{ key: 'taskStatus', title: '状态' },
];
const rows = ref([]);
let timer = null;
function mapStatus(status) {
const code = Number(status);
// WmsStackerTaskStatusEnums
switch (code) {
case -2: return '定时器用';
case -1: return '暂存';
case 0: return '初始化';
case 1: return '已解析';
case 2: return '已下发';
case 3: return '正在执行';
case 4: return '执行完成';
case 98: return '已取消';
case 99: return '执行异常';
default: return String(status ?? '');
}
}
async function load() {
try {
const data = await getTaskTypInData({ pageNum: 1, pageSize: 200, standId: 3 });
const list = data || [];
rows.value = list.map((t) => ({
vehicleId: t?.vehicleId ?? '',
origin: t?.origin ?? t?.startPoint ?? '',
destination: t?.destination ?? t?.endPoint ?? '',
taskPriority: (
t?.task_priority ??
t?.taskPriority ??
t?.priority ??
t?.priorityLevel ??
''
),
taskStatus: mapStatus(t?.taskStatus ?? t?.status),
}));
} catch (error) {
console.error('加载入库数据失败:', error);
}
}
onMounted(() => {
load();
timer = setInterval(load, 5000);
});
onUnmounted(() => {
if (timer) {
clearInterval(timer);
}
});
</script>
<style scoped>
.title-center {
text-align: center;
}
/* 增大表格整体字体 */
:deep(.table-wrapper) {
font-size: 40px;
}
:deep(thead th) {
font-size: 40px; /* 表头字体稍大 */
}
:deep(tbody td) {
font-size: 40px; /* 表格内容字体 */
padding: 16px 12px; /* 同时增加内边距使布局更舒适 */
}
/* 设置第一列料箱号宽度为30% */
:deep(th:nth-child(1)),
:deep(td:nth-child(1)) {
width: 48%;
}
/* 设置第二列起点宽度为10% */
:deep(th:nth-child(2)),
:deep(td:nth-child(2)) {
width: 12%;
}
/* 设置第三列(终点)宽度 */
:deep(th:nth-child(3)),
:deep(td:nth-child(3)) {
width: 20%;
}
/* 设置第四列(优先级)宽度 */
:deep(th:nth-child(4)),
:deep(td:nth-child(4)) {
width: 20%;
}
</style>

View File

@ -13,8 +13,6 @@ import { getPickTaskDataP1 } from '@/services/api';
const columns = [ const columns = [
{ key: 'vehicleId', title: '料箱号', width: 200 }, { key: 'vehicleId', title: '料箱号', width: 200 },
{ key: 'pickStand', title: '拣选站台' }, { key: 'pickStand', title: '拣选站台' },
{ key: 'createTime', title: '创建时间' },
{ key: 'arriveTime', title: '到达时间' },
{ key: 'pickStatus', title: '状态' }, { key: 'pickStatus', title: '状态' },
]; ];
@ -83,9 +81,22 @@ onUnmounted(() => {
padding: 16px 12px; /* 同时增加内边距使布局更舒适 */ padding: 16px 12px; /* 同时增加内边距使布局更舒适 */
} }
/* 设置料箱号列更宽 */ /* 设置第一列料箱号宽度为30% */
:deep(th:first-child), :deep(th:nth-child(1)),
:deep(td:first-child) { :deep(td:nth-child(1)) {
width: 50%;
}
/* 设置第二列起点宽度为10% */
:deep(th:nth-child(2)),
:deep(td:nth-child(2)) {
width: 25%; width: 25%;
} }
/* 设置第三列(终点)宽度 */
:deep(th:nth-child(3)),
:deep(td:nth-child(3)) {
width: 25%;
}
</style> </style>

View File

@ -13,8 +13,6 @@ import { getPickTaskDataP2 } from '@/services/api';
const columns = [ const columns = [
{ key: 'vehicleId', title: '料箱号', width: 200 }, { key: 'vehicleId', title: '料箱号', width: 200 },
{ key: 'pickStand', title: '拣选站台' }, { key: 'pickStand', title: '拣选站台' },
{ key: 'createTime', title: '创建时间' },
{ key: 'arriveTime', title: '到达时间' },
{ key: 'pickStatus', title: '状态' }, { key: 'pickStatus', title: '状态' },
]; ];
@ -83,9 +81,20 @@ onUnmounted(() => {
padding: 16px 12px; /* 同时增加内边距使布局更舒适 */ padding: 16px 12px; /* 同时增加内边距使布局更舒适 */
} }
/* 设置料箱号列更宽 */ /* 设置第一列料箱号宽度为30% */
:deep(th:first-child), :deep(th:nth-child(1)),
:deep(td:first-child) { :deep(td:nth-child(1)) {
width: 50%;
}
/* 设置第二列起点宽度为10% */
:deep(th:nth-child(2)),
:deep(td:nth-child(2)) {
width: 25%;
}
/* 设置第三列(终点)宽度 */
:deep(th:nth-child(3)),
:deep(td:nth-child(3)) {
width: 25%; width: 25%;
} }
</style> </style>

View File

@ -13,8 +13,6 @@ import { getPickTaskDataP3 } from '@/services/api';
const columns = [ const columns = [
{ key: 'vehicleId', title: '料箱号' }, { key: 'vehicleId', title: '料箱号' },
{ key: 'pickStand', title: '拣选站台' }, { key: 'pickStand', title: '拣选站台' },
{ key: 'createTime', title: '创建时间' },
{ key: 'arriveTime', title: '到达时间' },
{ key: 'pickStatus', title: '状态' }, { key: 'pickStatus', title: '状态' },
]; ];
@ -83,9 +81,20 @@ onUnmounted(() => {
padding: 16px 12px; /* 同时增加内边距使布局更舒适 */ padding: 16px 12px; /* 同时增加内边距使布局更舒适 */
} }
/* 设置料箱号列更宽 */ /* 设置第一列料箱号宽度为30% */
:deep(th:first-child), :deep(th:nth-child(1)),
:deep(td:first-child) { :deep(td:nth-child(1)) {
width: 50%;
}
/* 设置第二列起点宽度为10% */
:deep(th:nth-child(2)),
:deep(td:nth-child(2)) {
width: 25%;
}
/* 设置第三列(终点)宽度 */
:deep(th:nth-child(3)),
:deep(td:nth-child(3)) {
width: 25%; width: 25%;
} }
</style> </style>

View File

@ -1,8 +1,8 @@
import axios from 'axios' import axios from 'axios'
const request = axios.create({ const request = axios.create({
//baseURL: 'http://172.18.222.253:12315/wms', baseURL: 'http://172.18.222.253:12315/wms',
baseURL: 'http://localhost:12315/wms', //baseURL: 'http://localhost:12315/wms',
timeout: 5000 timeout: 5000
}) })
// 172.18.222.253 // 172.18.222.253

View File

@ -14,13 +14,26 @@
<!-- <el-form-item label="料号" prop="goodsId">--> <!-- <el-form-item label="料号" prop="goodsId">-->
<!-- <el-input v-model="outTaskEntity.goodsId" @blur="getLackQty()" clearable/>--> <!-- <el-input v-model="outTaskEntity.goodsId" @blur="getLackQty()" clearable/>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <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-form-item label="数量" prop="needNum">-->
<!-- <el-input-number style="width: 196px" v-model.number="outTaskEntity.needNum"--> <!-- <el-input-number style="width: 196px" v-model.number="outTaskEntity.needNum"-->
<!-- controls-position="right" :min="1" clearable/>--> <!-- controls-position="right" :min="1" clearable/>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="箱号" prop="vehicleId">-->
<!-- <el-input v-model="outTaskEntity.vehicleId" clearable/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="特殊库存" prop="specialStock">-->
<!-- <el-input v-model="outTaskEntity.specialStock" ref="specialStock" clearable/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="特殊库存号" prop="specialStockNo">-->
<!-- <el-input v-model="outTaskEntity.specialStockNo" ref="specialStockNo" clearable/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="特殊库存item号" prop="specialStockItemNo">-->
<!-- <el-input v-model="outTaskEntity.specialStockItemNo" ref="specialStockItemNo" clearable/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="批次号" prop="batchNo">-->
<!-- <el-input v-model="outTaskEntity.batchNo" ref="batchNo" clearable/>-->
<!-- </el-form-item>-->
<!-- &lt;!&ndash; <el-form-item label="原因" prop="reason" v-if="outTaskEntity.outType === 9">--> <!-- &lt;!&ndash; <el-form-item label="原因" prop="reason" v-if="outTaskEntity.outType === 9">-->
<!-- <el-select-v2 style="width: 196px" v-model="outTaskEntity.reason" placeholder="请选择紧急出库原因"--> <!-- <el-select-v2 style="width: 196px" v-model="outTaskEntity.reason" placeholder="请选择紧急出库原因"-->
<!-- :options="reasonOptions"></el-select-v2>--> <!-- :options="reasonOptions"></el-select-v2>-->
@ -142,7 +155,11 @@ let outTaskEntity = reactive({
vehicleId: '', vehicleId: '',
reason: '', reason: '',
workOrder: '', workOrder: '',
needNum: null needNum: null,
specialStock: '',
specialStockNo: '',
specialStockItemNo: '',
batchNo: ''
}) })
const requestRules = reactive({ const requestRules = reactive({
outType: [ outType: [
@ -393,6 +410,10 @@ const clearInput = () => {
outTaskEntity.goodsId = '' outTaskEntity.goodsId = ''
outTaskEntity.vehicleId = '' outTaskEntity.vehicleId = ''
outTaskEntity.needNum = null outTaskEntity.needNum = null
outTaskEntity.specialStock = ''
outTaskEntity.specialStockNo = ''
outTaskEntity.batchNo = ''
outTaskEntity.specialStockItemNo = ''
} }
// //
// //
@ -408,13 +429,17 @@ const confirmOut = () => {
const request = { const request = {
// outType: outTaskEntity.outType, // outType: outTaskEntity.outType,
goodsId: outTaskEntity.goodsId ? outTaskEntity.goodsId.toUpperCase().trim() : '', goodsId: outTaskEntity.goodsId ? outTaskEntity.goodsId.toUpperCase().trim() : '',
// vehicleId: outTaskEntity.vehicleId ? outTaskEntity.vehicleId.toUpperCase().trim() : '', vehicleId: outTaskEntity.vehicleId ? outTaskEntity.vehicleId.toUpperCase().trim() : '',
needNum: outTaskEntity.needNum, needNum: outTaskEntity.needNum,
// reason: outTaskEntity.reason, // reason: outTaskEntity.reason,
workOrder: outTaskEntity.workOrder ? outTaskEntity.workOrder.trim() : '', workOrder: outTaskEntity.workOrder ? outTaskEntity.workOrder.trim() : '',
destination: STAND_ID, destination: STAND_ID,
userName: USER_NAME, userName: USER_NAME,
standId: STAND_ID standId: STAND_ID,
specialStock: outTaskEntity.specialStock ? outTaskEntity.specialStock.toUpperCase().trim() : '',
specialStockNo: outTaskEntity.specialStockNo ? outTaskEntity.specialStockNo.toUpperCase().trim() : '',
specialStockItemNo: outTaskEntity.specialStockItemNo ? outTaskEntity.specialStockItemNo.toUpperCase().trim() : '',
batchNo: outTaskEntity.batchNo ? outTaskEntity.batchNo.toUpperCase().trim() : '',
} }
loading.open('处理中...') loading.open('处理中...')
requireStockOut(request).then(res => { requireStockOut(request).then(res => {

View File

@ -17,6 +17,11 @@
<el-input class="form-input large-center-input" v-model="bindingData.goodsId" clearable readonly/> <el-input class="form-input large-center-input" v-model="bindingData.goodsId" clearable readonly/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="22" :offset="1">
<el-form-item label="跟单信息:" required>
<el-input class="form-input large-center-input" v-model="bindingData.remark" clearable readonly/>
</el-form-item>
</el-col>
<el-col :span="22" :offset="1"> <el-col :span="22" :offset="1">
<el-form-item label="本次实际拣选:" required> <el-form-item label="本次实际拣选:" required>
<el-input class="form-input large-center-input" v-model="bindingData.planPickQty" clearable/> <el-input class="form-input large-center-input" v-model="bindingData.planPickQty" clearable/>
@ -110,7 +115,8 @@ export default {
putArea: '', putArea: '',
warningQty: null, warningQty: null,
containerNo: '', containerNo: '',
standId: '' standId: '',
remark: ''
}, },
transferList: [], transferList: [],
inventoryList: [], inventoryList: [],
@ -209,6 +215,12 @@ export default {
confirmCurrentTask(request, { timeout: 15000 }).then(res => { confirmCurrentTask(request, { timeout: 15000 }).then(res => {
const responseData = res.data; const responseData = res.data;
if (responseData.code === 0) { if (responseData.code === 0) {
if (responseData.message === "继续拣选"){
ElMessageBox.alert('该料箱还有任务,请继续拣选!', '提示', {
confirmButtonText: '确定',
type: 'info'
});
}
ElMessage({ ElMessage({
message: '转移成功', message: '转移成功',
type: 'success', type: 'success',
@ -243,7 +255,7 @@ export default {
this.bindingData.planPickQty = ''; this.bindingData.planPickQty = '';
this.bindingData.realRemainQty = ''; this.bindingData.realRemainQty = '';
this.bindingData.containerNo = ''; this.bindingData.containerNo = '';
this.bindingData.remark = '';
// //
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.sourceBoxInput.focus(); this.$refs.sourceBoxInput.focus();
@ -293,6 +305,7 @@ export default {
this.bindingData.isOut = result.stockConfirm.isOut this.bindingData.isOut = result.stockConfirm.isOut
this.bindingData.putArea = result.stockConfirm.putArea || '' this.bindingData.putArea = result.stockConfirm.putArea || ''
this.bindingData.warningQty = result.stockConfirm.warningQty this.bindingData.warningQty = result.stockConfirm.warningQty
this.bindingData.remark = result.stockConfirm.remark
} }
console.log(this.bindingData) console.log(this.bindingData)
} else { } else {

View File

@ -16,6 +16,7 @@ public enum WmsPickTaskStatusEnum {
RUN(2, "执行中"), RUN(2, "执行中"),
ARRIVE(3, "已到达"), ARRIVE(3, "已到达"),
LEAVE(4, "已离开"), LEAVE(4, "已离开"),
NOSEND(6, "不必下发"),
CANCEL(5, "已取消"); CANCEL(5, "已取消");
private final Integer code; private final Integer code;
private final String desc; private final String desc;

View File

@ -8,6 +8,10 @@ import com.wms_main.service.controller.IDataControllerService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.List; import java.util.List;
/** /**
@ -21,14 +25,16 @@ import java.util.List;
public class DataController { public class DataController {
private final IDataControllerService dataControllerService; private final IDataControllerService dataControllerService;
/** /**
* 获取入库数据 * 获取入库数据
*/ */
@GetMapping("/getTaskTypInData") @GetMapping("/getTaskTypInData")
public Object getTaskTypInData(@RequestParam(defaultValue = "1") int pageNum, public Object getTaskTypInData(@RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "10") int pageSize) { @RequestParam(defaultValue = "10") int pageSize,
@RequestParam(defaultValue = "1") int standId) {
try { try {
return dataControllerService.getTaskTypInData(pageNum, pageSize); return dataControllerService.getTaskTypInData(pageNum, pageSize, standId);
} catch (Exception e) { } catch (Exception e) {
return "获取入库数据失败: " + e.getMessage(); return "获取入库数据失败: " + e.getMessage();
} }

View File

@ -37,7 +37,7 @@ public class ExcelController {
* @return 导入结果 * @return 导入结果
* @throws Exception 异常 * @throws Exception 异常
*/ */
@PostMapping("/importBaseGoods") //@PostMapping("/importBaseGoods")
public BaseWmsApiResponse importBaseGoods(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception { public BaseWmsApiResponse importBaseGoods(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception {
return importExcelEasyPoi.doImportBaseGoods(file, fileVo); return importExcelEasyPoi.doImportBaseGoods(file, fileVo);
} }
@ -49,7 +49,7 @@ public class ExcelController {
* @return 导入结果 * @return 导入结果
* @throws Exception 异常 * @throws Exception 异常
*/ */
@PostMapping("/importInventoryRequest") //@PostMapping("/importInventoryRequest")
public BaseWmsApiResponse importInventoryRequest(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception { public BaseWmsApiResponse importInventoryRequest(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception {
return importExcelEasyPoi.doImportInventoryRequest(file, fileVo); return importExcelEasyPoi.doImportInventoryRequest(file, fileVo);
} }
@ -61,7 +61,7 @@ public class ExcelController {
* @return 导入结果 * @return 导入结果
* @throws Exception 异常 * @throws Exception 异常
*/ */
@PostMapping("/importKanban") //@PostMapping("/importKanban")
public BaseWmsApiResponse importKanban(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception { public BaseWmsApiResponse importKanban(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception {
return importExcelEasyPoi.doImportKanban(file, fileVo); return importExcelEasyPoi.doImportKanban(file, fileVo);
} }
@ -73,7 +73,7 @@ public class ExcelController {
* @return 导入结果 * @return 导入结果
* @throws Exception 异常 * @throws Exception 异常
*/ */
@PostMapping("/importDbs") //@PostMapping("/importDbs")
public BaseWmsApiResponse importDbs(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception { public BaseWmsApiResponse importDbs(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception {
return importExcelEasyPoi.doImportDbs(file, fileVo); return importExcelEasyPoi.doImportDbs(file, fileVo);
} }
@ -85,7 +85,7 @@ public class ExcelController {
* @return 导入结果 * @return 导入结果
* @throws Exception 异常 * @throws Exception 异常
*/ */
@PostMapping("/importProduct") //@PostMapping("/importProduct")
public BaseWmsApiResponse importProduct(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception { public BaseWmsApiResponse importProduct(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception {
return importExcelEasyPoi.doImportProduct(file, fileVo); return importExcelEasyPoi.doImportProduct(file, fileVo);
} }
@ -97,7 +97,7 @@ public class ExcelController {
* @return 导入结果 * @return 导入结果
* @throws Exception 异常 * @throws Exception 异常
*/ */
@PostMapping("/importServiceProduct") //@PostMapping("/importServiceProduct")
public BaseWmsApiResponse importServiceProduct(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception { public BaseWmsApiResponse importServiceProduct(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception {
return importExcelEasyPoi.doImportServiceProduct(file, fileVo); return importExcelEasyPoi.doImportServiceProduct(file, fileVo);
} }
@ -109,7 +109,7 @@ public class ExcelController {
* @return 导入结果 * @return 导入结果
* @throws Exception 异常 * @throws Exception 异常
*/ */
@PostMapping("/importProductExtend") //@PostMapping("/importProductExtend")
public BaseWmsApiResponse importProductExtend(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception { public BaseWmsApiResponse importProductExtend(@RequestPart("file") MultipartFile file, @RequestPart("fileVo") FileVo fileVo) throws Exception {
return importExcelEasyPoi.doImportProductExtend(file, fileVo); return importExcelEasyPoi.doImportProductExtend(file, fileVo);
} }
@ -118,7 +118,7 @@ public class ExcelController {
* 导出DBS * 导出DBS
* @param dbsQuery 请求 * @param dbsQuery 请求
*/ */
@PostMapping("/exportDbsWithExcel") //@PostMapping("/exportDbsWithExcel")
public void exportDbsWithExcel(@RequestBody DbsQuery dbsQuery, HttpServletResponse response) throws IOException { public void exportDbsWithExcel(@RequestBody DbsQuery dbsQuery, HttpServletResponse response) throws IOException {
exportExcelEasyPoi.doExportDbs(dbsQuery, response); exportExcelEasyPoi.doExportDbs(dbsQuery, response);
} }
@ -127,7 +127,7 @@ public class ExcelController {
* 导出配料单 * 导出配料单
* @param kittingBomQuery 请求 * @param kittingBomQuery 请求
*/ */
@PostMapping("/exportKittingBomWithExcel") //@PostMapping("/exportKittingBomWithExcel")
public void exportKittingBomWithExcel(@RequestBody KittingBomQuery kittingBomQuery, HttpServletResponse response) throws IOException { public void exportKittingBomWithExcel(@RequestBody KittingBomQuery kittingBomQuery, HttpServletResponse response) throws IOException {
exportExcelEasyPoi.doExportKittingBom(kittingBomQuery, response); exportExcelEasyPoi.doExportKittingBom(kittingBomQuery, response);
} }
@ -136,7 +136,7 @@ public class ExcelController {
* 导出配对关系 * 导出配对关系
* @param kittingBomRelationQuery 请求 * @param kittingBomRelationQuery 请求
*/ */
@PostMapping("/exportKittingBomRelationWithExcel") //@PostMapping("/exportKittingBomRelationWithExcel")
public void exportKittingBomRelationWithExcel(@RequestBody KittingBomRelationQuery kittingBomRelationQuery, HttpServletResponse response) throws IOException { public void exportKittingBomRelationWithExcel(@RequestBody KittingBomRelationQuery kittingBomRelationQuery, HttpServletResponse response) throws IOException {
exportExcelEasyPoi.doExportKittingBomRelations(kittingBomRelationQuery, response); exportExcelEasyPoi.doExportKittingBomRelations(kittingBomRelationQuery, response);
} }
@ -154,7 +154,7 @@ public class ExcelController {
* 导出物料基础信息 * 导出物料基础信息
* @param goodsQuery 请求 * @param goodsQuery 请求
*/ */
@PostMapping("/exportGoodsExcel") //@PostMapping("/exportGoodsExcel")
public void exportGoodsExcel(@RequestBody GoodsQuery goodsQuery, HttpServletResponse response) throws IOException { public void exportGoodsExcel(@RequestBody GoodsQuery goodsQuery, HttpServletResponse response) throws IOException {
exportExcelEasyPoi.doExportGoods(goodsQuery, response); exportExcelEasyPoi.doExportGoods(goodsQuery, response);
} }
@ -172,7 +172,7 @@ public class ExcelController {
* 导出工作详情信息 * 导出工作详情信息
* @param workSummaryQuery 请求 * @param workSummaryQuery 请求
*/ */
@PostMapping("/exportWorkSummaryExcel") //@PostMapping("/exportWorkSummaryExcel")
public void exportWorkSummaryExcel(@RequestBody WorkSummaryQuery workSummaryQuery, HttpServletResponse response) throws IOException { public void exportWorkSummaryExcel(@RequestBody WorkSummaryQuery workSummaryQuery, HttpServletResponse response) throws IOException {
exportExcelEasyPoi.doExportWorkSummaryExcel(workSummaryQuery, response); exportExcelEasyPoi.doExportWorkSummaryExcel(workSummaryQuery, response);
} }
@ -181,7 +181,7 @@ public class ExcelController {
* 导出看板需求 * 导出看板需求
* @param kanbanQuery 请求 * @param kanbanQuery 请求
*/ */
@PostMapping("/exportKanbanExcel") //@PostMapping("/exportKanbanExcel")
public void exportKanbanExcel(@RequestBody KanbanQuery kanbanQuery, HttpServletResponse response) throws IOException { public void exportKanbanExcel(@RequestBody KanbanQuery kanbanQuery, HttpServletResponse response) throws IOException {
exportExcelEasyPoi.doExportKanbanExcel(kanbanQuery, response); exportExcelEasyPoi.doExportKanbanExcel(kanbanQuery, response);
} }

View File

@ -30,8 +30,10 @@ public class LocationController {
@PostMapping("/genLocations") @PostMapping("/genLocations")
public BaseWmsApiResponse genLocations(@RequestBody LocationQuery locationQuery) { public BaseWmsApiResponse genLocations(@RequestBody LocationQuery locationQuery) {
return locationControllerService.genLocations(locationQuery); return locationControllerService.genLocations(locationQuery);
//return locationControllerService.deleteLocation();
} }
/** /**
* 分页查询库位 * 分页查询库位
* @param locationQuery 查询参数 * @param locationQuery 查询参数

View File

@ -48,7 +48,7 @@ public class TaskController {
* @param stockInRequest 请求信息 * @param stockInRequest 请求信息
* @return 处理结果 * @return 处理结果
*/ */
@PostMapping("/requireStockIn") //@PostMapping("/requireStockIn")
public BaseWmsApiResponse requireStockIn(@RequestBody StockInRequest stockInRequest) { public BaseWmsApiResponse requireStockIn(@RequestBody StockInRequest stockInRequest) {
return taskControllerService.requireStockIn(stockInRequest); return taskControllerService.requireStockIn(stockInRequest);
} }
@ -58,7 +58,7 @@ public class TaskController {
* @param stockOutRequest 请求信息 * @param stockOutRequest 请求信息
* @return 处理结果 * @return 处理结果
*/ */
@PostMapping("/requireStockOut") //@PostMapping("/requireStockOut")
public BaseWmsApiResponse requireStockOut(@RequestBody StockOutRequest stockOutRequest) { public BaseWmsApiResponse requireStockOut(@RequestBody StockOutRequest stockOutRequest) {
return taskControllerService.requireStockOut(stockOutRequest); return taskControllerService.requireStockOut(stockOutRequest);
} }
@ -103,10 +103,10 @@ public class TaskController {
* @param voiRequest 请求信息 * @param voiRequest 请求信息
* @return 处理结果 * @return 处理结果
*/ */
@PostMapping("/requireVehiclesForIn") // @PostMapping("/requireVehiclesForIn")
public BaseWmsApiResponse requireVehiclesForIn(@RequestBody VehicleOutForInRequest voiRequest) { // public BaseWmsApiResponse requireVehiclesForIn(@RequestBody VehicleOutForInRequest voiRequest) {
return taskControllerService.requireVehiclesForIn(voiRequest); // return taskControllerService.requireVehiclesForIn(voiRequest);
} // }
/** /**
* 接收wcs反馈任务状态 * 接收wcs反馈任务状态

View File

@ -1,20 +1,28 @@
package com.wms_main.controller.wms; package com.wms_main.controller.wms;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.wms_main.model.dto.request.ewm.SendEwmGetStockInformationRequest; import com.wms_main.model.dto.request.ewm.SendEwmGetStockInformationRequest;
import com.wms_main.model.dto.request.ewm.SendWarehouseInCompletedRequest; import com.wms_main.model.dto.request.ewm.SendWarehouseInCompletedRequest;
import com.wms_main.model.dto.request.ewm.SendWarehouseOutCompletedRequest; import com.wms_main.model.dto.request.ewm.SendWarehouseOutCompletedRequest;
import com.wms_main.model.dto.request.wcs.WcsVehicleInRequest; import com.wms_main.model.dto.request.wcs.WcsVehicleInRequest;
import com.wms_main.model.dto.response.ewm.EwmApiBackResponse; import com.wms_main.model.dto.response.ewm.EwmApiBackResponse;
import com.wms_main.model.dto.response.ewm.EwmApiStockResponse; import com.wms_main.model.dto.response.ewm.EwmApiStockResponse;
import com.wms_main.model.po.TAppEquipment;
import com.wms_main.model.po.TAppLocation;
import com.wms_main.repository.utils.StringUtils;
import com.wms_main.repository.utils.UUIDUtils; import com.wms_main.repository.utils.UUIDUtils;
import com.wms_main.service.api.IEwmApiService; import com.wms_main.service.api.IEwmApiService;
import com.wms_main.service.business.IStackerTaskService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 测试专用 * 测试专用
@ -27,7 +35,7 @@ import java.util.List;
public class TestController { public class TestController {
private static final Logger log = LoggerFactory.getLogger(TestController.class); private static final Logger log = LoggerFactory.getLogger(TestController.class);
private final IEwmApiService ewmApiService; private final IEwmApiService ewmApiService;
private final IStackerTaskService stackerTaskService;// 堆垛机任务服务
@GetMapping(value = "/test") @GetMapping(value = "/test")
public String testApi() { public String testApi() {
return UUIDUtils.getNewUUID(); return UUIDUtils.getNewUUID();
@ -64,4 +72,11 @@ public class TestController {
//List<EwmApiStockResponse.BinStock> binStocks = ewmApiService.getEwmStock(request).getContent(); //List<EwmApiStockResponse.BinStock> binStocks = ewmApiService.getEwmStock(request).getContent();
return ewmApiService.getEwmStock(request); return ewmApiService.getEwmStock(request);
} }
@PostMapping("/status3")
public String test3() {
//List<Integer> equipmentIds = stackerTaskService.test();
TAppLocation targetLocation = stackerTaskService.requestOneLocation(null, "5555");
return targetLocation.getLocationId();
}
} }

View File

@ -52,7 +52,7 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
* @throws Exception 异常 * @throws Exception 异常
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse doImportDbs(MultipartFile file, FileVo fileVo) throws Exception { public BaseWmsApiResponse doImportDbs(MultipartFile file, FileVo fileVo) throws Exception {
// 设置解析条件 // 设置解析条件
ImportParams dbsImportparams = new ImportParams(); ImportParams dbsImportparams = new ImportParams();
@ -129,7 +129,7 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
* @throws Exception 异常 * @throws Exception 异常
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse doImportProduct(MultipartFile file, FileVo fileVo) throws Exception { public BaseWmsApiResponse doImportProduct(MultipartFile file, FileVo fileVo) throws Exception {
// 设置解析条件 // 设置解析条件
ImportParams productImportparams = new ImportParams(); ImportParams productImportparams = new ImportParams();
@ -208,7 +208,7 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
* @throws Exception 异常 * @throws Exception 异常
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse doImportServiceProduct(MultipartFile file, FileVo fileVo) throws Exception { public BaseWmsApiResponse doImportServiceProduct(MultipartFile file, FileVo fileVo) throws Exception {
// 设置解析条件 // 设置解析条件
ImportParams productImportparams = new ImportParams(); ImportParams productImportparams = new ImportParams();
@ -311,7 +311,7 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
* @throws Exception 异常 * @throws Exception 异常
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse doImportProductExtend(MultipartFile file, FileVo fileVo) throws Exception { public BaseWmsApiResponse doImportProductExtend(MultipartFile file, FileVo fileVo) throws Exception {
// 设置解析条件 // 设置解析条件
ImportParams productImportparams = new ImportParams(); ImportParams productImportparams = new ImportParams();
@ -358,7 +358,7 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
* @return 导入结果 * @return 导入结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse doImportBaseGoods(MultipartFile file, FileVo fileVo) throws Exception { public BaseWmsApiResponse doImportBaseGoods(MultipartFile file, FileVo fileVo) throws Exception {
// 设置解析条件 // 设置解析条件
ImportParams baseGoodsImportparams = new ImportParams(); ImportParams baseGoodsImportparams = new ImportParams();
@ -422,7 +422,7 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
* @throws Exception 异常 * @throws Exception 异常
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse doImportKanban(MultipartFile file, FileVo fileVo) throws Exception { public BaseWmsApiResponse doImportKanban(MultipartFile file, FileVo fileVo) throws Exception {
// 设置解析条件 // 设置解析条件
ImportParams kanbanImportparams = new ImportParams(); ImportParams kanbanImportparams = new ImportParams();
@ -474,7 +474,7 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
* @throws Exception 异常 * @throws Exception 异常
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse doImportInventoryRequest(MultipartFile file, FileVo fileVo) throws Exception { public BaseWmsApiResponse doImportInventoryRequest(MultipartFile file, FileVo fileVo) throws Exception {
// 设置解析条件 // 设置解析条件
ImportParams inventoryRequestImportparams = new ImportParams(); ImportParams inventoryRequestImportparams = new ImportParams();

View File

@ -13,6 +13,7 @@ import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import org.springframework.web.util.ContentCachingRequestWrapper; import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper; import org.springframework.web.util.ContentCachingResponseWrapper;
@ -31,6 +32,9 @@ public class RequestLogFilter extends HttpFilter {
*/ */
private final ITSysLogService sysLogService; private final ITSysLogService sysLogService;
// 添加对RequestMappingHandlerMapping的注入
private final RequestMappingHandlerMapping requestMappingHandlerMapping;
@Override @Override
protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
// Wrapper封装request和response // Wrapper封装request和response
@ -56,7 +60,10 @@ public class RequestLogFilter extends HttpFilter {
String requestContentString = formatStringWithMaxLength(new String(requestContent), 2048); String requestContentString = formatStringWithMaxLength(new String(requestContent), 2048);
String responseContentString = formatStringWithMaxLength(new String(responseContent), 2048); String responseContentString = formatStringWithMaxLength(new String(responseContent), 2048);
RequestLog logInfo = new RequestLog(method, uri, remoteHost, remoteAddr, requestContentString, String.valueOf(status), responseContentString); RequestLog logInfo = new RequestLog(method, uri, remoteHost, remoteAddr, requestContentString, String.valueOf(status), responseContentString);
if (!"GET".equals(method)) {
log.info(logInfo.toString()); log.info(logInfo.toString());
}
// 增加存储数据库的操作 // 增加存储数据库的操作
// new Thread(() -> { // new Thread(() -> {
// try { // try {

View File

@ -53,6 +53,12 @@ public class StockConfirmEntity {
@JsonProperty("warningQty") @JsonProperty("warningQty")
private Integer warningQty; private Integer warningQty;
/**
* 备注
*/
@JsonProperty("remark")
private String remark;
// /** // /**
// * 库存总剩余数量 // * 库存总剩余数量
// */ // */

View File

@ -49,4 +49,28 @@ public class StockOutRequest extends BaseWmsRequest {
*/ */
@JsonProperty("workOrder") @JsonProperty("workOrder")
private String workOrder; private String workOrder;
/**
* 特殊库存标识可选
*/
@JsonProperty("specialStock")
private String specialStock;
/**
* so单号与供应商编号出库指定SO号或者供应商编号出库可选
*/
@JsonProperty("specialStockNo")
private String specialStockNo;
/**
* 特殊库存item号可选
*/
@JsonProperty("specialStockItemNo")
private String specialStockItemNo;
/**
* 批次号可选
*/
@JsonProperty("batchNo")
private String batchNo;
} }

View File

@ -8,6 +8,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* 数据库出库单表映射 * 数据库出库单表映射
@ -134,4 +135,10 @@ public class TAppOuts {
*/ */
@TableField(value = "second_picking_code") @TableField(value = "second_picking_code")
private String secondPickingCode; private String secondPickingCode;
/**
* 拣货时间
*/
@TableField(value = "picking_date")
private Date pickingDate;
} }

View File

@ -77,7 +77,7 @@ public class EwmApiServiceImpl implements IEwmApiService {
HttpRequest httpRequest = HttpRequest.postInstanceOf( HttpRequest httpRequest = HttpRequest.postInstanceOf(
appCommon.getConfigByKey(AppConfigKeyEnums.EWM_SEND_WAREHOUSE_IN_COMPLETED_URL.getKey()), appCommon.getConfigByKey(AppConfigKeyEnums.EWM_SEND_WAREHOUSE_IN_COMPLETED_URL.getKey()),
request, request,
5000, 10000,
"application/json", "application/json",
"Basic " + encodedAuth); "Basic " + encodedAuth);
HttpResponse httpResponse = httpClient.httpPost(httpRequest); HttpResponse httpResponse = httpClient.httpPost(httpRequest);
@ -141,7 +141,7 @@ public class EwmApiServiceImpl implements IEwmApiService {
HttpRequest httpRequest = HttpRequest.postInstanceOf( HttpRequest httpRequest = HttpRequest.postInstanceOf(
finalUrl, finalUrl,
request, request,
5000, 10000,
"application/json", "application/json",
"Basic " + encodedAuth); "Basic " + encodedAuth);
@ -169,7 +169,7 @@ public class EwmApiServiceImpl implements IEwmApiService {
HttpRequest httpRequest = HttpRequest.postInstanceOf( HttpRequest httpRequest = HttpRequest.postInstanceOf(
appCommon.getConfigByKey(AppConfigKeyEnums.EWM_GET_STOCK_LIST_URL.getKey()), appCommon.getConfigByKey(AppConfigKeyEnums.EWM_GET_STOCK_LIST_URL.getKey()),
request, request,
5000, 10000,
"application/json", "application/json",
"Basic " + encodedAuth); "Basic " + encodedAuth);
HttpResponse httpResponse = httpClient.httpPost(httpRequest); HttpResponse httpResponse = httpClient.httpPost(httpRequest);
@ -196,7 +196,7 @@ public class EwmApiServiceImpl implements IEwmApiService {
HttpRequest httpRequest = HttpRequest.postInstanceOf( HttpRequest httpRequest = HttpRequest.postInstanceOf(
appCommon.getConfigByKey(AppConfigKeyEnums.EWM_CHECK_CONTAINER_NO_URL.getKey()), appCommon.getConfigByKey(AppConfigKeyEnums.EWM_CHECK_CONTAINER_NO_URL.getKey()),
request, request,
5000, 10000,
"application/json", "application/json",
"Basic " + encodedAuth); "Basic " + encodedAuth);
HttpResponse httpResponse = httpClient.httpPost(httpRequest); HttpResponse httpResponse = httpClient.httpPost(httpRequest);

View File

@ -36,6 +36,7 @@ public class WcsApiServiceImpl implements IWcsApiService {
public WcsApiResponse<WcsStackerTask> sendWcsStackerTask(WcsStackerTaskRequest request) { public WcsApiResponse<WcsStackerTask> sendWcsStackerTask(WcsStackerTaskRequest request) {
// 设置http请求 // 设置http请求
HttpRequest httpRequest = HttpRequest.postInstanceOf(appCommon.getConfigByKey(AppConfigKeyEnums.WCS_STACKER_TASK_URL.getKey()), request); HttpRequest httpRequest = HttpRequest.postInstanceOf(appCommon.getConfigByKey(AppConfigKeyEnums.WCS_STACKER_TASK_URL.getKey()), request);
httpRequest.setTimeout(30000);
HttpResponse httpResponse = httpClient.httpPost(httpRequest); HttpResponse httpResponse = httpClient.httpPost(httpRequest);
if (httpResponse != null && httpResponse.isSuccess()) { if (httpResponse != null && httpResponse.isSuccess()) {
WcsApiResponse<WcsStackerTask> response = new WcsApiResponse<>(); WcsApiResponse<WcsStackerTask> response = new WcsApiResponse<>();
@ -54,6 +55,7 @@ public class WcsApiServiceImpl implements IWcsApiService {
public WcsApiResponse<WcsPickTask> sendPickTask(WcsPickTaskRequest request) { public WcsApiResponse<WcsPickTask> sendPickTask(WcsPickTaskRequest request) {
// 设置http请求 // 设置http请求
HttpRequest httpRequest = HttpRequest.postInstanceOf(appCommon.getConfigByKey(AppConfigKeyEnums.WCS_PICK_TASK_URL.getKey()), request); HttpRequest httpRequest = HttpRequest.postInstanceOf(appCommon.getConfigByKey(AppConfigKeyEnums.WCS_PICK_TASK_URL.getKey()), request);
httpRequest.setTimeout(30000);
HttpResponse httpResponse = httpClient.httpPost(httpRequest); HttpResponse httpResponse = httpClient.httpPost(httpRequest);
if (httpResponse != null && httpResponse.isSuccess()) { if (httpResponse != null && httpResponse.isSuccess()) {
WcsApiResponse<WcsPickTask> response = new WcsApiResponse<>(); WcsApiResponse<WcsPickTask> response = new WcsApiResponse<>();
@ -72,6 +74,7 @@ public class WcsApiServiceImpl implements IWcsApiService {
public BaseWcsApiResponse releaseBox(WcsReleaseBoxRequest request) { public BaseWcsApiResponse releaseBox(WcsReleaseBoxRequest request) {
// 设置http请求 // 设置http请求
HttpRequest httpRequest = HttpRequest.postInstanceOf(appCommon.getConfigByKey(AppConfigKeyEnums.WCS_RELEASE_BOX_URL.getKey()), request); HttpRequest httpRequest = HttpRequest.postInstanceOf(appCommon.getConfigByKey(AppConfigKeyEnums.WCS_RELEASE_BOX_URL.getKey()), request);
httpRequest.setTimeout(30000);
HttpResponse httpResponse = httpClient.httpPost(httpRequest); HttpResponse httpResponse = httpClient.httpPost(httpRequest);
if (httpResponse != null && httpResponse.isSuccess()) { if (httpResponse != null && httpResponse.isSuccess()) {
return httpResponse.getData(BaseWcsApiResponse.class); return httpResponse.getData(BaseWcsApiResponse.class);
@ -88,6 +91,7 @@ public class WcsApiServiceImpl implements IWcsApiService {
public WcsApiResponse<WcsPickTask> cancelPickTask(WcsPickTaskRequest request) { public WcsApiResponse<WcsPickTask> cancelPickTask(WcsPickTaskRequest request) {
// 设置http请求 // 设置http请求
HttpRequest httpRequest = HttpRequest.postInstanceOf(appCommon.getConfigByKey(AppConfigKeyEnums.WCS_CANCEL_PICK_TASK_URL.getKey()), request); HttpRequest httpRequest = HttpRequest.postInstanceOf(appCommon.getConfigByKey(AppConfigKeyEnums.WCS_CANCEL_PICK_TASK_URL.getKey()), request);
httpRequest.setTimeout(30000);
HttpResponse httpResponse = httpClient.httpPost(httpRequest); HttpResponse httpResponse = httpClient.httpPost(httpRequest);
if (httpResponse != null && httpResponse.isSuccess()) { if (httpResponse != null && httpResponse.isSuccess()) {
WcsApiResponse<WcsPickTask> response = new WcsApiResponse<>(); WcsApiResponse<WcsPickTask> response = new WcsApiResponse<>();

View File

@ -43,4 +43,9 @@ public interface IStackerTaskService {
* @param stackerOutTasks 已完成的出库任务 * @param stackerOutTasks 已完成的出库任务
*/ */
void finishStackerOutTasks(List<TAppTask> stackerOutTasks); void finishStackerOutTasks(List<TAppTask> stackerOutTasks);
/**
* test
*/
List<Integer> test();
} }

View File

@ -15,6 +15,7 @@ import com.wms_main.model.bo.wms.OrderConfirmEntity;
import com.wms_main.model.bo.wms.StockConfirmEntity; import com.wms_main.model.bo.wms.StockConfirmEntity;
import com.wms_main.model.bo.wms.TaskConfirmEntity; import com.wms_main.model.bo.wms.TaskConfirmEntity;
import com.wms_main.model.bo.wms.WmsPickTask; import com.wms_main.model.bo.wms.WmsPickTask;
import com.wms_main.model.dto.request.wcs.WcsBoxArriveRequest;
import com.wms_main.model.dto.request.wcs.WcsPickTaskRequest; import com.wms_main.model.dto.request.wcs.WcsPickTaskRequest;
import com.wms_main.model.dto.request.wcs.WcsReleaseBoxRequest; import com.wms_main.model.dto.request.wcs.WcsReleaseBoxRequest;
import com.wms_main.model.dto.request.wcs.WcsStackerTaskRequest; import com.wms_main.model.dto.request.wcs.WcsStackerTaskRequest;
@ -29,6 +30,7 @@ import com.wms_main.repository.utils.UUIDUtils;
import com.wms_main.service.api.IWcsApiService; import com.wms_main.service.api.IWcsApiService;
import com.wms_main.service.business.IConveyTaskService; import com.wms_main.service.business.IConveyTaskService;
import com.wms_main.service.business.IStockDataService; import com.wms_main.service.business.IStockDataService;
import com.wms_main.service.controller.ITaskControllerService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -154,13 +156,19 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean releaseStandVehicle(TAppPickTask targetPickTask) { public boolean releaseStandVehicle(TAppPickTask targetPickTask) { //已到达的拣选任务
// 判断是否是需要回库 // 判断是否是需要回库
int router = 0;// 默认不需要回库 int router = 0;// 默认不需要回库
// if (!appPickTaskService.exists(new LambdaQueryWrapper<TAppPickTask>()
// .eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
// .ne(TAppPickTask::getPickStand, targetPickTask.getPickStand())
// .ne(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.FOR_IN.getCode()))) {
// router = 1;// 需要回库
// }
// 只要存在状态大于等于-1小于等于2的任务就说明不需要回库
if (!appPickTaskService.exists(new LambdaQueryWrapper<TAppPickTask>() if (!appPickTaskService.exists(new LambdaQueryWrapper<TAppPickTask>()
.eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId()) .eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
.ne(TAppPickTask::getPickStand, targetPickTask.getPickStand()) .between(TAppPickTask::getPickStatus, -1, 2))) {
.ne(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.FOR_IN.getCode()))) {
router = 1; // 需要回库 router = 1; // 需要回库
} }
// 需要回库时需要生成回库任务 // 需要回库时需要生成回库任务
@ -174,39 +182,40 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
appStockService.update(new LambdaUpdateWrapper<TAppStock>() appStockService.update(new LambdaUpdateWrapper<TAppStock>()
.set(TAppStock::getStockStatus, WmsStockStatusEnums.BACK.getCode()) .set(TAppStock::getStockStatus, WmsStockStatusEnums.BACK.getCode())
.eq(TAppStock::getVehicleId, targetPickTask.getVehicleId())); .eq(TAppStock::getVehicleId, targetPickTask.getVehicleId()));
// 查询这个箱子入库用的拣选任务 // // 查询这个箱子入库用的拣选任务
List<TAppPickTask> forInPickTasks = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>() // List<TAppPickTask> forInPickTasks = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
.eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId()) // .eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.FOR_IN.getCode())); // .eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.FOR_IN.getCode()));
boolean haveForIn = false;// 是否要为了入库不回库 boolean haveForIn = false;// 是否要为了入库不回库
for (TAppPickTask forInPickTask : forInPickTasks) { // for (TAppPickTask forInPickTask : forInPickTasks) {
if (!Objects.equals(forInPickTask.getPickStand(), targetPickTask.getPickStand())) { // if (!Objects.equals(forInPickTask.getPickStand(), targetPickTask.getPickStand())) {
haveForIn = true; // haveForIn = true;
} // }
// 生成记录并删除 // // 生成记录并删除
pickRecords.add(new TAppPickTaskBak( // pickRecords.add(new TAppPickTaskBak(
forInPickTask.getPickId(), // forInPickTask.getPickId(),
forInPickTask.getPickStand(), // forInPickTask.getPickStand(),
forInPickTask.getVehicleId(), // forInPickTask.getVehicleId(),
WmsPickTaskStatusEnum.FOR_IN.getCode(), // WmsPickTaskStatusEnum.FOR_IN.getCode(),
forInPickTask.getCreateTime(), // forInPickTask.getCreateTime(),
null, // null,
null, // null,
LocalDateTime.now() // LocalDateTime.now()
)); // ));
} // }
// 没有需要入库的拣选任务 // 没有需要入库的拣选任务
if (!haveForIn) { if (!haveForIn) {
// 判断空箱需不需要回库 // // 判断空箱需不需要回库
String emptyBack = "0"; // String emptyBack = "0";
try { // try {
emptyBack = appCommon.getConfigByKey(AppConfigKeyEnums.EMPTY_BACK.getKey()); // emptyBack = appCommon.getConfigByKey(AppConfigKeyEnums.EMPTY_BACK.getKey());
} catch (Exception e) { // } catch (Exception e) {
log.error("获取空箱回库配置失败,使用默认值不回库。"); // log.error("获取空箱回库配置失败,使用默认值不回库。");
} // }
// 判断这个箱子是不是空箱需要回库 // 判断这个箱子是不是空箱需要回库
if (!stockDataService.isEmptyVehicle(targetPickTask.getVehicleId()) if (!stockDataService.isEmptyVehicle(targetPickTask.getVehicleId())
|| (stockDataService.isEmptyVehicle(targetPickTask.getVehicleId()) && "1".equals(emptyBack))) { // || (stockDataService.isEmptyVehicle(targetPickTask.getVehicleId()) && "1".equals(emptyBack))
) {
// 生成回库任务 // 生成回库任务
TAppTask task = new TAppTask( TAppTask task = new TAppTask(
UUIDUtils.getNewUUID("BACK_"), UUIDUtils.getNewUUID("BACK_"),
@ -241,7 +250,8 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
appPickTaskService.update(new LambdaUpdateWrapper<TAppPickTask>() appPickTaskService.update(new LambdaUpdateWrapper<TAppPickTask>()
.set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.WAIT.getCode()) .set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.WAIT.getCode())
.eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId()) .eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.TEMP.getCode())); .eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.TEMP.getCode())
);
// 将这个载具的库存状态都设置为已出库 // 将这个载具的库存状态都设置为已出库
appStockService.update(new LambdaUpdateWrapper<TAppStock>() appStockService.update(new LambdaUpdateWrapper<TAppStock>()
.set(TAppStock::getStockStatus, WmsStockStatusEnums.OUTED.getCode()) .set(TAppStock::getStockStatus, WmsStockStatusEnums.OUTED.getCode())
@ -262,10 +272,15 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
)); ));
try { try {
appPickTaskBakService.saveBatch(pickRecords); appPickTaskBakService.saveBatch(pickRecords);
// 更新当前载具到达当前点位的拣选任务为已到达
updateVehicleArriveStatus(targetPickTask);
// 删除当前载具在当前站台的拣选任务 // 删除当前载具在当前站台的拣选任务
appPickTaskService.remove(new LambdaQueryWrapper<TAppPickTask>() // appPickTaskService.remove(new LambdaQueryWrapper<TAppPickTask>()
.eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId()) // .eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
.eq(TAppPickTask::getPickStand, targetPickTask.getPickStand())); // .eq(TAppPickTask::getPickStand, targetPickTask.getPickStand())
// .eq(TAppPickTask::getPickId, targetPickTask.getPickId())
// );
appPickTaskService.removeById(targetPickTask.getPickId());
} catch (Exception e) { } catch (Exception e) {
log.error("保存拣选任务记录时发生异常。载具号:{},站台号:{}", targetPickTask.getVehicleId(), targetPickTask.getPickStand()); log.error("保存拣选任务记录时发生异常。载具号:{},站台号:{}", targetPickTask.getVehicleId(), targetPickTask.getPickStand());
return false; return false;
@ -283,6 +298,42 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
return true; return true;
} }
/**
* 更新载具到达状态防止死锁
* @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.warn("没有找到符合条件的 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"));
}
}
/** /**
* 获得对应库存的第一条工作 * 获得对应库存的第一条工作
* *
@ -366,7 +417,7 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
null, null,
null, null,
null, null,
null null,null
); );
resultVo = new WorkConfirmVo(orderConfirmVo, stockConfirmVo); resultVo = new WorkConfirmVo(orderConfirmVo, stockConfirmVo);
break; break;
@ -458,11 +509,13 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
0, 0,
"ASRS", "ASRS",
stockDataService.getWarningQty(), stockDataService.getWarningQty(),
thisOuts.getWorkOrder(),
thisOuts.getSpecialStock() , thisOuts.getSpecialStock() ,
thisOuts.getBatchNo(), thisOuts.getBatchNo(),
thisOuts.getSpecialStockNo(), thisOuts.getSpecialStockNo(),
thisOuts.getSpecialStockItemNo() thisOuts.getSpecialStockItemNo()
); );
resultVo = new TaskConfirmVo(thisPickTask.getPickStand(),false,taskConfirmVo, stockConfirmVo); resultVo = new TaskConfirmVo(thisPickTask.getPickStand(),false,taskConfirmVo, stockConfirmVo);
break; break;

View File

@ -125,6 +125,7 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
equipmentIds = findMostRelaxEquip(); equipmentIds = findMostRelaxEquip();
} }
// 循环设备列表找到合适的库位 // 循环设备列表找到合适的库位
log.info("设备号优先级序列:{}", equipmentIds);
for (Integer equipmentId : equipmentIds) { for (Integer equipmentId : equipmentIds) {
// 判断一下这个设备号是否可用 // 判断一下这个设备号是否可用
TAppEquipment thisEquipment = appEquipmentService.getById(equipmentId); TAppEquipment thisEquipment = appEquipmentService.getById(equipmentId);
@ -152,9 +153,13 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
} }
return filterResult; return filterResult;
}) })
.sorted(Comparator.comparingInt(location -> location.getLCol() + location.getLLayer())) .sorted(Comparator.comparingInt(TAppLocation::getLCol).reversed()) // 按列倒序排列
.sorted(Comparator.comparingInt(TAppLocation::getLLayer))
.sorted(Comparator.comparingInt(TAppLocation::getLDepth).reversed()) .sorted(Comparator.comparingInt(TAppLocation::getLDepth).reversed())
.toList(); .toList();
// .sorted(Comparator.comparingInt(location -> location.getLCol() + location.getLLayer()))
// .sorted(Comparator.comparingInt(TAppLocation::getLDepth).reversed())
// .toList();
// 判断是否输入了subArea // 判断是否输入了subArea
if (locationFilter != null && StringUtils.isNotEmpty(locationFilter.getSubArea())) { if (locationFilter != null && StringUtils.isNotEmpty(locationFilter.getSubArea())) {
// 对candidateLocationList进行排序 // 对candidateLocationList进行排序
@ -243,55 +248,122 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
return result; return result;
} }
public List<Integer> test(){
return findMostRelaxEquip();
}
/** /**
* 找到最空闲的那台设备 * 找到最空闲的那台设备
*/ */
private List<Integer> findMostRelaxEquip() { private List<Integer> findMostRelaxEquip() {
// 构造可用库位map // 构造可用库位map统计每个设备的空闲库位数量
Map<Integer, Integer> equipCountMap = new HashMap<>(); Map<Integer, Integer> equipFreeCountMap = new HashMap<>();
// 找到可以使用的空闲库位最多的那台设备
// 找到可以使用的空闲库位
List<TAppLocation> emptyLocationList = appLocationService.list(new LambdaQueryWrapper<TAppLocation>() List<TAppLocation> emptyLocationList = appLocationService.list(new LambdaQueryWrapper<TAppLocation>()
.eq(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.EMPTY.getCode()) .eq(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.EMPTY.getCode())
.eq(TAppLocation::getIsLock, WmsLockEnums.UNLOCK.getCode())); .eq(TAppLocation::getIsLock, WmsLockEnums.UNLOCK.getCode()));
if (emptyLocationList.isEmpty()) { if (emptyLocationList.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
// 统计每个设备的空闲库位数量
for (TAppLocation appLocation : emptyLocationList) { for (TAppLocation appLocation : emptyLocationList) {
if (!equipCountMap.containsKey(appLocation.getEquipmentId())) { equipFreeCountMap.merge(appLocation.getEquipmentId(), 1, Integer::sum);
equipCountMap.put(appLocation.getEquipmentId(), 0);
}
} }
// 查找到所有的入库任务列表---非暂存和完成状态 // 查找到所有的入库任务列表---非暂存和完成状态
List<TAppTask> inTasks = appTaskService.list(new LambdaQueryWrapper<TAppTask>() List<TAppTask> inTasks = appTaskService.list(new LambdaQueryWrapper<TAppTask>()
.eq(TAppTask::getTaskType, WmsTaskTypeEnums.IN.getCode()) .eq(TAppTask::getTaskType, WmsTaskTypeEnums.IN.getCode())
.notIn(TAppTask::getTaskStatus, WmsStackerTaskStatusEnums.FINISH.getCode(), WmsStackerTaskStatusEnums.TEMP.getCode())); .notIn(TAppTask::getTaskStatus, WmsStackerTaskStatusEnums.FINISH.getCode(), WmsStackerTaskStatusEnums.TEMP.getCode()));
if (inTasks == null || inTasks.isEmpty()) {
for (TAppLocation appLocation : emptyLocationList) { // 统计每个设备的已分配任务数量
if (equipCountMap.containsKey(appLocation.getEquipmentId())) { Map<Integer, Integer> equipTaskCountMap = new HashMap<>();
equipCountMap.replace(appLocation.getEquipmentId(), equipCountMap.get(appLocation.getEquipmentId()) + 1); if (inTasks != null && !inTasks.isEmpty()) {
}
}
} else {
for (TAppTask inTask : inTasks) { for (TAppTask inTask : inTasks) {
if (StringUtils.isNotEmpty(inTask.getDestination())) { if (StringUtils.isNotEmpty(inTask.getDestination())) {
// 当前目标库位的设备号 // 当前目标库位的设备号
TAppLocation destinationEquipmentId = appCommon.getInstantLocationByLocationId(inTask.getDestination()); TAppLocation destinationEquipmentId = appCommon.getInstantLocationByLocationId(inTask.getDestination());
if (equipCountMap.containsKey(destinationEquipmentId.getEquipmentId())) { if (destinationEquipmentId != null) {
equipCountMap.replace(destinationEquipmentId.getEquipmentId(), equipCountMap.get(destinationEquipmentId.getEquipmentId()) + 1); equipTaskCountMap.merge(destinationEquipmentId.getEquipmentId(), 1, Integer::sum);
} }
} }
} }
} }
if (equipCountMap.isEmpty()) {
// 计算设备的空闲度分值空闲库位数 - 已分配任务数
Map<Integer, Integer> equipScoreMap = new HashMap<>();
for (Map.Entry<Integer, Integer> entry : equipFreeCountMap.entrySet()) {
Integer equipmentId = entry.getKey();
Integer freeCount = entry.getValue();
Integer taskCount = equipTaskCountMap.getOrDefault(equipmentId, 0);
// 空闲度分值 = 空闲库位数 - 已分配任务数
equipScoreMap.put(equipmentId, freeCount - taskCount);
}
if (equipScoreMap.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
// 排序
return equipCountMap.entrySet().stream() // 按空闲度分值降序排序分值高的设备更空闲
.sorted(Comparator.comparingInt(Map.Entry::getValue)) return equipScoreMap.entrySet().stream()
.sorted(Map.Entry.<Integer, Integer>comparingByValue().reversed())
.map(Map.Entry::getKey) .map(Map.Entry::getKey)
.toList(); .toList();
} }
// private List<Integer> findMostRelaxEquip() {
// // 构造可用库位map
// Map<Integer, Integer> equipCountMap = new HashMap<>();
// // 找到可以使用的空闲库位最多的那台设备
// List<TAppLocation> emptyLocationList = appLocationService.list(new LambdaQueryWrapper<TAppLocation>()
// .eq(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.EMPTY.getCode())
// .eq(TAppLocation::getIsLock, WmsLockEnums.UNLOCK.getCode()));
// if (emptyLocationList.isEmpty()) {
// return Collections.emptyList();
// }
// for (TAppLocation appLocation : emptyLocationList) {
// if (!equipCountMap.containsKey(appLocation.getEquipmentId())) {
// equipCountMap.put(appLocation.getEquipmentId(), 0);
// }
// }
// // 查找到所有的入库任务列表---非暂存和完成状态
// List<TAppTask> inTasks = appTaskService.list(new LambdaQueryWrapper<TAppTask>()
// .eq(TAppTask::getTaskType, WmsTaskTypeEnums.IN.getCode())
// .notIn(TAppTask::getTaskStatus, WmsStackerTaskStatusEnums.FINISH.getCode(), WmsStackerTaskStatusEnums.TEMP.getCode()));
// if (inTasks == null || inTasks.isEmpty()) {
// for (TAppLocation appLocation : emptyLocationList) {
// if (equipCountMap.containsKey(appLocation.getEquipmentId())) {
// equipCountMap.replace(appLocation.getEquipmentId(), equipCountMap.get(appLocation.getEquipmentId()) + 1);
// }
// }
// } else {
// for (TAppTask inTask : inTasks) {
// if (StringUtils.isNotEmpty(inTask.getDestination())) {
// // 当前目标库位的设备号
// TAppLocation destinationEquipmentId = appCommon.getInstantLocationByLocationId(inTask.getDestination());
// if (equipCountMap.containsKey(destinationEquipmentId.getEquipmentId())) {
// equipCountMap.replace(destinationEquipmentId.getEquipmentId(), equipCountMap.get(destinationEquipmentId.getEquipmentId()) + 1);
// }
// }
// }
// }
// if (equipCountMap.isEmpty()) {
// return Collections.emptyList();
// }
// // 排序
// return equipCountMap.entrySet().stream()
// .sorted(Comparator.comparingInt(Map.Entry::getValue))
// .map(Map.Entry::getKey)
// .toList();
//// return equipCountMap.entrySet().stream()
//// .sorted(Map.Entry.<Integer, Integer>comparingByValue().reversed())
//// .map(Map.Entry::getKey)
//// .toList();
//
// }
/** /**
* 实现 * 实现
* *
@ -495,6 +567,27 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
EwmApiBackResponse ewmApiBackResponse = ewmApiService.sendWarehouseInCompleted(request); EwmApiBackResponse ewmApiBackResponse = ewmApiService.sendWarehouseInCompleted(request);
if (!Objects.equals(ewmApiBackResponse.getState(), "successfully")) { if (!Objects.equals(ewmApiBackResponse.getState(), "successfully")) {
log.error("调用EWM系统接口异常请求参数: {}", request); log.error("调用EWM系统接口异常请求参数: {}", request);
// 需要将料箱下架生成一个出库任务
// 生成出库任务
TAppTask outTask = new TAppTask(
UUIDUtils.getNewUUID(),
WmsTaskTypeEnums.OUT.getCode(),
0,
9,
vehicleId,
emptyVehicle.getLocationId(),
null,
null,
LocalDateTime.now(),
null,
AppConstant.EMPTY_GOODS_ID,
0,
0,
appOuts.getUserName(),
"",
appOuts.getDestination(),
""
);
}else { }else {
log.info("调用EWM系统接口成功请求参数: {}", request); log.info("调用EWM系统接口成功请求参数: {}", request);
} }
@ -509,7 +602,7 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
* @param stackerInTasks 已完成的入库任务 * @param stackerInTasks 已完成的入库任务
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public void finishStackerInTasksMergeSameGoods(List<TAppTask> stackerInTasks) { public void finishStackerInTasksMergeSameGoods(List<TAppTask> stackerInTasks) {
// 入库任务完成需要做以下几件事情 // 入库任务完成需要做以下几件事情
// 1. 生成库存如果是已有库存则更新库存状态数量库位这些信息 // 1. 生成库存如果是已有库存则更新库存状态数量库位这些信息

View File

@ -12,7 +12,7 @@ public interface IDataControllerService {
* 获取任务类型为1的任务数据 * 获取任务类型为1的任务数据
* @return 任务类型为1的任务列表 * @return 任务类型为1的任务列表
*/ */
List<TAppTask> getTaskTypInData(int pageNum, int pageSize); List<TAppTask> getTaskTypInData(int pageNum, int pageSize, int standId);
/** /**
* 出库 * 出库

View File

@ -20,6 +20,9 @@ public interface ILocationControllerService {
*/ */
BaseWmsApiResponse genLocations(LocationQuery locationQuery); BaseWmsApiResponse genLocations(LocationQuery locationQuery);
BaseWmsApiResponse deleteLocation();
/** /**
* 根据条件分页查询库位列表---分页 * 根据条件分页查询库位列表---分页
* @param locationQuery 查询参数 * @param locationQuery 查询参数

View File

@ -64,6 +64,8 @@ public interface ITaskControllerService {
*/ */
WcsApiResponse<WcsStackerTask> wcsRequestVehicleIn(WcsVehicleInRequest wcsVehicleInRequest); WcsApiResponse<WcsStackerTask> wcsRequestVehicleIn(WcsVehicleInRequest wcsVehicleInRequest);
/** /**
* Wcs上报载具到达站台 * Wcs上报载具到达站台
* @param boxArriveRequest 请求信息 * @param boxArriveRequest 请求信息

View File

@ -31,12 +31,29 @@ public class DataControllerServiceImpl implements IDataControllerService {
* @return 任务类型为1的任务列表 * @return 任务类型为1的任务列表
*/ */
@Override @Override
public List<TAppTask> getTaskTypInData(int pageNum,int pageSize) { public List<TAppTask> getTaskTypInData(int pageNum, int pageSize, int standId) {
LambdaQueryWrapper<TAppTask> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TAppTask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TAppTask::getTaskType, 1); queryWrapper.eq(TAppTask::getTaskType, 1);
// 如果 standId 等于 1则筛选终点以 "A1" "A2" 开头的数据
if (standId == 1) {
queryWrapper.and(wrapper -> wrapper.likeRight(TAppTask::getDestination, "A1")
.or()
.likeRight(TAppTask::getDestination, "A2"));
}else if (standId == 2){
queryWrapper.and(wrapper -> wrapper.likeRight(TAppTask::getDestination, "A3")
.or()
.likeRight(TAppTask::getDestination, "A4"));
} else if (standId == 3) {
queryWrapper.and(wrapper -> wrapper.likeRight(TAppTask::getDestination, "A5")
.or()
.likeRight(TAppTask::getDestination, "A6"));
}
return tAppTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords(); return tAppTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords();
} }
/** /**
* 获取出库数据 * 获取出库数据
* @return 出库数据列表 * @return 出库数据列表
@ -54,21 +71,24 @@ public class DataControllerServiceImpl implements IDataControllerService {
@Override @Override
public List<TAppPickTask> getPickTaskDataP1(int pageNum, int pageSize) { public List<TAppPickTask> getPickTaskDataP1(int pageNum, int pageSize) {
LambdaQueryWrapper<TAppPickTask> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TAppPickTask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(TAppPickTask::getPickStand, "P11", "P12", "P13"); queryWrapper.in(TAppPickTask::getPickStand, "P11", "P12", "P13")
.orderByDesc(TAppPickTask::getPickStatus);
return tAppPickTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords(); return tAppPickTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords();
} }
@Override @Override
public List<TAppPickTask> getPickTaskDataP2(int pageNum, int pageSize) { public List<TAppPickTask> getPickTaskDataP2(int pageNum, int pageSize) {
LambdaQueryWrapper<TAppPickTask> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TAppPickTask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(TAppPickTask::getPickStand, "P14", "P15", "P16"); queryWrapper.in(TAppPickTask::getPickStand, "P14", "P15", "P16")
.orderByDesc(TAppPickTask::getPickStatus);
return tAppPickTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords(); return tAppPickTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords();
} }
@Override @Override
public List<TAppPickTask> getPickTaskDataP3(int pageNum, int pageSize) { public List<TAppPickTask> getPickTaskDataP3(int pageNum, int pageSize) {
LambdaQueryWrapper<TAppPickTask> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TAppPickTask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(TAppPickTask::getPickStand, "P17", "P18", "P19"); queryWrapper.in(TAppPickTask::getPickStand, "P17", "P18", "P19")
.orderByDesc(TAppPickTask::getPickStatus);;
return tAppPickTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords(); return tAppPickTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords();
} }
} }

View File

@ -120,7 +120,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
* @return 初始化任务响应信息 * @return 初始化任务响应信息
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse initWorks(InitKateWorkRequest initKateWorkRequest) { public BaseWmsApiResponse initWorks(InitKateWorkRequest initKateWorkRequest) {
if (initKateWorkRequest == null) { if (initKateWorkRequest == null) {
return BaseWmsApiResponse.error("请求信息为空,无法创建工作。"); return BaseWmsApiResponse.error("请求信息为空,无法创建工作。");
@ -281,7 +281,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
* @return 查询结果 * @return 查询结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public WmsApiResponse<WorkConfirmVo> getCurrentWorks(KateWorksQuery kateWorksQuery) { public WmsApiResponse<WorkConfirmVo> getCurrentWorks(KateWorksQuery kateWorksQuery) {
if (kateWorksQuery == null || StringUtils.isEmpty(kateWorksQuery.getStandId())) { if (kateWorksQuery == null || StringUtils.isEmpty(kateWorksQuery.getStandId())) {
return WmsApiResponse.error("请求缺少信息,请输入站台号。", null); return WmsApiResponse.error("请求缺少信息,请输入站台号。", null);
@ -318,7 +318,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
stockDataService.getWarningQty(),null, stockDataService.getWarningQty(),null,
null, null,
null, null,
null) null,null)
)); ));
} }
@ -377,7 +377,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
* @return 确认结果 * @return 确认结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse confirmCurrentWork(ConfirmWorkRequest confirmWorkRequest) { public BaseWmsApiResponse confirmCurrentWork(ConfirmWorkRequest confirmWorkRequest) {
if (confirmWorkRequest == null || StringUtils.isEmpty(confirmWorkRequest.getStandId())) { if (confirmWorkRequest == null || StringUtils.isEmpty(confirmWorkRequest.getStandId())) {
return BaseWmsApiResponse.error("请求缺少信息,请输入站台号。"); return BaseWmsApiResponse.error("请求缺少信息,请输入站台号。");
@ -505,7 +505,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
* @return 显示信息 * @return 显示信息
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public WmsApiResponse<BoxDetailVo> getBoxesAndLacks(BaseWmsRequest request) { public WmsApiResponse<BoxDetailVo> getBoxesAndLacks(BaseWmsRequest request) {
if (StringUtils.isEmpty(request.getStandId())) { if (StringUtils.isEmpty(request.getStandId())) {
// 站台号不能为空 // 站台号不能为空
@ -680,7 +680,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
* @return 生成结果 * @return 生成结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public WmsApiResponse<List<KanbanLackDetail>> genClcKanbanRequirement(GenKanbanRequirementRequest genRequest) { public WmsApiResponse<List<KanbanLackDetail>> genClcKanbanRequirement(GenKanbanRequirementRequest genRequest) {
// 判断工单列表是否为空 // 判断工单列表是否为空
if (genRequest == null) { if (genRequest == null) {
@ -1316,7 +1316,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
* @return 删除结果 * @return 删除结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse deleteDbsPlan(DbsRequest dbsRequest) { public BaseWmsApiResponse deleteDbsPlan(DbsRequest dbsRequest) {
if (dbsRequest == null) { if (dbsRequest == null) {
// 请求为空 // 请求为空
@ -1348,7 +1348,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
* @return 删除结果 * @return 删除结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse deleteKittingBom(KittingBomRequest kittingBomRequest) { public BaseWmsApiResponse deleteKittingBom(KittingBomRequest kittingBomRequest) {
if (kittingBomRequest == null) { if (kittingBomRequest == null) {
// 请求为NULL // 请求为NULL
@ -1579,7 +1579,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
null, null,
null, null,
null, null,
null null,null
); );
return new WorkConfirmVo(orderConfirmVo, stockConfirmVo); return new WorkConfirmVo(orderConfirmVo, stockConfirmVo);
} }

View File

@ -34,12 +34,16 @@ public class LocationControllerServiceImpl implements ILocationControllerService
* @return 处理结果 * @return 处理结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse genLocations(LocationQuery locationQuery) { public BaseWmsApiResponse genLocations(LocationQuery locationQuery) {
List<TAppLocation> locationList = appLocationService.list();
List<TAppLocation> newLocationList = new ArrayList<>(); List<TAppLocation> newLocationList = new ArrayList<>();
for (int row = 1; row <= 6; row++) { for (int row = 1; row <= 6; row++) {
for (int col = 1; col <= 74; col++) { for (int col = 1; col <= 66; col++) {
for (int layer = 1; layer <= 14; layer++) { for (int layer = 1; layer <= 16; layer++) {
if (row == 1 && layer == 16){
continue;
}
String locationId = "A" + StringUtils.padLeft(String.valueOf(row), "", 2) String locationId = "A" + StringUtils.padLeft(String.valueOf(row), "", 2)
+ "-" + StringUtils.padLeft(String.valueOf(col), "0", 2) + "-" + StringUtils.padLeft(String.valueOf(col), "0", 2)
+ "-" + StringUtils.padLeft(String.valueOf(layer), "0", 2); + "-" + StringUtils.padLeft(String.valueOf(layer), "0", 2);
@ -60,6 +64,13 @@ public class LocationControllerServiceImpl implements ILocationControllerService
1, 1,
"" ""
); );
// 替换原来的 contains 判断
boolean exists = locationList.stream()
.anyMatch(location -> location.getLocationId().equals(newLocation.getLocationId()));
if (exists) {
continue;
}
newLocationList.add(newLocation); newLocationList.add(newLocation);
} }
} }
@ -68,6 +79,23 @@ public class LocationControllerServiceImpl implements ILocationControllerService
return BaseWmsApiResponse.success("成功创建了" + newLocationList.size() + "个库位。"); return BaseWmsApiResponse.success("成功创建了" + newLocationList.size() + "个库位。");
} }
@Override
public BaseWmsApiResponse deleteLocation() {
// 构造删除条件isOccupy 不等于 1
LambdaQueryWrapper<TAppLocation> queryWrapper = new LambdaQueryWrapper<TAppLocation>()
.ne(TAppLocation::getIsOccupy, 1); // ne 表示不等于 (!=)
// 执行删除操作
boolean result = appLocationService.remove(queryWrapper);
if (result) {
return BaseWmsApiResponse.success("成功删除所有未被占用的库位");
} else {
return BaseWmsApiResponse.error("删除库位失败");
}
}
/** /**
* 查询库位信息分页---实现 * 查询库位信息分页---实现
* @param locationQuery 查询参数 * @param locationQuery 查询参数

View File

@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
//import com.google.common.collect.CompactHashMap; //import com.google.common.collect.CompactHashMap;
import com.wms_main.app.AppCommon; import com.wms_main.app.AppCommon;
import com.wms_main.constant.AppConstant; 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.WcsStackerTaskStatusEnums;
import com.wms_main.constant.enums.wcs.WcsStackerTaskTypeEnums; import com.wms_main.constant.enums.wcs.WcsStackerTaskTypeEnums;
import com.wms_main.constant.enums.wms.*; import com.wms_main.constant.enums.wms.*;
@ -43,6 +42,8 @@ import com.wms_main.service.controller.ITaskControllerService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
@ -82,8 +83,6 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
/** /**
* 实现 * 实现
* *
@ -91,7 +90,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
* @return 响应结果 * @return 响应结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse requireStockIn(StockInRequest stockInRequest) { public BaseWmsApiResponse requireStockIn(StockInRequest stockInRequest) {
// 判断请求信息的正确性 // 判断请求信息的正确性
if (stockInRequest == null || StringUtils.isEmpty(stockInRequest.getVehicleId())) { if (stockInRequest == null || StringUtils.isEmpty(stockInRequest.getVehicleId())) {
@ -251,7 +250,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
* @return 处理结果 * @return 处理结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse requireStockOut(StockOutRequest stockOutRequest) { public BaseWmsApiResponse requireStockOut(StockOutRequest stockOutRequest) {
// 保存 // 保存
if (stockOutRequest == null || stockOutRequest.getNeedNum() == null if (stockOutRequest == null || stockOutRequest.getNeedNum() == null
@ -314,9 +313,62 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
// return BaseWmsApiResponse.error("请求错误:库外料或未在系统中维护的料不允许紧急出库。"); // return BaseWmsApiResponse.error("请求错误:库外料或未在系统中维护的料不允许紧急出库。");
// } // }
// 判断库存是否足够 // 判断库存是否足够
List<TAppStock> stockList = appStockService.list(new LambdaQueryWrapper<TAppStock>() // List<TAppStock> stockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
// .eq(TAppStock::getGoodsId, stockOutRequest.getGoodsId())
// .gt(TAppStock::getRemainNum, 0));
LambdaQueryWrapper<TAppStock> stockQueryWrapper;
if (stockOutRequest.getVehicleId() == null || stockOutRequest.getVehicleId().isEmpty()){
// 判断库存是否足够
stockQueryWrapper = new LambdaQueryWrapper<TAppStock>()
.eq(TAppStock::getGoodsId, stockOutRequest.getGoodsId()) .eq(TAppStock::getGoodsId, stockOutRequest.getGoodsId())
.gt(TAppStock::getRemainNum, 0)); .gt(TAppStock::getRemainNum, 0);
}else {
stockQueryWrapper = new LambdaQueryWrapper<TAppStock>()
.eq(TAppStock::getVehicleId, stockOutRequest.getVehicleId())
.eq(TAppStock::getGoodsId, stockOutRequest.getGoodsId())
.gt(TAppStock::getRemainNum, 0);
}
// 精确匹配特殊属性字段的空值处理
if (StringUtils.isNotEmpty(stockOutRequest.getSpecialStock())) {
stockQueryWrapper.eq(TAppStock::getSpecialStock, stockOutRequest.getSpecialStock());
} else {
// 当请求字段为空时匹配数据库中的空值NULL或空字符串
stockQueryWrapper.and(wrapper -> wrapper.isNull(TAppStock::getSpecialStock)
.or().eq(TAppStock::getSpecialStock, ""));
}
if (StringUtils.isNotEmpty(stockOutRequest.getSpecialStockNo())) {
stockQueryWrapper.eq(TAppStock::getSpecialStockNo, stockOutRequest.getSpecialStockNo());
} else {
// 当请求字段为空时匹配数据库中的空值NULL或空字符串
stockQueryWrapper.and(wrapper -> wrapper.isNull(TAppStock::getSpecialStockNo)
.or().eq(TAppStock::getSpecialStockNo, ""));
}
if (StringUtils.isNotEmpty(stockOutRequest.getSpecialStockItemNo())) {
stockQueryWrapper.eq(TAppStock::getSpecialStockItemNo, stockOutRequest.getSpecialStockItemNo());
} else {
// 当请求字段为空时匹配数据库中的空值NULL或空字符串
stockQueryWrapper.and(wrapper -> wrapper.isNull(TAppStock::getSpecialStockItemNo)
.or().eq(TAppStock::getSpecialStockItemNo, ""));
}
if (StringUtils.isNotEmpty(stockOutRequest.getBatchNo())) {
stockQueryWrapper.eq(TAppStock::getBatchNo, stockOutRequest.getBatchNo());
} else {
// 当请求字段为空时匹配数据库中的空值NULL或空字符串
stockQueryWrapper.and(wrapper -> wrapper.isNull(TAppStock::getBatchNo)
.or().eq(TAppStock::getBatchNo, ""));
}
List<TAppStock> stockList = appStockService.list(stockQueryWrapper);
// 生成物料数量map // 生成物料数量map
Map<String, Integer> stockByGoodsMap = new HashMap<>(); Map<String, Integer> stockByGoodsMap = new HashMap<>();
for (TAppStock stock : stockList) { for (TAppStock stock : stockList) {
@ -350,12 +402,12 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
LocalDateTime.now(), LocalDateTime.now(),
stockOutRequest.getWorkOrder(), stockOutRequest.getWorkOrder(),
null, null,
stockOutRequest.getSpecialStock(),
stockOutRequest.getSpecialStockNo(),
stockOutRequest.getSpecialStockItemNo(),
stockOutRequest.getBatchNo(),
null, null,
null, null,null, null,new Date()
null,
null,
null,
null,null, null
); );
appOutsService.save(task); appOutsService.save(task);
return BaseWmsApiResponse.success("添加出库请求成功。"); return BaseWmsApiResponse.success("添加出库请求成功。");
@ -387,7 +439,23 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
// ); // );
//List<TAppOuts> appOuts = new ArrayList<>(); //List<TAppOuts> appOuts = new ArrayList<>();
for (EwmOutTaskRequest.TaskDetailInfo task : ewmOutTaskRequest.getTaskDetailInfo()){ for (EwmOutTaskRequest.TaskDetailInfo task : ewmOutTaskRequest.getTaskDetailInfo()){
// // 判断有没有出库数据相同的如果有直接在已有的outs上做累加
// List<TAppOuts> appOuts = appOutsService.list(new LambdaQueryWrapper<TAppOuts>()
// .eq(TAppOuts::getWorkOrder, task.getOrderNo())
// .eq(TAppOuts::getGoodsId, task.getMatNo())
// .eq(TAppOuts::getSpecialStock, task.getSpecialStock())
// .eq(TAppOuts::getSpecialStockNo, task.getSpecialStockNo())
// .eq(TAppOuts::getSpecialStockItemNo, task.getSpecialStockItemNo())
// .eq(TAppOuts::getBatchNo, task.getBatchNo())
// );
// if (appOuts != null && !appOuts.isEmpty()){
// // 更新需求数量
// TAppOuts existingOuts = appOuts.getFirst();
// existingOuts.setNeedNum(appOuts.getFirst().getNeedNum() + task.getPickingQty().intValue());
// appOutsService.updateById(existingOuts);
// }
// 判断料号数量是否输入 // 判断料号数量是否输入
if (StringUtils.isEmpty(task.getMatNo())) { if (StringUtils.isEmpty(task.getMatNo())) {
return EwmApiBackResponse.error("请求错误:拣选出库必须输入料号。"); return EwmApiBackResponse.error("请求错误:拣选出库必须输入料号。");
@ -493,7 +561,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
"EWM", "EWM",
"SYSTEM", "SYSTEM",
LocalDateTime.now(), LocalDateTime.now(),
null, task.getRemark(),
task.getOrderNo(), task.getOrderNo(),
task.getSpecialStock(), task.getSpecialStock(),
task.getSpecialStockNo(), task.getSpecialStockNo(),
@ -502,7 +570,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
ewmOutTaskRequest.getPickingType(), ewmOutTaskRequest.getPickingType(),
ewmOutTaskRequest.getWaveNo(), ewmOutTaskRequest.getWaveNo(),
task.getSkuUnit(), task.getSkuUnit(),
task.getSecondPickingKey() task.getSecondPickingKey(),
ewmOutTaskRequest.getPickingDate()
); );
//appOuts.add(outs); //appOuts.add(outs);
appOutsService.save(outs); appOutsService.save(outs);
@ -638,6 +707,10 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
for (String key : ewmStockMap.keySet()) { for (String key : ewmStockMap.keySet()) {
if (!localStockMap.containsKey(key)) { if (!localStockMap.containsKey(key)) {
EwmApiStockResponse.BinStock ewmStock = ewmStockMap.get(key); EwmApiStockResponse.BinStock ewmStock = ewmStockMap.get(key);
// 如果EWM数量为0跳过不记录
if (ewmStock.getTotalQuantity() == null || ewmStock.getTotalQuantity() <= 0) {
continue;
}
log.warn("库存不一致 - EWM有但本地没有: 物料={}, 批次={}, 数量={}", log.warn("库存不一致 - EWM有但本地没有: 物料={}, 批次={}, 数量={}",
ewmStock.getMatNo(), ewmStock.getMatNo(),
ewmStock.getBatchNo(), ewmStock.getTotalQuantity()); ewmStock.getBatchNo(), ewmStock.getTotalQuantity());
@ -748,7 +821,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
* @return 处理结果 * @return 处理结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public BaseWmsApiResponse requireVehiclesForIn(VehicleOutForInRequest voiRequest) { public BaseWmsApiResponse requireVehiclesForIn(VehicleOutForInRequest voiRequest) {
// 验证请求正确性 // 验证请求正确性
if (voiRequest == null || voiRequest.getGoodsIds() == null || voiRequest.getGoodsIds().isEmpty()) { if (voiRequest == null || voiRequest.getGoodsIds() == null || voiRequest.getGoodsIds().isEmpty()) {
@ -811,6 +884,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
null, null,
null, null,
null,null, null,null,
null,
null null
)); ));
} }
@ -1100,8 +1174,21 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
.eq(TAppTask::getVehicleId, wcsVehicleInRequest.getVehicleNo()) .eq(TAppTask::getVehicleId, wcsVehicleInRequest.getVehicleNo())
.eq(TAppTask::getTaskType, WmsTaskTypeEnums.IN.getCode()) .eq(TAppTask::getTaskType, WmsTaskTypeEnums.IN.getCode())
); );
if (!wmsTaskIsExist.isEmpty()) { // 1. 验证WCS任务是否已经存在
return WcsApiResponse.error("该载具号已经存在入库任务,请勿重复请求。", null); List<TAppWcsTask> wcsTaskIsExist = appWcsTaskService.list(
new LambdaQueryWrapper<TAppWcsTask>()
.eq(TAppWcsTask::getVehicleId, wcsVehicleInRequest.getVehicleNo())
.eq(TAppWcsTask::getWcsTaskType, WmsTaskTypeEnums.IN.getCode())
);
if (!wmsTaskIsExist.isEmpty() && !wcsTaskIsExist.isEmpty()){
appWcsTaskService.update(new LambdaUpdateWrapper<TAppWcsTask>()
.set(TAppWcsTask::getWcsTaskStatus, 0)
.eq(TAppWcsTask::getVehicleId, wcsVehicleInRequest.getVehicleNo())
.eq(TAppWcsTask::getWcsTaskType, WcsStackerTaskTypeEnums.IN.getCode()));
return WcsApiResponse.error("该载具号已经存在入库任务修改wcs状态重新下发。", null);
}
if (!wmsTaskIsExist.isEmpty() || !wcsTaskIsExist.isEmpty()){
return WcsApiResponse.error("该载具号已经存在入库任务,请检查。", null);
} }
// 1. 获取EWM数据 // 1. 获取EWM数据
@ -1229,6 +1316,16 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
} }
} }
// 无事务的查询方法
public TAppPickTask findPickTask(String vehicleNo) {
return appPickTaskService.getOne(new LambdaQueryWrapper<TAppPickTask>()
.eq(TAppPickTask::getVehicleId, vehicleNo)
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.SEND.getCode())
.orderByDesc(TAppPickTask::getCreateTime)
.last("LIMIT 1"));
}
/** /**
* 实现 * 实现
* *
@ -1236,20 +1333,36 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
* @return 响应信息 * @return 响应信息
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public BaseWcsApiResponse boxArrive(WcsBoxArriveRequest boxArriveRequest) { public BaseWcsApiResponse boxArrive(WcsBoxArriveRequest boxArriveRequest) {
if (boxArriveRequest == null if (boxArriveRequest == null
|| StringUtils.isEmpty(boxArriveRequest.getVehicleNo()) || StringUtils.isEmpty(boxArriveRequest.getVehicleNo())
|| StringUtils.isEmpty(boxArriveRequest.getLocation())) { || StringUtils.isEmpty(boxArriveRequest.getLocation())) {
return BaseWcsApiResponse.error("请求信息不完整,缺少载具号或者点位。"); return BaseWcsApiResponse.error("请求信息不完整,缺少载具号或者点位。");
} }
TAppPickTask pickTask = appPickTaskService.getOne(new LambdaQueryWrapper<TAppPickTask>() TAppPickTask pickTask = findPickTask(boxArriveRequest.getVehicleNo());
.eq(TAppPickTask::getVehicleId, boxArriveRequest.getVehicleNo())
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.SEND.getCode()));
if (pickTask == null) { if (pickTask == null) {
return BaseWcsApiResponse.error("没有找到当前载具的拣选任务。"); return BaseWcsApiResponse.error("没有找到当前载具的拣选任务。");
} }
String pickStand = pickTask.getPickStand(); String pickStand = pickTask.getPickStand();
// 判断当前站台有没有别的已到达的拣选任务
List<TAppPickTask> pickTaskList = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
.eq(TAppPickTask::getPickStand, boxArriveRequest.getLocation())
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode()));
// 如果有其他已到达的拣选任务将它们的状态设置为0等待状态
if (pickTaskList != null && !pickTaskList.isEmpty()) {
for (TAppPickTask otherTask : pickTaskList) {
appPickTaskService.update(new LambdaUpdateWrapper<TAppPickTask>()
.set(TAppPickTask::getPickStatus, 0) // 设置为等待状态
.set(TAppPickTask::getPickId, UUIDUtils.getNewUUID()) // 重新设置ID
.eq(TAppPickTask::getPickId, otherTask.getPickId()));
}
}
// 更新当前载具到达当前点位的拣选任务为已到达 // 更新当前载具到达当前点位的拣选任务为已到达
boolean isUpdateSuccess = appPickTaskService.update(new LambdaUpdateWrapper<TAppPickTask>() boolean isUpdateSuccess = appPickTaskService.update(new LambdaUpdateWrapper<TAppPickTask>()
.set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode()) .set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode())
@ -1264,8 +1377,11 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
.set(TAppPickPlan::getStandId, boxArriveRequest.getLocation()) .set(TAppPickPlan::getStandId, boxArriveRequest.getLocation())
.eq(TAppPickPlan::getVehicleId, boxArriveRequest.getVehicleNo()) .eq(TAppPickPlan::getVehicleId, boxArriveRequest.getVehicleNo())
.eq(TAppPickPlan::getStandId, pickStand) .eq(TAppPickPlan::getStandId, pickStand)
); .last("LIMIT 1"));
if (isUpdateSuccess) {
//boolean isUpdatePlanSuccess = updatePickPlanInNewTransaction(boxArriveRequest, pickStand);
if (isUpdateSuccess && isUpdatePlanSuccess) {
// 更新成功返回成功 // 更新成功返回成功
return BaseWcsApiResponse.success("处理成功。"); return BaseWcsApiResponse.success("处理成功。");
} else { } else {
@ -1274,6 +1390,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
} }
} }
/** /**
* 取消拣选任务实现 * 取消拣选任务实现
* *
@ -1311,7 +1428,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
* @return 获取结果 * @return 获取结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public WmsApiResponse<List<TaskConfirmVo>> getCurrentTask(BaseWmsRequest wmsRequest) { public WmsApiResponse<List<TaskConfirmVo>> getCurrentTask(BaseWmsRequest wmsRequest) {
if (wmsRequest == null || StringUtils.isEmpty(wmsRequest.getStandId())) { if (wmsRequest == null || StringUtils.isEmpty(wmsRequest.getStandId())) {
// 缺少站台号 // 缺少站台号
@ -1432,6 +1549,10 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
TAppOuts thisOut = appOutsService.getOne(new LambdaQueryWrapper<TAppOuts>() TAppOuts thisOut = appOutsService.getOne(new LambdaQueryWrapper<TAppOuts>()
.eq(TAppOuts::getTaskId, confirmTaskRequest.getTaskConfirm().getTaskId())); .eq(TAppOuts::getTaskId, confirmTaskRequest.getTaskConfirm().getTaskId()));
if (thisOut == null) {
return BaseWmsApiResponse.error("当前任务不存在或已经拣选完毕,请刷新后重试。");
}
// 调用EWM系统检验箱子 // 调用EWM系统检验箱子
SendEwmCheckContainerNo request = new SendEwmCheckContainerNo(); SendEwmCheckContainerNo request = new SendEwmCheckContainerNo();
request.setContainerNo(confirmTaskRequest.getTaskConfirm().getContainerNo()); request.setContainerNo(confirmTaskRequest.getTaskConfirm().getContainerNo());
@ -1439,12 +1560,18 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
request.setFirstOrSecond(false); request.setFirstOrSecond(false);
request.setCheckKey(thisOut.getSecondPickingCode()); request.setCheckKey(thisOut.getSecondPickingCode());
EwmApiBackResponse ewmResponse = ewmApiService.sendEwmCheckContainerNo(request); EwmApiBackResponse ewmResponse = ewmApiService.sendEwmCheckContainerNo(request);
// 判断EWM系统返回结果 // 检查 EWM 系统返回结果
if (ewmResponse == null || !"successfully".equals(ewmResponse.getState())) { if (ewmResponse == null) {
if (ewmResponse != null) { return BaseWmsApiResponse.error("EWM系统无响应请检查网络连接。");
return BaseWmsApiResponse.error(ewmResponse.getContent().toString()); }
// 检查返回内容是否为空
if (ewmResponse.getContent() == null) {
// 根据 state 状态处理
if ("successfully".equals(ewmResponse.getState())) {
return BaseWmsApiResponse.success("操作成功,但无返回内容。");
} else {
return BaseWmsApiResponse.error("EWM系统返回异常" + (ewmResponse.getMessage() != null ? ewmResponse.getMessage() : "未知错误"));
} }
return BaseWmsApiResponse.error("EWM系统异常请检查。");
} }
// 检测目标箱号是否存在别的物料以颗粒度为第一优先级如果颗粒度为空则使用工单号 // 检测目标箱号是否存在别的物料以颗粒度为第一优先级如果颗粒度为空则使用工单号
@ -1473,7 +1600,6 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
return BaseWmsApiResponse.error("当前目标箱号已存在其他工单号物料,请检查。"); return BaseWmsApiResponse.error("当前目标箱号已存在其他工单号物料,请检查。");
} }
} }
// 将出库完成需要反馈的信息插入outsCheck表中 // 将出库完成需要反馈的信息插入outsCheck表中
List<TAppOutsCheck> outsChecks = new ArrayList<>(); List<TAppOutsCheck> outsChecks = new ArrayList<>();
outsChecks.add(new TAppOutsCheck( outsChecks.add(new TAppOutsCheck(
@ -1501,35 +1627,43 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
// 更新库存信息 // 更新库存信息
stockDataService.updateStockInfo(confirmTaskRequest.getStockConfirm(), confirmTaskRequest.getStandId(), confirmTaskRequest.getUserName(), "出库拣选", null); stockDataService.updateStockInfo(confirmTaskRequest.getStockConfirm(), confirmTaskRequest.getStandId(), confirmTaskRequest.getUserName(), "出库拣选", null);
// 查询库存获得当前载具中存储的库存列表 // 查询库存获得当前载具中存储的库存列表
LambdaQueryWrapper<TAppStock> stockQueryWrapper = new LambdaQueryWrapper<TAppStock>() // LambdaQueryWrapper<TAppStock> stockQueryWrapper = new LambdaQueryWrapper<TAppStock>()
.eq(TAppStock::getVehicleId, thisPickTask.getVehicleId()) // .eq(TAppStock::getVehicleId, thisPickTask.getVehicleId())
.gt(TAppStock::getRealNum, 0); // .gt(TAppStock::getRealNum, 0);
List<TAppStock> stockList = appStockService.list(stockQueryWrapper); // List<TAppStock> stockList = appStockService.list(stockQueryWrapper);
// 界面直接点击确认/放行 // 界面直接点击确认/放行
if (!stockList.isEmpty()) { // if (stockList.isEmpty()) {
// conveyTaskService.cancelOtherStandPickTasks(thisPickTask.getVehicleId(), thisPickTask.getPickStand());
// 判断还有没有当前站台的其他拣选任务 // 判断还有没有当前站台的其他拣选任务
TaskConfirmVo taskConfirmVo = conveyTaskService.getCurrentStandTask(thisPickTask); // TaskConfirmVo taskConfirmVo = conveyTaskService.getCurrentStandTask(thisPickTask);
if (taskConfirmVo != null) { // if (taskConfirmVo != null) {
return BaseWmsApiResponse.warn("当前载具还有其他拣选任务,请根据界面信息进行拣配。"); // return BaseWmsApiResponse.warn("当前载具还有其他拣选任务,请根据界面信息进行拣配。");
} // }
// WorkConfirmVo resultVo = conveyTaskService.getCurrentStandWork(thisPickTask); // WorkConfirmVo resultVo = conveyTaskService.getCurrentStandWork(thisPickTask);
// if (resultVo != null) { // if (resultVo != null) {
// return BaseWmsApiResponse.warn("当前载具还有工作,请切换到拣配界面进行拣配。"); // return BaseWmsApiResponse.warn("当前载具还有工作,请切换到拣配界面进行拣配。");
// } // }
// 判断当前载具是否还有盘点任务 // 判断当前载具是否还有盘点任务
List<String> goodsIds = stockList.stream().map(TAppStock::getGoodsId).distinct().toList(); // List<String> goodsIds = stockList.stream().map(TAppStock::getGoodsId).distinct().toList();
List<TAppInventory> inventoryTasks = appInventoryService.list(new LambdaQueryWrapper<TAppInventory>() // List<TAppInventory> inventoryTasks = appInventoryService.list(new LambdaQueryWrapper<TAppInventory>()
.eq(TAppInventory::getVehicleId, thisPickTask.getVehicleId()) // .eq(TAppInventory::getVehicleId, thisPickTask.getVehicleId())
.in(TAppInventory::getGoodsId, goodsIds)); // .in(TAppInventory::getGoodsId, goodsIds));
if (inventoryTasks != null && !inventoryTasks.isEmpty()) { // if (inventoryTasks != null && !inventoryTasks.isEmpty()) {
return BaseWmsApiResponse.warn("当前载具还有盘点任务,请切换到盘点界面进行拣配。"); // return BaseWmsApiResponse.warn("当前载具还有盘点任务,请切换到盘点界面进行拣配。");
} // }
} else { // }
// 取消后续拣选任务 // else {
conveyTaskService.cancelOtherStandPickTasks(thisPickTask.getVehicleId(), thisPickTask.getPickStand()); // // 取消后续拣选任务
} // conveyTaskService.cancelOtherStandPickTasks(thisPickTask.getVehicleId(), thisPickTask.getPickStand());
// }
// 放行 // 放行
if (conveyTaskService.releaseStandVehicle(thisPickTask)) { if (conveyTaskService.releaseStandVehicle(thisPickTask)) {
if (appPickTaskService.exists(new LambdaQueryWrapper<TAppPickTask>()
.eq(TAppPickTask::getVehicleId, thisPickTask.getVehicleId())
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode())
)){
return BaseWmsApiResponse.success("继续拣选");
}
// // 回告EWm系统出库完成 // // 回告EWm系统出库完成
// SendWarehouseOutCompletedRequest request = new SendWarehouseOutCompletedRequest(); // SendWarehouseOutCompletedRequest request = new SendWarehouseOutCompletedRequest();
// List<SendWarehouseOutCompletedRequest.PickingDetail> pickingDetails = new ArrayList<>(); // List<SendWarehouseOutCompletedRequest.PickingDetail> pickingDetails = new ArrayList<>();
@ -2007,7 +2141,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
if (Objects.equals(ewmApiBackResponse.getState(), "successfully")) { if (Objects.equals(ewmApiBackResponse.getState(), "successfully")) {
log.info("调用EWM系统接口成功请求参数: {}", request); log.info("调用EWM系统接口成功请求参数: {}", request);
appOutsCheckService.remove(new LambdaQueryWrapper<TAppOutsCheck>() appOutsCheckService.remove(new LambdaQueryWrapper<TAppOutsCheck>()
.eq(TAppOutsCheck::getTaskNo, taskConfirm.getTaskId())); .eq(TAppOutsCheck::getTaskNo, taskConfirm.getTaskId())
);
}else { }else {
log.error("调用EWM系统接口异常请求参数: {}", request); log.error("调用EWM系统接口异常请求参数: {}", request);
// 触发事务回滚 // 触发事务回滚

View File

@ -34,6 +34,10 @@ public class OutsExecutor implements Job {
// log.error("解析工作(配料)失败{}", StringUtils.objectToString(e)); // log.error("解析工作(配料)失败{}", StringUtils.objectToString(e));
// } // }
// 处理出库单 // 处理出库单
// log.info("处理出库单开始");
try { try {
outsExecutorService.executeOuts(); outsExecutorService.executeOuts();
} catch (Exception e) { } catch (Exception e) {

View File

@ -76,6 +76,7 @@ public class WcsPickTaskSender implements Job {
new LambdaUpdateWrapper<TAppPickTask>() new LambdaUpdateWrapper<TAppPickTask>()
.set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.SEND.getCode()) .set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.SEND.getCode())
.set(TAppPickTask::getSendTime, LocalDateTime.now()) .set(TAppPickTask::getSendTime, LocalDateTime.now())
.eq(TAppPickTask::getPickId, pickTask.getPickId())
.eq(TAppPickTask::getVehicleId, pickTask.getVehicleId()) .eq(TAppPickTask::getVehicleId, pickTask.getVehicleId())
.eq(TAppPickTask::getPickStand, pickTask.getPickStand()) .eq(TAppPickTask::getPickStand, pickTask.getPickStand())
); );

View File

@ -2,6 +2,7 @@ package com.wms_main.service.quartz_job.serviceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wms_main.app.AppCommon; import com.wms_main.app.AppCommon;
import com.wms_main.constant.AppConstant; import com.wms_main.constant.AppConstant;
import com.wms_main.constant.enums.wms.*; import com.wms_main.constant.enums.wms.*;
@ -43,6 +44,7 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
private final ITAppInventoryService appInventoryService;// 盘点任务服务 private final ITAppInventoryService appInventoryService;// 盘点任务服务
private final AppCommon appCommon;// 应用共通数据 private final AppCommon appCommon;// 应用共通数据
/** /**
* 解析出库单 实现 * 解析出库单 实现
*/ */
@ -51,10 +53,24 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
public void executeOuts() { public void executeOuts() {
try { try {
// 查询到对应的出库单 // 查询到对应的出库单
// List<TAppOuts> appOutsList = appOutsService.list(
// new LambdaQueryWrapper<TAppOuts>().orderByDesc(TAppOuts::getOutType)
// );
// List<TAppOuts> appOutsList = appOutsService.list(
// new LambdaQueryWrapper<TAppOuts>()
// .le(TAppOuts::getPickingDate, LocalDate.now())
// .orderByDesc(TAppOuts::getOutType)
// );
List<TAppOuts> appOutsList = appOutsService.list( List<TAppOuts> appOutsList = appOutsService.list(
new LambdaQueryWrapper<TAppOuts>().orderByDesc(TAppOuts::getOutType) new LambdaQueryWrapper<TAppOuts>()
); .le(TAppOuts::getPickingDate, LocalDate.now())
if (appOutsList == null || appOutsList.isEmpty()) { .orderByDesc(TAppOuts::getOutType)
.last("LIMIT 15") // 限制只查询15条记录
).stream()
.filter(appOuts -> appOuts.getDistributeNum() < appOuts.getNeedNum())
.toList();
if (appOutsList.isEmpty()) {
return; return;
} }
// 需要保存的信息 // 需要保存的信息
@ -65,15 +81,30 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
// 拣选任务 // 拣选任务
List<TAppPickTask> pickTasks = appPickTaskService.list(); List<TAppPickTask> pickTasks = appPickTaskService.list();
// 查询库存条件剩余数量>0回库中锁定以外的库存状态 // 查询库存条件剩余数量>0回库中锁定以外的库存状态
List<TAppStock> allStocks = appStockService.list(new LambdaQueryWrapper<TAppStock>() // List<TAppStock> allStocks = appStockService.list(new LambdaQueryWrapper<TAppStock>()
// .le(TAppStock::getStockStatus, WmsStockStatusEnums.OUTED.getCode())
// .gt(TAppStock::getRemainNum, 0)
// .orderByAsc(TAppStock::getFirstInTime));
Set<String> requiredGoodsIds = appOutsList.stream()
.map(TAppOuts::getGoodsId)
.filter(StringUtils::isNotEmpty)
.collect(Collectors.toSet());
List<TAppStock> allStocks = new ArrayList<>();
if (!requiredGoodsIds.isEmpty()) {
allStocks = appStockService.list(new LambdaQueryWrapper<TAppStock>()
.in(TAppStock::getGoodsId, requiredGoodsIds)
.le(TAppStock::getStockStatus, WmsStockStatusEnums.OUTED.getCode()) .le(TAppStock::getStockStatus, WmsStockStatusEnums.OUTED.getCode())
.gt(TAppStock::getRemainNum, 0) .gt(TAppStock::getRemainNum, 0)
.orderByAsc(TAppStock::getFirstInTime)); .orderByAsc(TAppStock::getFirstInTime));
List<TAppVehicle> emptyVehicles = appVehicleService.list(new LambdaQueryWrapper<TAppVehicle>() }
.eq(TAppVehicle::getIsEmpty, 1)
.eq(TAppVehicle::getVehicleStatus, WmsVehicleStatusEnums.ON.getCode()) // List<TAppVehicle> emptyVehicles = appVehicleService.list(new LambdaQueryWrapper<TAppVehicle>()
.orderByAsc(TAppVehicle::getLastInTime));// 先进先出 // .eq(TAppVehicle::getIsEmpty, 1)
// 获取可用堆垛机 // .eq(TAppVehicle::getVehicleStatus, WmsVehicleStatusEnums.ON.getCode())
// .orderByAsc(TAppVehicle::getLastInTime)); // 先进先出
// // 获取可用堆垛机
List<TAppEquipment> usableStackers = appEquipmentService.list(new LambdaQueryWrapper<TAppEquipment>() List<TAppEquipment> usableStackers = appEquipmentService.list(new LambdaQueryWrapper<TAppEquipment>()
.eq(TAppEquipment::getEquipmentType, 1) .eq(TAppEquipment::getEquipmentType, 1)
.eq(TAppEquipment::getEquipmentStatus, WmsUsableStatusEnums.USABLE.getCode())); .eq(TAppEquipment::getEquipmentStatus, WmsUsableStatusEnums.USABLE.getCode()));
@ -83,15 +114,15 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
if (appOuts.getDistributeNum() >= appOuts.getNeedNum()) { if (appOuts.getDistributeNum() >= appOuts.getNeedNum()) {
continue; continue;
} }
// 判断目前是否是空箱任务 // // 判断目前是否是空箱任务
if (Objects.equals(appOuts.getOutType(), WmsOutTypeEnums.EMPTY.getCode())) { // if (Objects.equals(appOuts.getOutType(), WmsOutTypeEnums.EMPTY.getCode())) {
solveEmpty(appOuts, emptyVehicles, equipVehicleMap, newOutWmsTasks, thisTimeOutVehicleIds); // solveEmpty(appOuts, emptyVehicles, equipVehicleMap, newOutWmsTasks, thisTimeOutVehicleIds);
} else if (Objects.equals(appOuts.getOutType(), WmsOutTypeEnums.FOR_IN.getCode())) { // } else if (Objects.equals(appOuts.getOutType(), WmsOutTypeEnums.FOR_IN.getCode())) {
solveOutForIn(equipVehicleMap, appOuts, allStocks, pickTasks, newOutWmsTasks, newPickTasks, thisTimeOutVehicleIds); // solveOutForIn(equipVehicleMap, appOuts, allStocks, pickTasks, newOutWmsTasks, newPickTasks, thisTimeOutVehicleIds);
} else if (Objects.equals(appOuts.getOutType(), WmsOutTypeEnums.EMERGE.getCode())) { // } else if (Objects.equals(appOuts.getOutType(), WmsOutTypeEnums.EMERGE.getCode())) {
// 紧急出库 // 紧急出库
solveEmerge(equipVehicleMap, appOuts, allStocks, pickTasks, newOutWmsTasks, newPickTasks, thisTimeOutVehicleIds, newPickPlans); solveEmerge(equipVehicleMap, appOuts, allStocks, pickTasks, newOutWmsTasks, newPickTasks, thisTimeOutVehicleIds, newPickPlans);
} //}
} }
// 保存出库单---只更新分配数量 // 保存出库单---只更新分配数量
List<TAppOuts> onlyDistributeNumOuts = appOutsList.stream().map(outs -> { List<TAppOuts> onlyDistributeNumOuts = appOutsList.stream().map(outs -> {
@ -358,10 +389,17 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
continue; continue;
} }
String stockId = stockDataService.getFirstInStock(stock.getGoodsId(), allStocks,appOuts); String stockId = stockDataService.getFirstInStock(stock.getGoodsId(), allStocks,appOuts);
if (appOuts.getVehicleId() == null || appOuts.getVehicleId().isEmpty()){
if (StringUtils.isNotEmpty(stockId) && !Objects.equals(stockId, stock.getStockId())) { if (StringUtils.isNotEmpty(stockId) && !Objects.equals(stockId, stock.getStockId())) {
// 不是当前物料最先进的库存 // 不是当前物料最先进的库存
continue; continue;
} }
}else {
if (!Objects.equals(appOuts.getVehicleId(), stock.getVehicleId())) {
// 不是这个载具
continue;
}
}
if (stock.getRemainNum() <= 0) { if (stock.getRemainNum() <= 0) {
// 数量不够 // 数量不够
continue; continue;
@ -385,6 +423,13 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
// 没用到这条库存 // 没用到这条库存
continue; continue;
} }
// // 查找该workIndex的计划有没有有的话计划需要合并拣选任务不生产
// // 如果没有的话拣选任务不会合并而且对应的拣选任务要生成
// // 查询到对应的出库单
// List<TAppPickPlan> appPickPlans = appPickPlanService.list(
// new LambdaQueryWrapper<TAppPickPlan>().eq(TAppPickPlan::getWorkIndex, appOuts.getTaskId())
// );
// 生成拣选计划 // 生成拣选计划
TAppPickPlan pickPlan = new TAppPickPlan( TAppPickPlan pickPlan = new TAppPickPlan(
UUIDUtils.getNewUUID(), UUIDUtils.getNewUUID(),
@ -430,20 +475,21 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
if (Objects.equals(stock.getStockStatus(), WmsStockStatusEnums.OUTED.getCode())) { if (Objects.equals(stock.getStockStatus(), WmsStockStatusEnums.OUTED.getCode())) {
pickTaskStatus = WmsPickTaskStatusEnum.WAIT.getCode(); pickTaskStatus = WmsPickTaskStatusEnum.WAIT.getCode();
} }
// 已有的拣选任务 // // 已有的拣选任务
List<TAppPickTask> oldPickTasks = new ArrayList<>(); // List<TAppPickTask> oldPickTasks = new ArrayList<>();
if (pickTasks != null) { // if (pickTasks != null) {
oldPickTasks = pickTasks.stream().filter(pickTask -> // oldPickTasks = pickTasks.stream().filter(pickTask ->
Objects.equals(pickTask.getPickStand(), optimalDestination) // Objects.equals(pickTask.getPickStand(), optimalDestination)
&& pickTask.getVehicleId().equals(stock.getVehicleId()) // && pickTask.getVehicleId().equals(stock.getVehicleId())
&& !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList(); // && !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList();
} // }
// 新生成的拣选任务 // 新生成的拣选任务
List<TAppPickTask> newOldPickTasks = newPickTasks.stream().filter(pickTask -> pickTask.getVehicleId().equals(stock.getVehicleId()) // List<TAppPickTask> newOldPickTasks = newPickTasks.stream().filter(pickTask -> pickTask.getVehicleId().equals(stock.getVehicleId())
&& Objects.equals(pickTask.getPickStand(), optimalDestination) // && Objects.equals(pickTask.getPickStand(), optimalDestination)
&& !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList(); // && !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList();
// 生成拣选任务 // 生成拣选任务
if (oldPickTasks.isEmpty() && newOldPickTasks.isEmpty()) { //if (oldPickTasks.isEmpty() && newOldPickTasks.isEmpty() && appPickPlans.isEmpty()) {
// if (appPickPlans.isEmpty()) {
newPickTasks.add(new TAppPickTask( newPickTasks.add(new TAppPickTask(
UUIDUtils.getNewUUID(), UUIDUtils.getNewUUID(),
optimalDestination, optimalDestination,
@ -452,7 +498,7 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
LocalDateTime.now(), LocalDateTime.now(),
null, null, null,1 null, null, null,1
)); ));
} // }
} }
} }
@ -466,9 +512,9 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
private String getOptimalSubStand(String mainStand) { private String getOptimalSubStand(String mainStand) {
// 定义主站台与子站台的映射关系 // 定义主站台与子站台的映射关系
Map<String, List<String>> standMapping = new HashMap<>(); Map<String, List<String>> standMapping = new HashMap<>();
standMapping.put("P1", Arrays.asList("P11", "P12", "P13")); standMapping.put("P1", List.of("P12"));
standMapping.put("P2", Arrays.asList("P14", "P15", "P16")); standMapping.put("P2", List.of("P15"));
standMapping.put("P3", Arrays.asList("P17", "P18", "P19")); standMapping.put("P3", List.of("P18"));
standMapping.put("P4", Arrays.asList("P21", "P22", "P23")); standMapping.put("P4", Arrays.asList("P21", "P22", "P23"));
// 如果不是主站台直接返回原站台 // 如果不是主站台直接返回原站台
@ -1383,11 +1429,12 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
// 循环merge // 循环merge
for (TAppPickPlan beforeMergePickPlan : beforeMergePickPlanList) { for (TAppPickPlan beforeMergePickPlan : beforeMergePickPlanList) {
// key站台+箱号+料号+拣选类型+index // key站台+箱号+料号+拣选类型+index
String key = beforeMergePickPlan.getStandId() + "_" String key = beforeMergePickPlan.getPlanId() + "_"
+beforeMergePickPlan.getVehicleId() + "_" +beforeMergePickPlan.getVehicleId() + "_"
+ beforeMergePickPlan.getGoodsId() + "_" + beforeMergePickPlan.getGoodsId() + "_"
+ beforeMergePickPlan.getPickType() + "_" + beforeMergePickPlan.getPickType() + "_"
+ beforeMergePickPlan.getWorkIndex(); + beforeMergePickPlan.getWorkIndex();
if (mergedPickPlanMap.containsKey(key)) { if (mergedPickPlanMap.containsKey(key)) {
// 之前已经合并过 // 之前已经合并过
TAppPickPlan mergedPickPlan = mergedPickPlanMap.get(key); TAppPickPlan mergedPickPlan = mergedPickPlanMap.get(key);
@ -1395,7 +1442,7 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
mergedPickPlanMap.replace(key, mergedPickPlan); mergedPickPlanMap.replace(key, mergedPickPlan);
} else { } else {
// 之前没有合并过 // 之前没有合并过
TAppPickPlan existPickPlan = existPickPlanList.stream().filter(pickPlan -> Objects.equals(pickPlan.getStandId(), beforeMergePickPlan.getStandId()) TAppPickPlan existPickPlan = existPickPlanList.stream().filter(pickPlan -> Objects.equals(pickPlan.getPlanId(), beforeMergePickPlan.getPlanId())
&& Objects.equals(pickPlan.getVehicleId(), beforeMergePickPlan.getVehicleId()) && Objects.equals(pickPlan.getVehicleId(), beforeMergePickPlan.getVehicleId())
&& Objects.equals(pickPlan.getGoodsId(), beforeMergePickPlan.getGoodsId()) && Objects.equals(pickPlan.getGoodsId(), beforeMergePickPlan.getGoodsId())
&& Objects.equals(pickPlan.getPickType(), beforeMergePickPlan.getPickType()) && Objects.equals(pickPlan.getPickType(), beforeMergePickPlan.getPickType())

View File

@ -10,6 +10,8 @@ spring:
# password: developer # password: developer
# 本地 # 本地
url: jdbc:mysql://localhost:3306/wms_fengshang_yangzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true url: jdbc:mysql://localhost:3306/wms_fengshang_yangzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
# username: wms
# password: Admin123
username: root username: root
password: 123456 password: 123456
#在线 #在线

File diff suppressed because it is too large Load Diff