|
|
|
|
@ -104,6 +104,15 @@ public class PlcService {
|
|
|
|
|
public void orderStart(PlcCmdInfo plcCmdInfo) {
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
|
|
|
|
|
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",street.getId()));
|
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
|
try {
|
|
|
|
|
LightSourceService.lightControllerOpen(configProperties.getLightSource(),lightSource);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("open light"+lightSource.getIp()+" error",e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
if (street != null) {
|
|
|
|
|
if (plcCmdInfo.getLeftRight1() == 1) {
|
|
|
|
|
if (plcCmdInfo.getRow1() > street.getLeftRow() && plcCmdInfo.getColumn1() > street.getLeftColumn()) {
|
|
|
|
|
@ -116,10 +125,22 @@ public class PlcService {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Integer cameraId = getCameraByPlcCmd(plcCmdInfo,plcCmdInfo.getLeftRight1());
|
|
|
|
|
|
|
|
|
|
String code = "C2-" + plcCmdInfo.getLeftRightStr(0) + plcCmdInfo.getInOutStr(0);
|
|
|
|
|
gyrateCameraByCode(cameraId,code);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long delayTime = configProperties.getCameraConfig().getC1DelayCaptureTime();
|
|
|
|
|
|
|
|
|
|
String path = PathUtil.createFileNameByRowColumn("jpg",cameraId,plcCmdInfo.getRow1(),plcCmdInfo.getColumn1());
|
|
|
|
|
path = cameraCapture(cameraId,true,delayTime,path);
|
|
|
|
|
plcCmdInfo.setStreetId(street.getId());
|
|
|
|
|
Order order = new Order();
|
|
|
|
|
order.setOrderNum(plcCmdInfo.getOrderNum());
|
|
|
|
|
order.setStatus(0);
|
|
|
|
|
order.setPicPaths(path);
|
|
|
|
|
order.setStartTime(LocalDateTime.now());
|
|
|
|
|
order.setStreetId(street.getId());
|
|
|
|
|
order.setInOut1(plcCmdInfo.getSide1());
|
|
|
|
|
@ -177,6 +198,16 @@ public class PlcService {
|
|
|
|
|
String path = cameraVideo(street.getCamera2Id(), order.getStartTime(), endDownLoadTime);
|
|
|
|
|
update.setVideoPath2(path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",street.getId()));
|
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
|
try {
|
|
|
|
|
LightSourceService.lightControllerClose(configProperties.getLightSource(),lightSource);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("open light"+lightSource.getIp()+" error",e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
orderMapper.updateById(update);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -272,7 +303,7 @@ public class PlcService {
|
|
|
|
|
*/
|
|
|
|
|
Integer cameraId = getCameraByPlcCmd(plcCmdInfo,orderInfo.getLeftRight());
|
|
|
|
|
gyrateCameraByCode(cameraId,orderInfo.getCmdCode());
|
|
|
|
|
if(needCapture){
|
|
|
|
|
if(needCapture && code.startsWith("C4")){
|
|
|
|
|
Boolean delay = true;
|
|
|
|
|
Integer row = 0;
|
|
|
|
|
Integer column = 0;
|
|
|
|
|
@ -287,24 +318,12 @@ public class PlcService {
|
|
|
|
|
sep = plcCmdInfo.getSeparation2();
|
|
|
|
|
}
|
|
|
|
|
long delayTime = 0;
|
|
|
|
|
if(code.startsWith("C1")){
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC1DelayCaptureTime();
|
|
|
|
|
}else if(code.startsWith("C2")){
|
|
|
|
|
if(sep == 1){
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC2DelayCaptureTime();
|
|
|
|
|
}else {
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC2OutDelayCaptureTime();
|
|
|
|
|
}
|
|
|
|
|
}else if(code.startsWith("C3")){
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC3DelayCaptureTime();
|
|
|
|
|
|
|
|
|
|
}else if(code.startsWith("C4")){
|
|
|
|
|
//该项目只有c1,c4,并且c1由b1拍照
|
|
|
|
|
if(sep == 1){
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC4DelayCaptureTime();
|
|
|
|
|
}else {
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC4OutDelayCaptureTime();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
path = PathUtil.createFileNameByRowColumn("jpg",cameraId,row,column);
|
|
|
|
|
path = cameraCapture(cameraId,delay,delayTime,path);
|
|
|
|
|
}
|
|
|
|
|
@ -331,7 +350,7 @@ public class PlcService {
|
|
|
|
|
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",street.getId()));
|
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
|
try {
|
|
|
|
|
HikControlSocket.openLight(lightSource.getIp(),lightSource.getPort(),configProperties.getLightSource().getIndex(),1);
|
|
|
|
|
LightSourceService.lightControllerOpen(configProperties.getLightSource(),lightSource);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("open light"+lightSource.getIp()+" error",e);
|
|
|
|
|
}
|
|
|
|
|
@ -541,7 +560,14 @@ public class PlcService {
|
|
|
|
|
long end = System.currentTimeMillis();
|
|
|
|
|
long s = end - startTime;
|
|
|
|
|
log.info("time:{}millisecond", s);
|
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
|
try {
|
|
|
|
|
LightSourceService.lightControllerClose(configProperties.getLightSource(),lightSource);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("open light"+lightSource.getIp()+" error",e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|