From 90a9b7d4430cf06f5cced203fb770444dd608bd8 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期二, 04 三月 2025 14:03:40 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 94 ++++++++++++++++++++++++++++++++++++++--------
1 files changed, 77 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 e590600..fa18b85 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -11,9 +11,12 @@
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;
@@ -52,6 +55,8 @@
private BasCircularShuttleService basCircularShuttleService;
@Autowired
private WrkMastService wrkMastService;
+ @Autowired
+ private CommonService commonService;
@Value("${constant-parameters.perimeter}")
private Long perimeter;
@@ -63,12 +68,23 @@
private Long rgvCount;
@Value("${constant-parameters.rgvDate}")
private Double rgvDate;
+ @Value("${wms.url}")
+ private String wmsUrl;
+ @Value("${wms.reportOutPath}")
+ private String wmsOutPath;
+ @Value("${wms.reportSwitch}")
+ private boolean reportSwitch;
+ @Value("${wms.reportSwitchAuto}")
+ private boolean reportSwitchAuto;
/*
* 楠岃瘉璁稿彲璇佹槸鍚︽湁鏁�
* */
public synchronized boolean licenseVerify() {
try{
+// if (true) {
+// return true;
+// }
return new LicenseVerify().verify();
} catch (Exception e){
log.info("璁稿彲璇侀獙璇佸け璐ワ紒锛佸紓甯革細{}",e.getMessage());
@@ -121,7 +137,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;
}
@@ -161,6 +177,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) {
@@ -271,6 +291,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) {
@@ -287,21 +310,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();
@@ -371,7 +393,45 @@
break;
}
wrkMast.setWrkSts(3L);
- wrkMast.setAppeTime(new Date());
+ Date now = new Date();
+ wrkMast.setAppeTime(now);
+ try{
+ try{
+ if (reportSwitch){
+ RgvTaskReportingParam rgvTaskReportingParam = new RgvTaskReportingParam(wrkMast);
+ ReturnT<String> result = new PostMesDataUtils().postMesDataWcs(wmsUrl, wmsOutPath, rgvTaskReportingParam);
+ if (result.getCode()==200){
+ wrkMast.setWrkSts(4L);
+ wrkMast.setAppeTime(now);
+ wrkMastService.updateById(wrkMast);
+ continue;
+ }else {
+ log.error("宸ヤ綔鍙�"+wrkMast.getWrkNo()+"浠诲姟瀹屾垚淇℃伅涓婁紶澶勭悊澶辫触");
+ }
+ } else {
+ //娴嬭瘯鐢�
+ wrkMast.setWrkSts(4L);
+ wrkMast.setAppeTime(now);
+ wrkMastService.updateById(wrkMast);
+ if (reportSwitchAuto) {
+ WrkMast wrkMast1 = new WrkMast();
+ int workNo = commonService.getWorkNo(0);
+ wrkMast1.setWrkNo((long) workNo);
+ wrkMast1.setSourceStaNo(wrkMast.getSourceNoCs());
+ wrkMast1.setStaNo(wrkMast.getStaNoCs());
+ 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