2026.3.18 晚
新增agv获取输送机接口
This commit is contained in:
@@ -1,14 +1,22 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackRequest;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackResponse;
|
||||
import com.ruoyi.api.mapper.RequestLogMapper;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.api.service.impl.RequestLogServiceImpl;
|
||||
import com.ruoyi.common.annotation.RequestLog;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -18,13 +26,15 @@ import java.util.Map;
|
||||
@RequestMapping("/agv/api")
|
||||
@Slf4j
|
||||
public class AgvController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RequestLogServiceImpl requestLogService;
|
||||
|
||||
@Autowired
|
||||
private IApiService apiService;
|
||||
|
||||
/**
|
||||
* agv执行状态返回接口
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@@ -34,15 +44,14 @@ public class AgvController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
* @param param{
|
||||
* startPoint:起始点
|
||||
* endPoint:结束点
|
||||
* containerCode:容器编号
|
||||
* taskNo:任务号
|
||||
* }
|
||||
*
|
||||
* @param param{ startPoint:起始点
|
||||
* endPoint:结束点
|
||||
* containerCode:容器编号
|
||||
* taskNo:任务号
|
||||
* }
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/receiveAgvMoveJob")
|
||||
@@ -50,4 +59,26 @@ public class AgvController extends BaseController {
|
||||
return apiService.receiveAgvMoveJob(param);
|
||||
}
|
||||
|
||||
// agv 获取请求获取输送机空闲信号
|
||||
@PostMapping("/getDeviceMsg")
|
||||
@RequestLog
|
||||
public AjaxResult getDeviceMsg(@RequestBody Map<String, String> param) {
|
||||
DeviceSsj ssj = apiService.getDeviceMsg(param.get("taskNo"));
|
||||
com.ruoyi.api.domain.RequestLog requestLog = new com.ruoyi.api.domain.RequestLog();
|
||||
requestLog.setRequestBody(JSONUtil.toJsonStr(param));
|
||||
requestLog.setRequestMethod("getDeviceMsg");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLog.setRequestTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
requestLog.setRequestUrl("http://192.168.188.236:8081/agv/api/getDeviceMsg");
|
||||
requestLog.setRequestMethod("post");
|
||||
requestLog.setSourceSystem("agv");
|
||||
requestLog.setTargetSystem("wcs");
|
||||
requestLog.setEndpoint("获取输送机信号");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success(ssj)));
|
||||
requestLog.setResponseStatus("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return AjaxResult.success(ssj);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRespons
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
|
||||
@@ -136,4 +137,8 @@ public interface IApiService
|
||||
AjaxResult allotSpace(JobParam jobParam);
|
||||
|
||||
AjaxResult JobFinish(Map<String, Object> param);
|
||||
|
||||
DeviceSsj getDeviceMsg(String taskNo);
|
||||
|
||||
DeviceSsj getDeviceMsgSsj(String entranceId);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.job.service.IMydoJobService;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
@@ -51,6 +53,8 @@ public class ApiServiceImpl implements IApiService {
|
||||
private IAgvQueueService agvQueueService;
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
|
||||
|
||||
|
||||
@@ -447,4 +451,21 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceSsj getDeviceMsg(String taskNo) {
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Long.valueOf(taskNo));
|
||||
DeviceSsj ssj = new DeviceSsj();
|
||||
ssj.setDeviceCode(mydoJob.getEntranceId());
|
||||
List<DeviceSsj> deviceSsjs = deviceSsjService.selectDeviceSsjList(ssj);
|
||||
return deviceSsjs.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceSsj getDeviceMsgSsj(String entranceId) {
|
||||
DeviceSsj ssj = new DeviceSsj();
|
||||
ssj.setDeviceCode(entranceId);
|
||||
List<DeviceSsj> deviceSsjs = deviceSsjService.selectDeviceSsjList(ssj);
|
||||
return deviceSsjs.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.queue.srgv.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.queue.srgv.domain.WcsSrgvQueue;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 四向小车任务队列Mapper接口
|
||||
|
||||
@@ -309,7 +309,8 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
||||
minXDistance = currentXDistance;
|
||||
bestSrgv = srgv;
|
||||
log.info("楼层相等,找到更近小车(Y轴更优) Y距离{} X距离{} srgv:{}", currentYDistance, currentXDistance, srgv);
|
||||
} else if (currentYDistance == minYDistance) {
|
||||
}
|
||||
if (currentYDistance == minYDistance) {
|
||||
// 情况2:Y轴距离相同,比较X轴距离
|
||||
if (currentXDistance < minXDistance) {
|
||||
minXDistance = currentXDistance;
|
||||
@@ -569,7 +570,8 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
||||
minXDistance = currentXDistance;
|
||||
bestSrgv = srgv;
|
||||
log.info("楼层相等,找到更近小车(Y轴更优) Y距离{} X距离{} srgv:{}", currentYDistance, currentXDistance, srgv);
|
||||
} else if (currentYDistance == minYDistance) {
|
||||
}
|
||||
if (currentYDistance == minYDistance) {
|
||||
// 情况2:Y轴距离相同,比较X轴距离
|
||||
if (currentXDistance < minXDistance) {
|
||||
minXDistance = currentXDistance;
|
||||
@@ -1465,7 +1467,7 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
||||
case "2":
|
||||
MydoJob mydoJobOut = mydoJobService.selectMydoJobByTaskNo(Long.valueOf(wcsSrgvQueue.getTaskNo()));
|
||||
if (mydoJobOut != null && (cargoPlaceSite.equals(currSite))) {
|
||||
log.info("1471 taskNo:[{}],currSite:[{}],cargoPlaceSite:[{}]",wcsSrgvQueue.getTaskNo(),currSite,cargoPlaceSite);
|
||||
log.info("1471 taskNo:[{}],currSite:[{}],cargoPlaceSite:[{}]", wcsSrgvQueue.getTaskNo(), currSite, cargoPlaceSite);
|
||||
JobCallBack jobCallBack = new JobCallBack();
|
||||
jobCallBack.setType(wcsSrgvQueue.getDefault02());
|
||||
jobCallBack.setMydojobId(mydoJobOut.getJobId());
|
||||
@@ -1513,16 +1515,16 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
||||
{
|
||||
wcsSagvQueueMapper.deleteWcsSrgvQueueByGuid(wcsSrgvQueue.getGuid());
|
||||
}
|
||||
// 如果是空车且 任务是点到点并且目标点是“070301”
|
||||
}else if ("1".equals(taskType)&&wcsSrgvQueue.getDefault02().equals("4")&&wcsSrgvQueue.getEndSite().equals("070301")){
|
||||
// 如果是空车且 任务是点到点并且目标点是“070301”
|
||||
} else if ("1".equals(taskType) && wcsSrgvQueue.getDefault02().equals("4") && wcsSrgvQueue.getEndSite().equals("070301")) {
|
||||
String endSite = "";
|
||||
String xfType = "";
|
||||
WcsSrgvMap wcsSrgvMapq = wcsSrgvMapService.selectWcsSrgvMapBySiteId(cargoPickSite);
|
||||
WcsSrgvMap wcsSrgvMapf = wcsSrgvMapService.selectWcsSrgvMapBySiteId(cargoPlaceSite);
|
||||
// 取货点地图和放货点地图不为空
|
||||
if (wcsSrgvMapq != null && wcsSrgvMapf != null) {
|
||||
//如果是同层,终点为取货点
|
||||
endSite = cargoPickSite;
|
||||
//如果是同层,终点为取货点
|
||||
endSite = cargoPickSite;
|
||||
// 更新目标点,修改执行队列
|
||||
wcsSrgvQueue.setEndSite(endSite);
|
||||
wcsSrgvQueue.setDefault02("4");
|
||||
|
||||
Reference in New Issue
Block a user