Junjie
2 天以前 63b01db83d9aad8a15276b4236a9a22e4aeef065
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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.Date;
 
@Component
@RequiredArgsConstructor
public class DataAnalysisMcpTools {
 
    private final WcsDataFacade wcsDataFacade;
 
    @Tool(name = "analysis_query_task_throughput", description = "查询指定时间范围内的任务吞吐量统计:任务总量、入库/出库/移库数量、平均时长、故障汇总")
    public Object queryTaskThroughput(
            @ToolParam(description = "分析开始时间") Date startTime,
            @ToolParam(description = "分析结束时间") Date endTime) {
        return wcsDataFacade.getTaskThroughput(json().fluentPut("startTime", startTime).fluentPut("endTime", endTime));
    }
 
    @Tool(name = "analysis_query_device_fault_summary", description = "查询指定时间范围内的设备故障汇总:按设备类型(堆垛机/双工位堆垛机/RGV/输送线)统计故障次数和故障时长")
    public Object queryDeviceFaultSummary(
            @ToolParam(description = "分析开始时间") Date startTime,
            @ToolParam(description = "分析结束时间") Date endTime) {
        return wcsDataFacade.getDeviceFaultSummary(json().fluentPut("startTime", startTime).fluentPut("endTime", endTime));
    }
 
    @Tool(name = "analysis_query_device_utilization", description = "查询指定时间范围内的设备利用率:按设备编号统计任务分配量、平均任务时长、故障数")
    public Object queryDeviceUtilization(
            @ToolParam(description = "分析开始时间") Date startTime,
            @ToolParam(description = "分析结束时间") Date endTime) {
        return wcsDataFacade.getDeviceUtilization(json().fluentPut("startTime", startTime).fluentPut("endTime", endTime));
    }
 
    @Tool(name = "analysis_query_error_logs", description = "查询指定时间范围内的设备错误日志统计:按设备类型统计错误次数")
    public Object queryErrorLogs(
            @ToolParam(description = "分析开始时间") Date startTime,
            @ToolParam(description = "分析结束时间") Date endTime) {
        return wcsDataFacade.getErrorLogSummary(json().fluentPut("startTime", startTime).fluentPut("endTime", endTime));
    }
 
    private JSONObject json() {
        return new JSONObject();
    }
}