球机视频多一点

rtc不报错
逻辑修改盘点同时发送http信息,后期自我判断
changchun-医药
LAPTOP-S9HJSOEB\昊天 2 years ago
parent afe22452e3
commit 404655c7c6

@ -197,4 +197,30 @@ public class CameraController {
return Result.success();
}
@GetMapping("/rtcConfig")
@ApiOperation(value = "获取rtcConfig")
public Result<String> rtcConfig(String rtcServer) {
List<Camera> cameraList = cameraService.getCamerasByRtcServer(rtcServer);
JSONObject jsonObject = new JSONObject();
JSONObject server = new JSONObject();
server.put("http_port",":8083");
String [] strings = new String[1];
strings[0] = "stun:stun.l.google.com:19302";
server.put("ice_servers",strings);
server.put("ice_username","");
server.put("ice_credential","");
jsonObject.put("server",server);
JSONObject streams = new JSONObject();
cameraList.forEach(camera -> {
JSONObject obj = new JSONObject();
obj.put("on_demand",true);
obj.put("disable_audio",true);
obj.put("url",camera.getRtsp());
streams.put("camera"+camera.getId(),obj);
});
jsonObject.put("streams",streams);
return Result.success(jsonObject.toJSONString());
}
}

@ -33,11 +33,25 @@ public class RealTimeController {
return Result.success(realTimeService.realTimes());
}
@GetMapping("/allCameras")
@GetMapping("/allCameras1")
@ApiOperation(value = "全部球机")
//@SessionHandler
public Result<List<Camera>> allCameras() {
return Result.success(cameraService.allCameras());
public Result<List<Camera>> allCameras1() {
return Result.success(cameraService.allCameras(0));
}
@GetMapping("/allCameras2")
@ApiOperation(value = "全部球机")
//@SessionHandler
public Result<List<Camera>> allCameras2() {
return Result.success(cameraService.allCameras(1));
}
@GetMapping("/allCameras3")
@ApiOperation(value = "全部球机")
//@SessionHandler
public Result<List<Camera>> allCameras3() {
return Result.success(cameraService.allCameras(2));
}
@GetMapping("/wallStyle")

@ -6,6 +6,7 @@ import com.zhehekeji.web.mapper.CheckLogMapper;
import com.zhehekeji.web.mapper.RFIDMapper;
import com.zhehekeji.web.mapper.StreetMapper;
import com.zhehekeji.web.service.CheckLogService;
import com.zhehekeji.web.service.PlcService;
import com.zhehekeji.web.service.interfaces.RfidLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -27,10 +28,12 @@ public class VideoccController {
private CheckLogMapper checkLogMapper;
@Resource
private StreetMapper streetMapper;
@Resource
PlcService plcService;
@PostMapping("/xiddata")
@ApiOperation(value = "库存信息")
public VideoccResponse xiddata(@RequestBody Videocc videocc ){
public VideoccResponse xiddata1(@RequestBody Videocc videocc ){
String orderNum = videocc.getLoc().substring(0,3)+ "_"+videocc.getJobNum();
Set<String> list = new HashSet<>();
if(videocc.getDetails()!=null && videocc.getDetails().size()>0){
for(String detail:videocc.getDetails().keySet()){
@ -38,33 +41,14 @@ public class VideoccController {
list.addAll(videocc.getDetails().get(detail));
}
}
plcService.wmsTrayCodeMapByTask.put(orderNum,list);
VideoccResponse videoccResponse = new VideoccResponse();
videoccResponse.setMsg("失败");
videoccResponse.setIsSuccess(0);RfidLog rfidLog = rfidLogService.getOne(new QueryWrapper<RfidLog>().eq("task_id",videocc.getJobNum()).orderByDesc("create_time"));
Street street = streetMapper.selectById(rfidLog.getStreet_id());
CheckLog checkLog = checkLogMapper.selectOne(new QueryWrapper<CheckLog>().eq("check_Num",street.getPlcId()+"_"+videocc.getJobNum()).orderByDesc("create_time"));
if(rfidLog!=null){
Set<String> codes = rfidLog.getRfidTrayCode().split(",").length>0?new HashSet<>(Arrays.asList(rfidLog.getRfidTrayCode().split(","))):new HashSet<>();
if(codes.containsAll(list)){
checkLog.setStatus(2);
videoccResponse.setMsg("成功");
videoccResponse.setIsSuccess(1);
}else {
checkLog.setStatus(1);
videoccResponse.setMsg("扫码错误,请检查货物");
videoccResponse.setIsSuccess(0);
}
checkLogMapper.updateById(checkLog);
}else {
videoccResponse.setMsg("rfid扫码未完成请稍后重试");
videoccResponse.setIsSuccess(0);
}
return videoccResponse;
}
}

@ -13,6 +13,8 @@ public class Videocc {
private String taskKey;
@JsonProperty(value = "JOBNUM")
private String jobNum;
@JsonProperty(value = "SRMNumber")
private String SRMNumber;
@JsonProperty(value = "PLTNUM")
private String pltNum;
@JsonProperty(value = "LOC")

@ -1,6 +1,7 @@
package com.zhehekeji.web.service;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhehekeji.core.util.Assert;
@ -124,6 +125,14 @@ public class CameraService {
return new PageInfo<>(cameras);
}
public List<Camera> getCamerasByRtcServer(String rtcServer){
if(StringUtils.isEmpty(rtcServer)){
rtcServer = "127.0.0.1";
}
return cameraMapper.selectList(new QueryWrapper<Camera>().eq("rtc_server",rtcServer));
}
public class StatusThread extends Thread{
private Camera camera;
private CountDownLatch latch;
@ -159,8 +168,14 @@ public class CameraService {
return cameraMapper.selectById(id);
}
public List<Camera> allCameras(int i){
int count = (configProperties.getVideoStyleConfig().getVideoStyleColumn()) * (configProperties.getVideoStyleConfig().getVideoStyleRow());
int i1 = count * i;
return cameraMapper.selectList(new QueryWrapper<Camera>().last("limit "+i1+" ,"+count));
}
public List<Camera> allCameras(){
return cameraMapper.selectByMap(new HashMap<>());
return cameraMapper.selectList(new QueryWrapper<Camera>());
}
/**

@ -98,6 +98,8 @@ public class PlcService {
@Resource
private RfidLiveService rfidLiveService;
public static Map<String, Set<String>> wmsTrayCodeMapByTask = new HashMap<>();
private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 8, 200, TimeUnit.MINUTES, new ArrayBlockingQueue<>(100000));
public void setCameraControlModule(CameraControlModule cameraControlModule) {
@ -714,9 +716,17 @@ public class PlcService {
}
if (tags != null && tags.size() > 0 ) {
if(tags.containsAll(wmsTrayCodeMapByTask.get(plcCmdInfo.getOrderNum()))) {
trayCode = "未盘点";
trayCode = "盘点正常";
trayCheck = Boolean.TRUE;
}else {
trayCode = "盘点失败";
trayCheck = Boolean.FALSE;
}
wmsTrayCodeMapByTask.remove(plcCmdInfo.getOrderNum());
RFID rfid = rfidMapper.selectOne(new QueryWrapper<RFID>().eq("street_id", street.getId()));
if(! rfidLiveService.getRfidLive(plcCmdInfo,street,wmsTrayCode)){
rfidLiveService.rfidRemoveLive(plcCmdInfo,street,rfid);
@ -816,6 +826,7 @@ public class PlcService {
}
public void checkLog(Stock stock) {
CheckLog checkLog = new CheckLog();
checkLog.setCheckNum(stock.getCheckNum());

@ -198,36 +198,12 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
// }
} else if (Cmd.E.name().equals(ksecInfo.getType()) ) {
//盘点
//转球机到盘点位 然后拍照
// if(!StringUtils.isEmpty(lotnum) && !lotnum.equals(lastLotnum)){
// //需要把stock表truncate
// FileUtil.save(lotnum,"lastLotnum");
// tcpLogger.info("truncate table ,last lotnum:{},new lotnum:{}",lastLotnum,lotnum);
// plcService.truncateStock();
// lastLotnum = lotnum;
// }
// plcCmdInfo.setTimes(1);
// Boolean ok = plcService.check(plcCmdInfo,ksecInfo.getData().getCmdName(), dataInfo.getCode(), dataInfo.getTrayCode());
// if(ok){
// ksecInfo.getData().setAckStatus(1);
// }else {
// ksecInfo.getData().setAckStatus(0);
// }
// ctx.channel().writeAndFlush(ksecInfo);
//rfid的逻辑
String code = dataInfo.getCmdName();
log.info("盘点指令:{}", ksecInfo);
plcService.check(plcCmdInfo,ksecInfo.getType(),dataInfo.getCode(),dataInfo.getTrayCode());
ksecInfo.getData().setAckStatus(1);
/*
if("E1".equals(code)){
plcService.RFIDCheck(plcCmdInfo);
}else {
plcService.RFIDStop(plcCmdInfo);
}*/
ctx.channel().writeAndFlush(ksecInfo);
log.info("盘点完成");
}

Loading…
Cancel
Save