From 36c6d6b39e2b76080480c5bc90a412d711b76144 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 19 六月 2024 15:54:24 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/Four-Way-Rack' into Four-Way-Rack
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java | 102 ++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 81 insertions(+), 21 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 47e9dc2..f6c96a9 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
@@ -56,12 +56,6 @@
public List<Motion> generateMotion(Task task) {
List<Motion> motionList = new ArrayList<>();
-// switch (Objects.requireNonNull(WorkZoneType.query(task.getTaskSts() == TaskStsType.NEW_INBOUND.sts ? task.getOriginSite() : task.getDestSite()))) {
-// case FIRST_ZONE:
-// motionList = this.generateFirstZoneMotion(task);
-// break;
-// default:
-// }
motionList = this.generateFirstZoneMotion(task);
return motionList;
}
@@ -81,21 +75,86 @@
* 5.绌挎杞﹀叆搴撹嚦鐩爣搴撲綅
*/
if (task.getTaskSts() == TaskStsType.NEW_INBOUND.sts) {
-// // lift
-// LiftThread liftThread = liftDispatcher.queryLiftForTransport(task.getOriginSite());
-// LiftProtocol liftProtocol = liftThread.getStatus();
-// if (liftProtocol == null) {
-// return motionList;
-// }
+ // locNo
+ String destLoc = task.getDestLoc();
+
+ // shuttle
+ 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());
+ ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+ if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+ return motionList;
+ }
+ if (!shuttleThread.isIdle()) {
+ return motionList;
+ }
+
+ String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
+
+ //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑绌洪棽鍙崲灞傛彁鍗囨満
+ LiftThread liftThread = liftDispatcher.searchIdleLift(shuttleLocNo, task.getHostId(), true);
+ if (liftThread == null) {
+ return motionList;
+ }
+ Device transferLiftDevice = liftThread.getDevice();
+
+ LiftProtocol liftProtocol = liftThread.getStatus();
+ if (liftProtocol == null || liftProtocol.getLiftNo() == null) {
+ return motionList;
+ }
+
+ //妫�娴嬬┛姊溅鏄惁鏈変换鍔$粦瀹�
+ boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice);
+ if (shuttleResult) {
+ //瀛樺湪浠诲姟锛岀姝㈣В鏋�
+ 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())
+ .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo))
+ .eq(ShuttleStandby::getStatus, 1));
+
+ //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 鍑烘彁鍗囨満
+ ShuttleStandby shuttleStandbyFrom = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
+ .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
+ .eq(ShuttleStandby::getDeviceLev, Utils.getLev(destLoc))
+ .eq(ShuttleStandby::getStatus, 1));
+ if (shuttleStandbyTo == null || shuttleStandbyFrom == null) {
+ return motionList;
+ }
+
+ //绌挎杞﹁繘鎻愬崌鏈哄簱浣嶅彿
+ String liftLocNoTo = shuttleStandbyTo.getDeviceLoc();
+
+ //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿
+ String liftLocNoFrom = shuttleStandbyFrom.getDeviceLoc();
+
+ //绌挎杞﹁繘鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
+ String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc();
+
+ //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
+ String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc();
// shuttle
// ShuttleThread shuttleThread = shuttleDispatcher.queryShuttleWhichConvenient(task, Integer.parseInt(liftThread.getStatus().getLiftNo()));
// ShuttleThread shuttleThread = shuttleDispatcher.queryShuttleWhichConvenient(task, 1);
- ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, 6);
- if (Cools.isEmpty(shuttleThread)) { return motionList; }
- ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
// String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
- String shuttleLocNo = "0100201";
// // conveyor
// DevpSlave devpSlave = conveyorDispatcher.queryByInBound(task.getSourceStaNo());
@@ -747,12 +806,13 @@
String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
- // lift
- Device transferLiftDevice = Utils.getRecentTransferLift(shuttleLocNo, shuttleProtocol.getShuttleNo());
- if (transferLiftDevice == null) {
+ //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑绌洪棽鍙崲灞傛彁鍗囨満
+ LiftThread liftThread = liftDispatcher.searchIdleLift(shuttleLocNo, task.getHostId(), true);
+ if (liftThread == null) {
return motionList;
}
- LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, transferLiftDevice.getId().intValue());
+ Device transferLiftDevice = liftThread.getDevice();
+
LiftProtocol liftProtocol = liftThread.getStatus();
if (liftProtocol == null || liftProtocol.getLiftNo() == null) {
return motionList;
@@ -853,7 +913,7 @@
MotionCtgType.SHUTTLE_MOVE_TO_LIFT
));
- // 鎻愬崌鏈烘惉杞� 鑷� 杈撻�佺嚎灞�
+ // 鎻愬崌鏈烘惉杞� 鑷� 鍏呯數灞�
motionList.addAll(kernelService.liftMoveShuttle(
MotionDto.build((dto -> {
dto.setLiftNo(transferLiftDevice.getId().intValue());
--
Gitblit v1.9.1