Browse Source

优化代码

wuhb 1 week ago
parent
commit
217073bcc8

+ 4 - 4
mes/ktg-admin/src/main/resources/application-syl.yml

@@ -1,6 +1,6 @@
 server:
     # 服务器的HTTP端口,默认为8080
-    port: 8905
+    port: 83
 
 # 数据源配置
 spring:
@@ -11,7 +11,7 @@ spring:
             # 主库数据源
             master:
 #                url: jdbc:mysql://localhost:3306/ygtx_emcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-                url: jdbc:mysql://127.0.0.1:3306/ygtx_emcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                url: jdbc:mysql://127.0.0.1:3306/ygtx_syl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                 #url: jdbc:mysql://118.195.146.34:3306/j2eedb?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
                 username: root
                 password: ygtx@365
@@ -71,11 +71,11 @@ spring:
         host: 127.0.0.1
         #host: 192.168.1.86
         # 端口,默认为6379
-        port: 6379
+        port: 2037
         # 数据库索引
         database: 0
         # 密码
-        password:
+        password: 6*7Uprrt0$#llAC90FDDA233F;PPkk
         # 连接超时时间
         timeout: 10s
         lettuce:

+ 16 - 0
mes/ktg-mes/src/main/java/com/ktg/mes/rms/service/impl/RmsTaskPoolServiceImpl.java

@@ -852,10 +852,26 @@ public class RmsTaskPoolServiceImpl implements IRmsTaskPoolService
                 if(deviceType.equals(item.getDeviceType())){
                     liftList.add(DeviceTypeEnum.ROLLERAGV.getKey());
                 }
+                deviceType = String.valueOf(DeviceTypeEnum.LIFTAGV.getValue());
+                if(deviceType.equals(item.getDeviceType())){
+                    liftList.add(DeviceTypeEnum.LIFTAGV.getKey());
+                }
+                deviceType = String.valueOf(DeviceTypeEnum.RAILAGV.getValue());
+                if(deviceType.equals(item.getDeviceType())){
+                    liftList.add(DeviceTypeEnum.RAILAGV.getKey());
+                }
+                deviceType = String.valueOf(DeviceTypeEnum.LATENTAGV.getValue());
+                if(deviceType.equals(item.getDeviceType())){
+                    liftList.add(DeviceTypeEnum.LATENTAGV.getKey());
+                }
                 deviceType = String.valueOf(DeviceTypeEnum.ROLLER.getValue());
                 if(deviceType.equals(item.getDeviceType())){
                     liftList.add(item.getLiftCode());
                 }
+                deviceType = String.valueOf(DeviceTypeEnum.PICKPLAT.getValue());
+                if(deviceType.equals(item.getDeviceType())){
+                    liftList.add(DeviceTypeEnum.PICKPLAT.getKey());
+                }
             });
         }
         return liftList;

+ 12 - 33
mes/ktg-mes/src/main/java/com/ktg/mes/rms/task/ApiStockTask.java

@@ -49,7 +49,6 @@ public class ApiStockTask {
     public static List<AgvThread> runAgvThread = new CopyOnWriteArrayList<>();
     public static List<RailAgvThread> runRailAgvThread = new CopyOnWriteArrayList<>();
     public static Map<String, RollerThread> runRollerThread = new ConcurrentHashMap<>();
-    public static volatile boolean isStop = false;
     public static Map<String, LiftPlcHelper>  liftPlcHelpTask = new ConcurrentHashMap<>();
     public static Map<String, RmsTaskPool> lastLiftTask = new ConcurrentHashMap<>();
     public static Map<Long, Long> waitTaskTime = new ConcurrentHashMap<>();
@@ -80,7 +79,6 @@ public class ApiStockTask {
 
     private boolean isLock = false;
     private int checkLiftStatus = 1;
-    private int stopWaitNum = 1;
     private String erpSysOpen;
 
     @PostConstruct
@@ -195,9 +193,6 @@ public class ApiStockTask {
                         }
                     }
                 }
-                if(isStop){
-                    throw new Exception(rmsTaskPool.getTaskName() + "任务锁定");
-                }
             }catch (Exception ex){
                 log.error("AGV任务异常:" + ex.getMessage());
                 String msg = "AGV任务异常:" + ex.getMessage();
@@ -304,9 +299,6 @@ public class ApiStockTask {
                         }
                     }
                 }
-                if(isStop){
-                    throw new Exception(rmsTaskPool.getTaskName() + "任务锁定");
-                }
             }catch (Exception ex){
                 log.error("轨道AGV任务异常:" + ex.getMessage());
                 String msg = "轨道AGV任务异常:" + ex.getMessage();
@@ -556,9 +548,6 @@ public class ApiStockTask {
                 }
 //=========================debug================
 
-                if(isStop){
-                    throw new Exception(taskPool.getTaskName() + "任务锁定");
-                }
             }catch (Exception e){
                 log.error("轨道车执行:" + e.getMessage());
                 String msg = "轨道车执行异常:" + e.getMessage();
@@ -971,37 +960,27 @@ public class ApiStockTask {
     private boolean checkLockTaskPool(RmsTaskPool pool){
         List<String> groupCodeList = apiCache.getOrSetRedis(ApiCache.ERROR_POOL, null, 0);
         for(String groupCode:groupCodeList){
-            List<String> errorLiftList = rmsTaskPoolService.getGroupDevice(groupCode);
-            if(errorLiftList.contains(pool.getLiftCode())){
+            List<String> errorDeviceList = rmsTaskPoolService.getGroupDevice(groupCode);
+            if(errorDeviceList.contains(pool.getLiftCode())){
                 return false;
             }
-            if(errorLiftList.contains(DeviceTypeEnum.ROLLERAGV.getKey())
-                && pool.getDeviceType().equals(String.valueOf(DeviceTypeEnum.ROLLERAGV.getValue()))){
-                return false;
+            for(DeviceTypeEnum type : DeviceTypeEnum.values()){
+                if(errorDeviceList.contains(type.getKey())
+                    && pool.getDeviceType().equals(String.valueOf(type.getValue()))){
+                    return false;
+                }
             }
         }
-        if(groupCodeList.size() == 0){
-            isStop = false;
-        }
         return true;
     }
 
     private int checkErrorTaskPool(RmsTaskPool taskPool, Queue<RmsTaskPool> queue) throws InterruptedException {
-        if(isStop){
-            log.info("锁定状态,需要手动处理");
-            boolean rs = checkLockTaskPool(taskPool);
-            if(!rs){
-                stopWaitNum = 1;
-                rmsWebSocketServer.sendToUI("lift",DateUtils.getTime() + " "+"异常中,等待处理!");
-                log.info(taskPool.getTaskId() + "锁定");
-            }else{
-                stopWaitNum++;
-            }
-            if(stopWaitNum < 10){
-                return 2;
-            }
+        boolean rs = checkLockTaskPool(taskPool);
+        if(!rs){
+            rmsWebSocketServer.sendToUI("lift",DateUtils.getTime() + " "+"异常中,等待处理!");
+            log.info(taskPool.getTaskId() + " 所属设备异常中,等待处理");
+            return 2;
         }
-        stopWaitNum = 1;
         return checkTaskPool(taskPool, queue);
     }
 

+ 0 - 1
mes/ktg-mes/src/main/java/com/ktg/mes/rms/thread/BaseThread.java

@@ -46,7 +46,6 @@ public class BaseThread extends Thread{
 
     public void updateLog(RmsTaskPool rmsTaskPool, String remark){
         log.info("添加异常:" + rmsTaskPool.getGroupCode());
-        ApiStockTask.isStop = true;
         String logRemark = remark;
         DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
         definition.setPropagationBehaviorName("PROPAGATION_REQUIRED");