增加http来查看当前的rfid扫码情况

请求体过大接收
changchun-医药
LAPTOP-S9HJSOEB\昊天 2 years ago
parent 6f2b5ebda4
commit 136b6b3523

@ -0,0 +1,58 @@
package com.zhehekeji.web.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhehekeji.web.entity.RfidLog;
import com.zhehekeji.web.entity.Videocc;
import com.zhehekeji.web.entity.VideoccResponse;
import com.zhehekeji.web.mapper.RFIDMapper;
import com.zhehekeji.web.service.interfaces.RfidLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.*;
@Api(tags = "对外接口")
@RequestMapping("/videocc")
@RestController
public class VideoccController {
@Resource
private RfidLogService rfidLogService;
@PostMapping("/xiddata")
@ApiOperation(value = "库存信息")
public VideoccResponse xiddata(@RequestBody Videocc videocc ){
Set<String> list = new HashSet<>();
if(videocc.getDetails()!=null){
for(Videocc.Detail detail:videocc.getDetails()){
list.add(detail.getBoxCode());
if(detail.getEquipCodes() != null) {
list.addAll(detail.getEquipCodes());
}
}
}
VideoccResponse videoccResponse = new VideoccResponse();
videoccResponse.setMsg("失败");
videoccResponse.setIsSuccess(0);
RfidLog rfidLog = rfidLogService.getOne(new QueryWrapper<RfidLog>().eq("task_id",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)){
videoccResponse.setMsg("成功");
videoccResponse.setIsSuccess(1);
}else {
videoccResponse.setMsg("扫码错误,请检查货物");
videoccResponse.setIsSuccess(0);
}
}else {
videoccResponse.setMsg("rfid扫码未完成请稍后重试");
videoccResponse.setIsSuccess(0);
}
return videoccResponse;
}
}

@ -1,6 +1,7 @@
package com.zhehekeji.web.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -18,8 +19,12 @@ public class RfidLive {
private Integer streetId;
private Integer direction;
private Integer side;
private Integer rfidRow;
private Integer rfidColumn;
@TableField("`row`")
private Integer row;
@TableField("`column`")
private Integer column;
private String rfidTrayCode;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")

@ -1,6 +1,7 @@
package com.zhehekeji.web.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -21,8 +22,12 @@ public class RfidLog {
private Integer street_id;
private Integer direction;
private Integer side;
private Integer rfidRow;
private Integer rfidColumn;
@TableField("`row`")
private Integer row;
@TableField("`column`")
private Integer column;
private String rfidTrayCode;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")

@ -0,0 +1,31 @@
package com.zhehekeji.web.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
@Data
public class Videocc {
@JsonProperty(value = "TASKKEY")
private String taskKey;
@JsonProperty(value = "JOBNUM")
private String jobNum;
@JsonProperty(value = "PLTNUM")
private String pltNum;
@JsonProperty(value = "LOC")
private String loc;
@JsonProperty(value = "SKU")
private String sku;
@JsonProperty(value = "QTY")
private String qty;
@JsonProperty("DETAIL")
private List<Detail> details;
@Data
public static class Detail {
private String boxCode;
@JsonProperty("equipCode")
private List<String> equipCodes;
}
}

@ -0,0 +1,10 @@
package com.zhehekeji.web.entity;
import lombok.Data;
@Data
public class VideoccResponse {
private Integer IsSuccess;
private String Msg;
}

@ -24,6 +24,7 @@ import com.zhehekeji.web.ws.WebSocketServer;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.SetUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.poi.util.ArrayUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -40,6 +41,7 @@ import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @Description plc
@ -307,9 +309,9 @@ public class PlcService {
gyrateCameraByCodeTimeLater(street.getCamera1Id(), "C5", configProperties.getCameraConfig().getC2OutDelayCaptureTime() + 500);
}
}
threadPoolExecutor.execute(()->{
rfidLiveService.rfidOrderStock(plcCmdInfo, times, code);
});
// threadPoolExecutor.execute(()->{
// rfidLiveService.rfidOrderStock(plcCmdInfo, times, code);
// });
}
private Integer getCameraByPlcCmdAction(PlcCmdInfo plcCmdInfo, String code) {
@ -643,7 +645,12 @@ public class PlcService {
}
String path = PathUtil.createFileNameByRowColumn("jpg", cameraId, plcCmdInfo.getRow1(), plcCmdInfo.getColumn1());
try {
cameraCapture(cameraId, false, null, path);
}catch (NullPointerException e){
log.error("相机{}未连接无法拍照",cameraId);
}
//托盘码
String trayCode = null;
Boolean trayCheck = Boolean.TRUE;
@ -696,33 +703,42 @@ public class PlcService {
tags = RFIDStop(plcCmdInfo);
log.info("盘点rfid扫描结果"+tags);
}
if (tags != null && tags.size() > 0 && tags.contains(wmsTrayCode)) {
// 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.getFromSeparation())
// .eq("rfid_row", plcCmdInfo.getRow1())
// .eq("rfid_column", plcCmdInfo.getColumn1()));
// if (ToolUtil.isNotEmpty(rfidLive) && ToolUtil.isNotEmpty(rfidLive.getRfidTrayCode()) && rfidLive.getRfidTrayCode().contains(wmsTrayCode)) {
// trayCode = wmsTrayCode;
// trayCheck = Boolean.TRUE;
// log.info("数据库查询rfid", trayCode);
// } else {
// trayCode = "";
// trayCheck = Boolean.FALSE;
// }
// }
if (tags != null && tags.size() > 0 ) {
trayCode = wmsTrayCode;
trayCheck = Boolean.TRUE;
if(! rfidLiveService.getRfidLive(plcCmdInfo,street,wmsTrayCode)){
RFID rfid = rfidMapper.selectOne(new QueryWrapper<RFID>().eq("street_id", street.getId()));
if(! rfidLiveService.getRfidLive(plcCmdInfo,street,wmsTrayCode)){
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.getFromSeparation())
.eq("rfid_row", plcCmdInfo.getRow1())
.eq("rfid_column", plcCmdInfo.getColumn1()));
if (ToolUtil.isNotEmpty(rfidLive) && ToolUtil.isNotEmpty(rfidLive.getRfidTrayCode()) && rfidLive.getRfidTrayCode().contains(wmsTrayCode)) {
trayCode = wmsTrayCode;
trayCheck = Boolean.TRUE;
log.info("数据库查询rfid", trayCode);
} else {
trayCode = "";
trayCheck = Boolean.FALSE;
}
rfidLiveService.rfidSave(plcCmdInfo, String.join(",", tags),street,rfid);
}
}

@ -76,21 +76,10 @@ public class RfidLiveServiceImpl extends ServiceImpl<RfidLiveMapper, RfidLive> i
.eq("street_Id", street.getId())
.eq("direction", plcCmdInfo.getFromDirection())
.eq("side", plcCmdInfo.getFromSeparation())
.eq("rfid_row", plcCmdInfo.getFromRow())
.eq("rfid_column", plcCmdInfo.getFromColumn()));
.eq("`row`", plcCmdInfo.getFromRow())
.eq("`column`", plcCmdInfo.getFromColumn()));
remove(new QueryWrapper<RfidLive>().isNull("direction"));
rfidLog.setRfidId(rfid.getId());
rfidLog.setStreet_id(street.getId());
rfidLog.setDirection(plcCmdInfo.getFromDirection());
rfidLog.setSide(plcCmdInfo.getSeparation1());
rfidLog.setRfidRow(plcCmdInfo.getRow1());
rfidLog.setRfidColumn(plcCmdInfo.getColumn1());
rfidLog.setCreateTime(LocalDateTime.now());
rfidLog.setRfidId(rfid.getId());
rfidLog.setTaskId(plcCmdInfo.getTaskId());
rfidLog.setMovement(2);
rfidLogService.save(rfidLog);
}
public void rfidSave(PlcCmdInfo plcCmdInfo, String code, Street street, RFID rfid) {
@ -104,10 +93,10 @@ public class RfidLiveServiceImpl extends ServiceImpl<RfidLiveMapper, RfidLive> i
rfidLive.setRfidId(rfid.getId());
rfidLive.setRfidTrayCode(code);
rfidLive.setStreetId(street.getId());
rfidLive.setDirection(plcCmdInfo.getToDirection());
rfidLive.setSide(plcCmdInfo.getSeparation2());
rfidLive.setRfidRow(plcCmdInfo.getRow2());
rfidLive.setRfidColumn(plcCmdInfo.getColumn2());
rfidLive.setDirection(plcCmdInfo.getFromDirection());
rfidLive.setSide(plcCmdInfo.getFromSeparation());
rfidLive.setRow(plcCmdInfo.getFromRow());
rfidLive.setColumn(plcCmdInfo.getFromColumn());
rfidLive.setCreateTime(LocalDateTime.now());
rfidLive.setRfidId(rfid.getId());
rfidLive.setTaskId(plcCmdInfo.getTaskId());
@ -115,10 +104,10 @@ public class RfidLiveServiceImpl extends ServiceImpl<RfidLiveMapper, RfidLive> i
}
rfidLog.setRfidId(rfid.getId());
rfidLog.setStreet_id(street.getId());
rfidLog.setDirection(plcCmdInfo.getToDirection());
rfidLog.setSide(plcCmdInfo.getSeparation2());
rfidLog.setRfidRow(plcCmdInfo.getRow2());
rfidLog.setRfidColumn(plcCmdInfo.getColumn2());
rfidLog.setDirection(plcCmdInfo.getFromDirection());
rfidLog.setSide(plcCmdInfo.getFromSeparation());
rfidLog.setRow(plcCmdInfo.getFromRow());
rfidLog.setColumn(plcCmdInfo.getFromColumn());
rfidLog.setCreateTime(LocalDateTime.now());
rfidLog.setRfidId(rfid.getId());
rfidLog.setTaskId(plcCmdInfo.getTaskId());
@ -131,8 +120,8 @@ public class RfidLiveServiceImpl extends ServiceImpl<RfidLiveMapper, RfidLive> i
.eq("street_Id", street.getId())
.eq("direction", plcCmdInfo.getFromDirection())
.eq("side", plcCmdInfo.getFromSide())
.eq("rfid_row", plcCmdInfo.getFromRow())
.eq("rfid_column", plcCmdInfo.getFromColumn()).eq("rfid_Tray_Code",rfidTrayCode)) == 1;
.eq("`row`", plcCmdInfo.getFromRow())
.eq("`column`", plcCmdInfo.getFromColumn()).eq("rfid_Tray_Code",rfidTrayCode)) == 1;
}
}

@ -123,7 +123,7 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
if (Cmd.A.name().equals(ksecInfo.getType())) {
//心跳
log.debug("receieve heart ");
} else if (Cmd.B.name().equals(ksecInfo.getType()) ||(Cmd.E.name().equals(ksecInfo.getType()) && !dataInfo.getTrayCode().startsWith("E"))) {
} else if (Cmd.B.name().equals(ksecInfo.getType())) {
//任务
if (Cmd.B1.name().equals(cmdName)) {
//昆船盘点模式下也会发B1 ,但是不会发送B2
@ -196,7 +196,7 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
// }else {
// log.info("other D code :{}",code);
// }
} else if (Cmd.E.name().equals(ksecInfo.getType()) && dataInfo.getTrayCode().startsWith("E")) {
} else if (Cmd.E.name().equals(ksecInfo.getType()) ) {
//盘点
//转球机到盘点位 然后拍照

@ -19,6 +19,7 @@ spring:
validationQuery: SELECT 1 FROM DUAL
# --------本服务端口号
server:
max-http-header-size: 232400
port: 8099
#--------------
# ------用户中心地址
@ -96,7 +97,7 @@ deleteFileDays: 60
#rfid
rfid:
#rfid连续扫描时间默认5s 单位s
scanTime: 20
scanTime: 1
asyncExecutorThread:

Loading…
Cancel
Save