From 14f2c4fce50c871d84f89d2dca2298e0892b4672 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期二, 05 五月 2026 08:25:26 +0800
Subject: [PATCH] Merge branch 'rcs_master_1.0' into rcs_master_all

---
 zy-acs-cv/src/main/java/com/zy/asrs/service/impl/WmsMainServiceImpl.java |   84 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/zy-acs-cv/src/main/java/com/zy/asrs/service/impl/WmsMainServiceImpl.java b/zy-acs-cv/src/main/java/com/zy/asrs/service/impl/WmsMainServiceImpl.java
new file mode 100644
index 0000000..85bfb20
--- /dev/null
+++ b/zy-acs-cv/src/main/java/com/zy/asrs/service/impl/WmsMainServiceImpl.java
@@ -0,0 +1,84 @@
+package com.zy.asrs.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.zy.acs.framework.exception.CoolException;
+import com.zy.asrs.controller.vo.ApplyInDto;
+import com.zy.asrs.controller.vo.ApplyInRepsonseDto;
+import com.zy.asrs.service.WmsMainService;
+import com.zy.common.utils.HttpHandler;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 绔嬩綋浠撳簱WCS绯荤粺涓绘祦绋嬩笟鍔�
+ * Created by vincent on 2020/8/6
+ */
+@Slf4j
+@Service
+@Transactional
+@Data
+public class WmsMainServiceImpl implements WmsMainService {
+
+
+    @Value("${wms.url}")
+    private String wmsUrl;
+
+
+    @Value("${wms.apply}")
+    private String apply;
+
+    private String code = "code";
+
+    private String dataCode = "data";
+
+    private Integer codeValue = 200;
+
+    private Integer timeout = 1200;
+
+
+    /**
+     * 妫�鏌ョ珯鐐圭姸鎬�
+     *
+     * @param applyInDto 绔欑偣缂栧彿
+     * @return 搴撲綅淇℃伅
+     */
+    public ApplyInRepsonseDto getLocOfWms(ApplyInDto applyInDto) {
+        String response = "";
+        try {
+            response = new HttpHandler.Builder()
+                    .setUri(wmsUrl)
+                    .setPath(apply)
+                    .setTimeout(timeout, TimeUnit.SECONDS)
+                    .setJson(JSON.toJSONString(applyInDto))
+                    .build()
+                    .doPost();
+            log.info("WMS杩斿洖鏁版嵁锛歿}", response);
+            JSONObject jsonObject = JSON.parseObject(response);
+            if (jsonObject.get(code) != null && jsonObject.getInteger(code).equals(codeValue)) {
+                return JSONObject.parseObject(jsonObject.getString(dataCode), ApplyInRepsonseDto.class);
+            } else {
+                log.error("璋冪敤涓嬪彂浠诲姟鎺ュ彛鎶ラ敊锛屽搷搴旂爜锛歿}锛屽搷搴斿唴瀹癸細{}", jsonObject.getInteger(code), response);
+                //throw new CoolException("璋冪敤涓嬪彂浠诲姟鎺ュ彛鎶ラ敊锛屽搷搴旂爜锛�" + jsonObject.getInteger(code));
+            }
+        } catch (CoolException e) {
+            log.error("璋冪敤绔欑偣鐘舵�佹帴鍙e紓甯�", e);
+            //throw e;
+        } catch (Exception e) {
+            log.error("妫�鏌ョ珯鐐圭姸鎬佸け璐ワ紝鏉$爜缂栧彿锛歿},绔欑偣锛歿}", applyInDto.getBarcode(), applyInDto.getStaNo(), e);
+        }
+        return null;
+    }
+
+    public static void main(String[] args) {
+        String s= "{\"msg\":\"Success\",\"code\":200,\"data\":{\"locNo\":\"A102400201\",\"batchNo\":\"TK2603104428\",\"taskNo\":\"TK2603104428\"}}";
+        //System.out.println(JSON.parseObject(s).getString("data"));
+        ApplyInRepsonseDto applyInRepsonseDto = JSONObject.parseObject(JSON.parseObject(s).getString("data"), ApplyInRepsonseDto.class);
+        System.out.println(applyInRepsonseDto);
+    }
+}

--
Gitblit v1.9.1