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); + } } + }, }