Tiroble 3 tahun lalu
induk
melakukan
011ff5883b

+ 40 - 12
src/main/java/com/steerinfo/dil/controller/OffSiteTransportationController.java

@@ -96,12 +96,19 @@ public class OffSiteTransportationController extends BaseRESTfulController {
     }
     @ApiOperation("全路径查询")
     @PostMapping("/fullPath")
-    public Object fullPath(String orderNumber) throws Exception {
+    public RESTfulResult fullPath(String orderNumber) throws Exception {
         //运输订单号:orderNumber、车牌号:capacityNumber、出厂时间:resultOutGateTime、预警开关:turnOf、发货地址:shipperName、收货地址:receiveAddress
         //初始化请求参数
-        HashMap<String,Object> mapValue=new HashMap<>();
-        mapValue.put("orderNumber",orderNumber);
-        return routeService.fullPathVisualization(mapValue);
+        //判断是否自提
+        int count = offSiteTransportationService.isSelfMentionByOrderNumber(orderNumber);
+        if (count==0){
+            HashMap<String,Object> mapValue=new HashMap<>();
+            mapValue.put("orderNumber",orderNumber);
+            return success(routeService.fullPathVisualization(mapValue).get());
+        }else {
+            return failed("-1");
+        }
+
     }
 
     @ApiOperation("查询在途运输")
@@ -465,11 +472,18 @@ public class OffSiteTransportationController extends BaseRESTfulController {
             @ApiImplicitParam(name = "mapValue", value = "查询条件", required = false, dataType = "HashMap")
     })
     @PostMapping("/fullPathVisualizationByCarNumber")
-    public RouteVo fullPathVisualizationByCarNumber(@RequestBody HashMap mapValue) throws Exception {
+    public RESTfulResult fullPathVisualizationByCarNumber(@RequestBody HashMap mapValue) throws Exception {
 
-        CompletableFuture<RouteVo> createOrder =routeService.fullPathVisualizationByCarNumber(mapValue);
+        //判断是否自提
+        int count = offSiteTransportationService.isSelfMention(mapValue.get("capacityNumber").toString());
+        if (count==0){
+            CompletableFuture<RouteVo> createOrder =routeService.fullPathVisualizationByCarNumber(mapValue);
+
+            return  success(createOrder.get());
+        }else {
+            return failed(-1);
+        }
 
-        return createOrder.get();
     }
 
     @ApiOperation(value="展示抵达实绩信息")
@@ -498,19 +512,33 @@ public class OffSiteTransportationController extends BaseRESTfulController {
     }
     @PostMapping("/createTotalResult")
     public RESTfulResult createTotalResult(@RequestBody(required=true) Map<String, Object> mapValue) throws Exception {
-        CompletableFuture<String> totalResult = routeService.createTotalResult(mapValue);
-        return success(totalResult);
+
+        //判断是否自提
+        int count = offSiteTransportationService.isSelfMention(mapValue.get("capacityNumber").toString());
+        if (count==0){
+            CompletableFuture<String> totalResult = routeService.createTotalResult(mapValue);
+            return success(totalResult);
+        }else {
+            return failed(-1);
+        }
     }
     @GetMapping("/getCurrentLocation")
     public RESTfulResult getCurrentLocation(@RequestParam("capcityNumber") String capcityNumber) throws Exception {
-        CurrentLocationResult currentLocationResult= routeService.getCurrentLocation(capcityNumber);
-        return success(currentLocationResult);
+        //判断是否自提
+        int count = offSiteTransportationService.isSelfMention(capcityNumber);
+        if (count==0){
+            CurrentLocationResult currentLocationResult= routeService.getCurrentLocation(capcityNumber);
+            return success(currentLocationResult);
+        }else {
+            return failed(-1);
+        }
+
 
     }
     //在途订单列表
     @PostMapping("/transportationPerformance")
     public RESTfulResult transportationPerformance(@RequestBody Map<String,Object> mapValue,
-                                                   @RequestParam(required = true,defaultValue = "468",name = "apiId")Integer apiId,
+                                                   @RequestParam(required = true,defaultValue = "479",name = "apiId")Integer apiId,
                                                    @RequestParam(required = false,name = "pageNum")Integer pageNum,
                                                    @RequestParam(required = false,name = "pageSize")Integer pageSize){
         if(mapValue.containsKey("startTime")&&mapValue.containsKey("endTime")){

+ 4 - 0
src/main/java/com/steerinfo/dil/mapper/OffSiteTransportationMapper.java

@@ -40,4 +40,8 @@ public interface OffSiteTransportationMapper {
     List<Map<String, Object>> getTransportAbnormalInfo(Map<String, Object> mapValue);
 
     List<Map<String, Object>> transportationPerformance(Map<String, Object> mapValue);
+
+    int selectIsSelfMention(String capcityNumber);
+
+    int isSelfMentionByOrderNumber(String orderNumber);
 }

+ 4 - 0
src/main/java/com/steerinfo/dil/service/OffSiteTransportationService.java

@@ -33,4 +33,8 @@ public interface OffSiteTransportationService {
     List<Map<String, Object>> getTransportAbnormalInfo(Map<String, Object> mapValue);
 
     List<Map<String, Object>> transportationPerformance(Map<String, Object> mapValue);
+
+    int isSelfMention(String capcityNumber);
+
+    int isSelfMentionByOrderNumber(String orderNumber);
 }

+ 10 - 0
src/main/java/com/steerinfo/dil/service/impl/OffSiteTransportationServiceImpl.java

@@ -158,6 +158,16 @@ public class OffSiteTransportationServiceImpl implements OffSiteTransportationSe
         return offSiteTransportationMapper.transportationPerformance(mapValue);
     }
 
+    @Override
+    public int isSelfMention(String capcityNumber) {
+        return offSiteTransportationMapper.selectIsSelfMention(capcityNumber);
+    }
+
+    @Override
+    public int isSelfMentionByOrderNumber(String orderNumber) {
+        return offSiteTransportationMapper.isSelfMentionByOrderNumber(orderNumber);
+    }
+
 
     public synchronized int addTransportationAlarm(TmstruckAbnormalResult tmstruckAbnormalResult,String tripId) {
         long id;

+ 1 - 1
src/main/java/com/steerinfo/inPlantNavigation/service/impl/IPMMSVertexEdgeServiceImpl.java

@@ -263,7 +263,7 @@ public class IPMMSVertexEdgeServiceImpl implements IIPMMSVertexEdgeService {
 
         IPMMSVertexEdge ipmmsVertexList0Edge20=new IPMMSVertexEdge();
         ipmmsVertexList0Edge20.setVertexEdgeID(new BigDecimal(20));
-        ipmmsVertexList0Edge20.setWeigh(1);
+        ipmmsVertexList0Edge20.setWeigh(150);
         ipmmsVertexList0Edge20.setOutVertexID(new BigDecimal(13));
         ipmmsVertexList0Edge20.setInVertexID(new BigDecimal(0));
         arrayList13.add(ipmmsVertexList0Edge20);

+ 28 - 10
src/main/java/com/steerinfo/inPlantNavigation/service/impl/IPMMSVertexServiceImpl.java

@@ -18,11 +18,11 @@ public class IPMMSVertexServiceImpl implements IIPMMSVertexService {
     @Override
     public ArrayList<IPMMSVertex> getObtainTheOptimalPath(String startpoint,String endPoint,Map<String, List<IPMMSVertexEdge>> vertexEdgeList, Map<String, IPMMSVertex> vertexList) throws VertexAngEdgeException {
         //初始化数据
-        int[] startPoin=new int[]{0,-1};
+        int[] startPoin=new int[]{0,-1,0};
         //创建S战队(放入的是已经遍历过边的顶点)
         List<String> obtainTheOptimalPath=new ArrayList();
         //obtainTheOptimalPath.add(statpoint);
-        //创建 dist[]  (起点到集合点中的最短路径) key:指向的点 new int[]{0,-1}; {权重、中间点}
+        //创建 dist[]  (起点到集合点中的最短路径) key:指向的点 new int[]{0,-1}; {累计权重、中间点、自己权重}
         HashMap<String,int[]> currentBestDinstance=new HashMap<>();
         currentBestDinstance.put(startpoint,startPoin);
         while (obtainTheOptimalPath.size()!=vertexList.size()){
@@ -36,9 +36,6 @@ public class IPMMSVertexServiceImpl implements IIPMMSVertexService {
             if (island(currentBestDinstance,stringMinimumValue,vertexEdgeList)){
                 continue;
             }
-            if (stringMinimumValue.equals("0")||stringMinimumValue.equals("13")){
-                System.out.println();
-            }
 
             //借东风
             List<IPMMSVertexEdge> ipmmsVertexEdges = vertexEdgeList.get(stringMinimumValue);
@@ -66,17 +63,37 @@ public class IPMMSVertexServiceImpl implements IIPMMSVertexService {
                 if(historyBestPaht==null){
                     int distance=starBestPath[0]+ipmmsVertexEdge.getWeigh();
                     int outVertex=outVertexID.intValue();
-                    int[] bestPath=new int[]{distance,outVertex};
+                    int[] bestPath=new int[]{distance,outVertex,ipmmsVertexEdge.getWeigh()};
                     currentBestDinstance.put(inVertexID.toString(),bestPath);
                 }else if ((starBestPath[0]+ipmmsVertexEdge.getWeigh())<historyBestPaht[0]){
                     //更新和此顶点有关的数据
+                    int distance=starBestPath[0]+ipmmsVertexEdge.getWeigh();
+                    int outVertex=outVertexID.intValue();
+                    int[] bestPath=new int[]{distance,outVertex,ipmmsVertexEdge.getWeigh()};
+                    currentBestDinstance.put(inVertexID.toString(),bestPath);
+                    ArrayList<String> updateList = new ArrayList<>();
+                    updateRelactionVertex(updateList, stringMinimumValue, currentBestDinstance);
                 }
             }
         }
-
-
+        if (!currentBestDinstance.containsKey(endPoint)){
+            throw new VertexAngEdgeException("没有该条路径,请检查是否缺少边!");
+        }
         return startPointToEndPointPaht(endPoint,currentBestDinstance,vertexList);
     }
+    //更新相关的值
+    public void updateRelactionVertex(List<String> result,String currentVertex,HashMap<String,int[]> currentBestDinstance){
+        Set<String> keys = currentBestDinstance.keySet();
+        for (String  key:  keys){
+            int[] value=currentBestDinstance.get(key);
+            if (value[1]==Integer.valueOf(currentVertex).intValue()){
+                value[0]=value[2]+currentBestDinstance.get(currentVertex)[0];
+                currentBestDinstance.put(key,value);
+                updateRelactionVertex(result,key,currentBestDinstance);
+            }
+        }
+
+    }
     //判断是否有进入这个顶点的边,如果没有这个顶点就是一个孤岛
     public Boolean island(HashMap<String,int[]> currentBestDinstance,String stringMinimumValue,Map<String, List<IPMMSVertexEdge>> vertexEdgeList){
         if(!currentBestDinstance.containsKey(stringMinimumValue)){
@@ -91,10 +108,10 @@ public class IPMMSVertexServiceImpl implements IIPMMSVertexService {
         }
         return false;
     }
-    //通过所有最优解集合选择我们要的
+    //通过所有最优解集合选择我们要的路径
     public ArrayList<IPMMSVertex> startPointToEndPointPaht(String point,HashMap<String,int[]> currentBestDinstance,Map<String, IPMMSVertex> vertexList){
         ArrayList<IPMMSVertex> obtainOptimalPath=new ArrayList();
-        int beforeDistance=100;
+        int beforeDistance=0;
         do {
             int[] ints = currentBestDinstance.get(point);
             beforeDistance=ints[1];
@@ -105,6 +122,7 @@ public class IPMMSVertexServiceImpl implements IIPMMSVertexService {
         return obtainOptimalPath;
     }
 
+    //获得目前最短距离
     public String getStringMinimumValue(HashMap<String,int[]> currentBestDinstance,List<String> obtainTheOptimalPath){
 
         HashMap<String,int[]> bestDinstance = (HashMap<String, int[]>) SerializationUtils.clone(currentBestDinstance);

+ 0 - 2
src/main/resources/application-prod.yml

@@ -18,8 +18,6 @@ spring:
       time-to-live: 300000
       cache-null-values: true
 piction:
-  # path: /usr/share/nginx/html/image
-  #  path: /test/data/nginx/html/image
   #path: C:\Users\24390\Desktop\work\a
   path: /shared
 #feign设置

+ 23 - 4
src/main/resources/com/steerinfo/dil/mapper/OffSiteTransportationMapper.xml

@@ -611,11 +611,12 @@
         TAR.RESULT_ARRIVAL_ADDRESS "resultArrivalAddress",--抵达收货点的地址
         TLFR.RESULT_OUT_GATE_TIME    "resultOutGateTime",--出厂时间
         TAR.INSERT_TIME "arrivalTime",--抵达作业时间
-        TRR.INSERT_TIME "recepitTime"--签收作业时间
+        TRR.INSERT_TIME "recepitTime",--签收作业时间
     
---         CEIL((TRR.INSERT_TIME-TAR.INSERT_TIME) * 24  ) "unloadingWaitingTime",
---
---         CEIL((TAR.INSERT_TIME  - TLFR.RESULT_OUT_GATE_TIME) * 24  ) "transportationTime"
+        to_char(to_timestamp(to_char(TRR.INSERT_TIME,'yyyy-MM-dd HH24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')-to_timestamp(to_char(TAR.INSERT_TIME,'yyyy-MM-dd HH24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')) "unloadingWaitingTime",
+    
+        to_char(to_timestamp(to_char(TAR.INSERT_TIME,'yyyy-MM-dd HH24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')-to_timestamp(to_char(TLFR.RESULT_OUT_GATE_TIME,'yyyy-MM-dd HH24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')) "transportationTime"
+
     
         from OMSTRUCK_ORDER OO --运输订单
         left join AMS_SALE_ORDER_MATERIAL ASOM --销售订单物质表
@@ -797,6 +798,24 @@
         </where>
         <include refid="orderBy"></include>
     </select>
+    <select id="selectIsSelfMention" resultType="java.lang.Integer">
+        select count(*) from RMS_CAPACITY RC
+        left join OMSTRUCK_ORDER OO
+        on  RC.CAPACITY_ID=OO.CAPACITY_ID
+        left join AMS_SALE_ORDER_MATERIAL ASOM
+        on OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        left join AMS_SALE_ORDER ASO
+        on ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        where OO.ORDER_TYPE in (1) and ASO.Sale_Order_Isself_Mention='是' and  RC.CAPACITY_NUMBER = #{capcityNumber}
+    </select>
+    <select id="isSelfMentionByOrderNumber" resultType="java.lang.Integer">
+        select count(*) from OMSTRUCK_ORDER OO
+        left join AMS_SALE_ORDER_MATERIAL ASOM
+        on OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        left join AMS_SALE_ORDER ASO
+        on ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        where OO.ORDER_TYPE in (1) and ASO.Sale_Order_Isself_Mention='是' and  OO.ORDER_NUMBER =#{orderNumber}
+    </select>
     <sql id="orderBy">
         <if test="orderField != null and orderField != ''">
             order by  "${orderField}"