自动化立体仓库 - WCS系统
Junjie
2023-10-19 191f08b7a74c461d1914652aed737888967a69f1
src/main/java/com/zy/common/utils/RobotUtils.java
@@ -23,7 +23,7 @@
        try {
            String response = new HttpHandler.Builder()
                    .setUri(robotUrl)
                    .setPath("/api/wcs/is_system_ready")
                    .setPath("/adaptor/api/wcs/is_vp_ready")
                    .setJson(JSON.toJSONString(map))
                    .build()
                    .doPost();
@@ -40,9 +40,22 @@
    }
    //WCS向机械臂下发单拆任务
    public static boolean sendTask(String taskId, Map<String, Object> skuInfo, String from, String to) {
    public static boolean sendTask(String taskId, Integer skuNum, String from) {
        Environment environment = SpringUtils.getBean(Environment.class);
        String robotUrl = environment.getProperty("robot.url");
        Map<String, Object> skuInfo = new HashMap<>();
        skuInfo.put("sku_id", "1");
        skuInfo.put("length", 500);
        skuInfo.put("width", 350);
        skuInfo.put("height", 200);
        skuInfo.put("weight", 1);
        skuInfo.put("sku_num", skuNum);
        String to = "307";
        if (from.equals("317")) {
            to = "310";
        }
        HashMap<String, Object> map = new HashMap<>();
        map.put("task_id", taskId);
@@ -52,14 +65,15 @@
        try {
            String response = new HttpHandler.Builder()
                    .setUri(robotUrl)
                    .setPath("api/wcs/single_class_depal_task")
                    .setPath("/adaptor/api/wcs/task/single_depal")
                    .setJson(JSON.toJSONString(map))
                    .build()
                    .doPost();
            JSONObject data = JSON.parseObject(response);
            int error = Integer.parseInt(data.get("error").toString());
            if (error == 0) {
            int code = Integer.parseInt(data.get("code").toString());
            String msg = data.get("msg").toString();
            if (code == 0 && msg.equals("success")) {
                return true;//成功
            }
        } catch (IOException e) {