Merge branch 'bozhou-古井贡酒' of https://gitlab.hzleaper.com:81/duoji/backend-duoji-monitor into bozhou-古井贡酒

行修改,光源修改
bozhou-古井贡酒
LAPTOP-S9HJSOEB\昊天 2 years ago
commit 805e0a8dac

@ -672,9 +672,21 @@ public class PlcService {
CronTab.putTime(street.getId()); CronTab.putTime(street.getId());
plcCmdInfo.setStreetName(street.getName()); plcCmdInfo.setStreetName(street.getName());
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id", street.getId())); List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id", street.getId()));
lightSources.forEach(lightSource -> { lightSources.forEach(lightSource -> {
HikControlSocket.openLight(lightSource.getIp(), lightSource.getPort(), configProperties.getLightSource().getIndex(), 1); 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()); log.info("盘点摄像头变化参数:" + plcCmdInfo.toString());
Integer cameraId = getCameraByPlcCmdE(plcCmdInfo, plcCmdInfo.getLeftRight1()); Integer cameraId = getCameraByPlcCmdE(plcCmdInfo, plcCmdInfo.getLeftRight1());
String code = "E1" + "-" + plcCmdInfo.getEndStr(1, plcCmdInfo.getFromAround()); String code = "E1" + "-" + plcCmdInfo.getEndStr(1, plcCmdInfo.getFromAround());
@ -740,8 +752,6 @@ public class PlcService {
long s = end - startTime; long s = end - startTime;
log.info("time:{}millisecond", s); log.info("time:{}millisecond", s);
//关闭光源
streetController.closeStreetLightSource(street.getId());
return algorithmPojo; return algorithmPojo;
} }
@ -829,8 +839,8 @@ public class PlcService {
//古井贡酒没有side使用双伸单伸Separation代替全部side //古井贡酒没有side使用双伸单伸Separation代替全部side
plcCmdInfo = new PlcCmdInfo(dataInfo.getSRMNumber(), dataInfo.getTaskId(), plcCmdInfo = new PlcCmdInfo(dataInfo.getSRMNumber(), dataInfo.getTaskId(),
dataInfo.getFromSeparation(), dataInfo.getFromDirection(), dataInfo.getFromColumn(), dataInfo.getFromSeparation(), dataInfo.getFromDirection(), dataInfo.getFromColumn(),
dataInfo.getFromStorey(), dataInfo.getFromSeparation(), dataInfo.getToSeparation(), dataInfo.getFromRow(), dataInfo.getFromSeparation(), dataInfo.getToSeparation(),
dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToStorey(), dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToRow(),
dataInfo.getToSeparation(), lotnum); dataInfo.getToSeparation(), lotnum);
plcCmdInfo.setFromDirection(dataInfo.getFromDirection()); plcCmdInfo.setFromDirection(dataInfo.getFromDirection());
plcCmdInfo.setToDirection(dataInfo.getToDirection()); plcCmdInfo.setToDirection(dataInfo.getToDirection());
@ -843,6 +853,13 @@ public class PlcService {
plcCmdInfo.setToSeparation(dataInfo.getToSeparation()); plcCmdInfo.setToSeparation(dataInfo.getToSeparation());
plcCmdInfo.setFromAround(dataInfo.getFromAround()); plcCmdInfo.setFromAround(dataInfo.getFromAround());
plcCmdInfo.setToSide(dataInfo.getToSeparation()); 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() != null) {
if (dataInfo.getFromDirection() == 1) { if (dataInfo.getFromDirection() == 1) {

@ -7,6 +7,7 @@ import com.zhehekeji.web.config.ConfigProperties;
import com.zhehekeji.web.entity.AlgorithmPojo; import com.zhehekeji.web.entity.AlgorithmPojo;
import com.zhehekeji.web.entity.Street; import com.zhehekeji.web.entity.Street;
import com.zhehekeji.web.service.ksec.KsecDataInfo; import com.zhehekeji.web.service.ksec.KsecDataInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestClientException;
@ -19,6 +20,7 @@ import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@Slf4j
public class AlgorithmService { public class AlgorithmService {
@Resource @Resource
RestTemplate restTemplate; RestTemplate restTemplate;
@ -33,18 +35,23 @@ public class AlgorithmService {
AlgorithmService algorithmService = new AlgorithmService(); AlgorithmService algorithmService = new AlgorithmService();
algorithmService.getGoodResult(algorithmPojo); algorithmService.getGoodResult(algorithmPojo);
System.out.println(algorithmPojo);
System.out.println(algorithmPojo);
System.out.println("aaaaa");
} }
public AlgorithmPojo getGoodResult(AlgorithmPojo algorithmPojo) { 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(); RestTemplate restTemplate =new RestTemplate();
String url = "http://127.0.0.1:8083"+"/visionCompute"; //String url = "http://127.0.0.1:8083"+"/visionCompute";
ResponseEntity<String> body = null; ResponseEntity<String> body = null;
try { try {
@ -60,8 +67,11 @@ public class AlgorithmService {
} }
System.out.println(body); System.out.println(body);
}catch (RestClientException e){ }catch (RestClientException e){
log.error("未连接上堆垛机"+e);
//Assert.isTrue(false,"请求失败,视觉服务未连接"); //Assert.isTrue(false,"请求失败,视觉服务未连接");
e.printStackTrace(); algorithmPojo.setResult(0);
return algorithmPojo;
} }
return algorithmPojo; return algorithmPojo;
} }

Loading…
Cancel
Save