1.增加巷道查找

2.球机时间校准
3.下一个如果包含错误
4.加层数
bozhou-古井贡酒
LAPTOP-S9HJSOEB\昊天 2 years ago
parent bac44e656a
commit 937dfa5e20

@ -133,4 +133,5 @@ public interface CameraControlModule {
void toPtzSlow(Integer cameraId, Integer x); void toPtzSlow(Integer cameraId, Integer x);
boolean setCameraTime(Integer id);
} }

@ -20,6 +20,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Timer; import java.util.Timer;
import static com.zhehekeji.web.lib.hik.HCNetSDK.NET_DVR_SET_TIMECFG;
/** /**
* *
* *
@ -435,4 +437,13 @@ public class HikCameraControlModuleImpl implements CameraControlModule {
} }
} }
public boolean setCameraTime(Integer cameraId) {
int lUserId = CameraConnMap.getConnId(cameraId).intValue();
HCNetSDK.NET_DVR_TIME time = new HCNetSDK.NET_DVR_TIME();
LocalDateTime localDateTime = LocalDateTime.now();
time.setTime(localDateTime.getYear(),localDateTime.getMonthValue(),localDateTime.getDayOfMonth(),localDateTime.getHour(),localDateTime.getMinute(),localDateTime.getSecond());
time.write();
return HikLoginModuleImpl.hcNetsdk.NET_DVR_SetDVRConfig(lUserId, NET_DVR_SET_TIMECFG, 0,time.getPointer(), time.size());
}
} }

@ -352,6 +352,9 @@ public class JoywareCameraControlModuleImpl implements CameraControlModule {
log.error("toPtzSlow cameraId:{},error:{}", cameraId,ToolKits.getErrorCodePrint()); log.error("toPtzSlow cameraId:{},error:{}", cameraId,ToolKits.getErrorCodePrint());
} }
} }
public boolean setCameraTime(Integer cameraId) {
return false;
}
/** /**
* 360 * 360

@ -13,7 +13,7 @@ public interface StockMapper extends BaseMapper<Stock> {
void insertOrUpdate(@Param("req") Stock stock); void insertOrUpdate(@Param("req") Stock stock);
@Select("select * from stock where `street_id` = #{streetId} and `direction` = #{direction} and `side` = #{side} and `row` = #{row} and `column` = #{column} limit 1") @Select("select * from stock where `street_id` = #{streetId} and `direction` = #{direction} and `side` = #{side} and `row` = #{row} and `column` = #{column} order by export_time desc limit 1")
Stock getByStreetAndDirectionAndSideAndRowColumn(@Param("streetId") Integer streetId,@Param("direction") Integer direction,@Param("side") Integer side,@Param("row") Integer row,@Param("column") Integer column); Stock getByStreetAndDirectionAndSideAndRowColumn(@Param("streetId") Integer streetId,@Param("direction") Integer direction,@Param("side") Integer side,@Param("row") Integer row,@Param("column") Integer column);
void truncate(); void truncate();

@ -17,6 +17,7 @@ public class OrderSearch {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTimestamp; private LocalDateTime endTimestamp;
private Integer streetId;
private Integer pageSize; private Integer pageSize;

@ -3,7 +3,13 @@ package com.zhehekeji.web.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhehekeji.web.config.ConfigProperties; import com.zhehekeji.web.config.ConfigProperties;
import com.zhehekeji.web.controller.StreetController; import com.zhehekeji.web.controller.StreetController;
import com.zhehekeji.web.entity.Camera;
import com.zhehekeji.web.entity.LightSource; import com.zhehekeji.web.entity.LightSource;
import com.zhehekeji.web.lib.CameraConnMap;
import com.zhehekeji.web.lib.CameraControlModule;
import com.zhehekeji.web.lib.hik.HikLoginModuleImpl;
import com.zhehekeji.web.lib.joyware.JoywareLoginModuleImpl;
import com.zhehekeji.web.mapper.CameraMapper;
import com.zhehekeji.web.mapper.LightSourceMapper; import com.zhehekeji.web.mapper.LightSourceMapper;
import com.zhehekeji.web.service.damLightSource.JYDAMEquip; import com.zhehekeji.web.service.damLightSource.JYDAMEquip;
import com.zhehekeji.web.service.damLightSource.JYDamHelper; import com.zhehekeji.web.service.damLightSource.JYDamHelper;
@ -73,6 +79,39 @@ public class CronTab {
lightTimeMap.put(streetId,System.currentTimeMillis()); lightTimeMap.put(streetId,System.currentTimeMillis());
} }
@Resource
private CameraMapper cameraMapper;
@Resource
private CameraService cameraService;
@Resource
private CameraControlModule cameraControlModule;
@Scheduled(cron = "${cameraConfig.cameraTimeUpdateCron}")
public void cameraTimeUpdate() {
log.info(" cameraTimeUpdate");
long timeStamp = System.currentTimeMillis();
List<Camera> cameras = cameraMapper.selectList(new QueryWrapper<>());
for (Camera camera : cameras){
Boolean ok = false;
if(configProperties.getCameraConfig().getCameraType() == ConfigProperties.HIK_CAMERA){
ok = HikLoginModuleImpl.connectStatus(CameraConnMap.getConnId(camera.getId()).intValue());
}else {
ok = JoywareLoginModuleImpl.connectStatus(CameraConnMap.getConnId(camera.getId()));
}
if(ok){
cameraControlModule.setCameraTime(camera.getId());
}else {
CameraConnMap.disConn(camera.getId());
camera.setStatus("未连接");
cameraService.cameraLogin(camera);
}
}
}
@Scheduled(cron = "0 0/1 * * * ?") @Scheduled(cron = "0 0/1 * * * ?")
public void lightStatus() { public void lightStatus() {
log.debug(" lightStatus"); log.debug(" lightStatus");
@ -102,7 +141,7 @@ public class CronTab {
} }
@Scheduled(cron = "0 0 0 * * ? ") @Scheduled(cron = "0 4 0 * * ? ")
public void lightCloseAll() { public void lightCloseAll() {
streetController.closeLightSource(); streetController.closeLightSource();
} }

@ -66,7 +66,7 @@ public class InitService implements ApplicationRunner {
cameraService.setCameraLoginModule(cameraControlLoginModule); cameraService.setCameraLoginModule(cameraControlLoginModule);
return cameraControlLoginModule; return cameraControlLoginModule;
} }
CameraControlModule cameraControlModule;
@Bean @Bean
public CameraControlModule cameraControlModule(ConfigProperties configProperties){ public CameraControlModule cameraControlModule(ConfigProperties configProperties){
CameraControlModule cameraControlModule = null; CameraControlModule cameraControlModule = null;
@ -77,6 +77,7 @@ public class InitService implements ApplicationRunner {
} }
plcService.setCameraControlModule(cameraControlModule); plcService.setCameraControlModule(cameraControlModule);
cameraService.setCameraControlModule(cameraControlModule); cameraService.setCameraControlModule(cameraControlModule);
this.cameraControlModule = cameraControlModule;
return cameraControlModule; return cameraControlModule;
} }
@ -84,6 +85,7 @@ public class InitService implements ApplicationRunner {
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
//球机登录 //球机登录
List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>(0)); List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>(0));
cameras.forEach(camera -> { cameras.forEach(camera -> {
LoginThread loginThread = new LoginThread(camera); LoginThread loginThread = new LoginThread(camera);
loginThread.start(); loginThread.start();
@ -121,6 +123,8 @@ public class InitService implements ApplicationRunner {
} }
}else if(configProperties.getServerMode() == 3){} }else if(configProperties.getServerMode() == 3){}
TaskDelayExecutor.runMp4DownloadExecutor(); TaskDelayExecutor.runMp4DownloadExecutor();
streetController.closeLightSource(); streetController.closeLightSource();
} }
@ -134,7 +138,9 @@ public class InitService implements ApplicationRunner {
@Override @Override
public void run() { public void run() {
cameraService.cameraLogin(camera); cameraService.cameraLogin(camera);
cameraControlModule.setCameraTime(camera.getId());
} }
} }

@ -204,6 +204,7 @@ public class PlcService {
LocalDateTime endTime = LocalDateTime.now(); LocalDateTime endTime = LocalDateTime.now();
Order order = orderMapper.getOneByOrderNum(plcCmdInfo.getOrderNum()); Order order = orderMapper.getOneByOrderNum(plcCmdInfo.getOrderNum());
order.setEndTime(endTime);
if (order == null) { if (order == null) {
log.error("订单结束信号订单不存在orderNum:{}", plcCmdInfo.getOrderNum()); log.error("订单结束信号订单不存在orderNum:{}", plcCmdInfo.getOrderNum());
return; return;
@ -354,7 +355,6 @@ public class PlcService {
long delayTime = 0; long delayTime = 0;
if (code.startsWith("C1")) { if (code.startsWith("C1")) {
delayTime = configProperties.getCameraConfig().getC1DelayCaptureTime(); delayTime = configProperties.getCameraConfig().getC1DelayCaptureTime();
} else if (code.startsWith("C2")) { } else if (code.startsWith("C2")) {
if (sep == 1) { if (sep == 1) {
@ -362,7 +362,7 @@ public class PlcService {
} else { } else {
delayTime = configProperties.getCameraConfig().getC2OutDelayCaptureTime(); delayTime = configProperties.getCameraConfig().getC2OutDelayCaptureTime();
} }
if (configProperties.getOrderTest() == 1 && plcCmdInfo.getFromAround() == 2) { if (configProperties.getOrderTest() == 1) {
checkTest(plcCmdInfo); checkTest(plcCmdInfo);
} }
} else if (code.startsWith("C3")) { } else if (code.startsWith("C3")) {
@ -829,8 +829,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.getFromRow(), dataInfo.getFromSeparation(), dataInfo.getToSeparation(), dataInfo.getFromStorey(), dataInfo.getFromSeparation(), dataInfo.getToSeparation(),
dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToRow(), dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToStorey(),
dataInfo.getToSeparation(), lotnum); dataInfo.getToSeparation(), lotnum);
plcCmdInfo.setFromDirection(dataInfo.getFromDirection()); plcCmdInfo.setFromDirection(dataInfo.getFromDirection());
plcCmdInfo.setToDirection(dataInfo.getToDirection()); plcCmdInfo.setToDirection(dataInfo.getToDirection());
@ -882,10 +882,6 @@ public class PlcService {
} else if (Cmd.B2.name().equals(cmdName)) { } else if (Cmd.B2.name().equals(cmdName)) {
//B2 C4 一起发的需要停止等B2
orderStop(plcCmdInfo); orderStop(plcCmdInfo);
} }
} else if (Cmd.C.name().equals(ksecInfo.getType())) { } else if (Cmd.C.name().equals(ksecInfo.getType())) {

@ -112,7 +112,11 @@ public class StockService {
} }
Map<String,Integer> columnTabCorrectCount = new LinkedHashMap<>(); Map<String,Integer> columnTabCorrectCount = new LinkedHashMap<>();
Map<String,Integer> rowTabCorrectCount = new LinkedHashMap<>(); Map<String,Integer> rowTabCorrectCount = new LinkedHashMap<>();
List<Stock> stocks = stockMapper.selectList(new QueryWrapper<Stock>().select("status","`row`","`column`").eq("`street_id`",rowColumnStatus.getStreetId()).eq("direction",rowColumnStatus.getDirection()).eq("side",rowColumnStatus.getSide())); List<Stock> stocks = stockMapper.selectList(new QueryWrapper<Stock>()
.select("status","`row`","`column`")
.eq("`street_id`",rowColumnStatus.getStreetId())
.eq("direction",rowColumnStatus.getDirection())
.eq("side",rowColumnStatus.getSide()));
if(CollectionUtils.isEmpty(stocks)){ if(CollectionUtils.isEmpty(stocks)){
stockInit(rowColumnStatus.getRowStart(), rowColumnStatus.getRowEnd(), rowColumnStatus.getColumnStart(), rowColumnStatus.getColumnEnd(), null,stocks); stockInit(rowColumnStatus.getRowStart(), rowColumnStatus.getRowEnd(), rowColumnStatus.getColumnStart(), rowColumnStatus.getColumnEnd(), null,stocks);
checkStatus.setStocks(stocks); checkStatus.setStocks(stocks);
@ -437,7 +441,7 @@ public class StockService {
public Stock nextOne(Long id) { public Stock nextOne(Long id) {
QueryWrapper<Stock> stockQueryWrapper = new QueryWrapper<>(); QueryWrapper<Stock> stockQueryWrapper = new QueryWrapper<>();
stockQueryWrapper.eq("status","0") stockQueryWrapper.eq("status","0").or().eq("status","1")
.ne(ToolUtil.isNotEmpty(id),"id",id) .ne(ToolUtil.isNotEmpty(id),"id",id)
.orderByDesc("export_time").last("limit 1"); .orderByDesc("export_time").last("limit 1");
Stock stock =stockMapper.selectOne(stockQueryWrapper); Stock stock =stockMapper.selectOne(stockQueryWrapper);

@ -2,6 +2,7 @@ package com.zhehekeji.web.service.algorithm;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.zhehekeji.web.config.ConfigProperties; 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;
@ -24,16 +25,33 @@ public class AlgorithmService {
@Resource @Resource
ConfigProperties configProperties; ConfigProperties configProperties;
public static void main(String[] args) {
AlgorithmPojo algorithmPojo= new AlgorithmPojo();
algorithmPojo.setGoodsTypeResult("qqq");
algorithmPojo.setIp("12");
algorithmPojo.setPort(8083);
AlgorithmService algorithmService = new AlgorithmService();
algorithmService.getGoodResult(algorithmPojo);
}
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();
//url = "http://127.0.0.1:8083"+configProperties.getVisualSense().getUrl();
String url = "http://127.0.0.1:8083"+"/visionCompute";
ResponseEntity<String> body = null; ResponseEntity<String> body = null;
try { try {
System.out.println(algorithmPojo); System.out.println(algorithmPojo);
Gson gson = new Gson();
// String jsonString = gson.toJson(algorithmPojo);
body = restTemplate.postForEntity(url, algorithmPojo, String.class); body = restTemplate.postForEntity(url, algorithmPojo, String.class);
algorithmPojo = JSONObject.parseObject(body.getBody(), AlgorithmPojo.class); algorithmPojo = JSONObject.parseObject(body.getBody(), AlgorithmPojo.class);

@ -16,6 +16,7 @@ public class KsecDataInfo {
private Integer fromColumn; private Integer fromColumn;
private Integer fromRow; private Integer fromRow;
private Integer fromStorey;
private Integer fromDirection; private Integer fromDirection;
@ -27,6 +28,8 @@ public class KsecDataInfo {
private Integer toRow; private Integer toRow;
private Integer toStorey;
private Integer toDirection; private Integer toDirection;
private Integer toSide; private Integer toSide;

@ -26,6 +26,7 @@ userUrl: http://115.236.65.98:11001
# ----------- # -----------
# ----默认摄像头的连接信息 # ----默认摄像头的连接信息
cameraConfig: cameraConfig:
cameraTimeUpdateCron: 0 0/1 * * * ?
# ------------球機選擇--- 0:利珀 1海康 # ------------球機選擇--- 0:利珀 1海康
cameraType: 1 cameraType: 1
cameraPassword: a1234567 cameraPassword: a1234567

@ -12,6 +12,9 @@
<if test="req.startTimestamp != null and req.endTimestamp != null"> <if test="req.startTimestamp != null and req.endTimestamp != null">
and t.start_time >= #{req.startTimestamp} and t.start_time &lt;= #{req.endTimestamp} and t.start_time >= #{req.startTimestamp} and t.start_time &lt;= #{req.endTimestamp}
</if> </if>
<if test="req.streetId != null and req.streetId != ''">
and t.street_id = #{req.streetId}
</if>
</where> </where>
order by t.id desc order by t.id desc
</select> </select>

Loading…
Cancel
Save