小车调度
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
package com.ruoyi.schedule.scheduleTask.srgv;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.ruoyi.bas.port.domain.WcsPort;
|
||||
import com.ruoyi.bas.port.mapper.WcsPortMapper;
|
||||
import com.ruoyi.bas.port.service.IWcsPortService;
|
||||
import com.ruoyi.device.srgv.domain.DeviceSrgv;
|
||||
import com.ruoyi.queue.srgv.domain.WcsSrgvQueue;
|
||||
import com.ruoyi.queue.srgv.service.IWcsSrgvQueueFinishService;
|
||||
import com.ruoyi.queue.srgv.service.IWcsSrgvQueueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -14,6 +23,11 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
||||
|
||||
public HashMap<String, List<DeviceSrgv>> sRgvCodeList;
|
||||
|
||||
public IWcsSrgvQueueService wcsSagvQueueMapper;
|
||||
|
||||
public IWcsSrgvQueueFinishService wcsSagvQueueFinishMapper;
|
||||
|
||||
public IWcsPortService wcsPortService;
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +44,10 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
||||
for (DeviceSrgv deviceSrgv : sRgvCodeList.get(type)) {
|
||||
try {
|
||||
if (ObjUtil.isNotNull(deviceSrgv)) {
|
||||
sRgvTask(deviceSrgv);
|
||||
//循环所有楼层
|
||||
for (int i = 1; i <= 8; i++) {
|
||||
sRgvTask(deviceSrgv);
|
||||
}
|
||||
} else {
|
||||
log.error("堆垛机设备为空");
|
||||
}
|
||||
@@ -51,12 +68,12 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
||||
/**
|
||||
* 四向小车任务处理
|
||||
*/
|
||||
private void sRgvTask(DeviceSrgv deviceSrgv) {
|
||||
private void sRgvTask(DeviceSrgv deviceSrgv,int floor) {
|
||||
//处理队列下发
|
||||
resQueue(deviceSrgv);
|
||||
resQueue(deviceSrgv,floor);
|
||||
|
||||
//小车完成队列
|
||||
completeCarTask(deviceSrgv);
|
||||
completeCarTask(deviceSrgv,floor);
|
||||
|
||||
//小车发送任务
|
||||
sendTask(deviceSrgv);
|
||||
@@ -89,15 +106,78 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
||||
/**
|
||||
* 小车完成队列
|
||||
*/
|
||||
private void completeCarTask(DeviceSrgv deviceSrgv) {
|
||||
private void completeCarTask(DeviceSrgv deviceSrgv,int floor) {
|
||||
if (deviceSrgv.getWorkMode()==5){
|
||||
//22到达充电位置 23到达换层目标
|
||||
if (deviceSrgv.getStatus() == 1 || (deviceSrgv.getStatus() == 2 && (deviceSrgv.getWorkPhase() == 22 || deviceSrgv.getWorkPhase() == 23))) {
|
||||
WcsSrgvQueue param = new WcsSrgvQueue();
|
||||
param.setAgvId(Convert.toStr(deviceSrgv.getDeviceId()));
|
||||
param.setEndSite(deviceSrgv.getCurrSite());//目标点
|
||||
param.setIssued("1");
|
||||
param.setExecutionStatus("1");//
|
||||
List<WcsSrgvQueue> wcsSagvQueues = wcsSagvQueueMapper.selectWcsSrgvQueueList(param);//查询到达目标的
|
||||
if (CollUtil.isNotEmpty(wcsSagvQueues)) {
|
||||
WcsSrgvQueue wcsSrgvQueue = wcsSagvQueues.get(0);
|
||||
|
||||
/*
|
||||
* 1、处理终点是提升机站点的四向车
|
||||
* 2、处理终点不是提升机站点的
|
||||
* */
|
||||
boolean taskFinishFlag = finishTaskByQueue(deviceSrgv.getCurrSite(), wcsSrgvQueue, floor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 队列完成
|
||||
* @param currSite
|
||||
* @param wcsSrgvQueue
|
||||
* @param floor
|
||||
* @return
|
||||
*/
|
||||
private boolean finishTaskByQueue(String currSite, WcsSrgvQueue wcsSrgvQueue, int floor) {
|
||||
if (currSite.equals(wcsSrgvQueue.getEndSite())){
|
||||
//当前在放货站点
|
||||
WcsPort param = new WcsPort();
|
||||
param.setPortCode(currSite);
|
||||
List<WcsPort> wcsPorts = wcsPortService.selectWcsPortList(param);
|
||||
if (CollUtil.isNotEmpty(wcsPorts)){
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 队列处理
|
||||
* @param deviceSrgv
|
||||
*/
|
||||
private void resQueue(DeviceSrgv deviceSrgv) {
|
||||
private void resQueue(DeviceSrgv deviceSrgv, int floor) {
|
||||
int taskNo = deviceSrgv.getTaskNo();
|
||||
String currSite = deviceSrgv.getCurrSite();
|
||||
Integer deviceId = deviceSrgv.getDeviceId();
|
||||
|
||||
if (taskNo>999 && !"000000".equals(currSite)){
|
||||
WcsSrgvQueue param = new WcsSrgvQueue();
|
||||
param.setTheFloor(Convert.toStr(floor));
|
||||
param.setTaskNo(Convert.toStr(taskNo));
|
||||
param.setIssued("0");
|
||||
param.setAgvId(String.valueOf(deviceId));
|
||||
List<WcsSrgvQueue> wcsSagvQueues = wcsSagvQueueMapper.selectWcsSrgvQueueList(param);
|
||||
|
||||
if (CollUtil.isNotEmpty(wcsSagvQueues)){
|
||||
WcsSrgvQueue wcsSrgvQueue = wcsSagvQueues.get(0);
|
||||
|
||||
String startSite = wcsSrgvQueue.getStartSite();
|
||||
|
||||
if (!startSite.equals(currSite)){
|
||||
wcsSrgvQueue.setIssued("1");
|
||||
wcsSrgvQueue.setStartDate(DateUtil.now());
|
||||
wcsSagvQueueMapper.updateWcsSrgvQueue(wcsSrgvQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user