|
|
|
@ -71,7 +71,6 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
String body = in.toString(Charset.forName("UTF-8"));
|
|
|
|
String body = in.toString(Charset.forName("UTF-8"));
|
|
|
|
tcpLogger.info(body);
|
|
|
|
|
|
|
|
if (body.startsWith("<")){
|
|
|
|
if (body.startsWith("<")){
|
|
|
|
// 去掉首尾标识符
|
|
|
|
// 去掉首尾标识符
|
|
|
|
body = body.substring(1, body.length());
|
|
|
|
body = body.substring(1, body.length());
|
|
|
|
@ -86,17 +85,7 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
|
|
|
|
String srmNumber = null;
|
|
|
|
String srmNumber = null;
|
|
|
|
String cmdName = null;
|
|
|
|
String cmdName = null;
|
|
|
|
if(dataInfo != null){
|
|
|
|
if(dataInfo != null){
|
|
|
|
//左右换过来
|
|
|
|
|
|
|
|
if(dataInfo.getFromDirection() == 1){
|
|
|
|
|
|
|
|
dataInfo.setFromDirection(2);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
dataInfo.setFromDirection(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(dataInfo.getToDirection() != null && dataInfo.getToDirection() == 1){
|
|
|
|
|
|
|
|
dataInfo.setToDirection(2);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
dataInfo.setToDirection(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
plcCmdInfo = new PlcCmdInfo(dataInfo.getSRMNumber(), dataInfo.getTaskId(), dataInfo.getFromSide(), dataInfo.getFromDirection(), dataInfo.getFromColumn(), dataInfo.getFromRow(), dataInfo.getFromSeparation(),dataInfo.getToSide(), dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToRow(),dataInfo.getToSeparation(),lotnum);
|
|
|
|
plcCmdInfo = new PlcCmdInfo(dataInfo.getSRMNumber(), dataInfo.getTaskId(), dataInfo.getFromSide(), dataInfo.getFromDirection(), dataInfo.getFromColumn(), dataInfo.getFromRow(), dataInfo.getFromSeparation(),dataInfo.getToSide(), dataInfo.getToDirection(), dataInfo.getToColumn(), dataInfo.getToRow(),dataInfo.getToSeparation(),lotnum);
|
|
|
|
|
|
|
|
|
|
|
|
srmNumber = dataInfo.getSRMNumber();
|
|
|
|
srmNumber = dataInfo.getSRMNumber();
|
|
|
|
@ -106,7 +95,7 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
|
|
|
|
//心跳
|
|
|
|
//心跳
|
|
|
|
log.debug("receieve heart ");
|
|
|
|
log.debug("receieve heart ");
|
|
|
|
} else if (Cmd.B.name().equals(ksecInfo.getType())) {
|
|
|
|
} else if (Cmd.B.name().equals(ksecInfo.getType())) {
|
|
|
|
|
|
|
|
tcpLogger.info(body);
|
|
|
|
//任务
|
|
|
|
//任务
|
|
|
|
if (Cmd.B1.name().equals(cmdName)) {
|
|
|
|
if (Cmd.B1.name().equals(cmdName)) {
|
|
|
|
//昆船盘点模式下也会发B1 ,但是不会发送B2
|
|
|
|
//昆船盘点模式下也会发B1 ,但是不会发送B2
|
|
|
|
@ -142,7 +131,7 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
|
|
|
|
plcService.orderStop(plcCmdInfo);
|
|
|
|
plcService.orderStop(plcCmdInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (Cmd.C.name().equals(ksecInfo.getType())) {
|
|
|
|
} else if (Cmd.C.name().equals(ksecInfo.getType())) {
|
|
|
|
|
|
|
|
tcpLogger.info(body);
|
|
|
|
//动作
|
|
|
|
//动作
|
|
|
|
String code = dataInfo.getCmdName();
|
|
|
|
String code = dataInfo.getCmdName();
|
|
|
|
log.info("action code,{},orderInfo:{}", code, plcCmdInfo.toString());
|
|
|
|
log.info("action code,{},orderInfo:{}", code, plcCmdInfo.toString());
|
|
|
|
@ -182,7 +171,7 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
|
|
|
|
|
|
|
|
|
|
|
|
//盘点
|
|
|
|
//盘点
|
|
|
|
//转球机到盘点位 然后拍照
|
|
|
|
//转球机到盘点位 然后拍照
|
|
|
|
|
|
|
|
tcpLogger.info(body);
|
|
|
|
if(!StringUtils.isEmpty(lotnum) && !lotnum.equals(lastLotnum)){
|
|
|
|
if(!StringUtils.isEmpty(lotnum) && !lotnum.equals(lastLotnum)){
|
|
|
|
//需要把stock表truncate
|
|
|
|
//需要把stock表truncate
|
|
|
|
FileUtil.save(lotnum,"lastLotnum");
|
|
|
|
FileUtil.save(lotnum,"lastLotnum");
|
|
|
|
|