|
@@ -1,5 +1,6 @@
|
|
package com.steerinfo.inPlantNavigation.service.impl;
|
|
package com.steerinfo.inPlantNavigation.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.steerinfo.inPlantNavigation.exception.VertexAngEdgeException;
|
|
import com.steerinfo.inPlantNavigation.exception.VertexAngEdgeException;
|
|
import com.steerinfo.inPlantNavigation.mapper.MapVertexMapper;
|
|
import com.steerinfo.inPlantNavigation.mapper.MapVertexMapper;
|
|
import com.steerinfo.inPlantNavigation.model.IPMMSVertex;
|
|
import com.steerinfo.inPlantNavigation.model.IPMMSVertex;
|
|
@@ -72,6 +73,11 @@ public class MapVertexServiceImpl implements IMapVertexService {
|
|
return mapVertexMapper.findAllAvailable();
|
|
return mapVertexMapper.findAllAvailable();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ArrayList<MapVertex> findSelections() {
|
|
|
|
+ return mapVertexMapper.findSelections();
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Map<String, MapVertex> initMapVertex() {
|
|
public Map<String, MapVertex> initMapVertex() {
|
|
List<MapVertex> list=mapVertexMapper.findAllAvailable();
|
|
List<MapVertex> list=mapVertexMapper.findAllAvailable();
|
|
@@ -149,6 +155,7 @@ public class MapVertexServiceImpl implements IMapVertexService {
|
|
return startPointToEndPointPath(endPoint,currentBestDinstance,vertexList);
|
|
return startPointToEndPointPath(endPoint,currentBestDinstance,vertexList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
//获得目前最短距离
|
|
//获得目前最短距离
|
|
public String getStringMinimumValue(HashMap<String,Integer[]> currentBestDinstance,List<String> obtainTheOptimalPath){
|
|
public String getStringMinimumValue(HashMap<String,Integer[]> currentBestDinstance,List<String> obtainTheOptimalPath){
|
|
|
|
|
|
@@ -213,4 +220,69 @@ public class MapVertexServiceImpl implements IMapVertexService {
|
|
while (beforeDistance!=-1);
|
|
while (beforeDistance!=-1);
|
|
return obtainOptimalPath;
|
|
return obtainOptimalPath;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> findOrderDetails(String orderId) {
|
|
|
|
+ Map<String, Object> result=mapVertexMapper.findOrderDetails(orderId);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ArrayList<MapVertex> getPathByOrderID(String orderId,String startStep,String endStep,Map<String, MapVertex> vertexList,Map<String, List<MapVertexEdge>> vertexEdgeList) throws VertexAngEdgeException {
|
|
|
|
+ //校验
|
|
|
|
+ if(orderId==null || startStep==null ||endStep==null){
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ //初始化
|
|
|
|
+ ArrayList<MapVertex> obtainOptimalPath=null;
|
|
|
|
+ Map<String, Object> details=mapVertexMapper.findOrderDetails(orderId);
|
|
|
|
+ String startPoint=null;
|
|
|
|
+ String endPoint=null;
|
|
|
|
+ //取得起点的顶点
|
|
|
|
+ startPoint=parseVertexID(startStep,details);
|
|
|
|
+ //取得终点的顶点
|
|
|
|
+ endPoint=parseVertexID(endStep,details);
|
|
|
|
+ //不为空则找寻最短路径
|
|
|
|
+ if(startPoint!=null && endPoint!=null){
|
|
|
|
+ obtainOptimalPath= getObtainTheOptimalPath(startPoint,endPoint,vertexEdgeList,vertexList);
|
|
|
|
+ Collections.reverse(obtainOptimalPath);//翻转
|
|
|
|
+ }
|
|
|
|
+ return obtainOptimalPath;
|
|
|
|
+ }
|
|
|
|
+ //转换成顶点编号
|
|
|
|
+ private String parseVertexID(String step,Map<String, Object> details){
|
|
|
|
+ //校验数据
|
|
|
|
+ if(step==null || details==null || details.size()<1){
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ //转换成顶点id
|
|
|
|
+ String point=null;
|
|
|
|
+ switch (step){
|
|
|
|
+ case "进厂":
|
|
|
|
+ if(details.get("entryGatepostId")!=null)
|
|
|
|
+ point=mapVertexMapper.getVertexIdByGatePostId(details.get("entryGatepostId").toString());
|
|
|
|
+ break;
|
|
|
|
+ case "计皮":
|
|
|
|
+ if(details.get("tareCalculateId")!=null)
|
|
|
|
+ point=mapVertexMapper.getVertexIdByCalculateId(details.get("tareCalculateId").toString());
|
|
|
|
+ break;
|
|
|
|
+ case "装货":
|
|
|
|
+ if(details.get("loadingID")!=null)
|
|
|
|
+ point=mapVertexMapper.getVertexIdByWarehouseId(details.get("loadingID").toString());
|
|
|
|
+ break;
|
|
|
|
+ case "卸货":
|
|
|
|
+ if(details.get("unloadWarhouseId")!=null)
|
|
|
|
+ point=mapVertexMapper.getVertexIdByWarehouseId(details.get("unloadWarhouseId").toString());
|
|
|
|
+ break;
|
|
|
|
+ case "计毛":
|
|
|
|
+ if(details.get("grossPlaceId")!=null)
|
|
|
|
+ point=mapVertexMapper.getVertexIdByCalculateId(details.get("grossPlaceId").toString());
|
|
|
|
+ break;
|
|
|
|
+ case "出厂":
|
|
|
|
+ if(details.get("leaveGatepostId")!=null)
|
|
|
|
+ point=mapVertexMapper.getVertexIdByGatePostId(details.get("leaveGatepostId").toString());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ return point;
|
|
|
|
+ }
|
|
}
|
|
}
|