|
|
|
|
@ -16,8 +16,10 @@ import com.zhehekeji.web.pojo.websocket.WebSocketVo;
|
|
|
|
|
import com.zhehekeji.web.service.RFID.RFIDMap;
|
|
|
|
|
import com.zhehekeji.web.service.RFID.RFIDSocket;
|
|
|
|
|
import com.zhehekeji.web.service.hikLightSource.HikControlSocket;
|
|
|
|
|
import com.zhehekeji.web.service.interfaces.RfidLiveService;
|
|
|
|
|
import com.zhehekeji.web.service.ksec.KsecNettyClient;
|
|
|
|
|
import com.zhehekeji.web.service.sick.SickSocket;
|
|
|
|
|
import com.zhehekeji.web.util.ToolUtil;
|
|
|
|
|
import com.zhehekeji.web.ws.WebSocketServer;
|
|
|
|
|
import io.swagger.models.auth.In;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
@ -33,10 +35,7 @@ import java.io.FileWriter;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.time.Duration;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.ArrayBlockingQueue;
|
|
|
|
|
import java.util.concurrent.BlockingDeque;
|
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
@ -65,6 +64,9 @@ public class PlcService {
|
|
|
|
|
private WarnMapper warnMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private OrderService orderService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
RFIDMapper rfidMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private StockLogMapper stockLogMapper;
|
|
|
|
|
|
|
|
|
|
@ -87,10 +89,12 @@ public class PlcService {
|
|
|
|
|
private RFIDService rfidService;
|
|
|
|
|
@Resource
|
|
|
|
|
private CheckLogMapper checkLogMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private RfidLiveService rfidLiveService;
|
|
|
|
|
|
|
|
|
|
private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1,8,200,TimeUnit.MINUTES,new ArrayBlockingQueue<>(100000));
|
|
|
|
|
private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 8, 200, TimeUnit.MINUTES, new ArrayBlockingQueue<>(100000));
|
|
|
|
|
|
|
|
|
|
public void setCameraControlModule(CameraControlModule cameraControlModule){
|
|
|
|
|
public void setCameraControlModule(CameraControlModule cameraControlModule) {
|
|
|
|
|
this.cameraControlModule = cameraControlModule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -101,7 +105,7 @@ public class PlcService {
|
|
|
|
|
|
|
|
|
|
public Integer plcStatus() {
|
|
|
|
|
Integer count = 1;
|
|
|
|
|
if(configProperties.getServerMode() == 0){
|
|
|
|
|
if (configProperties.getServerMode() == 0) {
|
|
|
|
|
count = streetMapper.selectCount(new QueryWrapper<>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -118,14 +122,14 @@ public class PlcService {
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
|
|
|
|
|
if (street != null) {
|
|
|
|
|
if(plcCmdInfo.getLeftRight1() == 1){
|
|
|
|
|
if(plcCmdInfo.getRow1()>street.getLeftRow() && plcCmdInfo.getColumn1() > street.getLeftColumn()){
|
|
|
|
|
log.error("row:{},column:{},error in streetId:{} left",plcCmdInfo.getRow1(),plcCmdInfo.getColumn1(),street.getId());
|
|
|
|
|
if (plcCmdInfo.getLeftRight1() == 1) {
|
|
|
|
|
if (plcCmdInfo.getRow1() > street.getLeftRow() && plcCmdInfo.getColumn1() > street.getLeftColumn()) {
|
|
|
|
|
log.error("row:{},column:{},error in streetId:{} left", plcCmdInfo.getRow1(), plcCmdInfo.getColumn1(), street.getId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if(plcCmdInfo.getRow1()>street.getRightRow() && plcCmdInfo.getColumn1() > street.getRightColumn()){
|
|
|
|
|
log.error("row:{},column:{},error in streetId:{} right",plcCmdInfo.getRow1(),plcCmdInfo.getColumn1(),street.getId());
|
|
|
|
|
} else {
|
|
|
|
|
if (plcCmdInfo.getRow1() > street.getRightRow() && plcCmdInfo.getColumn1() > street.getRightColumn()) {
|
|
|
|
|
log.error("row:{},column:{},error in streetId:{} right", plcCmdInfo.getRow1(), plcCmdInfo.getColumn1(), street.getId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -173,17 +177,17 @@ public class PlcService {
|
|
|
|
|
update.setColumn2(plcCmdInfo.getColumn2());
|
|
|
|
|
update.setRow2(plcCmdInfo.getRow2());
|
|
|
|
|
LocalDateTime endDownLoadTime = endTime.plusSeconds(5);
|
|
|
|
|
Duration duration = Duration.between(order.getStartTime(),endDownLoadTime);
|
|
|
|
|
Duration duration = Duration.between(order.getStartTime(), endDownLoadTime);
|
|
|
|
|
|
|
|
|
|
if(duration.toMinutes() > 50){
|
|
|
|
|
if (duration.toMinutes() > 50) {
|
|
|
|
|
endDownLoadTime = order.getStartTime().plusMinutes(50);
|
|
|
|
|
}
|
|
|
|
|
if (street.getCamera1Id() != null) {
|
|
|
|
|
String path = cameraVideo(street.getCamera1Id(),order.getStartTime(),endDownLoadTime);
|
|
|
|
|
String path = cameraVideo(street.getCamera1Id(), order.getStartTime(), endDownLoadTime);
|
|
|
|
|
update.setVideoPath1(path);
|
|
|
|
|
}
|
|
|
|
|
if (street.getCamera2Id() != null) {
|
|
|
|
|
String path = cameraVideo(street.getCamera2Id(),order.getStartTime(),endDownLoadTime);
|
|
|
|
|
String path = cameraVideo(street.getCamera2Id(), order.getStartTime(), endDownLoadTime);
|
|
|
|
|
update.setVideoPath2(path);
|
|
|
|
|
}
|
|
|
|
|
orderMapper.updateById(update);
|
|
|
|
|
@ -205,12 +209,12 @@ public class PlcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String cameraVideo(Integer cameraId, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
|
|
String path = PathUtil.createFileName("mp4",cameraId);
|
|
|
|
|
String path = PathUtil.createFileName("mp4", cameraId);
|
|
|
|
|
Thread thread = new Thread(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
String realPath = configProperties.getSavePath().getMp4Path() + path;
|
|
|
|
|
TaskDelayExecutor.addMp4DelayTask(cameraId,realPath,startTime,endTime,configProperties.getCameraConfig().getDelayDownloadMp4());
|
|
|
|
|
TaskDelayExecutor.addMp4DelayTask(cameraId, realPath, startTime, endTime, configProperties.getCameraConfig().getDelayDownloadMp4());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
thread.start();
|
|
|
|
|
@ -244,83 +248,84 @@ public class PlcService {
|
|
|
|
|
* 右侧转camera2
|
|
|
|
|
* 没有就不管了
|
|
|
|
|
*/
|
|
|
|
|
Integer cameraId = getCameraByPlcCmd(plcCmdInfo,orderInfo.getLeftRight());
|
|
|
|
|
gyrateCameraByCode(cameraId,orderInfo.getCmdCode());
|
|
|
|
|
if(needCapture){
|
|
|
|
|
Integer cameraId = getCameraByPlcCmd(plcCmdInfo, orderInfo.getLeftRight());
|
|
|
|
|
gyrateCameraByCode(cameraId, orderInfo.getCmdCode());
|
|
|
|
|
if (needCapture) {
|
|
|
|
|
Boolean delay = true;
|
|
|
|
|
Integer row = 0;
|
|
|
|
|
Integer column = 0;
|
|
|
|
|
Integer sep = 0;
|
|
|
|
|
if(times<=2){
|
|
|
|
|
if (times <= 2) {
|
|
|
|
|
row = plcCmdInfo.getRow1();
|
|
|
|
|
column = plcCmdInfo.getColumn1();
|
|
|
|
|
sep = plcCmdInfo.getSeparation1();
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
row = plcCmdInfo.getRow2();
|
|
|
|
|
column = plcCmdInfo.getColumn2();
|
|
|
|
|
sep = plcCmdInfo.getSeparation2();
|
|
|
|
|
}
|
|
|
|
|
long delayTime = 0;
|
|
|
|
|
|
|
|
|
|
if(code.startsWith("C1")){
|
|
|
|
|
if (code.startsWith("C1")) {
|
|
|
|
|
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC1DelayCaptureTime();
|
|
|
|
|
}else if(code.startsWith("C2")){
|
|
|
|
|
if(sep == 1){
|
|
|
|
|
} else if (code.startsWith("C2")) {
|
|
|
|
|
if (sep == 1) {
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC2DelayCaptureTime();
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC2OutDelayCaptureTime();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else if(code.startsWith("C3")){
|
|
|
|
|
} else if (code.startsWith("C3")) {
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC3DelayCaptureTime();
|
|
|
|
|
|
|
|
|
|
}else if(code.startsWith("C4")){
|
|
|
|
|
if(sep == 1){
|
|
|
|
|
} else if (code.startsWith("C4")) {
|
|
|
|
|
if (sep == 1) {
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC4DelayCaptureTime();
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC4OutDelayCaptureTime();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
path = PathUtil.createFileNameByRowColumn("jpg",cameraId,row,column);
|
|
|
|
|
path = cameraCapture(cameraId,delay,delayTime,path);
|
|
|
|
|
path = PathUtil.createFileNameByRowColumn("jpg", cameraId, row, column);
|
|
|
|
|
path = cameraCapture(cameraId, delay, delayTime, path);
|
|
|
|
|
}
|
|
|
|
|
//update order info after capture
|
|
|
|
|
if (path != null && needCapture) {
|
|
|
|
|
captureUpdateOrderAndStock(orderInfo, path);
|
|
|
|
|
}
|
|
|
|
|
//转向原点位
|
|
|
|
|
if(times == 2){
|
|
|
|
|
if (times == 2) {
|
|
|
|
|
|
|
|
|
|
if(street.getCamera2Id() != null){
|
|
|
|
|
gyrateCameraByCodeTimeLater(street.getCamera2Id(),"C5",configProperties.getCameraConfig().getC2OutDelayCaptureTime()+500);
|
|
|
|
|
if (street.getCamera2Id() != null) {
|
|
|
|
|
gyrateCameraByCodeTimeLater(street.getCamera2Id(), "C5", configProperties.getCameraConfig().getC2OutDelayCaptureTime() + 500);
|
|
|
|
|
}
|
|
|
|
|
if(street.getCamera1Id() != null){
|
|
|
|
|
gyrateCameraByCodeTimeLater(street.getCamera1Id(),"C5",configProperties.getCameraConfig().getC2OutDelayCaptureTime()+500);
|
|
|
|
|
if (street.getCamera1Id() != null) {
|
|
|
|
|
gyrateCameraByCodeTimeLater(street.getCamera1Id(), "C5", configProperties.getCameraConfig().getC2OutDelayCaptureTime() + 500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rfidLiveService.rfidOrderStock(plcCmdInfo, times, code);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void gyrateCamera(PlcCmdInfo plcCmdInfo,String code){
|
|
|
|
|
public void gyrateCamera(PlcCmdInfo plcCmdInfo, String code) {
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
if(street == null){
|
|
|
|
|
if (street == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(street.getCamera1Id() != null){
|
|
|
|
|
gyrateCameraByCode(street.getCamera1Id(),code);
|
|
|
|
|
if (street.getCamera1Id() != null) {
|
|
|
|
|
gyrateCameraByCode(street.getCamera1Id(), code);
|
|
|
|
|
}
|
|
|
|
|
if(street.getCamera2Id() != null){
|
|
|
|
|
gyrateCameraByCode(street.getCamera2Id(),code);
|
|
|
|
|
if (street.getCamera2Id() != null) {
|
|
|
|
|
gyrateCameraByCode(street.getCamera2Id(), code);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void warnAction(PlcCmdInfo plcCmdInfo,String warnCode){
|
|
|
|
|
public void warnAction(PlcCmdInfo plcCmdInfo, String warnCode) {
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
if(street.getCamera1Id() != null){
|
|
|
|
|
gyrateCameraByCode(street.getCamera1Id(),warnCode);
|
|
|
|
|
if (street.getCamera1Id() != null) {
|
|
|
|
|
gyrateCameraByCode(street.getCamera1Id(), warnCode);
|
|
|
|
|
}
|
|
|
|
|
if(street.getCamera2Id() != null){
|
|
|
|
|
gyrateCameraByCode(street.getCamera2Id(),warnCode);
|
|
|
|
|
if (street.getCamera2Id() != null) {
|
|
|
|
|
gyrateCameraByCode(street.getCamera2Id(), warnCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -343,13 +348,13 @@ public class PlcService {
|
|
|
|
|
*
|
|
|
|
|
* @Return pic address
|
|
|
|
|
*/
|
|
|
|
|
public String cameraCapture(Integer cameraId,Boolean delay,Long delayTime,String path) {
|
|
|
|
|
public String cameraCapture(Integer cameraId, Boolean delay, Long delayTime, String path) {
|
|
|
|
|
//String path = PathUtil.createFileName("jpg",cameraId);
|
|
|
|
|
String realPath = configProperties.getSavePath().getMediaPath() + path;
|
|
|
|
|
if(delay){
|
|
|
|
|
TaskDelayExecutor.addPicDelayTask(cameraId,realPath,delayTime);
|
|
|
|
|
}else {
|
|
|
|
|
cameraControlModule.pic(cameraId,0,realPath);
|
|
|
|
|
if (delay) {
|
|
|
|
|
TaskDelayExecutor.addPicDelayTask(cameraId, realPath, delayTime);
|
|
|
|
|
} else {
|
|
|
|
|
cameraControlModule.pic(cameraId, 0, realPath);
|
|
|
|
|
}
|
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
@ -364,17 +369,17 @@ public class PlcService {
|
|
|
|
|
Integer ptzId = cameraService.getPtzIdByCodeAndCameraId(code, cameraId);
|
|
|
|
|
if (ptzId != null && ptzId >= 0) {
|
|
|
|
|
log.info("gyrate camera by code, code:{},cameraId:{},ptId:{}", code, cameraId, ptzId);
|
|
|
|
|
cameraControlModule.toPtz(ptzId,cameraId);
|
|
|
|
|
cameraControlModule.toPtz(ptzId, cameraId);
|
|
|
|
|
} else {
|
|
|
|
|
log.error("ptz not found ,code:{},cameraId:{}", code, cameraId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void gyrateCameraByCodeTimeLater(Integer cameraId, String code,long times) {
|
|
|
|
|
public void gyrateCameraByCodeTimeLater(Integer cameraId, String code, long times) {
|
|
|
|
|
Integer ptzId = cameraService.getPtzIdByCodeAndCameraId(code, cameraId);
|
|
|
|
|
if (ptzId != null && ptzId >= 0) {
|
|
|
|
|
log.info("gyrate camera by code, code:{},cameraId:{},ptId:{}", code, cameraId, ptzId);
|
|
|
|
|
TaskDelayExecutor.addGyrateCameraTask(cameraId,times,ptzId);
|
|
|
|
|
TaskDelayExecutor.addGyrateCameraTask(cameraId, times, ptzId);
|
|
|
|
|
//cameraControlModule.toPtz(ptzId,cameraId);
|
|
|
|
|
} else {
|
|
|
|
|
log.error("ptz not found ,code:{},cameraId:{}", code, cameraId);
|
|
|
|
|
@ -412,7 +417,7 @@ public class PlcService {
|
|
|
|
|
Order order = orderMapper.getOneByOrderNum(orderNum);
|
|
|
|
|
if (order != null) {
|
|
|
|
|
//stop the order
|
|
|
|
|
log.debug("plcId:{},warn start and stop the order",plcId);
|
|
|
|
|
log.debug("plcId:{},warn start and stop the order", plcId);
|
|
|
|
|
orderStopByWarn(orderNum);
|
|
|
|
|
OrderVO orderVO = new OrderVO();
|
|
|
|
|
BeanUtils.copyProperties(order, orderVO);
|
|
|
|
|
@ -451,11 +456,11 @@ public class PlcService {
|
|
|
|
|
//结束该告警,并录像
|
|
|
|
|
warn.setEndTime(LocalDateTime.now());
|
|
|
|
|
if (street.getCamera1Id() != null) {
|
|
|
|
|
String path = cameraVideo(street.getCamera1Id(),warn.getStartTime(),LocalDateTime.now());
|
|
|
|
|
String path = cameraVideo(street.getCamera1Id(), warn.getStartTime(), LocalDateTime.now());
|
|
|
|
|
warn.setVideoPath1(path);
|
|
|
|
|
}
|
|
|
|
|
if (street.getCamera2Id() != null) {
|
|
|
|
|
String path = cameraVideo(street.getCamera2Id(),warn.getStartTime(),LocalDateTime.now());
|
|
|
|
|
String path = cameraVideo(street.getCamera2Id(), warn.getStartTime(), LocalDateTime.now());
|
|
|
|
|
warn.setVideoPath2(path);
|
|
|
|
|
}
|
|
|
|
|
warnMapper.updateById(warn);
|
|
|
|
|
@ -475,7 +480,7 @@ public class PlcService {
|
|
|
|
|
Order order = orderMapper.getOneByOrderNum(orderInfo.getOrderNum());
|
|
|
|
|
if (order != null) {
|
|
|
|
|
//update picPath in stock if code is C2/C4
|
|
|
|
|
if(orderInfo.getCode().startsWith("C2") || orderInfo.getCode().startsWith("C4")){
|
|
|
|
|
if (orderInfo.getCode().startsWith("C2") || orderInfo.getCode().startsWith("C4")) {
|
|
|
|
|
StockLog stockLog = new StockLog();
|
|
|
|
|
stockLog.setStreetId(orderInfo.getStreetId());
|
|
|
|
|
stockLog.setDirection(orderInfo.getLeftRight());
|
|
|
|
|
@ -483,7 +488,7 @@ public class PlcService {
|
|
|
|
|
stockLog.setRow(orderInfo.getRow());
|
|
|
|
|
stockLog.setColumn(orderInfo.getColumn());
|
|
|
|
|
stockLog.setPic(path);
|
|
|
|
|
String type = orderInfo.getCode().substring(1,2);
|
|
|
|
|
String type = orderInfo.getCode().substring(1, 2);
|
|
|
|
|
stockLog.setType(Integer.valueOf(type));
|
|
|
|
|
stockLog.setOrderNum(orderInfo.getOrderNum());
|
|
|
|
|
stockLog.setCreateTime(LocalDateTime.now());
|
|
|
|
|
@ -524,16 +529,16 @@ public class PlcService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Integer getCameraByPlcCmd(PlcCmdInfo plcCmdInfo,Integer leftRight){
|
|
|
|
|
public Integer getCameraByPlcCmd(PlcCmdInfo plcCmdInfo, Integer leftRight) {
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
//判断单双伸 type=0 单伸 1为双伸
|
|
|
|
|
Integer type;
|
|
|
|
|
if(leftRight == 1){
|
|
|
|
|
if (leftRight == 1) {
|
|
|
|
|
type = street.getLeftType();
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
type = street.getRightType();
|
|
|
|
|
}
|
|
|
|
|
if(type == 0){
|
|
|
|
|
if (type == 0) {
|
|
|
|
|
//单伸
|
|
|
|
|
if (street.getCamera1Id() != null && street.getCamera2Id() != null && street.getCamera1Id() != 0 && street.getCamera2Id() != 0) {
|
|
|
|
|
if (leftRight == 1) {
|
|
|
|
|
@ -545,14 +550,14 @@ public class PlcService {
|
|
|
|
|
Integer cameraId = street.getCamera1Id() != null && street.getCamera1Id() != 0 ? street.getCamera1Id() : street.getCamera2Id();
|
|
|
|
|
return cameraId;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
if (street.getCamera1Id() != null && street.getCamera2Id() != null && street.getCamera1Id() != 0 && street.getCamera2Id() != 0) {
|
|
|
|
|
//双伸 todo 这个因项目而异,看现场的情况
|
|
|
|
|
//默认是 左侧返回camera2 右侧返回camera1
|
|
|
|
|
if(plcCmdInfo.getLeftRight1() == 1){
|
|
|
|
|
return street.getCamera2Id();
|
|
|
|
|
}else {
|
|
|
|
|
//默认是 左侧返回camera1 右侧返回camera2
|
|
|
|
|
if (plcCmdInfo.getLeftRight1() == 1) {
|
|
|
|
|
return street.getCamera1Id();
|
|
|
|
|
} else {
|
|
|
|
|
return street.getCamera2Id();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Integer cameraId = street.getCamera1Id() != null && street.getCamera1Id() != 0 ? street.getCamera1Id() : street.getCamera2Id();
|
|
|
|
|
@ -562,38 +567,50 @@ public class PlcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Integer getCameraByPlcCmdE(PlcCmdInfo plcCmdInfo, Integer leftRight) {
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
//判断单双伸 type=0 单伸 1为双伸
|
|
|
|
|
Integer type;
|
|
|
|
|
if (plcCmdInfo.getFromSeparation() == 1) {
|
|
|
|
|
return street.getCamera1Id();
|
|
|
|
|
} else {
|
|
|
|
|
return street.getCamera2Id();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Resource
|
|
|
|
|
private LightSourceMapper lightSourceMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void webSocketSendInfo(PlcCmdInfo plcCmdInfo,String cmdCode) throws IOException {
|
|
|
|
|
public String webSocketSendInfo(PlcCmdInfo plcCmdInfo, String cmdCode) throws IOException {
|
|
|
|
|
WebSocketVo<PlcCmdInfo> webSocketVo = new WebSocketVo<>();
|
|
|
|
|
webSocketVo.setMessage(plcCmdInfo);
|
|
|
|
|
webSocketVo.setType("wmsCmdCode-"+cmdCode);
|
|
|
|
|
webSocketVo.setType("wmsCmdCode-" + cmdCode);
|
|
|
|
|
webSocketVo.setMessageType("object");
|
|
|
|
|
WebSocketServer.sendInfo(JSONObject.toJSONString(webSocketVo),null);
|
|
|
|
|
WebSocketServer.sendInfo(JSONObject.toJSONString(webSocketVo), null);
|
|
|
|
|
return JSONObject.toJSONString(webSocketVo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean check(PlcCmdInfo plcCmdInfo,String cmdCode,String wmsCode,String wmsTrayCode){
|
|
|
|
|
public Boolean check(PlcCmdInfo plcCmdInfo, String cmdCode, String wmsCode, String wmsTrayCode) {
|
|
|
|
|
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
CronTab.putTime(street.getId());
|
|
|
|
|
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",street.getId()));
|
|
|
|
|
plcCmdInfo.setStreetName(street.getName());
|
|
|
|
|
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id", street.getId()));
|
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
|
HikControlSocket.openLight(lightSource.getIp(),lightSource.getPort(),configProperties.getLightSource().getIndex(),1);
|
|
|
|
|
HikControlSocket.openLight(lightSource.getIp(), lightSource.getPort(), configProperties.getLightSource().getIndex(), 1);
|
|
|
|
|
});
|
|
|
|
|
Integer cameraId = getCameraByPlcCmd(plcCmdInfo,plcCmdInfo.getLeftRight1());
|
|
|
|
|
log.info("盘点摄像头变化参数:"+plcCmdInfo.toString());
|
|
|
|
|
Integer cameraId = getCameraByPlcCmdE(plcCmdInfo, plcCmdInfo.getLeftRight1());
|
|
|
|
|
|
|
|
|
|
if(plcCmdInfo.getSeparation1() == 1 && configProperties.getScanCodeMode().getTray() == 2){
|
|
|
|
|
if (plcCmdInfo.getSeparation1() == 1 && configProperties.getScanCodeMode().getTray() == 2) {
|
|
|
|
|
//内测
|
|
|
|
|
String c = cmdCode + "-" + plcCmdInfo.getLeftRightStr(1) + "-IN";
|
|
|
|
|
log.info("camera ptz"+c);
|
|
|
|
|
log.info("camera ptz" + c);
|
|
|
|
|
gyrateCameraByCode(cameraId, c);
|
|
|
|
|
} else {
|
|
|
|
|
String c = cmdCode + "1";
|
|
|
|
|
gyrateCameraByCode(cameraId, c);
|
|
|
|
|
}else {
|
|
|
|
|
String c = cmdCode+"1";
|
|
|
|
|
gyrateCameraByCode(cameraId, cmdCode);
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(configProperties.getCameraConfig().getDelayCaptureTime());
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
@ -601,106 +618,129 @@ public class PlcService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String path = PathUtil.createFileNameByRowColumn("jpg",cameraId,plcCmdInfo.getRow1(),plcCmdInfo.getColumn1());
|
|
|
|
|
cameraCapture(cameraId,false,null,path);
|
|
|
|
|
String path = PathUtil.createFileNameByRowColumn("jpg", cameraId, plcCmdInfo.getRow1(), plcCmdInfo.getColumn1());
|
|
|
|
|
cameraCapture(cameraId, false, null, path);
|
|
|
|
|
//托盘码
|
|
|
|
|
String trayCode = null;
|
|
|
|
|
Boolean trayCheck = Boolean.TRUE;
|
|
|
|
|
//如果是用扫码枪 扫 托盘码,就直接扫
|
|
|
|
|
//if(configProperties.getScanCodeMode().getTray() == 2){
|
|
|
|
|
if(plcCmdInfo.getSeparation1() == 1 && configProperties.getScanCodeMode().getTray() == 2){
|
|
|
|
|
if (plcCmdInfo.getSeparation1() == 1 && configProperties.getScanCodeMode().getTray() == 2) {
|
|
|
|
|
//托盘使用sick扫码枪
|
|
|
|
|
SensorGun sensorGun = sensorService.getSensorByPlc(street.getId(),plcCmdInfo.getLeftRight1());
|
|
|
|
|
if(sensorGun == null){
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
log.error("no sensor gun config in database ,street id:{},direction:{}",street.getId(),plcCmdInfo.getLeftRight1());
|
|
|
|
|
}else {
|
|
|
|
|
trayCode = SickSocket.readOCR(sensorGun.getIp(),sensorGun.getPort());
|
|
|
|
|
log.info("sensor tray code:{}",trayCode);
|
|
|
|
|
if("".equals(wmsTrayCode)){
|
|
|
|
|
//托盘码为空,无货物
|
|
|
|
|
//只要扫码枪未识别出条码,即认为盘点正确
|
|
|
|
|
if(StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")){
|
|
|
|
|
trayCode = "";
|
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
|
}else {
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
log.warn("sick ocr error:{}",trayCode);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if(StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")){
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
log.warn("sick ocr error:{}",trayCode);
|
|
|
|
|
}else {
|
|
|
|
|
trayCheck = wmsTrayCode.equals(trayCode);
|
|
|
|
|
}
|
|
|
|
|
SensorGun sensorGun = sensorService.getSensorByPlc(street.getId(), plcCmdInfo.getLeftRight1());
|
|
|
|
|
if (sensorGun == null) {
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
log.error("no sensor gun config in database ,street id:{},direction:{}", street.getId(), plcCmdInfo.getLeftRight1());
|
|
|
|
|
} else {
|
|
|
|
|
trayCode = SickSocket.readOCR(sensorGun.getIp(), sensorGun.getPort());
|
|
|
|
|
log.info("sensor tray code:{}", trayCode);
|
|
|
|
|
if ("".equals(wmsTrayCode)) {
|
|
|
|
|
//托盘码为空,无货物
|
|
|
|
|
//只要扫码枪未识别出条码,即认为盘点正确
|
|
|
|
|
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
|
|
|
|
|
trayCode = "";
|
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
|
} else {
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
log.warn("sick ocr error:{}", trayCode);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
log.warn("sick ocr error:{}", trayCode);
|
|
|
|
|
} else {
|
|
|
|
|
trayCheck = wmsTrayCode.equals(trayCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else if(configProperties.getScanCodeMode().getTray() == 3){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (configProperties.getScanCodeMode().getTray() == 3) {
|
|
|
|
|
// //RFID
|
|
|
|
|
// RFID rfid = rfidService.getRFIDByPlc(street.getId(),plcCmdInfo.getLeftRight1());
|
|
|
|
|
try{
|
|
|
|
|
RFIDCheck(plcCmdInfo);
|
|
|
|
|
Thread.sleep(1000*configProperties.getRfid().getScanTime());
|
|
|
|
|
Set<String> tags = RFIDStop(plcCmdInfo);
|
|
|
|
|
if(tags!= null && tags.size()>0 && tags.contains(wmsTrayCode)){
|
|
|
|
|
Set<String> tags = new HashSet<>();
|
|
|
|
|
try {
|
|
|
|
|
RFIDCheck(plcCmdInfo,true);
|
|
|
|
|
Thread.sleep(1000 * configProperties.getRfid().getScanTime());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
tags = RFIDStop(plcCmdInfo);
|
|
|
|
|
}
|
|
|
|
|
if (tags != null && tags.size() > 0 && tags.contains(wmsTrayCode)) {
|
|
|
|
|
|
|
|
|
|
trayCode = wmsTrayCode;
|
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
|
if(! rfidLiveService.getRfidLive(plcCmdInfo,street,wmsTrayCode)){
|
|
|
|
|
|
|
|
|
|
RFID rfid = rfidMapper.selectOne(new QueryWrapper<RFID>().eq("street_id", street.getId()));
|
|
|
|
|
rfidLiveService.rfidRemoveLive(plcCmdInfo,street,rfid);
|
|
|
|
|
rfidLiveService.rfidSave(plcCmdInfo,trayCode,street,rfid);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log.warn("sick ocr error:{}", "");
|
|
|
|
|
//查看数据库里数据
|
|
|
|
|
RfidLive rfidLive = rfidLiveService.getOne(new QueryWrapper<RfidLive>()
|
|
|
|
|
.eq("street_Id", street.getId())
|
|
|
|
|
.eq("direction", plcCmdInfo.getFromDirection())
|
|
|
|
|
.eq("side", plcCmdInfo.getSide1())
|
|
|
|
|
.eq("rfid_row", plcCmdInfo.getRow1())
|
|
|
|
|
.eq("rfid_column", plcCmdInfo.getRow1()));
|
|
|
|
|
if (ToolUtil.isNotEmpty(rfidLive) && ToolUtil.isNotEmpty(rfidLive.getRfidTrayCode()) && rfidLive.getRfidTrayCode().equals(wmsTrayCode)) {
|
|
|
|
|
trayCode = wmsTrayCode;
|
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
|
}else {
|
|
|
|
|
log.info("数据库查询rfid", trayCode);
|
|
|
|
|
} else {
|
|
|
|
|
trayCode = "";
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
log.warn("sick ocr error:{}",trayCode);
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
OrderInfo orderInfo = new OrderInfo(street,plcCmdInfo,1,cmdCode);
|
|
|
|
|
Stock stock = stockMapper.getByStreetAndDirectionAndSideAndRowColumn(orderInfo.getStreetId(),plcCmdInfo.getFromDirection(),orderInfo.getSeparation(),orderInfo.getRow(),orderInfo.getColumn());
|
|
|
|
|
OrderInfo orderInfo = new OrderInfo(street, plcCmdInfo, 1, cmdCode);
|
|
|
|
|
Stock stock = stockMapper.getByStreetAndDirectionAndSideAndRowColumn(orderInfo.getStreetId(), plcCmdInfo.getFromDirection(), orderInfo.getSeparation(), orderInfo.getRow(), orderInfo.getColumn());
|
|
|
|
|
String scanCode = null;
|
|
|
|
|
Boolean codeCheck = Boolean.TRUE;
|
|
|
|
|
Boolean trayCodeCheck = Boolean.TRUE;
|
|
|
|
|
//货物使用球机扫码
|
|
|
|
|
|
|
|
|
|
if(configProperties.getScanCodeMode().getTray() == 2 && plcCmdInfo.getSeparation1() == 2){
|
|
|
|
|
if (configProperties.getScanCodeMode().getTray() == 2 && plcCmdInfo.getSeparation1() == 2) {
|
|
|
|
|
//托盘使用球机扫码
|
|
|
|
|
if("".equals(wmsTrayCode)){
|
|
|
|
|
if ("".equals(wmsTrayCode)) {
|
|
|
|
|
//空货物的处理
|
|
|
|
|
//如果系统货物为空,则只要扫码识别未出结果,就认为无货物
|
|
|
|
|
trayCode = BarcodeDetector.detectBestCodeUntilOK(configProperties.getSavePath().getMediaPath()+path,configProperties.getScanCodeMode().getTrayCodeTypes());
|
|
|
|
|
log.info("tray code:{},sys trayCode:{}",trayCode,wmsTrayCode);
|
|
|
|
|
if(StringUtils.isEmpty(trayCode)|| trayCode.equals("Unrecognized")){
|
|
|
|
|
trayCode = BarcodeDetector.detectBestCodeUntilOK(configProperties.getSavePath().getMediaPath() + path, configProperties.getScanCodeMode().getTrayCodeTypes());
|
|
|
|
|
log.info("tray code:{},sys trayCode:{}", trayCode, wmsTrayCode);
|
|
|
|
|
if (StringUtils.isEmpty(trayCode) || trayCode.equals("Unrecognized")) {
|
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
|
trayCode = "";
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
trayCheck = wmsTrayCode.equals(trayCode);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
trayCode = BarcodeDetector.detectBestCodeUntilOK(configProperties.getSavePath().getMediaPath()+path,configProperties.getScanCodeMode().getTrayCodeTypes());
|
|
|
|
|
if(StringUtils.isEmpty(trayCode)){
|
|
|
|
|
log.error("row:{},cloumn:{}",plcCmdInfo.getRow1(),plcCmdInfo.getColumn1());
|
|
|
|
|
log.error("detectBestBarCode:{}",trayCode);
|
|
|
|
|
} else {
|
|
|
|
|
trayCode = BarcodeDetector.detectBestCodeUntilOK(configProperties.getSavePath().getMediaPath() + path, configProperties.getScanCodeMode().getTrayCodeTypes());
|
|
|
|
|
if (StringUtils.isEmpty(trayCode)) {
|
|
|
|
|
log.error("row:{},cloumn:{}", plcCmdInfo.getRow1(), plcCmdInfo.getColumn1());
|
|
|
|
|
log.error("detectBestBarCode:{}", trayCode);
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
trayCheck = wmsTrayCode.equals(trayCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
log.info("code:{}",scanCode);
|
|
|
|
|
log.info("code:{}", scanCode);
|
|
|
|
|
//核对异常
|
|
|
|
|
Integer status = 1;
|
|
|
|
|
//托盘和货物都正确
|
|
|
|
|
if(trayCheck && codeCheck){
|
|
|
|
|
if (trayCheck && codeCheck) {
|
|
|
|
|
status = 2;
|
|
|
|
|
}
|
|
|
|
|
if(stock == null){
|
|
|
|
|
if (stock == null) {
|
|
|
|
|
stock = Stock.builder()
|
|
|
|
|
.checkNum(plcCmdInfo.getOrderNum())
|
|
|
|
|
.lotnum(plcCmdInfo.getLotnum())
|
|
|
|
|
@ -717,7 +757,7 @@ public class PlcService {
|
|
|
|
|
.checkPic(path)
|
|
|
|
|
.exportTime(LocalDateTime.now()).build();
|
|
|
|
|
stockMapper.insert(stock);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
stock.setStatus(status);
|
|
|
|
|
stock.setLotnum(plcCmdInfo.getLotnum());
|
|
|
|
|
stock.setExportTime(LocalDateTime.now());
|
|
|
|
|
@ -732,27 +772,26 @@ public class PlcService {
|
|
|
|
|
checkLog(stock);
|
|
|
|
|
// StockCheckRunnable stockCheckRunnable = new StockCheckRunnable(street,plcCmdInfo,cmdCode,stockMapper,path,checkLogMapper,configProperties.getScanCodeMode().getGoods(),wmsCode,wmsTrayCode,trayCode,trayCheck,configProperties,sensorGun);
|
|
|
|
|
// threadPoolExecutor.execute(stockCheckRunnable);
|
|
|
|
|
|
|
|
|
|
//还原相机
|
|
|
|
|
gyrateCameraByCode(cameraId, "C5");
|
|
|
|
|
long end = System.currentTimeMillis();
|
|
|
|
|
long s = end - startTime;
|
|
|
|
|
log.info("time:{}millisecond",s);
|
|
|
|
|
log.info("time:{}millisecond", s);
|
|
|
|
|
WebSocketVo<PlcCmdInfo> webSocketVo = WebSocketVo.<PlcCmdInfo>builder()
|
|
|
|
|
.message(plcCmdInfo)
|
|
|
|
|
.messageType("object")
|
|
|
|
|
.type("InventoryPush")
|
|
|
|
|
.build();
|
|
|
|
|
try {
|
|
|
|
|
WebSocketServer.sendInfo(JSONObject.toJSONString(webSocketVo),"");
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
public Boolean checkRfid(PlcCmdInfo plcCmdInfo,String wmsTrayCode){
|
|
|
|
|
RFIDCheck(plcCmdInfo);
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(1000*configProperties.getRfid().getScanTime());
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
Set<String> tags = RFIDStop(plcCmdInfo);
|
|
|
|
|
if(tags!= null && tags.size()>0 && tags.contains(wmsTrayCode)){
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}else {
|
|
|
|
|
return Boolean.FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void checkLog(Stock stock){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void checkLog(Stock stock) {
|
|
|
|
|
CheckLog checkLog = new CheckLog();
|
|
|
|
|
checkLog.setCheckNum(stock.getCheckNum());
|
|
|
|
|
checkLog.setPic(stock.getCheckPic());
|
|
|
|
|
@ -770,42 +809,67 @@ public class PlcService {
|
|
|
|
|
checkLog.setLotnum(stock.getLotnum());
|
|
|
|
|
checkLogMapper.insert(checkLog);
|
|
|
|
|
}
|
|
|
|
|
public void truncateStock(){
|
|
|
|
|
|
|
|
|
|
public void truncateStock() {
|
|
|
|
|
stockMapper.truncate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RFIDCheck(PlcCmdInfo plcCmdInfo){
|
|
|
|
|
/**
|
|
|
|
|
* 根据信息开启rfid链接
|
|
|
|
|
* @param plcCmdInfo 相关信息
|
|
|
|
|
* @param fromOrTo 确定方向
|
|
|
|
|
*/
|
|
|
|
|
public void RFIDCheck(PlcCmdInfo plcCmdInfo, boolean fromOrTo) {
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
if(street != null){
|
|
|
|
|
if (street != null) {
|
|
|
|
|
//rfid不分左右,rfid使用同一ip和端口,依靠传递字符调整方向
|
|
|
|
|
RFID rfid = rfidService.getRFIDByPlc(street.getId(),null);
|
|
|
|
|
if(rfid != null){
|
|
|
|
|
RFIDStart(rfid.getIp(),rfid.getPort(),street.getId(), plcCmdInfo.getFromDirection());
|
|
|
|
|
RFID rfid = rfidService.getRFIDByPlc(street.getId(), null);
|
|
|
|
|
if (rfid != null) {
|
|
|
|
|
if (fromOrTo) {
|
|
|
|
|
RFIDStart(rfid.getIp(), rfid.getPort(), street.getId(), plcCmdInfo.getFromDirection());
|
|
|
|
|
}else
|
|
|
|
|
RFIDStart(rfid.getIp(), rfid.getPort(), street.getId(), plcCmdInfo.getToDirection());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RFIDStart(String ip, Integer port, Integer streetId, Integer direction){
|
|
|
|
|
RFIDSocket rfidSocket = new RFIDSocket(ip,port);
|
|
|
|
|
public void RFIDStart(String ip, Integer port, Integer streetId, Integer direction) {
|
|
|
|
|
RFIDSocket rfidSocket = new RFIDSocket(ip, port);
|
|
|
|
|
log.info("rfid调用,ip:"+ip+";port:"+port);
|
|
|
|
|
rfidSocket.startCheck(direction);
|
|
|
|
|
rfidSocket.readData();
|
|
|
|
|
RFIDMap.put(streetId,rfidSocket);
|
|
|
|
|
RFIDMap.put(streetId, rfidSocket);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Set<String> RFIDStop(PlcCmdInfo plcCmdInfo){
|
|
|
|
|
public Set<String> RFIDStop(PlcCmdInfo plcCmdInfo) {
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
RFIDSocket rfidSocket = RFIDMap.get(street.getId());
|
|
|
|
|
Set<String> tags = null;
|
|
|
|
|
if(rfidSocket != null){
|
|
|
|
|
if (rfidSocket != null) {
|
|
|
|
|
tags = rfidSocket.getTags();
|
|
|
|
|
log.info("tags:{}",tags);
|
|
|
|
|
log.info("tags:{}", tags);
|
|
|
|
|
rfidSocket.close();
|
|
|
|
|
RFIDMap.remove(street.getId());
|
|
|
|
|
}
|
|
|
|
|
return tags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String RFIDStopGetRFID(PlcCmdInfo plcCmdInfo) {
|
|
|
|
|
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
RFIDSocket rfidSocket = RFIDMap.get(street.getId());
|
|
|
|
|
String tags = "";
|
|
|
|
|
if (rfidSocket != null) {
|
|
|
|
|
tags = rfidSocket.getTag();
|
|
|
|
|
log.info("tag:{}", tags);
|
|
|
|
|
rfidSocket.close();
|
|
|
|
|
RFIDMap.remove(street.getId());
|
|
|
|
|
}
|
|
|
|
|
return tags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConfigProperties getConfigProperties(){
|
|
|
|
|
public ConfigProperties getConfigProperties() {
|
|
|
|
|
return configProperties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|