package com.zy.asrs.wcs.core.map.websocket;
|
|
import com.alibaba.fastjson.JSON;
|
import com.zy.asrs.wcs.core.map.entity.MapWsShuttleVo;
|
import com.zy.asrs.wcs.core.map.entity.MapWsVo;
|
import com.zy.asrs.wcs.core.utils.Utils;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* Created by vincent on 4/3/2024
|
*/
|
@Component
|
public class MockScheduler {
|
|
private int row = 1;
|
private int bay = 1;
|
private int lev = 1;
|
|
@Scheduled(cron = "0/1 * * * * ? ")
|
public void mock() {
|
MapWsVo wsVo = new MapWsVo();
|
|
// shuttle
|
MapWsShuttleVo shuttleVo = new MapWsShuttleVo();
|
shuttleVo.setShuttleNo("1");
|
|
|
if (bay < 30) {
|
bay ++;
|
} else {
|
bay = 1;
|
if (row < 10) {
|
row ++;
|
} else {
|
row = 1;
|
}
|
}
|
|
shuttleVo.setCurLocNo(Utils.getLocNo(row, bay, lev));
|
wsVo.getShuttleVos().add(shuttleVo);
|
|
MapWebSocket.broadcast(JSON.toJSONString(wsVo));
|
}
|
|
}
|