From dda2e4a84cbf54262fd465718b769eb50676977a Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期二, 18 十一月 2025 12:39:13 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 103 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index d004dc4..5c53a63 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -179,6 +179,55 @@
     }
 
     @Override
+    public List<ManLocDetl> pingKuGetList(PKInventoryAdjustment combParam) {
+        Node node = nodeService.selectOne(new EntityWrapper<Node>().eq("name", combParam.getLocno()).eq("type", 3));
+        if (Cools.isEmpty(node)){
+            throw new CoolException("鏈壘鍒板钩搴撳簱浣嶄俊鎭�");
+        }
+        EntityWrapper<ManLocDetl> manLocDetlEntityWrapper = new EntityWrapper<>();
+        manLocDetlEntityWrapper.eq("loc_no", node.getName());
+        manLocDetlEntityWrapper.eq(!Cools.isEmpty(combParam.getMatnr()),"matnr", combParam.getMatnr());
+        List<ManLocDetl> manLocDetls = manLocDetlService.selectList(manLocDetlEntityWrapper);
+        if (Cools.isEmpty(manLocDetls)){
+            throw new CoolException("鏈壘鍒板簱瀛樹俊鎭�");
+        }
+        return manLocDetls;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void pingKuInventoryAdjustment(PKInventoryAdjustment combParam) {
+        Node node = nodeService.selectOne(new EntityWrapper<Node>().eq("name", combParam.getLocno()).eq("type", 3));
+        if (Cools.isEmpty(node)){
+            throw new CoolException("鏈壘鍒板钩搴撳簱浣嶄俊鎭�");
+        }
+        for (ManLocDetl manLocDetl :combParam.getManLocDetls()){
+            EntityWrapper<ManLocDetl> manLocDetlEntityWrapper = new EntityWrapper<>();
+            manLocDetlEntityWrapper.eq("loc_no", manLocDetl.getLocNo());
+            manLocDetlEntityWrapper.eq("matnr", manLocDetl.getMatnr());
+            manLocDetlEntityWrapper.eq("batch", manLocDetl.getBatch());
+            List<ManLocDetl> manLocDetls = manLocDetlService.selectList(manLocDetlEntityWrapper);
+            if (Cools.isEmpty(manLocDetls) || manLocDetls.size() > 1){
+                throw new CoolException("鏁版嵁閿欒");
+            }
+
+            ManLocDetl manLocDetl1 = manLocDetls.get(0);
+            BigDecimal adjustBigDecimal = new BigDecimal(manLocDetl.getAnfme().toString());
+            BigDecimal orgBigDecimal = new BigDecimal(manLocDetl1.getAnfme().toString());
+            if (orgBigDecimal.compareTo(adjustBigDecimal) == 0){
+                continue;
+            }
+            manLocDetl1.setAnfme(adjustBigDecimal.doubleValue());
+            if (!manLocDetlService.update(manLocDetl1,manLocDetlEntityWrapper)){
+                throw new CoolException("鏇存柊鏁版嵁澶辫触");
+            }
+
+
+
+        }
+    }
+
+    @Override
     public R inLocCallAgv(String sta, String inSta) {
 
         BasDevp basDevp = basDevpMapper.selectById(inSta);
@@ -273,6 +322,57 @@
         }
 
         return success ? R.ok("鍛煎彨agv鎴愬姛") : R.parse(message);
+    }
+
+    @Override
+    public R unbind2(String site) {
+        String staMap = AgvSiteConstant.SiteMap.get(site);
+        if (staMap == null) {
+            return R.parse("娌℃湁鎵惧埌璇ョ珯鐐圭殑鍏ュ簱鏄犲皠锛�" + site);
+        }
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("reqCode",UUID.randomUUID().toString().replace("-", "")); // 璇锋眰鍞竴鍊�
+        jsonObject.put("ctnrTyp","3"); // 瀹瑰櫒绫诲瀷2
+        jsonObject.put("stgBinCode",staMap); // 浠撲綅缂栧彿锛屾牴鎹浠撶紪鍙疯浆鎹�
+        jsonObject.put("indBind","0"); // 1缁戝畾锛�0瑙g粦
+
+        String body = jsonObject.toJSONString();
+        String response = "";
+        String message = "";
+        boolean success = false;
+        try {
+            response = new HttpHandler.Builder()
+                    .setUri(ApiInterfaceConstant.AGV_IP)
+                    .setPath(ApiInterfaceConstant.AGV_BIND_PATH)
+                    .setJson(body)
+                    .build()
+                    .doPost();
+            JSONObject res = JSON.parseObject(response);
+            message = res.getString("message");
+            if (res.getInteger("code").equals(0)) {
+                success = true;
+            } else {
+                log.error("璋冪敤agv瑙g粦鏆傚瓨浣嶅け璐ワ紒锛侊紒url锛歿}锛況equest锛歿}锛況esponse锛歿}", ApiInterfaceConstant.AGV_IP + ApiInterfaceConstant.AGV_BIND_PATH, body, response);
+            }
+        } catch (Exception e) {
+            log.error("璋冪敤agv瑙g粦鏆傚瓨浣嶅紓甯�", e);
+        } finally {
+            try {
+                // 淇濆瓨鎺ュ彛鏃ュ織
+                apiLogService.save(
+                        "璋冪敤agv瑙g粦鏆傚瓨浣�",
+                        ApiInterfaceConstant.AGV_IP + ApiInterfaceConstant.AGV_BIND_PATH,
+                        null,
+                        "127.0.0.1",
+                        body,
+                        response,
+                        success
+                );
+            } catch (Exception e) {
+                log.error("", e);
+            }
+        }
+        return success ? R.ok("瑙g粦鎴愬姛") : R.parse(message);
     }
 
     @Override
@@ -429,8 +529,8 @@
         }
         return success;
     }
-
-    private boolean bindPodAndBerth(String sta) {
+    @Override
+    public boolean bindPodAndBerth(String sta) {
         String staMap = AgvSiteConstant.SiteMap.get(sta);
         if (staMap == null) {
             log.error("娌℃湁鎵惧埌璇ョ珯鐐圭殑鍏ュ簱鏄犲皠:{}",sta);
@@ -438,7 +538,7 @@
         }
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("reqCode",UUID.randomUUID().toString().replace("-", "")); // 璇锋眰鍞竴鍊�
-        jsonObject.put("ctnrTyp","2"); // 瀹瑰櫒绫诲瀷2
+        jsonObject.put("ctnrTyp","3"); // 瀹瑰櫒绫诲瀷2
         jsonObject.put("stgBinCode",staMap); // 浠撲綅缂栧彿锛屾牴鎹浠撶紪鍙疯浆鎹�
         jsonObject.put("indBind","1"); // 1缁戝畾锛�0瑙g粦
 

--
Gitblit v1.9.1