| | |
| | | private DualCrnCommand station1LastCommand = null; |
| | | private DualCrnCommand station2LastCommand = null; |
| | | |
| | | private long commandWaitMs() { return FakeConfigSupport.getLong(FakeConfigKeys.FAKE_DUAL_CRN_COMMAND_WAIT_MS); } |
| | | private long transferDurationMs() { return FakeConfigSupport.getLong(FakeConfigKeys.FAKE_DUAL_CRN_TRANSFER_DURATION_MS); } |
| | | private long pickDurationMs() { return FakeConfigSupport.getLong(FakeConfigKeys.FAKE_DUAL_CRN_PICK_DURATION_MS); } |
| | | private long putDurationMs() { return FakeConfigSupport.getLong(FakeConfigKeys.FAKE_DUAL_CRN_PUT_DURATION_MS); } |
| | | private long levelStepDurationMs() { return FakeConfigSupport.getLong(FakeConfigKeys.FAKE_DUAL_CRN_LEVEL_STEP_DURATION_MS); } |
| | | private long bayStepDurationMs() { return FakeConfigSupport.getLong(FakeConfigKeys.FAKE_DUAL_CRN_BAY_STEP_DURATION_MS); } |
| | | private long resetDurationMs() { return FakeConfigSupport.getLong(FakeConfigKeys.FAKE_DUAL_CRN_RESET_DURATION_MS); } |
| | | |
| | | public ZyDualCrnFakeConnect(DeviceConfig deviceConfig) { |
| | | this.deviceConfig = deviceConfig; |
| | | this.crnStatus = JSON.parseObject(deviceConfig.getFakeInitStatus(), ZyDualCrnStatusEntity.class); |
| | |
| | | } |
| | | |
| | | private void commandTaskComplete(DualCrnCommand command) { |
| | | sleep(resetDurationMs()); |
| | | if(command.getStation() == 1) { |
| | | if (crnStatus.getLoaded() == 0) { |
| | | this.crnStatus.setTaskNo(0); |
| | |
| | | if (station2LastCommand == null) { |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.IDLE.id); |
| | | }else { |
| | | if (station1LastCommand.getTaskMode().intValue() == DualCrnTaskModeType.PICK.id) { |
| | | if (station2LastCommand.getTaskMode().intValue() == DualCrnTaskModeType.PICK.id) { |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.FETCH_COMPLETE.id); |
| | | }else { |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.IDLE.id); |
| | |
| | | break; |
| | | } |
| | | |
| | | sleep(200); |
| | | sleep(commandWaitMs()); |
| | | } |
| | | |
| | | if(command.getStation() == 1) { |
| | |
| | | }else { |
| | | this.crnStatus.setTaskNoTwo(taskNo); |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.PUT_MOVING.id); |
| | | this.crnStatus.setTaskReceive(1); |
| | | this.crnStatus.setTaskReceiveTwo(1); |
| | | moveYZ(this.crnStatus.getBay(), destinationPosY, this.crnStatus.getLevel(), destinationPosZ, command.getStation()); |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.WAITING.id); |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | sleep(200); |
| | | sleep(commandWaitMs()); |
| | | } |
| | | |
| | | if(command.getStation() == 1) { |
| | |
| | | |
| | | moveYZ(this.crnStatus.getBay(), sourcePosY,this.crnStatus.getLevel(), sourcePosZ,command.getStation()); |
| | | this.crnStatus.setStatus(DualCrnStatusType.FETCHING.id); |
| | | sleep(2000); |
| | | sleep(transferDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | this.crnStatus.setStatus(DualCrnStatusType.PUT_MOVING.id); |
| | | moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation()); |
| | | this.crnStatus.setStatus(DualCrnStatusType.PUTTING.id); |
| | | sleep(2000); |
| | | sleep(transferDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | |
| | | moveYZ(this.crnStatus.getBay(), sourcePosY,this.crnStatus.getLevel(), sourcePosZ, command.getStation()); |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.FETCHING.id); |
| | | sleep(2000); |
| | | sleep(transferDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.PUT_MOVING.id); |
| | | moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation()); |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.PUTTING.id); |
| | | sleep(2000); |
| | | sleep(transferDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | sleep(200); |
| | | sleep(commandWaitMs()); |
| | | } |
| | | |
| | | if(command.getStation() == 1) { |
| | |
| | | |
| | | moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation()); |
| | | this.crnStatus.setStatus(DualCrnStatusType.FETCHING.id); |
| | | sleep(3000); |
| | | sleep(pickDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | |
| | | moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation()); |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.FETCHING.id); |
| | | sleep(3000); |
| | | sleep(pickDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | sleep(200); |
| | | sleep(commandWaitMs()); |
| | | } |
| | | |
| | | if(command.getStation() == 1) { |
| | |
| | | |
| | | moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation()); |
| | | this.crnStatus.setStatus(DualCrnStatusType.PUTTING.id); |
| | | sleep(3000); |
| | | sleep(putDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | |
| | | moveYZ(this.crnStatus.getBay(), destinationPosY,this.crnStatus.getLevel(), destinationPosZ, command.getStation()); |
| | | this.crnStatus.setStatusTwo(DualCrnStatusType.PUTTING.id); |
| | | sleep(3000); |
| | | sleep(putDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | for(int i = 0; i < moveLength; i++) { |
| | | initSourcePosZ++; |
| | | this.crnStatus.setLevel(initSourcePosZ); |
| | | sleep(1000); |
| | | sleep(levelStepDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | initSourcePosZ--; |
| | | this.crnStatus.setLevel(initSourcePosZ); |
| | | this.crnStatus.setLevel(initSourcePosZ); |
| | | sleep(1000); |
| | | sleep(levelStepDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | for(int i = 0; i < moveLength; i++) { |
| | | initSourcePosY++; |
| | | this.crnStatus.setBay(initSourcePosY); |
| | | sleep(500); |
| | | sleep(bayStepDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | |
| | | for(int i = 0; i < moveLength; i++) { |
| | | initSourcePosY--; |
| | | this.crnStatus.setBay(initSourcePosY); |
| | | sleep(500); |
| | | sleep(bayStepDurationMs()); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |