Commit 1f74955b zshaohui

1.解析库位坐标修改

2.入库是调用save和退料接口
1 个父辈 da0b61c3
......@@ -10,65 +10,92 @@ public class PointUtil {
return getPosPoint(posId,true );
}
public static void main(String[] args) {
//Point posPoint = getPosPoint("DUO1-R_04_112_05",false);
Point posPoint = getPosPoint("05AA03040102",false);
System.out.println(JsonUtil.toJsonStr(posPoint));
}
/**
* 获取坐标
* @param posId 库位号
*
* @param posId 库位号
* @param isUpdatePos true=更新库位坐标。false=查询使用
* @return
*/
public static Point getPosPoint(String posId, boolean isUpdatePos) {
// 库位号格式:
// 例:05AA03040102
// 05:表示料仓编号,01-08
// AA:存储机构A面或B面,AA或者BB
// 03:表示抽屉在第几行
// 04:表示抽屉在第几列
// 01:表示在抽屉中的第几行
// 02:表示在抽屉中的第几列
Point p = new Point(0, 0);
try {
if (posId.length() == 12 &&((posId.contains("AA")||posId.contains("BB")))) {
if (posId.contains("DUO") && ((posId.contains("-L") || posId.contains("-R")))) {
double storageNum = 0;
int storage = Integer.parseInt(posId.substring(0, 2));
String typeStr = posId.substring(2, 4);
if (typeStr.equals("AA")) {
if(isUpdatePos){
storageNum = storage * 10 + 1;
}else{
//获取到第一个-,获取到设备的id
int firstIndex = posId.indexOf("-");
String cidStr = posId.substring(0, firstIndex);
cidStr = cidStr.replace("DUO", "");
int storage = Integer.parseInt(cidStr);
//判断是1面,还是2面
int endIndex = posId.lastIndexOf("_");
String sideStr = posId.substring(0, endIndex);
//String typeStr = posId.substring(2, 4);
if (sideStr.endsWith("1")) {
if (isUpdatePos) {
storageNum = storage * 10 + 1;
} else {
storageNum = storage * 10 + 2;
}
} else {
if(isUpdatePos){
if (isUpdatePos) {
storageNum = storage * 10 + 2;
}else{
} else {
storageNum = storage * 10 + 1;
}
}
double row = Integer.parseInt(posId.substring(4, 6));
double column = Integer.parseInt(posId.substring(6, 8));
//获取行列表
int rowIndex = posId.lastIndexOf("_");
String rowStr = posId.substring(0, rowIndex);
rowIndex = rowStr.lastIndexOf("_");
rowStr = rowStr.substring(rowIndex + 1);
rowStr = rowStr.substring(0, rowStr.length() - 1);
//获取列
int columnIndex = posId.indexOf("_");
String columnStr = posId.substring(columnIndex + 1);
columnIndex = columnStr.indexOf("_");
columnStr = columnStr.substring(0, columnIndex);
double row = Integer.parseInt(rowStr);
double column = Integer.parseInt(columnStr);
double x = storageNum + column / 100;
double y = storageNum + row / 1000;
double drawerRow=1;
double drawerColumn=1;
if (isUpdatePos) {
drawerRow = Integer.parseInt(posId.substring(8, 10));
drawerColumn = Integer.parseInt(posId.substring(10, 12));
//获取对应抽屉的,行和列
int drawerRowIndex = posId.lastIndexOf("_");
String drawerRowStr = posId.substring(drawerRowIndex + 1);
double drawerRow = Double.valueOf(drawerRowStr);
//获取到对应的列
double drawerColumn = 1;
if (sideStr.endsWith("2")) {
drawerColumn = 2;
}
x += drawerColumn / 100 / 1000;
y += +drawerRow / 1000 / 100;
y += drawerRow / 1000 / 100;
p = new Point(x, y);
}
} catch (Exception ex) {
log.error("解析库位[" + posId + "]的坐标出错:" + ex);
}
// log.info("解析库位[" + posId + "]的坐标结果:" + p.toString());
return p;
}
}
......@@ -723,7 +723,7 @@ public class DeviceController {
}
}
if (dataLog == null){
return ResultBean.newErrorResult(-1,"","");
return ResultBean.newErrorResult(-1,"",code+"未找到对应的入库任务");
}
Storage storage = dataCache.getStorage(cid);
......
......@@ -328,15 +328,15 @@ public class LizhenApi extends DefaultSmfApiListener {
}
}
if (task.isFinished()){
DataLog oldTask = dataLogManager.findOne(new Query(Criteria.where("barcode").is(task.getBarcode()).and("type").is(OP.CHECKOUT)
.and("status").is(OP_STATUS.FINISHED.name()).and("createDate").lte(new Date())).with(Sort.by(Sort.Direction.DESC, "createDate")));
if (oldTask == null) {
log.info(task.getBarcode()+"为新料,调用save2ReelInfo接口");
//DataLog oldTask = dataLogManager.findOne(new Query(Criteria.where("barcode").is(task.getBarcode()).and("type").is(OP.CHECKOUT)
// .and("status").is(OP_STATUS.FINISHED.name()).and("createDate").lte(new Date())).with(Sort.by(Sort.Direction.DESC, "createDate")));
//if (oldTask == null) {
// log.info(task.getBarcode()+"为新料,调用save2ReelInfo接口");
reelInToTower(task);
} else {
log.info(task.getBarcode()+"为旧料,调用RMRecord接口");
reelReturnTower(oldTask);
}
//} else {
// log.info(task.getBarcode()+"为旧料,调用RMRecord接口");
reelReturnTower(task);
//}
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!