From 2eae4b403c7b582158705b627649eb8b67f38662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Thu, 2 Oct 2025 10:58:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/automatedWarehouse/palletPacking.js | 4 ++ .../automatedWarehouse/palletAssembly.vue | 36 ++++++++------- .../automatedWarehouse/palletPacking.vue | 44 ++++++++++--------- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/src/api/automatedWarehouse/palletPacking.js b/src/api/automatedWarehouse/palletPacking.js index 0cbb00e..2280b47 100644 --- a/src/api/automatedWarehouse/palletPacking.js +++ b/src/api/automatedWarehouse/palletPacking.js @@ -30,6 +30,10 @@ export const updatePalletDetailPosition = data => createAPI(`/wcsIntegration/upd // 获取AGV站点列表 - AI制作 export const getAgvStations = data => createAPI(`/wcsIntegration/getAgvStations`,'post',data) +// 获取可用的AGV站点列表(已在后台过滤状态和类型)- AI制作 +// 参数:statusDb - 站点状态(0-空闲,1-有货),不传则返回所有正式站点 +export const getAvailableAgvStations = data => createAPI(`/wcsIntegration/getAvailableAgvStations`,'post',data) + // 根据起点站点获取可达目标站点 - AI制作 export const getTargetStations = data => createAPI(`/wcsIntegration/getTargetStations`,'post',data) diff --git a/src/views/modules/automatedWarehouse/palletAssembly.vue b/src/views/modules/automatedWarehouse/palletAssembly.vue index 8cd18a0..1acb7b8 100644 --- a/src/views/modules/automatedWarehouse/palletAssembly.vue +++ b/src/views/modules/automatedWarehouse/palletAssembly.vue @@ -353,6 +353,7 @@ import { getPalletTypeAreas, updatePalletTypeAndAutoSort, getAgvStations, + getAvailableAgvStations, callPalletToStation, completePalletAssembly } from '../../../api/automatedWarehouse/palletPacking' @@ -637,24 +638,29 @@ export default { this.selectedCallStartStation = ''; this.selectedCallTargetStation = ''; - // 获取AGV站点列表,分别过滤起始站点和目标站点 - getAgvStations({}).then(({ data }) => { - if (data.code === 0) { - const allStations = data.stations || []; - // 起始站点:过滤出statusDb为1(有货)且为正式站点的站点 - this.callStartStationOptions = allStations.filter(station => - station.statusDb === 1 && station.stationType === '正式站点' - ); - // 目标站点:过滤出statusDb为0(空闲)且为正式站点的站点 - this.callTargetStationOptions = allStations.filter(station => - station.statusDb === 0 && station.stationType === '正式站点' - ); + // 获取起始站点(有货的正式站点) + getAvailableAgvStations({ statusDb: 1 }).then(({ data }) => { + if (data && data.code === 0) { + this.callStartStationOptions = data.stations || []; + console.log('起始站点列表:', this.callStartStationOptions); + } else { + this.$message.error(data.msg || '获取起始站点列表失败'); + } + }).catch(error => { + console.error('获取起始站点列表失败:', error); + this.$message.error('获取起始站点列表失败'); + }); + + // 获取目标站点(空闲的正式站点) + getAvailableAgvStations({ statusDb: 0 }).then(({ data }) => { + if (data && data.code === 0) { + this.callTargetStationOptions = data.stations || []; } else { - this.$message.error(data.msg || '获取站点列表失败'); + this.$message.error(data.msg || '获取目标站点列表失败'); } }).catch(error => { - console.error('获取站点列表失败:', error); - this.$message.error('获取站点列表失败'); + console.error('获取目标站点列表失败:', error); + this.$message.error('获取目标站点列表失败'); }); }, diff --git a/src/views/modules/automatedWarehouse/palletPacking.vue b/src/views/modules/automatedWarehouse/palletPacking.vue index 5ea91dd..da3582e 100644 --- a/src/views/modules/automatedWarehouse/palletPacking.vue +++ b/src/views/modules/automatedWarehouse/palletPacking.vue @@ -408,6 +408,7 @@ import { getLayersForEdit, updatePalletDetailPosition, getAgvStations, + getAvailableAgvStations, callPalletToStation, callPalletToStationWithUpdateZuPan, getPalletInfo, @@ -710,23 +711,28 @@ export default { this.selectedCallTargetStation = ''; // 获取AGV站点列表,分别过滤起始站点和目标站点 - getAgvStations({}).then(({ data }) => { - if (data.code === 0) { - const allStations = data.stations || []; - // 起始站点:过滤出statusDb为1(有货)且为正式站点的站点 - this.callStartStationOptions = allStations.filter(station => - station.statusDb === 1 && station.stationType === '正式站点' - ); - // 目标站点:过滤出statusDb为0(空闲)且为正式站点的站点 - this.callTargetStationOptions = allStations.filter(station => - station.statusDb === 0 && station.stationType === '正式站点' - ); + // 获取起始站点(有货的正式站点) + getAvailableAgvStations({ statusDb: 1 }).then(({ data }) => { + if (data && data.code === 0) { + this.callStartStationOptions = data.stations || []; + } else { + this.$message.error(data.msg || '获取起始站点列表失败'); + } + }).catch(error => { + console.error('获取起始站点列表失败:', error); + this.$message.error('获取起始站点列表失败'); + }); + + // 获取目标站点(空闲的正式站点) + getAvailableAgvStations({ statusDb: 0 }).then(({ data }) => { + if (data && data.code === 0) { + this.callTargetStationOptions = data.stations || []; } else { - this.$message.error(data.msg || '获取站点列表失败'); + this.$message.error(data.msg || '获取目标站点列表失败'); } }).catch(error => { - console.error('获取站点列表失败:', error); - this.$message.error('获取站点列表失败'); + console.error('获取目标站点列表失败:', error); + this.$message.error('获取目标站点列表失败'); }); }, @@ -1056,13 +1062,11 @@ export default { this.selectedTargetArea = ''; this.transportAreaOptions = []; - // 获取所有AGV站点列表,只显示空闲站点(statusDb = 0)且站点类型为正式站点的区域 - getAgvStations({}).then(({ data }) => { + // 获取空闲的正式站点 + getAvailableAgvStations({ statusDb: 0 }).then(({ data }) => { if (data.code === 0) { - // 过滤出statusDb为0(空闲)且stationType为'正式站点'的站点 - const freeStations = (data.stations || []).filter(station => - station.statusDb === 0 && station.stationType === '正式站点' - ); + // 后台已过滤,直接使用 + const freeStations = data.stations || []; console.log('空闲且为正式站点的数量:', freeStations.length);