#
Junjie
4 天以前 0c1110daa59bf77ddcff2704641280f417158c10
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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_query", description = "按任务号、状态、设备、条码、库位等条件查询任务数据")
    public Object queryTasks(
            @ToolParam(description = "内部工作号列表 wrkNos", required = false) List<Integer> wrkNos,
            @ToolParam(description = "WMS任务号列表 wmsWrkNos", required = false) List<String> wmsWrkNos,
            @ToolParam(description = "任务状态列表 wrkStsList", required = false) List<Long> wrkStsList,
            @ToolParam(description = "入出库类型列表 ioTypeList", required = false) List<Integer> ioTypeList,
            @ToolParam(description = "堆垛机编号", required = false) Integer crnNo,
            @ToolParam(description = "双工位堆垛机编号", required = false) Integer dualCrnNo,
            @ToolParam(description = "RGV编号", required = false) Integer rgvNo,
            @ToolParam(description = "条码关键字", required = false) String barcode,
            @ToolParam(description = "批次号关键字", required = false) String batch,
            @ToolParam(description = "源库位关键字", required = false) String sourceLocNo,
            @ToolParam(description = "目标库位关键字", required = false) String locNo,
            @ToolParam(description = "源站号", required = false) Integer sourceStaNo,
            @ToolParam(description = "目标站号", required = false) Integer staNo,
            @ToolParam(description = "返回条数上限,默认 200,最大 500", required = false) Integer limit) {
        return wcsDataFacade.getTasks(json()
                .fluentPut("wrkNos", wrkNos)
                .fluentPut("wmsWrkNos", wmsWrkNos)
                .fluentPut("wrkStsList", wrkStsList)
                .fluentPut("ioTypeList", ioTypeList)
                .fluentPut("crnNo", crnNo)
                .fluentPut("dualCrnNo", dualCrnNo)
                .fluentPut("rgvNo", rgvNo)
                .fluentPut("barcode", barcode)
                .fluentPut("batch", batch)
                .fluentPut("sourceLocNo", sourceLocNo)
                .fluentPut("locNo", locNo)
                .fluentPut("sourceStaNo", sourceStaNo)
                .fluentPut("staNo", staNo)
                .fluentPut("limit", limit));
    }
 
    @Tool(name = "log_query", description = "通过筛选条件查询系统运行日志数据")
    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();
    }
}