增加查找请求

hubei-jinshennong
LAPTOP-S9HJSOEB\昊天 9 months ago
parent 3c2c206c9d
commit c6ae6756b2

@ -1,5 +1,5 @@
#Generated by Maven
#Fri Jan 10 11:12:09 CST 2025
#Sat May 24 09:59:24 CST 2025
groupId=com.zhehekeji
artifactId=common
version=1.0.0

@ -0,0 +1,14 @@
com\zhehekeji\common\properities\Properity.class
com\zhehekeji\common\util\FileUtil.class
com\zhehekeji\common\util\QrUtil.class
com\zhehekeji\common\util\SpringContextUtil.class
com\zhehekeji\common\util\PathUtil.class
com\zhehekeji\common\util\ValidatorUtil.class
com\zhehekeji\common\properities\Md5Properity.class
com\zhehekeji\common\util\Tools.class
META-INF\spring-configuration-metadata.json
com\zhehekeji\common\properities\RedisProperity.class
com\zhehekeji\common\constant\CommonConstant.class
com\zhehekeji\common\util\MD5Util.class
com\zhehekeji\common\util\HttpUtil.class
com\zhehekeji\common\CommonConfigure.class

@ -0,0 +1,8 @@
com\zhehekeji\filter\pojo\SessionHandler.class
com\zhehekeji\filter\pojo\CurrentUser.class
com\zhehekeji\filter\pojo\UserType.class
com\zhehekeji\filter\aspect\SessionAspect.class
com\zhehekeji\filter\util\CurrentUserUtil.class
com\zhehekeji\filter\pojo\CurrentUser$CurrentUserBuilder.class
com\zhehekeji\filter\util\JwtUtil.class
com\zhehekeji\filter\FilterConstance.class

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

@ -49,7 +49,7 @@ public class EmptyCheckService {
* @param transmission
* @return
*/
public Order visualJudgment(Transmission transmission,String code){
public Order visualJudgment(Transmission transmission,String code,int i){
String key = transmission.getSRMNumber() + "-";
if("TP".equals(code)){
key+="C3";
@ -63,9 +63,10 @@ public class EmptyCheckService {
transmission.setUrl(transmission.getUrl().replace("E:","").replace("D:",""));
transmission.setUrl("http://"+street.getPlcIp()+":9007/api/pic"+transmission.getUrl());
order.setPicPaths(order.getPicPaths()!=null ? order.getPicPaths() + "," +transmission.getUrl(): transmission.getUrl());
if(transmission.getNumber() != null ){
order.setNumber(transmission.getNumber());
}
if (transmission.getNgBoolean()){
order.setStatus(1);
plcConnectionService.writePlcDataStatusErr(street.getPlcId(),i);
}
orderMapper.updateById(order);
return order;

@ -84,7 +84,7 @@ public class Decoder extends DelimiterBasedFrameDecoder {
Transmission transmission = new Transmission(body);
if("BP".equals(transmission.getHeader())){
//底部拍照
Order order = emptyCheckService.visualJudgment(transmission,"BP");
Order order = emptyCheckService.visualJudgment(transmission,"BP",0);
//KsecInfo ksecInfo = emptyCheckService.getKSECWriteByOrder(order,street);
//KsecNettyClient.write(ksecInfo);
@ -95,7 +95,7 @@ public class Decoder extends DelimiterBasedFrameDecoder {
}else if("TP".equals(transmission.getHeader())){
//顶部拍照
Order order = emptyCheckService.visualJudgment(transmission,"TP");
Order order = emptyCheckService.visualJudgment(transmission,"TP",1);
// KsecInfo ksecInfo = emptyCheckService.getKSECWriteByOrder(order,street);
// KsecNettyClient.write(ksecInfo);

@ -13,7 +13,8 @@ public class Transmission {
private Boolean success;
private String url;
private Integer number;
private String isNg;
private Boolean ngBoolean = false;
// public String toString(){
@ -24,8 +25,9 @@ public class Transmission {
// return sb.toString();
// }
public Transmission(String body){
this.body = body;
String [] strings = body.split(Split);
this.body = body.replace(">","");
String [] strings = this.body.split(Split);
if(strings.length >= 2){
this.header= strings[0];
this.SRMNumber= strings[1];
@ -35,11 +37,16 @@ public class Transmission {
this.url= strings[3];
}
if(strings.length >= 5){
this.number= Integer.valueOf(strings[4]);
this.isNg= strings[4];
if (isNg.equals("NG")){
this.ngBoolean = true;
}else{
this.ngBoolean = false;
}
}
}
public static void main(String[] args) {
Transmission t = new Transmission("TP&003&3&E:/ccd/tupian/shang/20250110_114141_546832100.png&1&0>");
Transmission t = new Transmission("TP&003&3&E:/ccd/tupian/shang/20250110_114141_546832100.png&NG>");
System.out.println(t);
}
public String getHeader(){

@ -5,13 +5,6 @@ import com.sourceforge.snap7.moka7.S7Client;
import com.zhehekeji.web.service.PlcService;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.apache.plc4x.java.api.PlcConnection;
import org.apache.plc4x.java.api.PlcDriverManager;
import org.apache.plc4x.java.api.messages.PlcReadRequest;
import org.apache.plc4x.java.api.messages.PlcReadResponse;
import org.apache.plc4x.java.api.types.PlcResponseCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
@ -64,6 +57,7 @@ public class PLCConnectionExample {
}
}
/**
*
*/
@ -278,14 +272,15 @@ public class PLCConnectionExample {
public boolean writePlcDataStatusErr(String plcId,int digit){
if (digit==1){
return writePlcDataStatus(addressMap.get(plcId+"-ET-out:"),digit,false);
return writePlcDataStatus((plcId+"-ET-out"),digit,true);
}else {
return writePlcDataStatus(addressMap.get(plcId+"-ED-out"),digit,false);
return writePlcDataStatus((plcId+"-ED-out"),digit,true);
}
}
public boolean writePlcDataStatus(int startOffset,int digit,boolean value){
public boolean writePlcDataStatus(String startOffset,int digit,boolean value){
S7Client client = getConnection();
try {
@ -295,9 +290,9 @@ public class PLCConnectionExample {
S7.SetBitAt(buffer, 0, digit, value);
// 写回DB121
int result = client.WriteArea(S7.S7AreaDB, dbNumber, startOffset, sizeToRead, buffer);
int result = client.WriteArea(S7.S7AreaDB, dbNumber, addressMap.get(startOffset), sizeToRead, buffer);
if (result == 0) {
log.info("写入成功");
log.info("写入成功位置:"+startOffset+":"+digit);
return true;
} else {
updateConnection(client);
@ -315,7 +310,6 @@ public class PLCConnectionExample {
// 分拣线PLC型号是西门子1518机架号0插槽1IP是10.69.105.122。
//交互数据块地址是DB121
/*
public static void main(String[] args) {
// 创建S7Client实例
S7Client client = new S7Client();
@ -328,24 +322,25 @@ public static void main(String[] args) {
// 定义数据块和偏移量
int dbNumber = 121; // DB121
int startOffset = 48; // 起始地址
int sizeToRead = 4; // 读取4个字节
int startOffset = 74; // 起始地址
int sizeToRead = 1; // 读取4个字节
//
byte[] buffer = new byte[sizeToRead];
boolean bitValue = true;
// // 读取DB121的数据
int result = client.ReadArea(S7.S7AreaDB, dbNumber, startOffset, sizeToRead, buffer);
if (result == 0) {
log.info("读取成功");
// 获取指定 bit 的值
// bitValue= S7.GetBitAt(buffer, 0, 1);
bitValue= S7.GetBitAt(buffer, 0, 1);
// log.info(bitValue);
int i = ((buffer[0] & 0xFF) << 24) |
((buffer[1] & 0xFF) << 16) |
((buffer[2] & 0xFF) << 8) |
(buffer[3] & 0xFF);
log.info(i);
//
// int i = ((buffer[0] & 0xFF) << 24) |
// ((buffer[1] & 0xFF) << 16) |
// ((buffer[2] & 0xFF) << 8) |
// (buffer[3] & 0xFF);
System.out.println(bitValue);
} else {
log.info("读取失败,错误码: " + result);
}
@ -353,23 +348,27 @@ public static void main(String[] args) {
// 修改第一个字节的第一个位为true即设置bit 0
//
S7.SetDIntAt(buffer,0,3001);
// S7.SetDIntAt(buffer,0,3001);
// 写回DB121
result = client.WriteArea(S7.S7AreaDB, dbNumber, startOffset, sizeToRead, buffer);
if (result == 0) {
log.info("写入成功");
} else {
log.info("写入失败,错误码: " + result);
}
S7.SetBitAt(buffer, 0, 1, true);
//
// // 写回DB121
result = client.WriteArea(S7.S7AreaDB, dbNumber,startOffset, sizeToRead, buffer);
// if (result == 0) {
// log.info("写入成功位置:"+startOffset+":"+0);
//// return true;
// } else {
//// updateConnection(client);
// log.info("写入失败,错误码: " + result);
//// return false;
// }
// 断开连接
client.Disconnect();
} else {
log.info("连接失败");
}
}
*/
}

@ -14,7 +14,7 @@ spring:
testWhileIdle: false
timeBetweenEvictionRunsMillis: 60000
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://127.0.0.1:3306/lia_duoji_jinshennogn?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
url: jdbc:mysql://127.0.0.1:3306/lia_duoji_gujinggong?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
username: root
validationQuery: SELECT 1 FROM DUAL
# --------本服务端口号

@ -7,7 +7,7 @@
from `order` t
<where>
<if test="req.orderNum != null and req.orderNum != ''">
and t.order_num = #{req.orderNum}
and t.order_num like concat('%', #{req.orderNum}, '%')
</if>
<if test="req.status != null and req.status != ''">

Loading…
Cancel
Save