This commit is contained in:
猫猫guowen
2025-12-23 13:06:46 +08:00
parent 2524f53a33
commit acc2ae68a4
2 changed files with 97 additions and 72 deletions

View File

@@ -7,6 +7,10 @@ import java.util.Map;
import com.ruoyi.device.ddj.domain.MsgDdj;
import com.ruoyi.device.ddj.service.IMsgDdjService;
import com.ruoyi.device.srgv.domain.DeviceSrgv;
import com.ruoyi.device.srgv.service.IDeviceSrgvService;
import com.ruoyi.device.tsj.domain.DeviceTsj;
import com.ruoyi.device.tsj.service.IDeviceTsjService;
import com.ruoyi.job.domain.MydoJob;
import com.ruoyi.job.service.IMydoJobService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +49,12 @@ public class IndexController extends BaseController {
@Autowired
private IDeviceSsjService deviceSsjService;
@Autowired
private IDeviceSrgvService deviceSrgvService;
@Autowired
private IDeviceTsjService deviceTsjService;
@Autowired
private IMsgDdjService msgDdjService;
@@ -58,18 +68,19 @@ public class IndexController extends BaseController {
@GetMapping("/deviceStats")
public AjaxResult getDeviceStats() {
try {
DeviceCar deviceCar = new DeviceCar();
MsgDdj msgDdj = new MsgDdj();
DeviceSrgv deviceSrgv = new DeviceSrgv();
DeviceTsj deviceTsj = new DeviceTsj();
DeviceSsj deviceSsj = new DeviceSsj();
List<DeviceCar> deviceList = deviceCarService.selectDeviceCarList(deviceCar);
List<MsgDdj> msgDdjList = msgDdjService.selectMsgDdjList(msgDdj);
List<DeviceSsj> deviceSsjList = deviceSsjService.selectDeviceSsjList(deviceSsj);
List<DeviceSrgv> deviceSrgvList = deviceSrgvService.selectDeviceSrgvList(deviceSrgv);
List<DeviceTsj> deviceTsjList = deviceTsjService.selectDeviceTsjList(deviceTsj);
Map<String, Object> count = new HashMap<>();
count.put("agvCount", deviceList.size());
count.put("ddjCount", msgDdjList.size());
count.put("srgvCount", deviceSrgvList.size());
count.put("ssjCount", deviceSsjList.size());
count.put("tsjCount", deviceTsjList.size());
return AjaxResult.success(count);
} catch (Exception e) {
@@ -84,8 +95,6 @@ public class IndexController extends BaseController {
public AjaxResult getTaskStats() {
try {
MydoJob mydoJob = new MydoJob();
AgvQueue agvQueue = new AgvQueue();
List<AgvQueue> queueList = agvQueueService.selectAgvQueueList(agvQueue);
List<MydoJob> mydoJobList = mydoJobService.selectMydoJobList(mydoJob);
List<MydoJob> mydoJobFinishList = mydoJobService.selectMydoJobFinishList(mydoJob);
@@ -144,23 +153,6 @@ public class IndexController extends BaseController {
try {
List<Map<String, Object>> runningDevices = new ArrayList<>();
// 查询运行中的AGV和CTU设备
/*DeviceCar deviceCar = new DeviceCar();
List<DeviceCar> deviceList = deviceCarService.selectDeviceCarList(deviceCar);
for (DeviceCar device : deviceList) {
String taskNo = device.getTaskNo();
// 判断是否为运行中设备:taskNo不为空且不为0
if (taskNo != null && !taskNo.trim().isEmpty() && !"0".equals(taskNo.trim())) {
Map<String, Object> deviceInfo = new HashMap<>();
deviceInfo.put("deviceCode", device.getDeviceCode());
deviceInfo.put("deviceName", device.getName());
deviceInfo.put("deviceType", "AGV");
deviceInfo.put("taskNo", device.getTaskNo());
runningDevices.add(deviceInfo);
}
}*/
// 查询运行中的SSJ设备
DeviceSsj deviceSsj = new DeviceSsj();
List<DeviceSsj> ssjList = deviceSsjService.selectDeviceSsjList(deviceSsj);
@@ -178,17 +170,30 @@ public class IndexController extends BaseController {
}
}
MsgDdj msgDdj = new MsgDdj();
List<MsgDdj> msgDdjList = msgDdjService.selectMsgDdjList(msgDdj);
DeviceSrgv deviceSrgv = new DeviceSrgv();
List<DeviceSrgv> srgvList = deviceSrgvService.selectDeviceSrgvList(deviceSrgv);
for (DeviceSrgv srgv : srgvList) {
int taskNo = srgv.getTaskNo();
if (taskNo != 0) {
Map<String, Object> deviceInfo = new HashMap<>();
deviceInfo.put("deviceCode", srgv.getDeviceId());
deviceInfo.put("deviceName", srgv.getDeviceName());
deviceInfo.put("deviceType", "SRGV");
deviceInfo.put("taskNo", String.valueOf(srgv.getTaskNo()));
runningDevices.add(deviceInfo);
}
}
for (MsgDdj ddj : msgDdjList){
Long taskNo = ddj.getRwh();
if (taskNo != 0){
HashMap<String, Object> deviceInfo = new HashMap<>();
deviceInfo.put("deviceCode",ddj.getId());
deviceInfo.put("deviceName", ddj.getName());
deviceInfo.put("deviceType", "DDJ");
deviceInfo.put("taskNo", ddj.getRwh());
DeviceTsj deviceTsj = new DeviceTsj();
List<DeviceTsj> tsjList = deviceTsjService.selectDeviceTsjList(deviceTsj);
for (DeviceTsj tsj : tsjList) {
Long taskNo = tsj.getRwh();
if (taskNo != 0) {
Map<String, Object> deviceInfo = new HashMap<>();
deviceInfo.put("deviceCode", tsj.getId());
deviceInfo.put("deviceName", tsj.getName());
deviceInfo.put("deviceType", "TSJ");
deviceInfo.put("taskNo", String.valueOf(tsj.getRwh()));
runningDevices.add(deviceInfo);
}
}
@@ -242,22 +247,22 @@ public class IndexController extends BaseController {
public AjaxResult getDeviceStatusChart() {
try {
Map<String, Map<String, Integer>> statusCount = new HashMap<>();
// statusCount.put("AGV", new HashMap<>());
statusCount.put("DDJ", new HashMap<>());
statusCount.put("SRGV", new HashMap<>());
statusCount.put("TSJ", new HashMap<>());
statusCount.put("SSJ", new HashMap<>());
// 查询DeviceCar数据(AGV)
DeviceCar deviceCar = new DeviceCar();
List<DeviceCar> deviceList = deviceCarService.selectDeviceCarList(deviceCar);
DeviceSrgv deviceSrgv = new DeviceSrgv();
List<DeviceSrgv> deviceSrgvs = deviceSrgvService.selectDeviceSrgvList(deviceSrgv);
for (DeviceCar device : deviceList) {
String taskNo = device.getTaskNo();
for (DeviceSrgv device : deviceSrgvs) {
int taskNo = device.getTaskNo();
String status = "其他";
// 根据taskNo判断状态:不等于空或0时为运行状态
if (taskNo != null && !taskNo.trim().isEmpty() && !"0".equals(taskNo.trim())) {
if (taskNo != 0) {
status = "运行";
}
Map<String, Integer> typeStatusCount = statusCount.get("AGV");
Map<String, Integer> typeStatusCount = statusCount.get("SRGV");
typeStatusCount.put(status, typeStatusCount.getOrDefault(status, 0) + 1);
}
@@ -279,16 +284,16 @@ public class IndexController extends BaseController {
typeStatusCount.put(status, typeStatusCount.getOrDefault(status, 0) + 1);
}
MsgDdj msgDdj = new MsgDdj();
List<MsgDdj> msgDdjList = msgDdjService.selectMsgDdjList(msgDdj);
DeviceTsj deviceTsj = new DeviceTsj();
List<DeviceTsj> TsjList = deviceTsjService.selectDeviceTsjList(deviceTsj);
for (MsgDdj ddj : msgDdjList){
Long taskNo = ddj.getRwh();
for (DeviceTsj tsj : TsjList){
Long taskNo = tsj.getRwh();
String status = "其他";
if (taskNo!=0){
if (taskNo != 0){
status = "运行";
}
Map<String,Integer> typeStatusCount = statusCount.get("DDJ");
Map<String,Integer> typeStatusCount = statusCount.get("TSJ");
typeStatusCount.put(status,typeStatusCount.getOrDefault(status,0) + 1);
}

View File

@@ -3,20 +3,20 @@
<!-- 统计卡片 -->
<el-row :gutter="20" class="stats-row">
<el-col :span="5">
<el-col :span="4">
<el-card class="stats-card">
<div class="stats-content">
<div class="stats-icon ddj-icon">
<i class="el-icon-cpu"></i>
</div>
<div class="stats-info">
<div class="stats-number">{{ deviceStats.ddjCount }}</div>
<div class="stats-label">堆垛机设备总数</div>
<div class="stats-number">{{ deviceStats.srgvCount }}</div>
<div class="stats-label">四向车设备总数</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="5">
<el-col :span="4">
<el-card class="stats-card">
<div class="stats-content">
<div class="stats-icon ctu-icon">
@@ -29,7 +29,20 @@
</div>
</el-card>
</el-col>
<el-col :span="5">
<el-col :span="4">
<el-card class="stats-card">
<div class="stats-content">
<div class="stats-icon tsj-icon">
<i class="el-icon-upload"></i>
</div>
<div class="stats-info">
<div class="stats-number">{{ deviceStats.tsjCount }}</div>
<div class="stats-label">提升机设备总数</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="4">
<el-card class="stats-card">
<div class="stats-content">
<div class="stats-icon queue-icon">
@@ -42,7 +55,7 @@
</div>
</el-card>
</el-col>
<el-col :span="5">
<el-col :span="4">
<el-card class="stats-card">
<div class="stats-content">
<div class="stats-icon running-icon">
@@ -170,9 +183,10 @@ export default {
return {
// 统计数据
deviceStats: {
agvCount: 0,
ctuCount: 0,
ssjCount: 0
srgvCount: 0,
tsjCount: 0,
ssjCount: 0,
tsjCount: 0
},
taskStats: {
pendingCount: 0,
@@ -414,21 +428,22 @@ export default {
if (response.code === 200) {
const statusData = response.data
// AGV数据
/*if (statusData.AGV) {
runningData[0] = statusData.AGV['运行'] || 0 // 运行
idleData[0] = statusData.AGV['其他'] || 0 // 其他
}*/
// CTU数据
if (statusData.DDJ) {
runningData[0] = statusData.DDJ['运行'] || 0 // 运行
idleData[0] = statusData.DDJ['其他'] || 0 // 其他
console.log(statusData)
// SRGV数据
if (statusData.SRGV) {
runningData[0] = statusData.SRGV['运行'] || 0 // 运行
idleData[0] = statusData.SRGV['其他'] || 0 // 其他
}
// SSJ数据
if (statusData.SSJ) {
runningData[1] = statusData.SSJ['运行'] || 0 // 运行
idleData[1] = statusData.SSJ['其他'] || 0 // 其他
}
// TSJ数据
if (statusData.TSJ) {
runningData[2] = statusData.TSJ['运行'] || 0 // 运行
idleData[2] = statusData.TSJ['其他'] || 0 // 其他
}
} else {
// 默认数据
runningData = [4, 2]
@@ -447,7 +462,7 @@ export default {
},
xAxis: {
type: 'category',
data: ['DDJ', 'SSJ']
data: ['SRGV', 'SSJ', 'TSJ']
},
yAxis: {
type: 'value'
@@ -483,7 +498,7 @@ export default {
},
xAxis: {
type: 'category',
data: ['AGV', 'DDJ', 'SSJ']
data: ['SRGV', 'SSJ', 'TSJ']
},
yAxis: {
type: 'value'
@@ -538,8 +553,8 @@ export default {
// 获取设备类型文本
getDeviceTypeText(type) {
const typeMap = {
'1': 'AGV',
'2': 'CTU',
'1': 'SRGV',
'2': 'TSJ',
'3': 'SSJ'
}
return typeMap[type] || this.$t('index.unknown') // 未知
@@ -618,8 +633,13 @@ export default {
background: linear-gradient(135deg, #36d1dc 0%, #5b86e5 100%);
}
.tsj-icon {
background: linear-gradient(135deg, #d593fb 0%, #f557e0 100%);
}
.queue-icon {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
background: linear-gradient(135deg, #fbf993 0%, #f56957 100%);
}
.running-icon {