Browse Source

rev: 修改设备监控大屏

master
李永德 2 years ago
parent
commit
0ae1452882
  1. 4
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/CockpitController.java
  2. 3
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/CockpitService.java
  3. 31
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java
  4. 36
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java

4
lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/CockpitController.java

@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
/** /**
* 大屏数据1 * 大屏数据1
@ -82,7 +84,7 @@ public class CockpitController{
@PostMapping("/deviceMonitor") @PostMapping("/deviceMonitor")
@Log("设备监控") @Log("设备监控")
@ApiOperation("设备监控") @ApiOperation("设备监控")
public CommonResult<List<DeviceInfoDto>> deviceMonitor() { public CommonResult<ConcurrentHashMap<String,List<DeviceInfoDto>>> deviceMonitor() {
return RestBusinessTemplate.execute(cockpitService::deviceMonitor); return RestBusinessTemplate.execute(cockpitService::deviceMonitor);
} }

3
lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/CockpitService.java

@ -8,6 +8,7 @@ import org.nl.wms.cockpit.service.dto.SchBasePointDto;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
/** /**
* 大屏服务接口1 * 大屏服务接口1
@ -43,7 +44,7 @@ public interface CockpitService{
* *
* @return 返回结果集 * @return 返回结果集
*/ */
List<DeviceInfoDto> deviceMonitor(); ConcurrentHashMap<String,List<DeviceInfoDto>> deviceMonitor();
/** /**
* 根据point_id获取设备信息 * 根据point_id获取设备信息

31
lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java

@ -22,10 +22,7 @@ import java.math.BigDecimal;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadPoolExecutor;
/** /**
* 大屏服务实现1 * 大屏服务实现1
@ -212,7 +209,7 @@ public class CockpitServiceImpl implements CockpitService{
* @since 2023/2/28 * @since 2023/2/28
*/ */
@Override @Override
public List<DeviceInfoDto> deviceMonitor() { public ConcurrentHashMap<String, List<DeviceInfoDto>> deviceMonitor() {
List<DeviceInfoDto> res; List<DeviceInfoDto> res;
ConcurrentHashMap<String, List<DeviceInfoDto>> map = new ConcurrentHashMap<>(); ConcurrentHashMap<String, List<DeviceInfoDto>> map = new ConcurrentHashMap<>();
JSONArray result = WQL.getWO("COCKPIT_DEVICE") JSONArray result = WQL.getWO("COCKPIT_DEVICE")
@ -225,14 +222,31 @@ public class CockpitServiceImpl implements CockpitService{
} }
JSONArray data = ObjectUtil.isNotEmpty( JSONArray data = ObjectUtil.isNotEmpty(
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : result; devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : result;
// 初始画数据
for (int i = 1; i <= 13; i++) {
DeviceEnum deviceEnum = DeviceEnum.getByModel(String.valueOf(i));
if (ObjectUtil.isEmpty(map.get(deviceEnum.getKeyName()))) {
List<DeviceInfoDto> de = new ArrayList<>();
map.put(deviceEnum.getKeyName(), de);
}
}
if (ObjectUtil.isNotEmpty(data)) { if (ObjectUtil.isNotEmpty(data)) {
res = data.toJavaList(DeviceInfoDto.class); res = data.toJavaList(DeviceInfoDto.class);
res.forEach(d -> { res.forEach(d -> {
DeviceEnum deviceEnum = DeviceEnum.get(d.getDevice_model(), d.getDevice_code()); DeviceEnum deviceEnum = DeviceEnum.getByModel(d.getDevice_model());
// 添加图片名字 // 添加图片名字
d.setDevice_url(deviceEnum.getPictureName()); d.setDevice_url(deviceEnum.getPictureName());
// 分类链表
if (ObjectUtil.isEmpty(map.get(deviceEnum.getKeyName()))) {
List<DeviceInfoDto> de = new ArrayList<>();
de.add(d);
map.put(deviceEnum.getKeyName(), de);
} else {
map.get(deviceEnum.getKeyName()).add(d);
map.put(deviceEnum.getKeyName(), map.get(deviceEnum.getKeyName()));
}
}); });
return res; return map;
} }
return null; return null;
} }
@ -379,8 +393,7 @@ public class CockpitServiceImpl implements CockpitService{
long minute = DateUtil.between(nowTime, inStorageTime, DateUnit.MINUTE); long minute = DateUtil.between(nowTime, inStorageTime, DateUnit.MINUTE);
if (minute < schBasePointDto.getStanding_time().longValue()) { if (minute < schBasePointDto.getStanding_time().longValue()) {
schBasePointDto.setStanding_status("静置中"); schBasePointDto.setStanding_status("静置中");
} } else {
else{
schBasePointDto.setStanding_status("静置完成"); schBasePointDto.setStanding_status("静置完成");
} }
if (schBasePointDto.getPoint_status().equals(PointEnum.POINT_STATUS_EMPTY_POSITION.getCode())) { if (schBasePointDto.getPoint_status().equals(PointEnum.POINT_STATUS_EMPTY_POSITION.getCode())) {

36
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java

@ -8,18 +8,19 @@ import cn.hutool.core.util.StrUtil;
* @Date: 2023/3/9 * @Date: 2023/3/9
*/ */
public enum DeviceEnum { public enum DeviceEnum {
HLJ("1", "混料机", "HLJ", "HLJ"), HLJ_S("1", "高速混料机", "HLJ", "HLJ_S"),
HLJ_S("2", "高速混料机", "HLJ_S", "HLJ_S"), HLJ("2", "混料机", "HLJ", "HLJ"),
YZJ("3", "压机", "YZJ", "YZJ"), YZJ_S("3", "液压机", "YZJ", "YZJ_S"), //
YZJ_S("4", "液压机", "YZJ_S", "YZJ_S"), // YZJ("4", "压机", "YZJ", "YZJ"),
FJJXS("5", "分拣机械手", "FJJXS", "FJJXS"), MDJXS("5", "码垛机械手", "MDJXS", "MDJXS"),
CPX("6", "拆盘线", "CPX", "CPX"), RYHJ("6", "入窑桁架", "YAO", "RYHJ"),
BZX("6", "包装线", "BZX", "BZX"), YAO("7", "窑", "YAO", "YAO"),
YAO("7", "窑设备", "YAO", "YAO"), CYHJ("8", "出窑桁架", "YAO", "CYHJ"),
DPJ("8", "叠盘架", "DPJ", "DPJ"), FJCDJXS("9", "分拣拆垛机械手", "FJJXS", "FJCDJXS"),
CPJ("9", "拆盘架", "CPJ", "CPJ"), FJMDJXS("10", "分拣码垛机械手", "FJJXS", "FJMDJXS"),
MDJXS("10", "码垛机械手", "MDJXS", "MDJXS"), RGV("11", "RGV", "BZX", "RGV"),
RGV("11", "RGV", "RGV", "RGV"); BZJ("12", "包装机", "BZX", "BZJ"),
DTJ("13", "叠托机", "BZX", "DTJ");
private final String model; private final String model;
private final String name; private final String name;
@ -35,7 +36,16 @@ public enum DeviceEnum {
public static DeviceEnum get(String model, String code) { public static DeviceEnum get(String model, String code) {
for (DeviceEnum deviceEnum : DeviceEnum.values()) { for (DeviceEnum deviceEnum : DeviceEnum.values()) {
if (code.equals(BZX.pictureName)) return BZX; if (code.equals(BZJ.pictureName)) return BZJ;
if (StrUtil.equals(deviceEnum.model, model)) {
return deviceEnum;
}
}
return null;
}
public static DeviceEnum getByModel(String model) {
for (DeviceEnum deviceEnum : DeviceEnum.values()) {
if (StrUtil.equals(deviceEnum.model, model)) { if (StrUtil.equals(deviceEnum.model, model)) {
return deviceEnum; return deviceEnum;
} }

Loading…
Cancel
Save