|
|
|
|
@ -0,0 +1,181 @@
|
|
|
|
|
package com.zhehekeji.web.service.client;
|
|
|
|
|
|
|
|
|
|
import lombok.Data;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
/**
|
|
|
|
|
* 盘点指令
|
|
|
|
|
* 与客户端的传输内容
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@Data
|
|
|
|
|
public class SCTransmission {
|
|
|
|
|
|
|
|
|
|
private static String header = "SC";
|
|
|
|
|
|
|
|
|
|
private String SRMNumber;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 搬运任务号
|
|
|
|
|
*/
|
|
|
|
|
private String taskNo;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 货位号
|
|
|
|
|
*/
|
|
|
|
|
private String goodsLocation;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 托盘号
|
|
|
|
|
*/
|
|
|
|
|
private String trayNo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String code;
|
|
|
|
|
/**
|
|
|
|
|
* 上位机下发品规
|
|
|
|
|
*/
|
|
|
|
|
private String category;
|
|
|
|
|
private Integer count;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 盘点结果
|
|
|
|
|
*/
|
|
|
|
|
private String rstCategory;
|
|
|
|
|
private Integer rstCount;
|
|
|
|
|
|
|
|
|
|
private String visualTest;
|
|
|
|
|
|
|
|
|
|
private String isDisConnect;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 盘点结果是否正确
|
|
|
|
|
*/
|
|
|
|
|
private String checkRst;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 左右 1:左 2:右
|
|
|
|
|
*/
|
|
|
|
|
private Integer direction;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 深浅 1:浅 2:深
|
|
|
|
|
*/
|
|
|
|
|
private Integer side;
|
|
|
|
|
|
|
|
|
|
private static String Split = "&";
|
|
|
|
|
|
|
|
|
|
private boolean collectOver;
|
|
|
|
|
|
|
|
|
|
public String toString(){
|
|
|
|
|
StringBuffer sb = new StringBuffer(header);
|
|
|
|
|
sb.append(Split).append(SRMNumber).append(Split).append(goodsLocation).append(Split)
|
|
|
|
|
.append(taskNo).append(Split).append(code)
|
|
|
|
|
.append(Split).append(count).append(Split).append(visualTest);
|
|
|
|
|
return sb.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String toSC02String(){
|
|
|
|
|
return header+Split+SRMNumber+Split+taskNo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String getHeader(){
|
|
|
|
|
return header;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public SCTransmission(String body){
|
|
|
|
|
// String [] strings = body.split(Split);
|
|
|
|
|
// if(strings != null && strings.length >= 9 && strings[0].equals(header)){
|
|
|
|
|
// if(strings.length == 9){
|
|
|
|
|
// SRMNumber = strings[1];
|
|
|
|
|
// taskNo = strings[2];
|
|
|
|
|
// goodsLocation = strings[3];
|
|
|
|
|
// trayNo = strings[4];
|
|
|
|
|
// code = strings[5];
|
|
|
|
|
// count = Integer.valueOf(strings[6]);
|
|
|
|
|
// visualTest = strings[7];
|
|
|
|
|
// isDisConnect = strings[8];
|
|
|
|
|
// direction = goodsLocation.substring(0).equals("L") ? 1:2;
|
|
|
|
|
// side = Integer.valueOf(goodsLocation.substring(2,3));
|
|
|
|
|
// //checkType = strings[7];
|
|
|
|
|
// collectOver = false;
|
|
|
|
|
// if("Y".equals(isDisConnect)){
|
|
|
|
|
// //需要拆分之前的
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }else if(strings.length == 3){
|
|
|
|
|
// //是盘点数据采集完成的信号
|
|
|
|
|
// collectOver = true;
|
|
|
|
|
// SRMNumber = strings[1];
|
|
|
|
|
// taskNo = strings[2];
|
|
|
|
|
// //goodsLocation = strings[3];
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//TM&6&UL062009050111&2121&11010019&30&NULL&NULL
|
|
|
|
|
public SCTransmission(String body){
|
|
|
|
|
log.info("tmtrans body: {}", body);
|
|
|
|
|
String [] strings = body.split(Split);
|
|
|
|
|
if(strings != null && strings.length >= 9 && strings[0].equals(header)){
|
|
|
|
|
if(strings.length == 9){
|
|
|
|
|
SRMNumber = strings[1];
|
|
|
|
|
goodsLocation = strings[2];
|
|
|
|
|
taskNo = strings[3];
|
|
|
|
|
category = strings[4];
|
|
|
|
|
count = Integer.valueOf(strings[5]);
|
|
|
|
|
rstCategory = strings[6];
|
|
|
|
|
rstCount = Integer.valueOf(strings[7]);
|
|
|
|
|
checkRst = strings[8];
|
|
|
|
|
collectOver = false;
|
|
|
|
|
log.info("taskNo:{}, srmNumber:{}, goodsLocation:{}", taskNo, SRMNumber, goodsLocation);
|
|
|
|
|
// if("Y".equals(isDisConnect)){
|
|
|
|
|
// //需要拆分之前的
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else if(strings.length == 3){
|
|
|
|
|
//是盘点数据采集完成的信号
|
|
|
|
|
collectOver = true;
|
|
|
|
|
SRMNumber = strings[1];
|
|
|
|
|
taskNo = strings[2];
|
|
|
|
|
//goodsLocation = strings[3];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SCTransmission(String SRMNumber,String taskId,String goodsLocation,String code,Integer count,String visual){
|
|
|
|
|
this.SRMNumber = SRMNumber;
|
|
|
|
|
this.taskNo = taskId;
|
|
|
|
|
this.goodsLocation = goodsLocation;
|
|
|
|
|
this.code = code;
|
|
|
|
|
this.count = count;
|
|
|
|
|
this.trayNo = "Unknown";
|
|
|
|
|
this.visualTest = visual;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SCTransmission(String SRMNumber,String taskId){
|
|
|
|
|
this.SRMNumber = SRMNumber;
|
|
|
|
|
this.taskNo = taskId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public RealtimeCheckMap.CheckInfo checkInfo(){
|
|
|
|
|
log.info("cheinfo start");
|
|
|
|
|
RealtimeCheckMap.CheckInfo checkInfo = new RealtimeCheckMap.CheckInfo();
|
|
|
|
|
Integer row = Integer.valueOf(goodsLocation.substring(8,10));
|
|
|
|
|
Integer column = Integer.valueOf(goodsLocation.substring(5,8));
|
|
|
|
|
Integer leftRight = Integer.valueOf(goodsLocation.substring(4,5));
|
|
|
|
|
Integer inout = Integer.valueOf(goodsLocation.substring(11,12));
|
|
|
|
|
checkInfo.setDirection(leftRight);
|
|
|
|
|
checkInfo.setColumn(column);
|
|
|
|
|
checkInfo.setRow(row);
|
|
|
|
|
checkInfo.setSide(inout);
|
|
|
|
|
checkInfo.setTaskNo(this.taskNo);
|
|
|
|
|
// checkInfo.setWMSCategory(category);
|
|
|
|
|
// checkInfo.setWMSCount(count);
|
|
|
|
|
// checkInfo.setWMSCode(code);
|
|
|
|
|
checkInfo.setCheckCode(goodsLocation);
|
|
|
|
|
checkInfo.setCheckCount(rstCount);
|
|
|
|
|
//checkInfo.setCheckCategory();
|
|
|
|
|
return checkInfo;
|
|
|
|
|
}
|
|
|
|
|
}
|