opt: 优化代码,更新logo展示

This commit is contained in:
yanps
2025-02-24 17:56:40 +08:00
parent df1795cbbd
commit 0b9c855c17
21 changed files with 391 additions and 460 deletions

View File

@@ -191,12 +191,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (plcToAgvDeviceDriver.getAGVSetOutReqUpper() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVSetOutReqUpper", "1");
}
//plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1");
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) {
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
}
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
data = feedBackStatus(data, index, 1, inst, task, 2, false);
}
}
@@ -206,24 +204,20 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (plcToAgvDeviceDriver.getAGVSetOutReqUpper() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVSetOutReqUpper", "1");
}
//plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1");
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) {
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
}
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
data = feedBackStatus(data, index, 1, inst, task, 2, false);
}
} else if ("2".equals(plc_to_agv)) {
if (plcToAgvDeviceDriver.getAGVSetOutReqLower() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVSetOutReqLower", "1");
}
//plcToAgvDeviceDriver.writing("AGVSetOutReqLower", "1");
if (plcToAgvDeviceDriver.getAGVSetOutLowerAllowed() == 1) {
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
}
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
data = feedBackStatus(data, index, 1, inst, task, 2, false);
}
}
@@ -369,12 +363,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (plcToAgvDeviceDriver.getAGVSetInReqUpper() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVSetInReqUpper", "1");
}
//plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1");
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) {
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
}
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
data = feedBackStatus(data, index, 3, inst, task, 2, false);
}
}
@@ -388,24 +380,20 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (plcToAgvDeviceDriver.getAGVSetInReqUpper() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVSetInReqUpper", "1");
}
//plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1");
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) {
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
}
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
data = feedBackStatus(data, index, 3, inst, task, 2, false);
}
} else if ("2".equals(plc_to_agv)) {
if (plcToAgvDeviceDriver.getAGVSetInReqLower() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVSetInReqLower", "1");
}
//plcToAgvDeviceDriver.writing("AGVSetInReqLower", "1");
if (plcToAgvDeviceDriver.getAGVSetInLowerAllowed() == 1) {
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
}
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
data = feedBackStatus(data, index, 3, inst, task, 2, false);
}
}

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -12,12 +13,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device.service.mapper.DeviceMapper;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.domain.RoutePlan;
import org.nl.acs.route.service.RoutePlanService;
import org.nl.acs.route.service.dto.RoutePlanDto;
import org.nl.acs.common.base.PageInfo;
@@ -55,6 +58,7 @@ import java.util.stream.Collectors;
* @author jiaolm
* @date 2023-05-09
*/
@Slf4j
@Service
@AllArgsConstructor
// @CacheConfig(cacheNames = RouteLineService.CACHE_KEY)
@@ -345,36 +349,31 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
}
}
}
// reload();
reload();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(RouteLineDto dto) throws SQLException {
RouteLineDto entity = this.findById(dto.getLine_uuid());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
if (ObjectUtil.isEmpty(entity)) throw new BadRequestException("被删除或无权限,操作失败!");
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setUpdate_time(now);
dto.setUpdate_by(currentUsername);
// WQLObject wo = WQLObject.getWQLObject("acs_route_line");
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
//
// wo.update(json);
RouteLine routeLine = ConvertUtil.convert(dto, RouteLine.class);
routeLineMapper.updateById(routeLine);
reload();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(String[] ids) throws SQLException {
routeLineMapper.deleteBatchIds(Arrays.asList(ids));
//reload();
reload();
}
@Override
@@ -413,12 +412,10 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
//获取所有设备 (主要是设备编号,可以修改)
List<Device> deviceList= new LambdaQueryChainWrapper<>(deviceMapper)
.list();
JSONArray de = JSONArray.parseArray(JSON.toJSONString(deviceList));
HashMap<String, Integer> map = new HashMap<>();
for (int i = 0; i < de.size(); i++) {
JSONObject jo = (JSONObject) de.get(i);
map.put(jo.getString("device_code"), i);
for (int i = 0; i < deviceList.size(); i++) {
Device device = deviceList.get(i);
map.put(device.getDevice_code(), i);
}
int size = map.size();
//查询所有路由
@@ -446,8 +443,6 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
smap.put("route_plan_id", routeLine.getRoute_plan_id());
n[s][e] = smap;
}
//对数组使用Floyd(弗洛伊德)算法求出任意两个设备之间的最短距离不通则为null
// JSONObject json = WQLObject.getWQLObject("sys_param").query("code ='route'").uniqueResult(0);
Param param = paramService.findByCode("route");
if (ObjectUtil.isNotEmpty(param)){
@@ -519,18 +514,12 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
*/
@Override
public void reload() throws SQLException {
Object[] param = new Object[0];
Map map = new HashMap();
List<RoutePlanDto> routePlans = this.routePlanService.queryAll(map);
List<RoutePlanDto> routePlans = this.routePlanService.queryAll((Map) null);
Iterator var2 = routePlans.iterator();
while (var2.hasNext()) {
RoutePlanDto routePlan = (RoutePlanDto) var2.next();
Map map1 = new HashMap();
map1.put("route_plan_id", routePlan.getPlan_uuid());
replaceAccess(routePlan.getPlan_uuid());
this.routePlans.put(routePlan.getPlan_code(), routePlan);
//this.routePlans.put(routePlan.getPlan_code(), routePlan);
List<RouteLineDto> routeDaoList = routePlansList.stream().map(entity -> {
RouteLineDto routeLineDto = new RouteLineDto();
routeLineDto.setDevice_code(entity.get("device_code").toString());
@@ -553,8 +542,6 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
}
routeLines.put(routePlan.getPlan_code(), list);
}
}
@Override