|
|
|
|
@ -45,11 +45,12 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
|
|
|
|
|
body = body.substring(1, body.length());
|
|
|
|
|
KsecInfo ksecInfo = JSONObject.parseObject(body, KsecInfo.class);
|
|
|
|
|
KsecDataInfo dataInfo = ksecInfo.getData();
|
|
|
|
|
String lotnum = dataInfo.getLotnum();
|
|
|
|
|
PlcCmdInfo plcCmdInfo = null;
|
|
|
|
|
String srmNumber = null;
|
|
|
|
|
String cmdName = null;
|
|
|
|
|
if(dataInfo != null){
|
|
|
|
|
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());
|
|
|
|
|
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();
|
|
|
|
|
cmdName = dataInfo.getCmdName();
|
|
|
|
|
}
|
|
|
|
|
@ -104,27 +105,23 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
|
|
|
|
|
tcpLogger.info("info:{}",body);
|
|
|
|
|
//盘点
|
|
|
|
|
//转球机到盘点位 然后拍照
|
|
|
|
|
String lotnum = dataInfo.getLotnum();
|
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(lotnum) && !lotnum.equals(lastLotnum)){
|
|
|
|
|
//需要把stock表truncate
|
|
|
|
|
tcpLogger.info("truncate table ,last lotnum:{},new lotnum:{}",lastLotnum,lotnum);
|
|
|
|
|
plcService.truncateStock();
|
|
|
|
|
lastLotnum = lotnum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(ksecInfo.getData().getCmdName().equals("test")){
|
|
|
|
|
plcService.kescTest6(plcCmdInfo,ksecInfo.getData().getCmdName(), dataInfo.getCode());
|
|
|
|
|
Boolean ok = plcService.check(plcCmdInfo,ksecInfo.getData().getCmdName(), dataInfo.getCode(), dataInfo.getTrayCode());
|
|
|
|
|
if(ok){
|
|
|
|
|
ksecInfo.getData().setAckStatus(1);
|
|
|
|
|
}else {
|
|
|
|
|
Boolean ok = plcService.check(plcCmdInfo,ksecInfo.getData().getCmdName(), dataInfo.getCode(), dataInfo.getTrayCode());
|
|
|
|
|
if(ok){
|
|
|
|
|
ksecInfo.getData().setAckStatus(1);
|
|
|
|
|
}else {
|
|
|
|
|
ksecInfo.getData().setAckStatus(0);
|
|
|
|
|
}
|
|
|
|
|
ctx.channel().writeAndFlush(ksecInfo);
|
|
|
|
|
ksecInfo.getData().setAckStatus(0);
|
|
|
|
|
}
|
|
|
|
|
ctx.channel().writeAndFlush(ksecInfo);
|
|
|
|
|
}
|
|
|
|
|
//找到该货位的最后一张照片与现在的照片比照
|
|
|
|
|
//plcService.recordStock(plcCmdInfo, dataInfo.getCode(), 0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
in.release();
|
|
|
|
|
return null;
|
|
|
|
|
|