自动化立体仓库 - WCS系统
Junjie
2023-06-17 928bc386bea03b9d3157e6d66dcb7afc843e9964
src/main/java/com/zy/core/thread/LiftThread.java
@@ -6,6 +6,7 @@
import HslCommunication.ModBus.ModbusTcpNet;
import com.alibaba.fastjson.JSON;
import com.core.common.DateUtils;
import com.core.common.RadixTools;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.BasLift;
@@ -21,7 +22,6 @@
import com.zy.core.cache.OutputQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.*;
import com.zy.core.model.DevpSlave;
import com.zy.core.model.LiftSlave;
import com.zy.core.model.Task;
import com.zy.core.model.command.*;
@@ -127,7 +127,7 @@
                liftProtocol.setLiftLock(CommonUtils.shortToBoolean(modbusTcpNet.getByteTransform().TransInt16(content, 0)));
                //位置到达反馈
                liftProtocol.setPositionArrivalFeedback(modbusTcpNet.getByteTransform().TransInt16(content,2));
                byte by = modbusTcpNet.getByteTransform().TransByte(content, 5);
                int[] datas = CommonUtils.byteToBits(by);
                //准备就绪
@@ -275,6 +275,14 @@
            array[29] = command.getLiftLockShortValue();
        }
        if (array[2] == 0) {
            // 开始任务
            short[] tmp = new short[2];
            tmp[0] = array[0];
            tmp[1] = array[1];
            array = tmp;
        }
        OperateResult result = modbusTcpNet.Write("41088", array);;
        if (result != null && result.IsSuccess) {
            News.info("提升机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
@@ -392,6 +400,12 @@
            News.info("提升机命令下发成功,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command));
            liftProtocol.setWrkTime(new Date());//更新工作时间
            try {
                Thread.sleep(1000);//命令下发完成后休眠1s
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            //判断数据是否执行完成
            if (commandStep < size - 1) {
                //更新redis数据
@@ -458,11 +472,11 @@
        command.setRun((short) 1);//升降
        Short position = LiftLevType.getRealLev(lev);//获取提升机实际楼层数值
        command.setDistPosition(position);
        command.setSpeed((short) 200);
        command.setHeight2((short) 180);
        command.setHeight3((short) 1645);
        command.setHeight4((short) (2 * 1645));
        command.setHeight5((short) (3 * 1645));
//        command.setSpeed((short) 200);
//        command.setHeight2((short) 180);
//        command.setHeight3((short) 1645);
//        command.setHeight4((short) (2 * 1645));
//        command.setHeight5((short) (3 * 1645));
        return command;
    }
@@ -476,11 +490,11 @@
        command.setLiftNo(liftNo);//提升机号
        command.setTaskNo(taskNo);//任务号
        command.setDistPosition(position);//目标楼层
        command.setSpeed((short) 200);
        command.setHeight2((short) 180);
        command.setHeight3((short) 1645);
        command.setHeight4((short) 3290);
        command.setHeight5((short) 4945);
//        command.setSpeed((short) 200);
//        command.setHeight2((short) 180);
//        command.setHeight3((short) 1645);
//        command.setHeight4((short) 3290);
//        command.setHeight5((short) 4945);
        return command;
    }