From 8cc074b0ce550c30159ac603611621e7b80e7ba2 Mon Sep 17 00:00:00 2001 From: Yxq <2290299376@qq.com> Date: Fri, 21 Nov 2025 09:52:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E6=96=B0=E5=A2=9E=E5=BA=93?= =?UTF-8?q?=E4=BD=8D=E4=BD=BF=E7=94=A8=E5=85=B7=E4=BD=93=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms_client/src/layout/stock.vue | 125 ++++++++++++++++++- wms_serve/src/main/resources/application.yml | 16 +-- 2 files changed, 132 insertions(+), 9 deletions(-) diff --git a/wms_client/src/layout/stock.vue b/wms_client/src/layout/stock.vue index 4d39864..8888de6 100644 --- a/wms_client/src/layout/stock.vue +++ b/wms_client/src/layout/stock.vue @@ -12,6 +12,8 @@ 当前物料总数量: {{ goodstotal }} + 立库库位统计 + 四向车库库位统计
+ + + + +
+
{{ locationStats.occupied }}
+
已占用库位
+
+
+ +
+
{{ locationStats.free }}
+
空闲库位
+
+
+
+ + +
+
{{ locationStats.total }}
+
总库位数
+
+
+
+
@@ -207,13 +234,22 @@ label: '按零件分类' } ], - goodsIdQuery: '' + goodsIdQuery: '', + // 新增库位统计数据 + locationStatsDialogVisible: false, + storageStatsTitle: '库位统计', // 新增标题数据 + locationStats: { + occupied: 0, + free: 0, + total: 0 + } } }, mounted() { this.refresh() }, methods: { + locationFormat: (row, column, cellValue, index) => { return locationFormatter(cellValue) }, @@ -413,12 +449,99 @@ showClose: true }) }) + }, + // 立库统计方法 +// 修改 showVerticalStorageStats 方法 + async showVerticalStorageStats() { + try { + this.storageStatsTitle = '立库统计'; + // 调用获取立库统计的API + const response = await fetch('http://172.21.80.150:19990/api/query/getAllLocations'); + const data = await response.json(); + + // 解析数据 + const occupied = data.find(item => item.name === '占用')?.value || 0; + const free = data.find(item => item.name === '空闲')?.value || 0; + const locked = data.find(item => item.name === '锁定')?.value || 0; + const total = occupied + free + locked; + + this.locationStats = { + occupied: occupied, + free: free, + total: total + }; + + this.locationStatsDialogVisible = true; + } catch (error) { + ElMessage.error("获取立库统计信息失败: " + error.message); + } + }, + +// 修改 showFourWayStorageStats 方法 + async showFourWayStorageStats() { + try { + this.storageStatsTitle = '四向车库统计'; + // 调用获取四向车库统计的API + // 注意:这里假设四向车库使用相同的接口,如果有不同的接口请相应修改URL + const response = await fetch('http://172.21.80.150:19990/api/query/getAllLocationsForFour'); + const data = await response.json(); + + // 解析数据(这里使用相同的数据结构,实际项目中可能需要根据参数区分) + const occupied = data.find(item => item.name === '占用')?.value || 0; + const free = data.find(item => item.name === '空闲')?.value || 0; + const locked = data.find(item => item.name === '锁定')?.value || 0; + const total = occupied + free + locked; + + this.locationStats = { + occupied: occupied, + free: free, + total: total + }; + + this.locationStatsDialogVisible = true; + } catch (error) { + ElMessage.error("获取四向车库统计信息失败: " + error.message); + } } + }, }