1.返回结果,如果不为失败则按照成功来

2.tcpinfo增加日志
just-camera
LAPTOP-S9HJSOEB\昊天 2 years ago
parent a3c02cce59
commit 5a7ae811b4

@ -11,6 +11,7 @@ public class StockCheckSearch {
@NotEmpty(message = "巷道标识符不能为空") @NotEmpty(message = "巷道标识符不能为空")
@ApiModelProperty("巷道标识符") @ApiModelProperty("巷道标识符")
private String SRMNumber; private String SRMNumber;
@NotNull(message = "行不能为空") @NotNull(message = "行不能为空")

@ -338,7 +338,6 @@ public class StockService {
if(stock.getCheckPic()!=null){ if(stock.getCheckPic()!=null){
stock.setCheckPics(stock.getCheckPic().split(";")); stock.setCheckPics(stock.getCheckPic().split(";"));
} }
return stock; return stock;
} }

@ -61,7 +61,7 @@ public class TransmissionPojo {
this.count = Integer.valueOf(dataArray[6]); this.count = Integer.valueOf(dataArray[6]);
} }
if (dataArray.length > 7) { if (dataArray.length > 7) {
this.result = Integer.valueOf(dataArray[7]); this.result = Integer.parseInt(dataArray[7])==0 ?0:1;
this.picsPath = dataArray[8].split(";"); this.picsPath = dataArray[8].split(";");
} }

@ -9,15 +9,20 @@ import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.channel.socket.nio.NioSocketChannel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.net.InetSocketAddress;
@Slf4j @Slf4j
@Component @Component
public class KsecNettyClient { public class KsecNettyClient {
static final Logger tcpLogger = LoggerFactory.getLogger("tcp");
private static EventLoopGroup group = new NioEventLoopGroup(); private static EventLoopGroup group = new NioEventLoopGroup();
@Resource @Resource
private PlcService plcService; private PlcService plcService;
@ -101,6 +106,9 @@ public class KsecNettyClient {
public static void write(KsecInfo ksecInfo){ public static void write(KsecInfo ksecInfo){
if(channel != null){ if(channel != null){
channel.writeAndFlush(ksecInfo); channel.writeAndFlush(ksecInfo);
InetSocketAddress socketAddress = (InetSocketAddress) channel.remoteAddress();
String clientIp = socketAddress.getAddress().getHostAddress();
tcpLogger.info("write kesc data:{} channel:{}",ksecInfo,clientIp);
}else { }else {
log.error(" no connected upPc"); log.error(" no connected upPc");
} }

Loading…
Cancel
Save