From f88f2d128a4339224d0489e863c94096662c4854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LAPTOP-S9HJSOEB=5C=E6=98=8A=E5=A4=A9?= Date: Sun, 9 Apr 2023 14:13:05 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BC=80=E6=94=BE=E4=BA=86rfid=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=97=B6=E9=97=B4=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0?= =?UTF-8?q?=202.=E5=9C=A8wms=E5=8F=91=E9=80=81=E7=9B=98=E7=82=B9=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=90=8E=EF=BC=8C=E6=89=A7=E8=A1=8Ccheck=E6=96=B9?= =?UTF-8?q?=E6=B3=95=203.=E5=AE=8C=E6=88=90=E5=A6=82=E6=9E=9Crfid=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=88=B0wms=E4=BC=A0=E8=BE=93=E7=9A=84trayCode?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E8=AF=9D=EF=BC=8C=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=9B=98=E7=82=B9=E4=B8=BA=E7=9B=98=E7=82=B9=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/config/ConfigProperties.java | 8 +++++++ .../com/zhehekeji/web/service/PlcService.java | 21 +++++++++++++++++++ .../web/service/ksec/KsecDecoder.java | 5 ++++- web/src/main/resources/application-dev.yml | 8 ++++++- web/src/main/resources/application-prod.yml | 8 ++++++- web/src/main/resources/application-test.yml | 11 +++++++--- web/src/main/resources/application.yml | 4 +++- 7 files changed, 58 insertions(+), 7 deletions(-) diff --git a/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java b/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java index 2c919dd..62dc9fb 100644 --- a/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java +++ b/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java @@ -36,11 +36,19 @@ public class ConfigProperties { private LightSource lightSource; private ScanCodeMode scanCodeMode; + private Rfid rfid; + + @Data + public static class Rfid { + + private Long scanTime = 5L; + } @Data public static class CameraConfig{ + private Integer cameraType; private String cameraPassword; diff --git a/web/src/main/java/com/zhehekeji/web/service/PlcService.java b/web/src/main/java/com/zhehekeji/web/service/PlcService.java index c473388..cfbeac5 100644 --- a/web/src/main/java/com/zhehekeji/web/service/PlcService.java +++ b/web/src/main/java/com/zhehekeji/web/service/PlcService.java @@ -14,13 +14,18 @@ import com.zhehekeji.web.service.hikLightSource.HikControlSocket; import com.zhehekeji.web.service.ksec.KsecNettyClient; import com.zhehekeji.web.service.sick.SickSocket; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.SetUtils; +import org.apache.poi.util.ArrayUtil; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import javax.annotation.Resource; +import java.io.File; +import java.io.FileWriter; import java.time.Duration; import java.time.LocalDateTime; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -621,6 +626,22 @@ public class PlcService { //RFID RFID rfid = rfidService.getRFIDByPlc(street.getId()); + try{ + + RFIDCheck(plcCmdInfo); + Thread.sleep(1000*configProperties.getRfid().getScanTime()); + Set tags = RFIDStop(plcCmdInfo); + if(tags!= null && tags.size()>0 && tags.contains(wmsTrayCode)){ + trayCode = ""; + trayCheck = Boolean.TRUE; + }else { + trayCode = "未识别"; + trayCheck = Boolean.FALSE; + log.warn("sick ocr error:{}",trayCode); + } + }catch (Exception e){ + e.printStackTrace(); + } } diff --git a/web/src/main/java/com/zhehekeji/web/service/ksec/KsecDecoder.java b/web/src/main/java/com/zhehekeji/web/service/ksec/KsecDecoder.java index 0fe32f0..5794ac0 100644 --- a/web/src/main/java/com/zhehekeji/web/service/ksec/KsecDecoder.java +++ b/web/src/main/java/com/zhehekeji/web/service/ksec/KsecDecoder.java @@ -201,11 +201,14 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder { // ctx.channel().writeAndFlush(ksecInfo); //rfid的逻辑 String code = dataInfo.getCmdName(); + + plcService.check(plcCmdInfo,ksecInfo.getType(),dataInfo.getCode(),dataInfo.getTrayCode()); + /* if("E1".equals(code)){ plcService.RFIDCheck(plcCmdInfo); }else { plcService.RFIDStop(plcCmdInfo); - } + }*/ } //找到该货位的最后一张照片与现在的照片比照 diff --git a/web/src/main/resources/application-dev.yml b/web/src/main/resources/application-dev.yml index bfa02a1..5381737 100644 --- a/web/src/main/resources/application-dev.yml +++ b/web/src/main/resources/application-dev.yml @@ -86,4 +86,10 @@ scanCodeMode: trayCodeTypes: - 14 # 照片 視頻保存多久 -deleteFileDays: 365 \ No newline at end of file +deleteFileDays: 365 + + +#rfid +rfid: + #rfid连续扫描时间,默认5s 单位s + scanTime: 1 \ No newline at end of file diff --git a/web/src/main/resources/application-prod.yml b/web/src/main/resources/application-prod.yml index 2387d7d..e78d40e 100644 --- a/web/src/main/resources/application-prod.yml +++ b/web/src/main/resources/application-prod.yml @@ -86,4 +86,10 @@ scanCodeMode: trayCodeTypes: - 14 # 照片 視頻保存多久 -deleteFileDays: 365 \ No newline at end of file +deleteFileDays: 365 + + +#rfid +rfid: + #rfid连续扫描时间,默认5s 单位s + scanTime: 1 \ No newline at end of file diff --git a/web/src/main/resources/application-test.yml b/web/src/main/resources/application-test.yml index 90415ee..6be8148 100644 --- a/web/src/main/resources/application-test.yml +++ b/web/src/main/resources/application-test.yml @@ -7,7 +7,7 @@ spring: maxWait: 60000 minEvictableIdleTimeMillis: 300000 minIdle: 15 - password: Leaper@123 + password: root poolPreparedStatements: true testOnBorrow: true testOnReturn: false @@ -64,11 +64,16 @@ lightSource: # -----goods 货物 # 扫码模式 0:此处不盘点 1:球机扫码 2:sick扫码枪 3:南北达RFID scanCodeMode: - tray: 0 + tray: 3 goods: 1 goodsCodeTypes: - 14 trayCodeTypes: - 14 # 照片 視頻保存多久 -deleteFileDays: 365 \ No newline at end of file +deleteFileDays: 365 + +#rfid +rfid: + #rfid连续扫描时间,默认5s 单位s + scanTime: 1 \ No newline at end of file diff --git a/web/src/main/resources/application.yml b/web/src/main/resources/application.yml index 35ee836..dbccd47 100644 --- a/web/src/main/resources/application.yml +++ b/web/src/main/resources/application.yml @@ -31,4 +31,6 @@ zhehe: enable: true postToken: w89euijon2&UHBTY$%huni34ri logging: - config: classpath:logback-spring.xml \ No newline at end of file + config: classpath:logback-spring.xml + level: + com.com.zhehekeji.web.mapper: debug \ No newline at end of file