Junjie
13 小时以前 f305e5244e059c5e43566412f69b180e2e790026
src/main/java/com/zy/core/network/fake/ZyDualCrnFakeConnect.java
@@ -2,7 +2,7 @@
import com.alibaba.fastjson.JSON;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.core.enums.CrnStatusType;
import com.zy.core.enums.DualCrnStatusType;
import com.zy.core.enums.DualCrnTaskModeType;
import com.zy.core.model.CommandResponse;
import com.zy.core.model.command.DualCrnCommand;
@@ -20,6 +20,8 @@
    private final ExecutorService executor = Executors
            .newFixedThreadPool(9999);
    private int taskExecuteStation = 0;
    private DualCrnCommand station1LastCommand = null;
    private DualCrnCommand station2LastCommand = null;
    public ZyDualCrnFakeConnect(DeviceConfig deviceConfig) {
        this.deviceConfig = deviceConfig;
@@ -71,13 +73,29 @@
                this.crnStatus.setTaskNo(0);
            }
            this.crnStatus.setTaskReceive(0);
            this.crnStatus.setStatus(CrnStatusType.IDLE.id);
            if (station1LastCommand == null) {
                this.crnStatus.setStatus(DualCrnStatusType.IDLE.id);
            }else {
                if (station1LastCommand.getTaskMode().intValue() == DualCrnTaskModeType.PICK.id) {
                    this.crnStatus.setStatus(DualCrnStatusType.FETCH_COMPLETE.id);
                }else {
                    this.crnStatus.setStatus(DualCrnStatusType.IDLE.id);
                }
            }
        }else {
            if (crnStatus.getLoadedTwo() == 0) {
                this.crnStatus.setTaskNoTwo(0);
            }
            this.crnStatus.setTaskReceiveTwo(0);
            this.crnStatus.setStatusTwo(CrnStatusType.IDLE.id);
            if (station2LastCommand == null) {
                this.crnStatus.setStatusTwo(DualCrnStatusType.IDLE.id);
            }else {
                if (station1LastCommand.getTaskMode().intValue() == DualCrnTaskModeType.PICK.id) {
                    this.crnStatus.setStatusTwo(DualCrnStatusType.FETCH_COMPLETE.id);
                }else {
                    this.crnStatus.setStatusTwo(DualCrnStatusType.IDLE.id);
                }
            }
        }
    }
@@ -103,16 +121,16 @@
        if(command.getStation() == 1) {
            this.crnStatus.setTaskNo(taskNo);
            this.crnStatus.setStatus(CrnStatusType.MOVING.id);
            this.crnStatus.setStatus(DualCrnStatusType.PUT_MOVING.id);
            this.crnStatus.setTaskReceive(1);
            moveYZ(this.crnStatus.getBay(), destinationPosY, this.crnStatus.getLevel(), destinationPosZ, command.getStation());
            this.crnStatus.setStatus(CrnStatusType.WAITING.id);
            this.crnStatus.setStatus(DualCrnStatusType.WAITING.id);
        }else {
            this.crnStatus.setTaskNoTwo(taskNo);
            this.crnStatus.setStatusTwo(CrnStatusType.MOVING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.PUT_MOVING.id);
            this.crnStatus.setTaskReceive(1);
            moveYZ(this.crnStatus.getBay(), destinationPosY, this.crnStatus.getLevel(), destinationPosZ, command.getStation());
            this.crnStatus.setStatusTwo(CrnStatusType.WAITING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.WAITING.id);
        }
        taskExecuteStation = 0;
@@ -143,48 +161,52 @@
        if(command.getStation() == 1) {
            this.crnStatus.setTaskNo(taskNo);
            this.crnStatus.setStatus(CrnStatusType.FETCH_MOVING.id);
            this.crnStatus.setStatus(DualCrnStatusType.FETCH_MOVING.id);
            this.crnStatus.setTaskReceive(1);
            moveYZ(this.crnStatus.getBay(), sourcePosY,this.crnStatus.getLevel(), sourcePosZ,command.getStation());
            this.crnStatus.setStatus(CrnStatusType.FETCHING.id);
            this.crnStatus.setStatus(DualCrnStatusType.FETCHING.id);
            sleep(2000);
            if (Thread.currentThread().isInterrupted()) {
                return;
            }
            this.crnStatus.setLoaded(1);
            this.crnStatus.setStatus(CrnStatusType.PUT_MOVING.id);
            this.crnStatus.setStatus(DualCrnStatusType.PUT_MOVING.id);
            moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation());
            this.crnStatus.setStatus(CrnStatusType.PUTTING.id);
            this.crnStatus.setStatus(DualCrnStatusType.PUTTING.id);
            sleep(2000);
            if (Thread.currentThread().isInterrupted()) {
                return;
            }
            this.crnStatus.setLoaded(0);
            this.crnStatus.setStatus(CrnStatusType.WAITING.id);
            this.crnStatus.setStatus(DualCrnStatusType.WAITING.id);
            this.station1LastCommand = command;
        }else {
            this.crnStatus.setTaskNoTwo(taskNo);
            this.crnStatus.setStatusTwo(CrnStatusType.FETCH_MOVING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.FETCH_MOVING.id);
            this.crnStatus.setTaskReceiveTwo(1);
            moveYZ(this.crnStatus.getBay(), sourcePosY,this.crnStatus.getLevel(), sourcePosZ, command.getStation());
            this.crnStatus.setStatusTwo(CrnStatusType.FETCHING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.FETCHING.id);
            sleep(2000);
            if (Thread.currentThread().isInterrupted()) {
                return;
            }
            this.crnStatus.setLoadedTwo(1);
            this.crnStatus.setStatusTwo(CrnStatusType.PUT_MOVING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.PUT_MOVING.id);
            moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation());
            this.crnStatus.setStatusTwo(CrnStatusType.PUTTING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.PUTTING.id);
            sleep(2000);
            if (Thread.currentThread().isInterrupted()) {
                return;
            }
            this.crnStatus.setLoadedTwo(0);
            this.crnStatus.setStatusTwo(CrnStatusType.WAITING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.WAITING.id);
            this.station2LastCommand = command;
        }
        taskExecuteStation = 0;
@@ -212,30 +234,34 @@
        if(command.getStation() == 1) {
            this.crnStatus.setTaskNo(taskNo);
            this.crnStatus.setStatus(CrnStatusType.FETCH_MOVING.id);
            this.crnStatus.setStatus(DualCrnStatusType.FETCH_MOVING.id);
            this.crnStatus.setTaskReceive(1);
            moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation());
            this.crnStatus.setStatus(CrnStatusType.FETCHING.id);
            this.crnStatus.setStatus(DualCrnStatusType.FETCHING.id);
            sleep(3000);
            if (Thread.currentThread().isInterrupted()) {
                return;
            }
            this.crnStatus.setLoaded(1);
            this.crnStatus.setStatus(CrnStatusType.WAITING.id);
            this.crnStatus.setStatus(DualCrnStatusType.WAITING.id);
            this.station1LastCommand = command;
        }else {
            this.crnStatus.setTaskNoTwo(taskNo);
            this.crnStatus.setStatusTwo(CrnStatusType.FETCH_MOVING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.FETCH_MOVING.id);
            this.crnStatus.setTaskReceiveTwo(1);
            moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation());
            this.crnStatus.setStatusTwo(CrnStatusType.FETCHING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.FETCHING.id);
            sleep(3000);
            if (Thread.currentThread().isInterrupted()) {
                return;
            }
            this.crnStatus.setLoadedTwo(1);
            this.crnStatus.setStatusTwo(CrnStatusType.WAITING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.WAITING.id);
            this.station2LastCommand = command;
        }
        taskExecuteStation = 0;
@@ -263,30 +289,34 @@
        if(command.getStation() == 1) {
            this.crnStatus.setTaskNo(taskNo);
            this.crnStatus.setStatus(CrnStatusType.PUT_MOVING.id);
            this.crnStatus.setStatus(DualCrnStatusType.PUT_MOVING.id);
            this.crnStatus.setTaskReceive(1);
            moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation());
            this.crnStatus.setStatus(CrnStatusType.PUTTING.id);
            this.crnStatus.setStatus(DualCrnStatusType.PUTTING.id);
            sleep(3000);
            if (Thread.currentThread().isInterrupted()) {
                return;
            }
            this.crnStatus.setLoaded(0);
            this.crnStatus.setStatus(CrnStatusType.WAITING.id);
            this.crnStatus.setStatus(DualCrnStatusType.WAITING.id);
            this.station1LastCommand = command;
        }else {
            this.crnStatus.setTaskNoTwo(taskNo);
            this.crnStatus.setStatusTwo(CrnStatusType.PUT_MOVING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.PUT_MOVING.id);
            this.crnStatus.setTaskReceiveTwo(1);
            moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation());
            this.crnStatus.setStatusTwo(CrnStatusType.PUTTING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.PUTTING.id);
            sleep(3000);
            if (Thread.currentThread().isInterrupted()) {
                return;
            }
            this.crnStatus.setLoadedTwo(0);
            this.crnStatus.setStatusTwo(CrnStatusType.WAITING.id);
            this.crnStatus.setStatusTwo(DualCrnStatusType.WAITING.id);
            this.station2LastCommand = command;
        }
        taskExecuteStation = 0;