From d9cea3d7757a8d580bb0574d419ba6dd9c2478e7 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 13 十二月 2024 15:11:50 +0800
Subject: [PATCH] #search shuttle
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java | 2224 ++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 1,376 insertions(+), 848 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 f2ce497..e645221 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,36 +1,31 @@
package com.zy.asrs.wcs.core.kernel;
+import com.alibaba.fastjson.JSON;
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.Task;
-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.TaskStsType;
-import com.zy.asrs.wcs.core.model.enums.WorkZoneType;
-import com.zy.asrs.wcs.core.service.TaskService;
-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.core.entity.*;
+import com.zy.asrs.wcs.core.model.NavigateNode;
+import com.zy.asrs.wcs.core.model.enums.*;
+import com.zy.asrs.wcs.core.service.*;
+import com.zy.asrs.wcs.core.utils.*;
+import com.zy.asrs.wcs.rcs.News;
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.entity.DeviceType;
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.service.DeviceTypeService;
+import com.zy.asrs.wcs.rcs.thread.LiftThread;
import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
-import java.util.Objects;
/**
- * todo:luxiaotao 1.鍏呯數浠诲姟锛�2.搴撲綅绉昏浆锛�3.灏忚溅杩佺Щ
+ * 1.鍏呯數浠诲姟锛�2.搴撲綅绉昏浆锛�3.灏忚溅杩佺Щ锛�4.鎵嬪姩浠诲姟
* Created by vincent on 2023/10/11
*/
@Service
@@ -46,668 +41,838 @@
private ShuttleDispatcher shuttleDispatcher;
@Autowired
private LiftDispatcher liftDispatcher;
- // @Autowired
-// private ConveyorDispatcher conveyorDispatcher;
+ @Autowired
+ private ConveyorDispatcher conveyorDispatcher;
@Autowired
private DeviceService deviceService;
@Autowired
- private DeviceTypeService deviceTypeService;
+ private ShuttleStandbyService shuttleStandbyService;
+ @Autowired
+ private BasConveyorPathService basConveyorPathService;
+ @Autowired
+ private BasConveyorStaService basConveyorStaService;
+ @Autowired
+ private BasConveyorService basConveyorService;
+ @Autowired
+ private TaskCtgService taskCtgService;
+
+ public Integer getStaByLev(Integer lev) {
+ HashMap<Integer, Integer> map = new HashMap<>();
+ map.put(1, 31006);
+ map.put(2, 31007);
+ map.put(3, 31008);
+
+ return map.get(lev);
+ }
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;
}
public List<Motion> generateFirstZoneMotion(Task task) {
List<Motion> motionList = new ArrayList<>();
- String shuttleNo = null;
- String liftNo = null;
/**
* 鍏ュ簱
- * 涓�銆佸叆搴撶洰鏍囧眰鏈夌┛姊溅
- * 1.鎻愬崌鏈哄崌闄嶅埌婧愬眰
- * 2.璐х墿浠庤緭閫佺嚎鍒版彁鍗囨満
- * 3.鎻愬崌鏈鸿浇璐хЩ鍔紙闈炲繀闇�锛�
- * 4.绌挎杞﹁蛋琛岃嚦鎻愬崌鏈�
- * 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
-// 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; }
+ 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();
-// String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
- String shuttleLocNo = "0100201";
+ if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+ return motionList;
+ }
+ if (!shuttleThread.isIdle()) {
+ return motionList;
+ }
-// // conveyor
-// DevpSlave devpSlave = conveyorDispatcher.queryByInBound(task.getSourceStaNo());
-// DevpSlave.Sta slaveInSta = devpSlave.queryInSta(wrkMast.getSourceStaNo());
+ String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
-// //妫�娴嬬┛姊溅鏄惁鏈変换鍔$粦瀹�
-// boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleProtocol.getShuttleNo().intValue());
-// if (shuttleResult) {
-// //瀛樺湪浠诲姟锛岀姝㈣В鏋�
-// return motionList;
-// }
-//
-// //妫�娴嬫彁鍗囨満鏄惁鏈変换鍔$粦瀹�
-// boolean liftResult = Utils.checkLiftHasBinding(liftSlave.getId());
-// if (liftResult) {
-// //瀛樺湪浠诲姟锛岀姝㈣В鏋�
-// return motionList;
-// }
+ //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑鍙崲灞傛彁鍗囨満(鍙兘涓嶇┖闂�)
+ LiftThread liftThread = liftDispatcher.searchLift(shuttleLocNo, task.getHostId(), true);
+ if (liftThread == null) {
+ return motionList;
+ }
+ Device transferLiftDevice = liftThread.getDevice();
-// //绌挎杞﹀埌鎻愬崌鏈哄簱浣嶅彿
-// String liftLocNoTo = LiftCodeType.getLocNo(Integer.parseInt(liftNo), Utils.getLev(shuttleLocNo), task.getHostId());
-//
-// //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿
-// String liftLocNoFrom = LiftCodeType.getLocNo(Integer.parseInt(liftNo), Utils.getLev(task.getDestLoc()), task.getHostId());
-//
-// //绌挎杞﹀埌鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-// String standbyLocNoTo = LiftCodeType.getStandbyLocNo(Integer.parseInt(liftNo), Utils.getLev(shuttleLocNo));
-//
-// //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-// String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(Integer.parseInt(liftNo), Utils.getLev(task.getDestLoc()));
+ LiftProtocol liftProtocol = liftThread.getStatus();
+ if (liftProtocol == null || liftProtocol.getLiftNo() == null) {
+ return motionList;
+ }
+
+ BasConveyorSta basConveyorStaDest = basConveyorStaService.selectBySiteNo(task.getDestSite());
+ if (basConveyorStaDest == null) {
+ return motionList;
+ }
+
+ //妫�娴嬬┛姊溅鏄惁鏈変换鍔$粦瀹�
+ boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo());
+ if (shuttleResult) {
+ //瀛樺湪浠诲姟锛岀姝㈣В鏋�
+ 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();
+
+ //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞
+ List<String> lockPath = shuttleStandbyFrom.getLockPath$();
// 鍏ュ簱鐩爣灞傛湁绌挎杞�
if (Utils.getLev(shuttleLocNo) == Utils.getLev(task.getDestLoc())) {
- // 绌挎杞﹁蛋琛岃嚦搴撲綅
+// // 鎻愬崌鏈鸿浇璐хЩ鍔�
+// motionList.addAll(kernelService.liftMoveGoods(
+// MotionDto.build((dto -> {
+// dto.setLiftNo(transferLiftDevice.getId().intValue());
+// dto.setLev(1);//鍏夋嘲1灞傛槸杈撻�佺嚎灞�
+// dto.setStaNo(31004);//鍏ュ簱绔欑偣
+// }))
+// , MotionDto.build((dto -> {
+// dto.setLiftNo(transferLiftDevice.getId().intValue());
+// dto.setLev(Utils.getLev(task.getDestLoc()));
+// dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc())));
+// dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue());
+// dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
+// }))
+// ));
+
+ // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
motionList.addAll(kernelService.shuttleMove(
MotionDto.build((dto -> {
- dto.setShuttleNo(Integer.valueOf(shuttleProtocol.getShuttleNo()));
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
dto.setLocNo(shuttleLocNo);
})),
MotionDto.build((dto -> {
- dto.setShuttleNo(Integer.valueOf(shuttleProtocol.getShuttleNo()));
- dto.setLocNo(task.getDestLoc());
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(standbyLocNoTo);
})),
MotionCtgType.SHUTTLE_MOVE
));
-// // 鎻愬崌鏈虹┖杞界Щ鍔�
-// motionList.addAll(kernelService.liftMove(
-// null
-// , MotionDto.build((dto -> {
-// dto.setLiftNo(Integer.valueOf(liftProtocol.getLiftNo()));
-//// dto.setLev(slaveInSta.getLiftLev());
-// dto.setLev(1);
-// }))
-// ));
-//
-// // 杈撻�佺嚎鍏ュ簱鑷虫彁鍗囨満鍙�
-// motionList.addAll(kernelService.conveyorInbound(
-// MotionDto.build((dto -> {
-//// dto.setDevpNo(devpSlave.getId());
-// dto.setDevpNo(1);
-// dto.setStaNo(Integer.valueOf(task.getOriginSite()));
-// })),
-// MotionDto.build((dto -> {
-// dto.setLiftNo(Integer.valueOf(liftProtocol.getLiftNo()));
-//// dto.setLev(slaveInSta.getLiftLev());
-// dto.setLev(1);
-// })),
-// MotionCtgType.CONVEYOR_INBOUND_TO_LIFT
-// ));
-//
-// // 鐩爣搴撲綅鏄惁涓庤緭閫佺嚎鍏ュ簱绔欏睘浜庡悓涓�灞�
-// if (!slaveInSta.getLiftLev().equals(Utils.getLev(wrkMast.getLocNo()))) {
-// // 鎻愬崌鏈鸿浇璐хЩ鍔�
-// motionList.addAll(kernelService.liftMoveGoods(
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(slaveInSta.getLiftLev());
-// }))
-// , MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(wrkMast.getLocNo()));
-// }))
-// ));
-// }
-//
-// // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(shuttleLocNo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-//
-// // 鎻愬崌鏈虹Щ鍔ㄨ嚦灏忚溅妤煎眰
-// motionList.addAll(kernelService.liftMove(
-// null
-// , MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(shuttleLocNo));
-// }))
-// ));
-//
-// // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満搴撲綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE_TO_LIFT
-// ));
-//
-// // 绌挎杞﹀叆搴撻《鍗囧苟绉诲姩鑷虫彁鍗囨満寰呮満浣�
-// motionList.addAll(kernelService.shuttleTransport(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionCtgType.SHUTTLE_TRANSPORT_FROM_LIFT
-// ));
-//
-// // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(wrkMast.getLocNo());
-// })),
-// MotionCtgType.SHUTTLE_MOVE_DOWN_PALLET
-// ));
+ // 绌挎杞﹀叆搴撻《鍗�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_LIFT
+ ));
+
+ // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(destLoc);
+// dto.setReleaseLift(2);//鎵ц涓噴鏀炬彁鍗囨満
+ })),
+ MotionCtgType.SHUTTLE_TRANSPORT
+ ));
+
+ // 绌挎杞﹀叆搴撴墭鐩樹笅闄�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_DOWN
+ ));
/**
* 浜屻�佸叆搴撶洰鏍囧眰娌℃湁绌挎杞�
- * 1.鎻愬崌鏈哄崌闄嶅埌绌挎杞﹀眰
- * 2.绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
- * 3.鎻愬崌鏈烘惉杩愮┛姊溅鑷崇洰鏍囧眰
- * 4.璐х墿浠庤緭閫佺嚎鍒版彁鍗囨満
- * 5.鎻愬崌鏈鸿浇杞︿笌璐хЩ鍔紙闈炲繀闇�锛�
- * 6.绌挎杞﹀叆搴撹嚦鐩爣搴撲綅
*/
} else {
-//
-// // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
-// motionList.addAll(kernelService.shuttleMove(
+
+// // 鎻愬崌鏈鸿浇璐хЩ鍔�
+// motionList.addAll(kernelService.liftMoveGoods(
// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(shuttleLocNo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-//
-// // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
-// motionList.addAll(kernelService.liftMove(
-// null
+// dto.setLiftNo(transferLiftDevice.getId().intValue());
+// dto.setLev(1);//鍏夋嘲1灞傛槸杈撻�佺嚎灞�
+// dto.setStaNo(31004);//鍏ュ簱绔欑偣
+// }))
// , MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(shuttleLocNo));
+// dto.setLiftNo(transferLiftDevice.getId().intValue());
+// dto.setLev(Utils.getLev(task.getDestLoc()));
+// dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc())));
+// dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue());
+// dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
// }))
// ));
-//
-// // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満搴撲綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE_TO_LIFT
-// ));
-//
-// // 鎻愬崌鏈烘惉杞� 鑷� 杈撻�佺嚎灞�
-// motionList.addAll(kernelService.liftMoveShuttle(
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(shuttleLocNo));
-// })),
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(slaveInSta.getLiftLev());
-// }))
-// ));
-//
-// // 杈撻�佺嚎鍏ュ簱鑷虫彁鍗囨満鍙�
-// motionList.addAll(kernelService.conveyorInbound(
-// MotionDto.build((dto -> {
-// dto.setDevpNo(devpSlave.getId());
-// dto.setStaNo(wrkMast.getSourceStaNo());
-// })),
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(slaveInSta.getLiftLev());
-// })),
-// MotionCtgType.CONVEYOR_INBOUND_TO_LIFT
-// ));
-//
-// // 鐩爣搴撲綅鏄惁涓庤緭閫佺嚎鍏ュ簱绔欏睘浜庡悓涓�灞�
-// if (!slaveInSta.getLiftLev().equals(Utils.getLev(wrkMast.getLocNo()))) {
-// // 鎻愬崌鏈鸿浇璐хЩ鍔�
-// motionList.addAll(kernelService.liftMoveGoodsAndShuttle(
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(slaveInSta.getLiftLev());
-// }))
-// , MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(wrkMast.getLocNo()));
-// }))
-// ));
-// }
-//
-// // 绌挎杞﹀叆搴撻《鍗囧苟绉诲姩鑷虫彁鍗囨満寰呮満浣�
-// motionList.addAll(kernelService.shuttleTransport(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionCtgType.SHUTTLE_TRANSPORT_FROM_LIFT
-// ));
-//
-// // 绌挎杞﹀緟鏈轰綅鑷冲叆搴撳簱浣�
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(wrkMast.getLocNo());
-// })),
-// MotionCtgType.SHUTTLE_MOVE_DOWN_PALLET
-// ));
+
+ // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ // 閿佸畾鎹㈠眰璺緞
+ motionList.addAll(kernelService.mapLockPath(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(JSON.toJSONString(lockPath));
+ }))
+ ));
+
+ // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
+ motionList.addAll(kernelService.liftMove(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_TO_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鎻愬崌鏈烘惉杞� 鑷� 鐩爣浣嶇疆灞�
+ motionList.addAll(kernelService.liftMoveShuttle(
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ })),
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(destLoc));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鏇存柊灏忚溅鍧愭爣
+ motionList.addAll(kernelService.shuttleUpdateLocation(
+ null
+ , MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ }))
+ ));
+
+ // 绌挎杞︾Щ鍔ㄨ嚦鎻愬崌鏈哄緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
+ }))
+ ));
+
+ // 瑙i攣鎹㈠眰璺緞
+ motionList.addAll(kernelService.mapUnlockPath(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(JSON.toJSONString(lockPath));
+ }))
+ ));
+
+ // 绌挎杞﹀叆搴撻《鍗�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_LIFT
+ ));
+
+ // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(destLoc);
+ })),
+ MotionCtgType.SHUTTLE_TRANSPORT
+ ));
+
+ // 绌挎杞﹀叆搴撴墭鐩樹笅闄�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_DOWN
+ ));
}
- shuttleNo = String.valueOf(shuttleProtocol.getShuttleNo());
-// liftNo = String.valueOf(liftProtocol.getLiftNo());
}
/**
* 鍑哄簱
*/
if (task.getTaskSts() == TaskStsType.NEW_OUTBOUND.sts) {
-// // lift
-// LiftProtocol liftProtocol = liftDispatcher.queryLiftForTransport(wrkMast.getStaNo());
-// LiftSlave liftSlave = liftProtocol.querySlave();
-//
-// // shuttle
-// ShuttleProtocol shuttleProtocol = shuttleDispatcher.queryShuttleWhichConvenient(wrkMast, liftProtocol.getLiftNo().intValue());
-// if (Cools.isEmpty(shuttleProtocol)) { return motionList; }
-// String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
-//
-// // conveyor
-// DevpSlave devpSlave = conveyorDispatcher.queryByOutBound(wrkMast.getSourceStaNo());
-// DevpSlave.Sta slaveOutSta = devpSlave.queryOutSta(wrkMast.getSourceStaNo());
-//
-// //妫�娴嬬┛姊溅鏄惁鏈変换鍔$粦瀹�
-// boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleProtocol.getShuttleNo().intValue());
-// if (shuttleResult) {
-// //瀛樺湪浠诲姟锛岀姝㈣В鏋�
-// return motionList;
-// }
-//
-// //妫�娴嬫彁鍗囨満鏄惁鏈変换鍔$粦瀹�
-// boolean liftResult = Utils.checkLiftHasBinding(liftSlave.getId());
-// if (liftResult) {
-// //瀛樺湪浠诲姟锛岀姝㈣В鏋�
-// return motionList;
-// }
-//
-// //绌挎杞﹀埌鎻愬崌鏈哄簱浣嶅彿
-// String liftLocNoTo = LiftCodeType.getLocNo(liftSlave.getId(), Utils.getLev(shuttleLocNo));
-//
-// //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿
-// String liftLocNoFrom = LiftCodeType.getLocNo(liftSlave.getId(), Utils.getLev(wrkMast.getSourceLocNo()));
-//
-// //绌挎杞﹀埌鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-// String standbyLocNoTo = LiftCodeType.getStandbyLocNo(liftSlave.getId(), Utils.getLev(shuttleLocNo));
-//
-// //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-// String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(liftSlave.getId(), Utils.getLev(wrkMast.getSourceLocNo()));
-//
-// /**
-// * 鍑哄簱
-// * 涓�銆佸嚭搴撹捣濮嬪眰鏈夌┛姊溅
-// * 1.绌挎杞﹁蛋琛岃嚦鍑哄簱搴撲綅
-// * 2.鎻愬崌鏈哄埌鍑哄簱璧峰灞�
-// * 3.绌挎杞﹀嚭搴撹嚦鎻愬崌鏈�
-// * 4.绌挎杞︾寮�鎻愬崌鏈�
-// * 5.鎻愬崌鏈鸿浇璐хЩ鍔紙闈炲繀闇�锛�
-// * 6.杈撻�佺嚎杩愯緭鑷冲嚭搴撳彛
-// */
-// if (Utils.getLev(shuttleLocNo) == Utils.getLev(wrkMast.getSourceLocNo())) {
-//
-// //绌挎杞︿笉鍦ㄥ嚭搴撳簱浣�
-// if (!shuttleLocNo.equals(wrkMast.getSourceLocNo())) {
-// // 绌挎杞﹁蛋琛岃嚦鍑哄簱搴撲綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(shuttleLocNo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(wrkMast.getSourceLocNo());
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-// }
-//
-// // 绌挎杞﹀嚭搴撹嚦鎻愬崌鏈哄緟鏈轰綅
-// motionList.addAll(kernelService.shuttleTransport(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(wrkMast.getSourceLocNo());
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE_LIFT_PALLET
-// ));
-//
-// // 鎻愬崌鏈虹┖杞界Щ鍔�
-// motionList.addAll(kernelService.liftMove(
-// null
-// , MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(wrkMast.getSourceLocNo()));
-// }))
-// ));
-//
-// // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満
-// motionList.addAll(kernelService.shuttleTransport(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_TRANSPORT_TO_LIFT
-// ));
-//
-// // 绌挎杞︾寮�鎻愬崌鏈� - 鍒版彁鍗囨満寰呮満浣�
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
-// ));
-//
-// // 鎻愬崌鏈鸿浇璐хЩ鍔�
-// // 鍑哄簱搴撲綅鏄惁涓庤緭閫佺嚎鍑哄簱绔欏睘浜庡悓涓�灞�
-// if (!slaveOutSta.getLiftLev().equals(Utils.getLev(wrkMast.getSourceLocNo()))) {
-// motionList.addAll(kernelService.liftMoveGoods(
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(wrkMast.getSourceLocNo()));
-// })),
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(slaveOutSta.getLiftLev());
-// }))
-// ));
-// }
-//
-// LiftNeighborType neighborType = LiftNeighborType.query(liftSlave.getId(), slaveOutSta.getLiftLev(), false, wrkMast.getStaNo());
-//
-// // 鎻愬崌鏈鸿繍杈撳埌杈撻�佺嚎
-// motionList.addAll(kernelService.liftTransportGoodsToConveyor(
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(slaveOutSta.getLiftLev());
-// })),
-// MotionDto.build((dto -> {
-// dto.setDevpNo(devpSlave.getId());
-// dto.setStaNo(neighborType.staNo);
-// }))
-// ));
-//
-// // 绌挎杞︽彁鍗囨満寰呮満浣� - 鍒板緟鏈轰綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(
-// ShuttleTempLocType.query(shuttleProtocol.getShuttleNo().intValue(), liftSlave.getId(), Utils.getLev(wrkMast.getSourceLocNo())).locNo
-// );
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-//
-// /**
-// * 浜屻�佸嚭搴撹捣濮嬪眰娌℃湁绌挎杞�
-// *
-// * 1.鎻愬崌鏈哄埌绌挎杞﹀眰
-// * 2.绌挎杞﹁蛋琛岃嚦鎻愬崌鏈�
-// * 3.鎻愬崌鏈鸿浇杞﹁嚦鍑哄簱璧峰灞�
-// * 4.绌挎杞﹁蛋琛岃嚦鍑哄簱搴撲綅
-// * 5.绌挎杞﹀嚭搴撹嚦鎻愬崌鏈�
-// * 6.绌挎杞︾寮�鎻愬崌鏈�
-// * 7.鎻愬崌鏈鸿浇璐хЩ鍔紙闈炲繀闇�锛�
-// * 8.杈撻�佺嚎杩愯緭鑷冲嚭搴撳彛
-// *
-// */
-// } else {
-//
-// // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(shuttleLocNo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-//
-// // 鎻愬崌鏈哄埌绌挎杞﹀眰
-// motionList.addAll(kernelService.liftMove(
-// null
-// , MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(shuttleLocNo));
-// }))
-// ));
-//
-// // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE_TO_LIFT
-// ));
-//
-// // 鎻愬崌鏈鸿浇杞﹁嚦鍑哄簱璧峰灞�
-// motionList.addAll(kernelService.liftMoveShuttle(
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(shuttleLocNo));
-// })),
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(wrkMast.getSourceLocNo()));
-// }))
-// ));
-//
-// // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
-// ));
-//
-// // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鍑哄簱搴撲綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(wrkMast.getSourceLocNo());
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-//
-// // 绌挎杞﹀嚭搴撹嚦鎻愬崌鏈哄緟鏈轰綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(wrkMast.getSourceLocNo());
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionCtgType.SHUTTLE_MOVE_LIFT_PALLET
-// ));
-//
-// // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鎻愬崌鏈�
-// motionList.addAll(kernelService.shuttleTransport(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoFrom);
-// })),
-// MotionCtgType.SHUTTLE_TRANSPORT_TO_LIFT
-// ));
-//
-// // 绌挎杞︾寮�鎻愬崌鏈�
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLocNo(liftLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(
-// ShuttleTempLocType.query(shuttleProtocol.getShuttleNo().intValue(), liftSlave.getId(), Utils.getLev(wrkMast.getSourceLocNo())).locNo
-// );
-// })),
-// MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
-// ));
-//
-// // 鎻愬崌鏈鸿浇璐хЩ鍔�
-// // 鍑哄簱搴撲綅鏄惁涓庤緭閫佺嚎鍑哄簱绔欏睘浜庡悓涓�灞�
-// if (!slaveOutSta.getLiftLev().equals(Utils.getLev(wrkMast.getSourceLocNo()))) {
-// motionList.addAll(kernelService.liftMoveGoods(
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(Utils.getLev(wrkMast.getSourceLocNo()));
-// })),
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(slaveOutSta.getLiftLev());
-// }))
-// ));
-// }
-//
-// LiftNeighborType neighborType = LiftNeighborType.query(liftSlave.getId(), slaveOutSta.getLiftLev(), false, wrkMast.getStaNo());
-//
-// // 鎻愬崌鏈鸿繍杈撳埌杈撻�佺嚎
-// motionList.addAll(kernelService.liftTransportGoodsToConveyor(
-// MotionDto.build((dto -> {
-// dto.setLiftNo(liftSlave.getId());
-// dto.setLev(slaveOutSta.getLiftLev());
-// })),
-// MotionDto.build((dto -> {
-// dto.setDevpNo(devpSlave.getId());
-// dto.setStaNo(neighborType.staNo);
-// }))
-// ));
-//
-// }
-//
-// shuttleNo = String.valueOf(shuttleProtocol.getShuttleNo());
-// liftNo = String.valueOf(liftProtocol.getLiftNo());
- }
+ // locNo
+ String originLoc = task.getOriginLoc();
- assert !Cools.isEmpty(shuttleNo);
-// task.setShuttleNo(Integer.parseInt(shuttleNo));
-// task.setLiftNo(Integer.parseInt(liftNo));
+ // 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;
+ }
+
+ BasConveyorSta basConveyorStaOrigin = basConveyorStaService.selectBySiteNo(task.getOriginSite());
+ if (basConveyorStaOrigin == null) {
+ return motionList;
+ }
+
+ //妫�娴嬬┛姊溅鏄惁鏈変换鍔$粦瀹�
+ boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo());
+ if (shuttleResult) {
+ //瀛樺湪浠诲姟锛岀姝㈣В鏋�
+ 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(originLoc))
+ .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();
+
+ //绌挎杞﹀嚭鎻愬崌鏈哄悗鍏ㄩ儴寰呮満浣�
+ String standbyLocs = shuttleStandbyFrom.getStandbyLoc();//鑾峰彇鍏ㄩ儴寰呮満浣�
+
+ //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞
+ List<String> lockPath = shuttleStandbyFrom.getLockPath$();
+
+ //鑾峰彇鍑哄簱浠诲姟绫诲瀷
+ 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::getTypeNo, taskCtg.getId()));
+ if (basConveyorPath == null) {
+ return motionList;
+ }
+
+ //鍒嗘瀽鍑哄簱璺緞寰呮満搴撲綅
+ String lastPathStartLoc = shuttleDispatcher.analyzeOutPathWaitLoc(originLoc, standbyLocNoTo, shuttleDevice);
+ if (lastPathStartLoc == null) {
+ return motionList;//鏈垎鏋愭垚鍔�
+ }
+
+ /**
+ * 鍑哄簱
+ */
+ if (Utils.getLev(shuttleLocNo) == Utils.getLev(originLoc)) {
+
+ //绌挎杞︿笉鍦ㄥ嚭搴撳簱浣�
+ if (!shuttleLocNo.equals(task.getOriginLoc())) {
+ // 绌挎杞﹁蛋琛岃嚦鍑哄簱搴撲綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(originLoc);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+ }
+
+ // 绌挎杞﹀嚭搴撻《鍗�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_LIFT
+ ));
+
+ if (!originLoc.equals(lastPathStartLoc)) {
+ // 绌挎杞﹁浇璐у嚭搴撹嚦鏈�鍚庝竴娈佃矾寰勭瓑寰�
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(originLoc);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(lastPathStartLoc);
+ })),
+ MotionCtgType.SHUTTLE_TRANSPORT
+ ));
+ }
+
+ // 绌挎杞﹁浇璐ц嚦鎻愬崌鏈哄緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(lastPathStartLoc);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//杈撻�佺珯
+ })),
+ MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR
+ ));
+
+ // 绌挎杞﹀嚭搴撴墭鐩樹笅闄�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_DOWN
+ ));
+
+ // 绌挎杞︽彁鍗囨満寰呮満浣� - 鍒板緟鏈轰綅(鑷姩閫夋嫨鍚堥�傚緟鏈轰綅)
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(standbyLocs);
+ dto.setSync(0);//寮傛鎵ц
+ dto.setReleaseShuttle(1);//鎵ц瀹屾垚鍚庨噴鏀惧皬杞�
+ })),
+ MotionCtgType.SHUTTLE_MOVE_STANDBY
+ ));
+
+ // 鎻愬崌鏈鸿浇璐хЩ鍔�
+ motionList.addAll(kernelService.liftMoveGoods(
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(task.getOriginLoc()));
+ dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//璧峰绔欑偣
+ }))
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(1);//鍏夋嘲1灞傛槸杈撻�佺嚎灞�
+ dto.setStaNo(31001);//鍑哄簱绔欑偣
+ dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue());
+ dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
+ }))
+ ));
+
+ // 杈撻�佺嚎杩愯緭鑷冲嚭搴撳彛
+// motionList.addAll(kernelService.conveyorOutbound(
+// MotionDto.build((dto -> {
+// dto.setDevpNo(basConveyorPath.getDeviceId().intValue());
+// dto.setStaNo(basConveyorPath.getDeviceStn());
+// })),
+// MotionDto.build((dto -> {
+// dto.setDevpNo(basConveyorPath.getDeviceId().intValue());
+// dto.setStaNo(basConveyorPath.getStnNo());
+// })),
+// MotionCtgType.CONVEYOR_OUTBOUND
+// ));
+
+ /**
+ * 浜屻�佸嚭搴撹捣濮嬪眰娌℃湁绌挎杞�
+ */
+ } else {
+
+ // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ // 閿佸畾鎹㈠眰璺緞
+ motionList.addAll(kernelService.mapLockPath(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(JSON.toJSONString(lockPath));
+ }))
+ ));
+
+ // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
+ motionList.addAll(kernelService.liftMove(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_TO_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鎻愬崌鏈烘惉杞� 鑷� 鐩爣浣嶇疆灞�
+ motionList.addAll(kernelService.liftMoveShuttle(
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ })),
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(liftLocNoFrom));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鏇存柊灏忚溅鍧愭爣
+ motionList.addAll(kernelService.shuttleUpdateLocation(
+ null
+ , MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ }))
+ ));
+
+ // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
+ }))
+ ));
+
+ // 瑙i攣鎹㈠眰璺緞
+ motionList.addAll(kernelService.mapUnlockPath(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(JSON.toJSONString(lockPath));
+ }))
+ ));
+
+ // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鍑哄簱搴撲綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(originLoc);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ // 绌挎杞﹀嚭搴撻《鍗�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_LIFT
+ ));
+
+ if (!originLoc.equals(lastPathStartLoc)) {
+ // 绌挎杞﹁浇璐у嚭搴撹嚦鏈�鍚庝竴娈佃矾寰勭瓑寰�
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(originLoc);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(lastPathStartLoc);
+ })),
+ MotionCtgType.SHUTTLE_TRANSPORT
+ ));
+ }
+
+ // 绌挎杞﹁浇璐ц嚦鎻愬崌鏈哄緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(lastPathStartLoc);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoFrom);
+ dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//杈撻�佺珯
+ })),
+ MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR
+ ));
+
+ // 绌挎杞﹀嚭搴撴墭鐩樹笅闄�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_DOWN
+ ));
+
+ // 绌挎杞︽彁鍗囨満寰呮満浣� - 鍒板緟鏈轰綅(鑷姩閫夋嫨鍚堥�傚緟鏈轰綅)
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(standbyLocs);
+ dto.setSync(0);//寮傛鎵ц
+ dto.setReleaseShuttle(1);//鎵ц瀹屾垚鍚庨噴鏀惧皬杞�
+ })),
+ MotionCtgType.SHUTTLE_MOVE_STANDBY
+ ));
+
+ // 鎻愬崌鏈鸿浇璐хЩ鍔�
+ motionList.addAll(kernelService.liftMoveGoods(
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(task.getOriginLoc()));
+ dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//璧峰绔欑偣
+ }))
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(1);//鍏夋嘲1灞傛槸杈撻�佺嚎灞�
+ dto.setStaNo(31001);//鍑哄簱绔欑偣
+ dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue());
+ dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
+ }))
+ ));
+
+ // 杈撻�佺嚎杩愯緭鑷冲嚭搴撳彛
+// motionList.addAll(kernelService.conveyorOutbound(
+// MotionDto.build((dto -> {
+// dto.setDevpNo(basConveyorPath.getDeviceId().intValue());
+// dto.setStaNo(basConveyorPath.getDeviceStn());
+// })),
+// MotionDto.build((dto -> {
+// dto.setDevpNo(basConveyorPath.getDeviceId().intValue());
+// dto.setStaNo(basConveyorPath.getStnNo());
+// })),
+// MotionCtgType.CONVEYOR_OUTBOUND
+// ));
+
+ }
+
+ }
return motionList;
}
@@ -718,164 +883,228 @@
*/
public List<Motion> generateChargeMotion(Task task) {
List<Motion> motionList = new ArrayList<>();
-// if (wrkCharge.getWrkSts() != WrkMastStsType.NEW_CHARGE.sts || wrkCharge.getIoType() != WrkIoTypeType.CHARGE.sts) {
-// return motionList;
-// }
-//
-// // locNo
-// String chargeLocNo = wrkCharge.getLocNo();
-//
-// // lift
-// Integer transferLiftNo = 2;
-// SiemensLiftThread liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, transferLiftNo);
-// LiftProtocol liftProtocol = liftThread.getLiftProtocol();
-// if (liftProtocol == null || liftProtocol.getLiftNo() == null) {
-// return motionList;
-// }
-//
-// // shuttle
-// Integer shuttleNo = wrkCharge.getShuttleNo();
-// ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
-// ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
-// if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
-// return motionList;
-// }
-// if (!shuttleProtocol.isIdle()) {
-// return motionList;
-// }
-//
-// //妫�娴嬬┛姊溅鏄惁鏈変换鍔$粦瀹�
-// boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleProtocol.getShuttleNo().intValue());
-// if (shuttleResult) {
-// //瀛樺湪浠诲姟锛岀姝㈣В鏋�
-// return motionList;
-// }
-//
-// //妫�娴嬫彁鍗囨満鏄惁鏈変换鍔$粦瀹�
-// boolean liftResult = Utils.checkLiftHasBinding(transferLiftNo);
-// if (liftResult) {
-// //瀛樺湪浠诲姟锛岀姝㈣В鏋�
-// return motionList;
-// }
-//
-// String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
-//
-// //绌挎杞﹀埌鎻愬崌鏈哄簱浣嶅彿
-// String liftLocNoTo = LiftCodeType.getLocNo(transferLiftNo, Utils.getLev(shuttleLocNo));
-//
-// //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿
-// String liftLocNoFrom = LiftCodeType.getLocNo(transferLiftNo, Utils.getLev(wrkCharge.getLocNo()));
-//
-// //绌挎杞﹀埌鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-// String standbyLocNoTo = LiftCodeType.getStandbyLocNo(transferLiftNo, Utils.getLev(shuttleLocNo));
-//
-// //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-// String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(transferLiftNo, Utils.getLev(wrkCharge.getLocNo()));
-//
-// // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鍏呯數灞�
-// if (Utils.getLev(shuttleLocNo) == Utils.getLev(chargeLocNo)) {
-//
-// // 绌挎杞﹁蛋琛岃嚦鍏呯數妗╁簱浣�
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(shuttleLocNo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(chargeLocNo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-//
-// } else {
-//
-// // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(shuttleLocNo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-//
-// // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
-// motionList.addAll(kernelService.liftMove(
-// null
-// , MotionDto.build((dto -> {
-// dto.setLiftNo(transferLiftNo);
-// dto.setLev(Utils.getLev(shuttleLocNo));
-// }))
-// ));
-//
-// // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鎻愬崌鏈哄簱浣�
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoTo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(transferLiftNo);
-// dto.setLocNo(liftLocNoTo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE_TO_LIFT
-// ));
-//
-// // 鎻愬崌鏈烘惉杞� 鑷� 杈撻�佺嚎灞�
-// motionList.addAll(kernelService.liftMoveShuttle(
-// MotionDto.build((dto -> {
-// dto.setLiftNo(transferLiftNo);
-// dto.setLev(Utils.getLev(shuttleLocNo));
-// })),
-// MotionDto.build((dto -> {
-// dto.setLiftNo(transferLiftNo);
-// dto.setLev(Utils.getLev(chargeLocNo));
-// }))
-// ));
-//
-// // 绌挎杞︽彁鍗囨満鑷虫彁鍗囨満寰呮満浣�
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLiftNo(transferLiftNo);
-// dto.setLocNo(liftLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
-// ));
-//
-// // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鍏呯數浣�
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(standbyLocNoFrom);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(chargeLocNo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-//
-// wrkCharge.setLiftNo(transferLiftNo);
-// wrkChargeMapper.updateById(wrkCharge);
-// }
-//
-// // 绌挎杞﹀紑濮嬪厖鐢�
-// motionList.addAll(kernelService.shuttleCharge(
-// null,
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// }))
-// ));
+ if (task.getTaskSts() != TaskStsType.NEW_CHARGE.sts) {
+ return motionList;
+ }
+
+ // locNo
+ String chargeLocNo = 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, task.getTaskNo());
+ if (shuttleResult) {
+ //瀛樺湪浠诲姟锛岀姝㈣В鏋�
+ 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(chargeLocNo))
+ .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();
+
+ // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鍏呯數灞�
+ if (Utils.getLev(shuttleLocNo) == Utils.getLev(chargeLocNo)) {
+
+ // 绌挎杞﹁蛋琛岃嚦鍏呯數妗╁簱浣�
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(chargeLocNo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ } else {
+
+ // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
+ motionList.addAll(kernelService.liftMove(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鎻愬崌鏈�
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_TO_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鎻愬崌鏈烘惉杞� 鑷� 鍏呯數灞�
+ motionList.addAll(kernelService.liftMoveShuttle(
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ })),
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(chargeLocNo));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鏇存柊灏忚溅鍧愭爣
+ motionList.addAll(kernelService.shuttleUpdateLocation(
+ null
+ , MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ }))
+ ));
+
+ // 绌挎杞︽彁鍗囨満鑷虫彁鍗囨満寰呮満浣�
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鍏呯數浣�
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(chargeLocNo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ }
+
+ // 绌挎杞﹀紑濮嬪厖鐢�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_CHARGE_ON
+ ));
return motionList;
}
@@ -885,40 +1114,57 @@
*/
public List<Motion> generateShuttleChargeWrkComplete(Task task) {
List<Motion> motionList = new ArrayList<>();
-// if (wrkCharge.getWrkSts() != WrkMastStsType.NEW_MOVE.sts || wrkCharge.getIoType() != WrkIoTypeType.MOVE.sts) {
-// return motionList;
-// }
-//
-// // locNo
-// String locNo = wrkCharge.getLocNo();
-//
-// // shuttle
-// Integer shuttleNo = wrkCharge.getShuttleNo();
-// ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
-// ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
-// if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
-// return motionList;
-// }
-//
-// String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
-//
-// // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鐩爣灞�
-// if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) {
-//
-// // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅
-// motionList.addAll(kernelService.shuttleMove(
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(shuttleLocNo);
-// })),
-// MotionDto.build((dto -> {
-// dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
-// dto.setLocNo(locNo);
-// })),
-// MotionCtgType.SHUTTLE_MOVE
-// ));
-//
-// }
+ if (task.getTaskSts() != TaskStsType.NEW_MOVE.sts) {
+ return motionList;
+ }
+
+ // locNo
+ String locNo = 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;
+ }
+
+ String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
+
+ // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鐩爣灞�
+ 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(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(locNo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ }
return motionList;
}
@@ -934,24 +1180,16 @@
// locNo
String locNo = task.getDestLoc();
- //鑾峰彇绌挎杞︾被鍨�
- DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
- .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
- .eq(DeviceType::getStatus, 1));
- if (deviceType == null) {
- return motionList;
- }
-
- Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
+ Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>()
.eq(Device::getDeviceNo, task.getShuttleNo())
- .eq(Device::getDeviceType, deviceType.getId())
+ .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
.eq(Device::getHostId, task.getHostId())
.eq(Device::getStatus, 1));
- if (device == null) {
+ if (shuttleDevice == null) {
return motionList;
}
- ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
+ ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue());
if (shuttleThread == null) {
return motionList;
}
@@ -966,14 +1204,183 @@
// 鍒ゆ柇绌挎杞︽槸鍚﹀湪鐩爣灞�
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.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(locNo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+ }
+
+ } else {
+ //灏忚溅璺ㄥ眰
+
+ //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑绌洪棽鍙崲灞傛彁鍗囨満
+ LiftThread liftThread = liftDispatcher.searchIdleLift(locNo, task.getHostId(), true);
+ if (liftThread == null) {
+ return motionList;
+ }
+ Device liftDevice = liftThread.getDevice();
+
+ //绌挎杞﹀埌鎻愬崌鏈哄簱浣嶅彿
+ String liftLocNoTo = liftDispatcher.getLiftLocNo(liftThread, Utils.getLev(shuttleLocNo));
+
+ //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿
+ String liftLocNoFrom = liftDispatcher.getLiftLocNo(liftThread, Utils.getLev(task.getDestLoc()));
+
+ //绌挎杞﹀埌鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
+ String standbyLocNoTo = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(shuttleLocNo));
+
+ //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
+ String standbyLocNoFrom = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(task.getDestLoc()));
+
+ //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞
+ List<String> lockPath = liftDispatcher.getLockPathByLocNo(liftThread, Utils.getLev(task.getDestLoc()));
+
+
+ // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
motionList.addAll(kernelService.shuttleMove(
MotionDto.build((dto -> {
- dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
dto.setLocNo(shuttleLocNo);
})),
MotionDto.build((dto -> {
- dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(liftDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ // 閿佸畾鎹㈠眰璺緞
+ motionList.addAll(kernelService.mapLockPath(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(JSON.toJSONString(lockPath));
+ }))
+ ));
+
+ // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
+ motionList.addAll(kernelService.liftMove(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(liftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(liftDevice.getId().intValue());
+ }))
+ ));
+
+ // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(liftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_TO_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(liftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鎻愬崌鏈烘惉杞� 鑷� 鐩爣浣嶇疆灞�
+ motionList.addAll(kernelService.liftMoveShuttle(
+ MotionDto.build((dto -> {
+ dto.setLiftNo(liftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ })),
+ MotionDto.build((dto -> {
+ dto.setLiftNo(liftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(locNo));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(liftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鏇存柊灏忚溅鍧愭爣
+ motionList.addAll(kernelService.shuttleUpdateLocation(
+ null
+ , MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ }))
+ ));
+
+ // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLiftNo(liftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(liftDevice.getId().intValue());
+ }))
+ ));
+
+ // 瑙i攣鎹㈠眰璺緞
+ motionList.addAll(kernelService.mapUnlockPath(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(JSON.toJSONString(lockPath));
+ }))
+ ));
+
+ // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鐩爣浣嶇疆
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLiftNo(liftDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
dto.setLocNo(locNo);
})),
MotionCtgType.SHUTTLE_MOVE
@@ -988,24 +1395,17 @@
*/
public List<Motion> generateShuttleManualMotion(Task task) {
List<Motion> motionList = new ArrayList<>();
- if (task.getTaskSts() != TaskStsType.NEW_MOVE.getId()) {
+ if (task.getTaskSts() != TaskStsType.NEW_MANUAL.sts) {
return motionList;
}
+ String sourceLoc = task.getOriginLoc();//婧愬簱浣�
String targetLoc = task.getDestLoc();//浠诲姟鐩爣(鍊熺敤瀛楁)
- String targetSite = task.getDestSite();//浠诲姟绫诲瀷(鍊熺敤瀛楁)
-
- //鑾峰彇绌挎杞︾被鍨�
- DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
- .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
- .eq(DeviceType::getStatus, 1));
- if (deviceType == null) {
- return motionList;
- }
+ String targetSite = task.getMemo();//浠诲姟绫诲瀷(鍊熺敤瀛楁)
Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
.eq(Device::getDeviceNo, task.getShuttleNo())
- .eq(Device::getDeviceType, deviceType.getId())
+ .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
.eq(Device::getHostId, task.getHostId())
.eq(Device::getStatus, 1));
if (device == null) {
@@ -1031,11 +1431,12 @@
// 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅
motionList.addAll(kernelService.shuttleMove(
MotionDto.build((dto -> {
- dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
+ dto.setShuttleNo(device.getId().intValue());
dto.setLocNo(shuttleLocNo);
})),
MotionDto.build((dto -> {
- dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
+ dto.setShuttleNo(device.getId().intValue());
+ dto.setShuttleDevice(device);
dto.setLocNo(targetLoc);
})),
MotionCtgType.SHUTTLE_MOVE
@@ -1046,32 +1447,159 @@
//鎵樼洏椤跺崌
motionList.add(Motion.build(motion -> {
motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
- motion.setDevice(String.valueOf(task.getShuttleNo()));
+ motion.setDevice(String.valueOf(device.getId()));
motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val());
}));
} else if (targetSite.equals("palletDown")) {
//鎵樼洏涓嬮檷
motionList.add(Motion.build(motion -> {
motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
- motion.setDevice(String.valueOf(task.getShuttleNo()));
+ motion.setDevice(String.valueOf(device.getId()));
motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val());
}));
} else if (targetSite.equals("chargeOpen")) {
//鍏呯數寮�
motionList.add(Motion.build(motion -> {
motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
- motion.setDevice(String.valueOf(task.getShuttleNo()));
+ motion.setDevice(String.valueOf(device.getId()));
motion.setMotionCtg(MotionCtgType.SHUTTLE_CHARGE_ON.val());
}));
} else if (targetSite.equals("chargeClose")) {
//鍏呯數鍏�
motionList.add(Motion.build(motion -> {
motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
- motion.setDevice(String.valueOf(task.getShuttleNo()));
+ motion.setDevice(String.valueOf(device.getId()));
motion.setMotionCtg(MotionCtgType.SHUTTLE_CHARGE_OFF.val());
}));
} else if (targetSite.equals("reset")) {
//澶嶄綅
+ } else if (targetSite.equals("takeMove")) {
+ //鍙栨斁璐�
+ String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
+
+ // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鐩爣灞�
+ if (Utils.getLev(shuttleLocNo) == Utils.getLev(targetLoc)) {
+
+ if (!shuttleLocNo.equals(sourceLoc)) {//灏忚溅涓嶅湪鐩爣搴撲綅
+ // 绌挎杞﹁蛋琛岃嚦婧愬簱浣�
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(device.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(device.getId().intValue());
+ dto.setShuttleDevice(device);
+ dto.setLocNo(sourceLoc);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+ }
+
+ //鎵樼洏椤跺崌
+ motionList.add(Motion.build(motion -> {
+ motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
+ motion.setDevice(String.valueOf(device.getId()));
+ motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val());
+ }));
+
+ // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(device.getId().intValue());
+ dto.setLocNo(sourceLoc);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(device.getId().intValue());
+ dto.setShuttleDevice(device);
+ dto.setLocNo(targetLoc);
+ })),
+ MotionCtgType.SHUTTLE_TRANSPORT
+ ));
+
+ //鎵樼洏涓嬮檷
+ motionList.add(Motion.build(motion -> {
+ motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
+ motion.setDevice(String.valueOf(device.getId()));
+ motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val());
+ }));
+
+ }
+ }
+
+ return motionList;
+ }
+
+ /**
+ * 鐢熸垚鎻愬崌鏈烘墜鍔ㄥ姩浣�
+ */
+ public List<Motion> generateLiftManualMotion(Task task) {
+ List<Motion> motionList = new ArrayList<>();
+ if (task.getTaskSts() != TaskStsType.NEW_MANUAL.sts) {
+ return motionList;
+ }
+
+ Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
+ .eq(Device::getDeviceNo, task.getLiftNo())
+ .eq(Device::getDeviceType, DeviceCtgType.LIFT.val())
+ .eq(Device::getHostId, task.getHostId())
+ .eq(Device::getStatus, 1));
+ if (device == null) {
+ return motionList;
+ }
+
+ String destSite = task.getMemo();//浠诲姟鐩爣(鍊熺敤瀛楁)
+ if (destSite.equals("move")) {
+ //鎻愬崌鏈哄崌闄嶆ゼ灞�
+
+ // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
+ motionList.addAll(kernelService.liftMove(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(device.getId().intValue());
+ dto.setLev(Integer.parseInt(task.getDestLoc()));
+ }))
+ ));
+
+ } else if (destSite.equals("movePallet")) {
+ //绉诲姩鎵樼洏
+ BasConveyorSta basConveyorStaOrigin = basConveyorStaService.selectBySiteNo(task.getOriginSite());
+ BasConveyorSta basConveyorStaDest = basConveyorStaService.selectBySiteNo(task.getDestSite());
+ if(basConveyorStaOrigin == null || basConveyorStaDest == null) {
+ return motionList;
+ }
+
+ // 鎻愬崌鏈虹Щ鍔ㄦ墭鐩�
+ motionList.addAll(kernelService.liftMoveGoods(
+ MotionDto.build((dto -> {
+ dto.setLiftNo(device.getId().intValue());
+ dto.setLev(Utils.getLev(basConveyorStaOrigin.getLocNo()));
+ dto.setStaNo(Integer.parseInt(task.getOriginSite()));
+ }))
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(device.getId().intValue());
+ dto.setLev(Utils.getLev(basConveyorStaDest.getLocNo()));
+ dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue());
+ dto.setStaNo(Integer.parseInt(task.getDestSite()));
+ }))
+ ));
+
+ } else if (destSite.equals("lock")) {
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(device.getId().intValue());
+ }))
+ ));
+ } else if (destSite.equals("unlock")) {
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(device.getId().intValue());
+ }))
+ ));
}
return motionList;
--
Gitblit v1.9.1