增加查找请求

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

@ -1,5 +1,5 @@
#Generated by Maven #Generated by Maven
#Fri Jan 10 11:12:09 CST 2025 #Sat May 24 09:59:24 CST 2025
groupId=com.zhehekeji groupId=com.zhehekeji
artifactId=common artifactId=common
version=1.0.0 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") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTimestamp; private LocalDateTime endTimestamp;
private Integer status; private String status;
private Integer streetId; private Integer streetId;

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

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

@ -13,7 +13,8 @@ public class Transmission {
private Boolean success; private Boolean success;
private String url; private String url;
private Integer number; private String isNg;
private Boolean ngBoolean = false;
// public String toString(){ // public String toString(){
@ -24,8 +25,9 @@ public class Transmission {
// return sb.toString(); // return sb.toString();
// } // }
public Transmission(String body){ public Transmission(String body){
this.body = body; this.body = body.replace(">","");
String [] strings = body.split(Split); String [] strings = this.body.split(Split);
if(strings.length >= 2){ if(strings.length >= 2){
this.header= strings[0]; this.header= strings[0];
this.SRMNumber= strings[1]; this.SRMNumber= strings[1];
@ -35,11 +37,16 @@ public class Transmission {
this.url= strings[3]; this.url= strings[3];
} }
if(strings.length >= 5){ 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) { 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); System.out.println(t);
} }
public String getHeader(){ public String getHeader(){

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

@ -14,7 +14,7 @@ spring:
testWhileIdle: false testWhileIdle: false
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 60000
type: com.alibaba.druid.pool.DruidDataSource 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 username: root
validationQuery: SELECT 1 FROM DUAL validationQuery: SELECT 1 FROM DUAL
# --------本服务端口号 # --------本服务端口号

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

Loading…
Cancel
Save