From 4f22e4508f5597fc689708dc96ea99accc357375 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期日, 02 三月 2025 09:06:13 +0800
Subject: [PATCH] *

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  104 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 87 insertions(+), 17 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 0838cc0..d451a62 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1,14 +1,23 @@
 package com.zy.asrs.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.common.Cools;
+import com.core.common.R;
+import com.core.exception.CoolException;
 import com.zy.asrs.entity.*;
 import com.zy.asrs.service.BasCircularShuttleService;
 import com.zy.asrs.service.BasDevpPositionService;
 import com.zy.asrs.service.WrkMastService;
+import com.zy.asrs.task.core.ReturnT;
+import com.zy.asrs.task.escalationParam.RgvTaskReportingParam;
+import com.zy.asrs.utils.PostMesDataUtils;
 import com.zy.asrs.utils.SortTheExecutionOfTheCarUtil;
 import com.zy.asrs.utils.TimeCalculatorUtils;
+import com.zy.common.CodeRes;
+import com.zy.common.service.CommonService;
+import com.zy.common.utils.HttpHandler;
 import com.zy.core.cache.MessageQueue;
 import com.zy.core.cache.SlaveConnection;
 import com.zy.core.enums.*;
@@ -18,6 +27,7 @@
 import com.zy.core.model.protocol.RgvProtocol;
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.RgvThread;
+import com.zy.system.entity.license.LicenseVerify;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -45,6 +55,8 @@
     private BasCircularShuttleService basCircularShuttleService;
     @Autowired
     private WrkMastService wrkMastService;
+    @Autowired
+    private CommonService commonService;
 
     @Value("${constant-parameters.perimeter}")
     private Long perimeter;
@@ -56,6 +68,22 @@
     private Long rgvCount;
     @Value("${constant-parameters.rgvDate}")
     private Double rgvDate;
+
+    /*
+    * 楠岃瘉璁稿彲璇佹槸鍚︽湁鏁�
+    * */
+    public synchronized boolean licenseVerify() {
+        try{
+//            if (true) {
+//                return true;
+//            }
+            return new LicenseVerify().verify();
+        } catch (Exception e){
+            log.info("璁稿彲璇侀獙璇佸け璐ワ紒锛佸紓甯革細{}",e.getMessage());
+        }
+        return false;
+    }
+
 
     /**
      * 绔欑偣浠诲姟妫�娴�  鏇存柊灏忚溅浣嶇疆淇℃伅
@@ -101,7 +129,7 @@
                 log.info("鏇存柊灏忚溅鎺掑簭淇℃伅寮傚父={}", rgvNo);
                 return;
             }
-            List<BasCircularShuttle> basCircularShuttleList = basCircularShuttleService.selectList(new EntityWrapper<BasCircularShuttle>().orderBy("rgv_id", true));
+            List<BasCircularShuttle> basCircularShuttleList = basCircularShuttleService.selectList(new EntityWrapper<BasCircularShuttle>().eq("status", 0).orderBy("rgv_id", true));
             if (basCircularShuttleList.get(0).getRgvNo().equals(rgvNo)) {
                 return;
             }
@@ -141,6 +169,10 @@
             Integer rgvNo = 0;
             List<BasCircularShuttle> basCircularShuttleList = basCircularShuttleService.selectList(new EntityWrapper<BasCircularShuttle>().orderBy("rgv_id", true));
             for (BasCircularShuttle basCircularShuttle : basCircularShuttleList) {
+                if (basCircularShuttle.getStatus() != 0){
+                    sign = true;
+                    continue;
+                }
                 RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, basCircularShuttle.getRgvNo());
                 RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
                 if (rgvProtocol == null) {
@@ -251,6 +283,9 @@
                         break runRgv;
                     }
                     BasCircularShuttle basCircularShuttle = basCircularShuttleService.selectOne(new EntityWrapper<BasCircularShuttle>().eq("rgv_id", rgvId));
+                    if (basCircularShuttle.getStatus() != 0){
+                        continue ;
+                    }
                     RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, basCircularShuttle.getRgvNo());
                     RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
                     if (rgvProtocol == null) {
@@ -267,21 +302,20 @@
                             && rgvProtocol.getTaskNo1() == 0
                             && rgvProtocol.getAlarm() == 0) {
                         if (rgvProtocol.getStatusType() == RgvStatusType.ROAM) {
-//                            double finalVelocity = 0.0;     // 鏈�缁堥�熷害 (m/s)
-//                            double distance = (Math.pow(finalVelocity, 2) - Math.pow(rgvProtocol.instantaneousSpeed / 60, 2)) / (2 * acceleration);
-//                            BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("dev_no", wrkMast.getSourceStaNo()));
-//                            if (distance * proportion > ((SortTheExecutionOfTheCarUtil.LatelyAndLessThan(basDevpPosition.getPlcPosition(), rgvProtocol.getRgvPos(), perimeter) + (rgvProtocol.instantaneousSpeed / 60) * proportion * rgvDate))) {
-//                                continue;
-//                            }
-                            List<BasDevpPosition> basDevpPositions = basDevpPositionService.selectList(new EntityWrapper<BasDevpPosition>().orderBy("plc_position", true));
-                            if (basDevpPositions.isEmpty()) {
-                                log.error("鑾峰彇鎵�鏈夌珯鐐逛俊鎭紓甯�,RGV浠诲姟涓嬪彂澶辫触锛岃鑱旂郴绠$悊鍛橈紒锛侊紒");
-                                break runRgv;
-                            }
-                            List<Integer> devpList = SortTheExecutionOfTheCarUtil.BasDevpPositionExtractSites(basDevpPositions);
-
-                            if (!SortTheExecutionOfTheCarUtil.calculateShortestDistanceDirection(devpList,rgvProtocol.getEndStaM(),wrkMast.getSourceStaNo())){
-                                continue;
+                            double finalVelocity = 0.0;     // 鏈�缁堥�熷害 (m/s)
+                            double distance = (Math.pow(finalVelocity, 2) - Math.pow(rgvProtocol.instantaneousSpeed / 60, 2)) / (2 * acceleration);
+                            BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("dev_no", wrkMast.getSourceStaNo()));
+                            if ((distance * proportion + (rgvProtocol.instantaneousSpeed / 60) * proportion * rgvDate) > (SortTheExecutionOfTheCarUtil.LatelyAndLessThan(basDevpPosition.getPlcPosition(), rgvProtocol.getRgvPos(), perimeter) )) {
+//                                List<BasDevpPosition> basDevpPositions = basDevpPositionService.selectList(new EntityWrapper<BasDevpPosition>().orderBy("plc_position", true));
+//                                if (basDevpPositions.isEmpty()) {
+//                                    log.error("鑾峰彇鎵�鏈夌珯鐐逛俊鎭紓甯�,RGV浠诲姟涓嬪彂澶辫触锛岃鑱旂郴绠$悊鍛橈紒锛侊紒");
+//                                    break runRgv;
+//                                }
+//                                List<Integer> devpList = SortTheExecutionOfTheCarUtil.BasDevpPositionExtractSites(basDevpPositions);
+//
+//                                if (!SortTheExecutionOfTheCarUtil.calculateShortestDistanceDirection(devpList,rgvProtocol.getEndStaM(),wrkMast.getSourceStaNo())){
+                                    continue;
+//                                }
                             }
                         }
                         RgvCommand rgvCommand = new RgvCommand();
@@ -351,7 +385,43 @@
                         break;
                     }
                     wrkMast.setWrkSts(3L);
-                    wrkMast.setAppeTime(new Date());
+                    Date now = new Date();
+                    wrkMast.setAppeTime(now);
+                    try{
+                        try{
+                            if (true){
+                                RgvTaskReportingParam rgvTaskReportingParam = new RgvTaskReportingParam(wrkMast);
+                                ReturnT<String> result = new PostMesDataUtils().postMesDataWcs("", "", rgvTaskReportingParam);
+                                if (result.getCode()==200){
+                                    wrkMast.setWrkSts(4L);
+                                    wrkMast.setAppeTime(now);
+                                    wrkMastService.updateById(wrkMast);
+                                    continue;
+                                }else {
+                                    log.error("宸ヤ綔鍙�"+wrkMast.getWrkNo()+"浠诲姟瀹屾垚淇℃伅涓婁紶澶勭悊澶辫触");
+                                }
+                            } else {
+                                //娴嬭瘯鐢�
+                                wrkMast.setWrkSts(5L);
+                                wrkMast.setAppeTime(now);
+                                wrkMastService.updateById(wrkMast);
+                                WrkMast wrkMast1 = new WrkMast();
+                                int workNo = commonService.getWorkNo(0);
+                                wrkMast1.setWrkNo((long) workNo);
+                                wrkMast1.setSourceStaNo(wrkMast.getStaNoCs());
+                                wrkMast1.setStaNo(wrkMast.getSourceNoCs());
+                                wrkMast1.setWrkSts(1L);
+                                wrkMast1.setIoType(1);
+                                wrkMast1.setModiTime(now);
+                                wrkMast1.setAppeTime(now);
+                                wrkMast1.setMemo("娴嬭瘯鏁版嵁");
+                                wrkMastService.insert(wrkMast1);
+                                continue;
+                            }
+                        } catch (Exception e){
+                            log.error("宸ヤ綔鍙�"+wrkMast.getWrkNo()+"浠诲姟瀹屾垚淇℃伅涓婁紶澶勭悊澶辫触锛屽紓甯镐俊鎭細"+e);
+                        }
+                    } catch (Exception e){}
                     wrkMastService.updateById(wrkMast);
                 }
             }

--
Gitblit v1.9.1