From 191f08b7a74c461d1914652aed737888967a69f1 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 19 十月 2023 16:51:38 +0800
Subject: [PATCH] #地图增加分布式锁

---
 src/main/java/com/zy/common/utils/RobotUtils.java |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/RobotUtils.java b/src/main/java/com/zy/common/utils/RobotUtils.java
index 2db7119..5c3f2b9 100644
--- a/src/main/java/com/zy/common/utils/RobotUtils.java
+++ b/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) {

--
Gitblit v1.9.1