diff --git a/web/src/main/java/com/zhehekeji/web/service/PlcService.java b/web/src/main/java/com/zhehekeji/web/service/PlcService.java index 09317db..36a6351 100644 --- a/web/src/main/java/com/zhehekeji/web/service/PlcService.java +++ b/web/src/main/java/com/zhehekeji/web/service/PlcService.java @@ -672,9 +672,21 @@ public class PlcService { CronTab.putTime(street.getId()); plcCmdInfo.setStreetName(street.getName()); List lightSources = lightSourceMapper.selectList(new QueryWrapper().eq("street_id", street.getId())); + lightSources.forEach(lightSource -> { HikControlSocket.openLight(lightSource.getIp(), lightSource.getPort(), configProperties.getLightSource().getIndex(), 1); }); + Thread thread = new Thread(() -> { + try { + Thread.sleep(30000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + //关闭光源 + streetController.closeStreetLightSource(street.getId()); + }); + thread.start(); + log.info("盘点摄像头变化参数:" + plcCmdInfo.toString()); Integer cameraId = getCameraByPlcCmdE(plcCmdInfo, plcCmdInfo.getLeftRight1()); String code = "E1" + "-" + plcCmdInfo.getEndStr(1, plcCmdInfo.getFromAround()); @@ -740,8 +752,6 @@ public class PlcService { long s = end - startTime; log.info("time:{}millisecond", s); - //关闭光源 - streetController.closeStreetLightSource(street.getId()); return algorithmPojo; } @@ -829,8 +839,8 @@ public class PlcService { //古井贡酒没有side使用双伸单伸Separation代替全部side plcCmdInfo = new PlcCmdInfo(dataInfo.getSRMNumber(), dataInfo.getTaskId(), dataInfo.getFromSeparation(), dataInfo.getFromDirection(), dataInfo.getFromColumn(), - dataInfo.getFromStorey(), dataInfo.getFromSeparation(), dataInfo.getToSeparation(), - dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToStorey(), + dataInfo.getFromRow(), dataInfo.getFromSeparation(), dataInfo.getToSeparation(), + dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToRow(), dataInfo.getToSeparation(), lotnum); plcCmdInfo.setFromDirection(dataInfo.getFromDirection()); plcCmdInfo.setToDirection(dataInfo.getToDirection()); @@ -843,6 +853,13 @@ public class PlcService { plcCmdInfo.setToSeparation(dataInfo.getToSeparation()); plcCmdInfo.setFromAround(dataInfo.getFromAround()); plcCmdInfo.setToSide(dataInfo.getToSeparation()); + if( dataInfo.getToStorey()!=null ){ + plcCmdInfo.setToRow(dataInfo.getToStorey()); + } + if( dataInfo.getFromStorey()!=null ){ + plcCmdInfo.setFromRow(dataInfo.getFromStorey()); + } + //左右不交换 if (dataInfo.getFromDirection() != null) { if (dataInfo.getFromDirection() == 1) { diff --git a/web/src/main/java/com/zhehekeji/web/service/algorithm/AlgorithmService.java b/web/src/main/java/com/zhehekeji/web/service/algorithm/AlgorithmService.java index 8a12ed9..08b6137 100644 --- a/web/src/main/java/com/zhehekeji/web/service/algorithm/AlgorithmService.java +++ b/web/src/main/java/com/zhehekeji/web/service/algorithm/AlgorithmService.java @@ -7,6 +7,7 @@ import com.zhehekeji.web.config.ConfigProperties; import com.zhehekeji.web.entity.AlgorithmPojo; import com.zhehekeji.web.entity.Street; import com.zhehekeji.web.service.ksec.KsecDataInfo; +import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestClientException; @@ -19,6 +20,7 @@ import java.util.Objects; import java.util.stream.Collectors; @Service +@Slf4j public class AlgorithmService { @Resource RestTemplate restTemplate; @@ -33,18 +35,23 @@ public class AlgorithmService { AlgorithmService algorithmService = new AlgorithmService(); algorithmService.getGoodResult(algorithmPojo); + + System.out.println(algorithmPojo); + + System.out.println(algorithmPojo); + System.out.println("aaaaa"); } public AlgorithmPojo getGoodResult(AlgorithmPojo algorithmPojo) { - //String url = "http://"+algorithmPojo.getIp()+":"+algorithmPojo.getPort()+configProperties.getVisualSense().getUrl(); + String url = "http://"+algorithmPojo.getIp()+":"+algorithmPojo.getPort()+configProperties.getVisualSense().getUrl(); RestTemplate restTemplate =new RestTemplate(); - String url = "http://127.0.0.1:8083"+"/visionCompute"; + //String url = "http://127.0.0.1:8083"+"/visionCompute"; ResponseEntity body = null; try { @@ -60,8 +67,11 @@ public class AlgorithmService { } System.out.println(body); }catch (RestClientException e){ + log.error("未连接上堆垛机"+e); //Assert.isTrue(false,"请求失败,视觉服务未连接"); - e.printStackTrace(); + algorithmPojo.setResult(0); + return algorithmPojo; + } return algorithmPojo; }