Commit 1f74955b zshaohui

1.解析库位坐标修改

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