From 91c235d583d3f6579d060fac9fa91faa65a1b42c Mon Sep 17 00:00:00 2001
From: cl <1442464845@qq.com>
Date: 星期二, 07 四月 2026 14:52:56 +0800
Subject: [PATCH] 取消还原

---
 src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java |   68 ++++++++++++++++++++++++++++++++-
 1 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index 36dae29..541a141 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -97,6 +97,8 @@
     private WorkService workService;
     @Autowired
     private BasCrnpService basCrnpService;
+    @Autowired
+    private ApiLogService apiLogService;
 
     @Override
     @Transactional
@@ -437,6 +439,19 @@
             return R.ok("鍙栨秷浠诲姟宸插彂閫佽嚦WCS").add(result);
         }
         throw new CoolException("reason浠呮敮鎸�1鎴�2");
+    }
+
+    /** WCS 杩斿洖闈炴垚鍔熺爜鏃舵姏閿� */
+    private void requireWcsPauseOk(R wcsR) {
+        if (wcsR == null) {
+            throw new CoolException("WCS鍙栨秷鍑哄簱浠诲姟鏃犺繑鍥�");
+        }
+        Object codeObj = wcsR.get("code");
+        int code = codeObj instanceof Number ? ((Number) codeObj).intValue() : -1;
+        if (code != 200) {
+            Object msgObj = wcsR.get("msg");
+            throw new CoolException(msgObj == null ? "WCS鍙栨秷鍑哄簱浠诲姟澶辫触" : String.valueOf(msgObj));
+        }
     }
 
     @Override
@@ -1224,7 +1239,10 @@
                 stationParams.add(stationParam);
             }
         }
+        String requestJson = JSON.toJSONString(stationParams);
         String response = "";
+        boolean pushOk = false;
+        String pushUrl = buildMesStationRequestUrl();
         try {
             //鑾峰彇Cookie鍊�
             HashMap<String, Object> headers = new HashMap<>();
@@ -1234,19 +1252,50 @@
                     .setHeaders(headers)
                     .setUri(mesUrl)
                     .setPath(stationAddress)
-                    .setJson(JSON.toJSONString(stationParams))
+                    .setJson(requestJson)
                     .build()
                     .doPost();
             JSONObject jsonResponse = JSON.parseObject(response);
-            if (jsonResponse.getInteger("code") == 200) {
-
+            if (jsonResponse != null && Integer.valueOf(200).equals(jsonResponse.getInteger("code"))) {
+                pushOk = true;
             } else {
                 return R.error();
             }
         } catch (Exception e) {
             e.printStackTrace();
+        } finally {
+            try {
+                apiLogService.save(
+                        "鎺‥RP-绔欑偣鍚屾",
+                        pushUrl,
+                        null,
+                        "127.0.0.1",
+                        requestJson,
+                        response,
+                        pushOk,
+                        "绔欑偣鍚屾鎺ㄥ鏂�"
+                );
+            } catch (Exception logEx) {
+                log.error("save station sync api log failed", logEx);
+            }
         }
         return R.ok();
+    }
+
+    private String buildMesStationRequestUrl() {
+        if (Cools.isEmpty(mesUrl)) {
+            return stationAddress;
+        }
+        if (stationAddress == null) {
+            return mesUrl;
+        }
+        if (mesUrl.endsWith("/") && stationAddress.startsWith("/")) {
+            return mesUrl + stationAddress.substring(1);
+        }
+        if (!mesUrl.endsWith("/") && !stationAddress.startsWith("/")) {
+            return mesUrl + "/" + stationAddress;
+        }
+        return mesUrl + stationAddress;
     }
 
     @Override
@@ -1377,6 +1426,19 @@
         }
         return R.ok().add(Cools.add("wrkNo", workNo).add("orderId", param.getOrderId()));
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public R outOrderBatch(List<OutTaskParam> params) {
+        int n = params.size();
+        for (OutTaskParam outTaskParam : params) {
+            R r = outOrder(outTaskParam, n);
+            if (!Objects.equals(r.get("code"), 200)) {
+                throw new CoolException("鍑哄簱寤哄崟澶辫触");
+            }
+        }
+        return R.ok();
+    }
 }
 
 

--
Gitblit v1.9.1