首页和设备监控页面
This commit is contained in:
@@ -5,8 +5,11 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
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;
|
||||
@@ -15,13 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.device.DeviceCar.service.IDeviceCarService;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueFinishService;
|
||||
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueueFinish;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
|
||||
/**
|
||||
@@ -33,18 +30,15 @@ import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
@RestController
|
||||
@RequestMapping("/index")
|
||||
public class IndexController extends BaseController {
|
||||
@Autowired
|
||||
private IDeviceCarService deviceCarService;
|
||||
|
||||
@Autowired
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
@Autowired
|
||||
private IAgvQueueFinishService agvQueueFinishService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceSrgvService deviceSrgvService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceTsjService deviceTsjService;
|
||||
|
||||
@Autowired
|
||||
private IMsgDdjService msgDdjService;
|
||||
|
||||
@@ -58,18 +52,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 +79,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,55 +137,60 @@ 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);
|
||||
|
||||
for (DeviceSsj ssj : ssjList) {
|
||||
int taskNo = ssj.getTaskNo();
|
||||
// 判断是否为运行中设备:taskNo不为0
|
||||
if (taskNo != 0) {
|
||||
Map<String, Object> deviceInfo = new HashMap<>();
|
||||
deviceInfo.put("deviceCode", ssj.getDeviceCode());
|
||||
deviceInfo.put("deviceName", ssj.getName());
|
||||
deviceInfo.put("deviceType", "SSJ");
|
||||
deviceInfo.put("taskNo", String.valueOf(ssj.getTaskNo()));
|
||||
runningDevices.add(deviceInfo);
|
||||
if (ssjList != null && !ssjList.isEmpty()){
|
||||
for (DeviceSsj ssj : ssjList) {
|
||||
Integer taskNo = ssj.getTaskNo();
|
||||
// 判断是否为运行中设备:taskNo不为0
|
||||
if (taskNo != 0 && taskNo != null) {
|
||||
Map<String, Object> deviceInfo = new HashMap<>();
|
||||
deviceInfo.put("deviceCode", ssj.getDeviceCode());
|
||||
deviceInfo.put("deviceName", ssj.getName());
|
||||
deviceInfo.put("deviceType", "SSJ");
|
||||
deviceInfo.put("taskNo", String.valueOf(ssj.getTaskNo()));
|
||||
runningDevices.add(deviceInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MsgDdj msgDdj = new MsgDdj();
|
||||
List<MsgDdj> msgDdjList = msgDdjService.selectMsgDdjList(msgDdj);
|
||||
|
||||
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());
|
||||
runningDevices.add(deviceInfo);
|
||||
DeviceSrgv deviceSrgv = new DeviceSrgv();
|
||||
List<DeviceSrgv> srgvList = deviceSrgvService.selectDeviceSrgvList(deviceSrgv);
|
||||
if (srgvList != null && !srgvList.isEmpty()){
|
||||
for (DeviceSrgv srgv : srgvList) {
|
||||
Integer taskNo = srgv.getTaskNo();
|
||||
if (taskNo != null && 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DeviceTsj deviceTsj = new DeviceTsj();
|
||||
List<DeviceTsj> tsjList = deviceTsjService.selectDeviceTsjList(deviceTsj);
|
||||
if (tsjList != null && !tsjList.isEmpty()){
|
||||
for (DeviceTsj tsj : tsjList) {
|
||||
Long taskNo = tsj.getRwh();
|
||||
if (taskNo != null && 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.success(runningDevices);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("获取运行中设备列表失败");
|
||||
@@ -242,56 +240,65 @@ 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);
|
||||
|
||||
if (deviceSrgvs != null && !deviceSrgvs.isEmpty()){
|
||||
for (DeviceSrgv device : deviceSrgvs) {
|
||||
Integer taskNo = device.getTaskNo();
|
||||
String status = "其他";
|
||||
// 根据taskNo判断状态:不等于空或0时为运行状态
|
||||
if (taskNo != 0 && taskNo != null) {
|
||||
status = "运行";
|
||||
}
|
||||
Map<String, Integer> typeStatusCount = statusCount.get("SRGV");
|
||||
typeStatusCount.put(status, typeStatusCount.getOrDefault(status, 0) + 1);
|
||||
|
||||
for (DeviceCar device : deviceList) {
|
||||
String taskNo = device.getTaskNo();
|
||||
String status = "其他";
|
||||
// 根据taskNo判断状态:不等于空或0时为运行状态
|
||||
if (taskNo != null && !taskNo.trim().isEmpty() && !"0".equals(taskNo.trim())) {
|
||||
status = "运行";
|
||||
}
|
||||
Map<String, Integer> typeStatusCount = statusCount.get("AGV");
|
||||
typeStatusCount.put(status, typeStatusCount.getOrDefault(status, 0) + 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 查询DeviceSsj数据(SSJ)
|
||||
DeviceSsj deviceSsj = new DeviceSsj();
|
||||
List<DeviceSsj> ssjList = deviceSsjService.selectDeviceSsjList(deviceSsj);
|
||||
|
||||
for (DeviceSsj ssj : ssjList) {
|
||||
int taskNo = ssj.getTaskNo();
|
||||
String status = "其他";
|
||||
if (ssjList != null && !ssjList.isEmpty()){
|
||||
for (DeviceSsj ssj : ssjList) {
|
||||
Integer taskNo = ssj.getTaskNo();
|
||||
String status = "其他";
|
||||
|
||||
// 根据taskNo判断状态:不等于空或0时为运行状态
|
||||
if (taskNo != 0) {
|
||||
status = "运行";
|
||||
// 根据taskNo判断状态:不等于空或0时为运行状态
|
||||
if (taskNo != 0 && taskNo != null) {
|
||||
status = "运行";
|
||||
}
|
||||
|
||||
Map<String, Integer> typeStatusCount = statusCount.get("SSJ");
|
||||
typeStatusCount.put(status, typeStatusCount.getOrDefault(status, 0) + 1);
|
||||
}
|
||||
|
||||
Map<String, Integer> typeStatusCount = statusCount.get("SSJ");
|
||||
typeStatusCount.put(status, typeStatusCount.getOrDefault(status, 0) + 1);
|
||||
}
|
||||
|
||||
MsgDdj msgDdj = new MsgDdj();
|
||||
List<MsgDdj> msgDdjList = msgDdjService.selectMsgDdjList(msgDdj);
|
||||
|
||||
for (MsgDdj ddj : msgDdjList){
|
||||
Long taskNo = ddj.getRwh();
|
||||
String status = "其他";
|
||||
if (taskNo!=0){
|
||||
status = "运行";
|
||||
DeviceTsj deviceTsj = new DeviceTsj();
|
||||
List<DeviceTsj> TsjList = deviceTsjService.selectDeviceTsjList(deviceTsj);
|
||||
|
||||
if (TsjList != null && !TsjList.isEmpty()){
|
||||
for (DeviceTsj tsj : TsjList){
|
||||
Long taskNo = tsj.getRwh();
|
||||
String status = "其他";
|
||||
if (taskNo != 0 && taskNo != null){
|
||||
status = "运行";
|
||||
}
|
||||
Map<String,Integer> typeStatusCount = statusCount.get("TSJ");
|
||||
typeStatusCount.put(status,typeStatusCount.getOrDefault(status,0) + 1);
|
||||
}
|
||||
Map<String,Integer> typeStatusCount = statusCount.get("DDJ");
|
||||
typeStatusCount.put(status,typeStatusCount.getOrDefault(status,0) + 1);
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.success(statusCount);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("获取设备状态分布数据失败");
|
||||
|
||||
@@ -6,8 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<resultMap type="DeviceSsj" id="DeviceSsjResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deviceCode " column="device_code " />
|
||||
<result property="name " column="name " />
|
||||
<result property="deviceCode" column="device_code" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="ipAddress" column="ip_address" />
|
||||
<result property="plcDbReadAddress" column="plc_db_read_address" />
|
||||
@@ -31,8 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectDeviceSsjList" parameterType="DeviceSsj" resultMap="DeviceSsjResult">
|
||||
<include refid="selectDeviceSsjVo"/>
|
||||
<where>
|
||||
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode }</if>
|
||||
<if test="name != null and name != ''"> and name = #{name }</if>
|
||||
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
|
||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
|
||||
<if test="plcDbReadAddress != null and plcDbReadAddress != ''"> and plc_db_read_address = #{plcDbReadAddress}</if>
|
||||
|
||||
Reference in New Issue
Block a user