package com.zy.ai.mcp.tool;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.zy.ai.mcp.service.WcsDataFacade;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.ai.tool.annotation.Tool;
|
import org.springframework.ai.tool.annotation.ToolParam;
|
import org.springframework.stereotype.Component;
|
|
import java.util.List;
|
|
@Component
|
@RequiredArgsConstructor
|
public class WcsMcpTools {
|
|
private final WcsDataFacade wcsDataFacade;
|
|
@Tool(name = "device_get_crn_status", description = "通过堆垛机编号查询堆垛机设备实时数据")
|
public Object getCrnDeviceStatus(
|
@ToolParam(description = "堆垛机编号列表,不传则查询全部堆垛机", required = false) List<Integer> crnNos) {
|
return wcsDataFacade.getCrnDeviceStatus(json().fluentPut("crnNos", crnNos));
|
}
|
|
@Tool(name = "device_get_station_status", description = "查询输送线站点设备实时数据")
|
public Object getStationDeviceStatus() {
|
return wcsDataFacade.getStationDeviceStatus(json());
|
}
|
|
@Tool(name = "device_get_rgv_status", description = "通过RGV编号查询RGV设备实时数据")
|
public Object getRgvDeviceStatus(
|
@ToolParam(description = "RGV编号列表,不传则查询全部RGV", required = false) List<Integer> rgvNos) {
|
return wcsDataFacade.getRgvDeviceStatus(json().fluentPut("rgvNos", rgvNos));
|
}
|
|
@Tool(name = "task_list", description = "通过筛选条件查询任务数据")
|
public Object getTasks(
|
@ToolParam(description = "堆垛机编号", required = false) Integer crnNo,
|
@ToolParam(description = "RGV编号", required = false) Integer rgvNo,
|
@ToolParam(description = "任务单号列表", required = false) List<Integer> taskNos,
|
@ToolParam(description = "返回条数上限,默认 200", required = false) Integer limit) {
|
return wcsDataFacade.getTasks(json()
|
.fluentPut("crnNo", crnNo)
|
.fluentPut("rgvNo", rgvNo)
|
.fluentPut("taskNos", taskNos)
|
.fluentPut("limit", limit));
|
}
|
|
@Tool(name = "log_query", description = "通过筛选条件查询 AI 日志数据")
|
public Object getLogs(
|
@ToolParam(description = "返回日志行数上限,默认 500", required = false) Integer limit) {
|
return wcsDataFacade.getLogs(json().fluentPut("limit", limit));
|
}
|
|
@Tool(name = "config_get_device_config", description = "通过设备编号查询设备配置数据")
|
public Object getDeviceConfig(
|
@ToolParam(description = "堆垛机编号列表", required = false) List<Integer> crnNos,
|
@ToolParam(description = "RGV编号列表", required = false) List<Integer> rgvNos,
|
@ToolParam(description = "输送线编号列表", required = false) List<Integer> devpNos) {
|
return wcsDataFacade.getDeviceConfig(json()
|
.fluentPut("crnNos", crnNos)
|
.fluentPut("rgvNos", rgvNos)
|
.fluentPut("devpNos", devpNos));
|
}
|
|
@Tool(name = "config_get_system_config", description = "查询系统配置数据")
|
public Object getSystemConfig() {
|
return wcsDataFacade.getSystemConfig(json());
|
}
|
|
private JSONObject json() {
|
return new JSONObject();
|
}
|
}
|