From e1b28ee09836787555448083bf9a6b59477ad330 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期六, 21 九月 2024 08:18:58 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java | 164 +++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 123 insertions(+), 41 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
index 43aae13..d017869 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -1,28 +1,22 @@
package com.zy.asrs.wcs.core.kernel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.wcs.core.domain.dto.MotionDto;
-import com.zy.asrs.wcs.core.entity.BasConveyorPath;
-import com.zy.asrs.wcs.core.entity.ShuttleStandby;
-import com.zy.asrs.wcs.core.entity.Task;
+import com.zy.asrs.wcs.core.entity.*;
import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
import com.zy.asrs.wcs.core.model.enums.MotionCtgType;
+import com.zy.asrs.wcs.core.model.enums.TaskCtgType;
import com.zy.asrs.wcs.core.model.enums.TaskStsType;
-import com.zy.asrs.wcs.core.service.BasConveyorPathService;
-import com.zy.asrs.wcs.core.service.ShuttleStandbyService;
-import com.zy.asrs.wcs.core.service.TaskService;
+import com.zy.asrs.wcs.core.service.*;
import com.zy.asrs.wcs.core.utils.ConveyorDispatcher;
import com.zy.asrs.wcs.core.utils.LiftDispatcher;
import com.zy.asrs.wcs.core.utils.ShuttleDispatcher;
import com.zy.asrs.wcs.core.utils.Utils;
import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
-import com.zy.asrs.wcs.core.entity.Motion;
import com.zy.asrs.wcs.rcs.entity.Device;
import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol;
import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
-import com.zy.asrs.wcs.core.service.MotionService;
import com.zy.asrs.wcs.rcs.service.DeviceService;
import com.zy.asrs.wcs.rcs.thread.LiftThread;
import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
@@ -57,6 +51,8 @@
private ShuttleStandbyService shuttleStandbyService;
@Autowired
private BasConveyorPathService basConveyorPathService;
+ @Autowired
+ private TaskCtgService taskCtgService;
public List<Motion> generateMotion(Task task) {
List<Motion> motionList = new ArrayList<>();
@@ -119,13 +115,6 @@
return motionList;
}
- //妫�娴嬫彁鍗囨満鏄惁鏈変换鍔$粦瀹�
- boolean liftResult = Utils.checkLiftHasBinding(Integer.parseInt(transferLiftDevice.getDeviceNo()));
- if (liftResult) {
- //瀛樺湪浠诲姟锛岀姝㈣В鏋�
- return motionList;
- }
-
//鑾峰彇灏忚溅寰呮満搴撲綅 ==> 杩涙彁鍗囨満
ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
.eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
@@ -167,6 +156,7 @@
dto.setLiftNo(transferLiftDevice.getId().intValue());
dto.setLev(Utils.getLev(task.getDestLoc()));
dto.setStaNo(0);//鎻愬崌鏈哄唴渚�
+ dto.setSync(0);//寮傛鎵ц
}))
));
@@ -178,7 +168,6 @@
})),
MotionDto.build((dto -> {
dto.setShuttleNo(shuttleDevice.getId().intValue());
- dto.setLiftNo(transferLiftDevice.getId().intValue());
dto.setLocNo(standbyLocNoTo);
})),
MotionCtgType.SHUTTLE_MOVE
@@ -234,6 +223,7 @@
null
, MotionDto.build((dto -> {
dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
}))
));
@@ -383,6 +373,7 @@
null
, MotionDto.build((dto -> {
dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
}))
));
@@ -459,13 +450,6 @@
return motionList;
}
- //妫�娴嬫彁鍗囨満鏄惁鏈変换鍔$粦瀹�
- boolean liftResult = Utils.checkLiftHasBinding(Integer.parseInt(transferLiftDevice.getDeviceNo()));
- if (liftResult) {
- //瀛樺湪浠诲姟锛岀姝㈣В鏋�
- return motionList;
- }
-
//鑾峰彇灏忚溅寰呮満搴撲綅 ==> 杩涙彁鍗囨満
ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
.eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
@@ -496,10 +480,18 @@
//绌挎杞﹀嚭鎻愬崌鏈哄悗灏忚溅寰呮満浣�
String shuttleFromLiftStandbyLoc = shuttleStandbyFrom.getStandbyLoc();
+ //鑾峰彇鍑哄簱浠诲姟绫诲瀷
+ TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>()
+ .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.OUT))
+ .eq(TaskCtg::getStatus, 1));
+ if (taskCtg == null) {
+ return motionList;
+ }
//鑾峰彇杈撻�佺嚎璺緞
BasConveyorPath basConveyorPath = basConveyorPathService.getOne(new LambdaQueryWrapper<BasConveyorPath>()
.eq(BasConveyorPath::getDeviceStn, task.getOriginSite())
- .eq(BasConveyorPath::getDeviceNo, liftProtocol.getLiftNo()));
+ .eq(BasConveyorPath::getDeviceNo, liftProtocol.getLiftNo())
+ .eq(BasConveyorPath::getTypeNo, taskCtg.getId()));
if (basConveyorPath == null) {
return motionList;
}
@@ -628,6 +620,8 @@
dto.setLiftNo(transferLiftDevice.getId().intValue());
dto.setLev(5);//绱㈢墝椤圭洰5灞傛槸杈撻�佺嚎灞�
dto.setStaNo(1);//鎻愬崌鏈哄乏渚�
+ dto.setSync(0);//寮傛鎵ц
+ dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
}))
));
@@ -773,6 +767,7 @@
null
, MotionDto.build((dto -> {
dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
}))
));
@@ -808,17 +803,17 @@
MotionDto.build((dto -> {
dto.setShuttleNo(shuttleDevice.getId().intValue());
dto.setLiftNo(transferLiftDevice.getId().intValue());
- dto.setLocNo(standbyLocNoTo);
+ dto.setLocNo(standbyLocNoFrom);
})),
MotionCtgType.SHUTTLE_MOVE
));
- // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
+ // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌鐩爣灞�
motionList.addAll(kernelService.liftMove(
null
, MotionDto.build((dto -> {
dto.setLiftNo(transferLiftDevice.getId().intValue());
- dto.setLev(Utils.getLev(shuttleLocNo));
+ dto.setLev(Utils.getLev(originLoc));
}))
));
@@ -834,12 +829,12 @@
motionList.addAll(kernelService.shuttleMove(
MotionDto.build((dto -> {
dto.setShuttleNo(shuttleDevice.getId().intValue());
- dto.setLocNo(standbyLocNoTo);
+ dto.setLocNo(standbyLocNoFrom);
})),
MotionDto.build((dto -> {
dto.setShuttleNo(shuttleDevice.getId().intValue());
dto.setLiftNo(transferLiftDevice.getId().intValue());
- dto.setLocNo(liftLocNoTo);
+ dto.setLocNo(liftLocNoFrom);
})),
MotionCtgType.SHUTTLE_MOVE_TO_LIFT
));
@@ -886,6 +881,7 @@
dto.setLiftNo(transferLiftDevice.getId().intValue());
dto.setLev(5);//绱㈢墝椤圭洰5灞傛槸杈撻�佺嚎灞�
dto.setStaNo(1);//鎻愬崌鏈哄乏渚�
+ dto.setSync(0);//寮傛鎵ц
}))
));
@@ -970,13 +966,6 @@
//妫�娴嬬┛姊溅鏄惁鏈変换鍔$粦瀹�
boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo());
if (shuttleResult) {
- //瀛樺湪浠诲姟锛岀姝㈣В鏋�
- return motionList;
- }
-
- //妫�娴嬫彁鍗囨満鏄惁鏈変换鍔$粦瀹�
- boolean liftResult = Utils.checkLiftHasBinding(Integer.parseInt(transferLiftDevice.getDeviceNo()));
- if (liftResult) {
//瀛樺湪浠诲姟锛岀姝㈣В鏋�
return motionList;
}
@@ -1142,16 +1131,15 @@
MotionCtgType.SHUTTLE_MOVE
));
- task.setLiftNo(Integer.parseInt(transferLiftDevice.getDeviceNo()));
- taskService.updateById(task);
}
// 绌挎杞﹀紑濮嬪厖鐢�
- motionList.addAll(kernelService.shuttleCharge(
+ motionList.addAll(kernelService.shuttleAction(
null,
MotionDto.build((dto -> {
dto.setShuttleNo(shuttleDevice.getId().intValue());
- }))
+ })),
+ MotionCtgType.SHUTTLE_CHARGE_ON
));
return motionList;
@@ -1188,6 +1176,15 @@
// 鍒ゆ柇绌挎杞︽槸鍚﹀湪鐩爣灞�
if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) {
+
+ // 绌挎杞﹀叧闂厖鐢�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_CHARGE_OFF
+ ));
// 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅
motionList.addAll(kernelService.shuttleMove(
@@ -1409,6 +1406,91 @@
}
return motionList;
}
+ /**
+ * 鐢熸垚灏忚溅杞借揣杩佺Щ鍔ㄤ綔
+ */
+ public List<Motion> generateShuttleLadenMoveMotion(Task task) {
+ List<Motion> motionList = new ArrayList<>();
+ if (task.getTaskSts() != TaskStsType.NEW_LADEN_MOVE.sts) {
+ return motionList;
+ }
+ //originLoc 婧愬簱浣�
+ String originLoc = task.getOriginLoc();
+ // locNo 鐩爣搴撲綅
+ String locNo = task.getDestLoc();
+
+ Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>()
+ .eq(Device::getDeviceNo, task.getShuttleNo())
+ .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
+ .eq(Device::getHostId, task.getHostId())
+ .eq(Device::getStatus, 1));
+ if (shuttleDevice == null) {
+ return motionList;
+ }
+
+ ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue());
+ if (shuttleThread == null) {
+ return motionList;
+ }
+
+ ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+ if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+ return motionList;
+ }
+
+ String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
+
+ // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鐩爣灞�
+ if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) {
+
+ if (!shuttleLocNo.equals(locNo)) {//灏忚溅涓嶅湪鐩爣搴撲綅
+ // 绌挎杞﹁蛋琛岃嚦婧愬簱浣�
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(originLoc);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ // 绌挎杞﹂《鍗�
+ motionList.add(Motion.build(motion -> {
+ motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
+ motion.setDevice(String.valueOf(shuttleDevice.getId()));
+ motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val());
+ }));
+
+ // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(originLoc);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(locNo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ //绌挎杞︽墭鐩樹笅闄�
+ motionList.add(Motion.build(motion -> {
+ motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
+ motion.setDevice(String.valueOf(shuttleDevice.getId()));
+ motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val());
+ }));
+
+ }
+
+ } else {
+ //灏忚溅璺ㄥ眰
+ }
+ return motionList;
+ }
/**
* 鐢熸垚灏忚溅鎵嬪姩鍔ㄤ綔
--
Gitblit v1.9.1