Commit b6ba5258 authored by tank.li@mushiny.com's avatar tank.li@mushiny.com

南沙WCS版本临时存储地址

parent dbe9f1ff
package com.mushiny.beans.order.midea;
import com.mushiny.beans.Address;
import com.mushiny.beans.Robot;
import com.mushiny.beans.Section;
import com.mushiny.beans.enums.AddressType;
import com.mushiny.beans.enums.TripStatus;
......@@ -86,7 +87,7 @@ public class PodRunOrder extends Order {
if (!MideaConstants.CarryPod.equalsIgnoreCase(this.type)
&& !MideaConstants.ANNTOMVOUT.equalsIgnoreCase(this.type)
&& !MideaConstants.LMGETMATERIAL.equalsIgnoreCase(this.type)) {
boolean success = this.getPodManager().targetAndLock(this.getPod(), this.getRobot());
boolean success = this.getPodManager().targetAndLock(this.getPod(), this.getRobot(),this.getRobotManager());
if (!success) {
logger.error(this.getOrderId() + "的POD=" + this.getPod().getPodName() + ":热度算法没有生成目标地址");
//从地图上查找一次
......@@ -97,6 +98,13 @@ public class PodRunOrder extends Order {
if(address.getType() == AddressType.STORAGE ){
success = noPodOnAddress(address)
&& address.robotLock(this.getRobot().getRobotId(),true);
//如果该节点被某小车锁定,而小车锁定的目的地不是该节点,表示数据有问题 2020-01-20
Robot lockedRobot = this.getRobotManager().getRobotById(address.getLockedBy());
if(lockedRobot.getLockedAddr() != Long.parseLong(address.getId())){
logger.error("该位置锁定的小车目的地不是这个点 lockedRobot.getLockedAddr():"
+lockedRobot.getLockedAddr()+" address.getId():"+address.getId());
success = true;
}
if (success) {
logger.error(this.getOrderId() + "的POD="
+ this.getPod().getPodName()+" 获取到目标地址:"+address.getId());
......
......@@ -864,9 +864,10 @@ public class PodManager implements CommandLineRunner {
*
* @param pod
* @param robot
* @param robotManager
* @return
*/
public synchronized boolean targetAndLock(Pod pod, Robot robot) {
public synchronized boolean targetAndLock(Pod pod, Robot robot, RobotManager robotManager) {
Address address = null;
try {
logger.debug("获取热度计算后的目标地址...");
......@@ -885,15 +886,20 @@ public class PodManager implements CommandLineRunner {
for (int j = 0; j < addressList.size(); j++) {
address = addressList.get(j);
//动态的目的地址要排除设定目标地址的那些
//如果该节点被某小车锁定,而小车锁定的目的地不是该节点,表示数据有问题 2020-01-20
Robot lockedRobot = robotManager.getRobotById(address.getLockedBy());
if (isAvaliable(address) && !Objects.equals(address, pod.getAddress())//不能找当前节点
&& !innerEmptyOrLockedBy(address) && noAvailableTripInInner(address)
&& (pod.getLockedBy() == address.getLockedBy() || address.getLockedBy() == 0)) {
&& (pod.getLockedBy() == address.getLockedBy() || address.getLockedBy() == 0
//增加这个条件 2020-01-20
|| lockedRobot.getLockedAddr() != Long.parseLong(address.getId()))) {
address.setLockedBy(robot.getRobotId());
address.setNodeState(AddressStatus.RESERVED);
robot.setLockedAddr(Long.parseLong(address.getId()));
logger.debug("小车" + robot.getRobotId() + " 同步锁定" + address);
return true;
}
}
//未找到再循环
/*try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment