From e90dba0edc93be26e1509cfb2ec1d0681eb86e48 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期三, 27 八月 2025 08:37:04 +0800
Subject: [PATCH] 合并出库添加日志
---
src/main/java/com/zy/asrs/controller/AgvLocMastController.java | 63 +++++++++++++++++++++++++++++--
src/main/resources/application-loc.yml | 2 +
src/main/resources/application-dev.yml | 2 +
src/main/resources/application-prod.yml | 1
4 files changed, 64 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/AgvLocMastController.java b/src/main/java/com/zy/asrs/controller/AgvLocMastController.java
index d86ae85..581c210 100644
--- a/src/main/java/com/zy/asrs/controller/AgvLocMastController.java
+++ b/src/main/java/com/zy/asrs/controller/AgvLocMastController.java
@@ -1,5 +1,6 @@
package com.zy.asrs.controller;
+import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -16,19 +17,22 @@
import com.zy.asrs.entity.AgvLocMast;
import com.zy.asrs.entity.AgvWrkMast;
import com.zy.asrs.entity.param.LocMastInitParam;
-import com.zy.asrs.service.AdjDetlService;
-import com.zy.asrs.service.AgvLocDetlService;
-import com.zy.asrs.service.AgvLocMastService;
-import com.zy.asrs.service.AgvWrkMastService;
+import com.zy.asrs.service.*;
+import com.zy.common.utils.HttpHandler;
import com.zy.common.web.BaseController;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
+@Slf4j
@RestController
@RequestMapping("/agv")
public class AgvLocMastController extends BaseController {
@@ -41,6 +45,13 @@
private AgvLocDetlService agvLocDetlService;
@Autowired
private AdjDetlService adjDetlService;
+ @Autowired
+ ApiLogService apiLogService;
+
+ @Value("${agv.url}")
+ private String url;
+ @Value("${agv.locStsUrl}")
+ private String locStsUrl;
@RequestMapping(value = "/locMast/list/auth")
@ManagerAuth
@@ -86,6 +97,7 @@
if (locMast.getLocSts().equals("F") && (oldLocMast.getLocSts().equals("D") || oldLocMast.getLocSts().equals("O"))) {
return R.error("褰撳墠鎿嶄綔宸茶闃绘锛岃鑱旂郴绠$悊鍛�");
}
+ String barcode = oldLocMast.getBarcode();
int br = 0;
if (locMast.getLocSts() == "O" || locMast.getLocSts() == "X") {
switch (locMast.getBarcode().substring(0, 2)) {
@@ -146,6 +158,49 @@
locMast.setModiTime(now);
if (!agvLockMastService.updateById(locMast)) {
throw new CoolException("涓诲簱浣嶄慨鏀瑰け璐�");
+ } else {
+ try {
+ if (locMast.getLocSts().equals("O")) {
+ HashMap<String, String> data = new HashMap<>();
+ data.put("reqCode", System.currentTimeMillis() + "");
+ data.put("podCode", barcode);
+ data.put("positionCode", locMast.getLocNo());
+ data.put("indBind", "0");
+ String response = "";
+ boolean success = false;
+ int code = 0;
+ try {
+ response = new HttpHandler.Builder()
+ .setUri(url)
+ .setPath(locStsUrl)
+ .setTimeout(30, TimeUnit.SECONDS)
+ .setJson(JSONObject.toJSONString(data))
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ code = Integer.parseInt(jsonObject.get("code").toString());
+ if (code != 0) {
+ log.info("搴撲綅瑙g粦AGV鎺ュ彛璋冪敤澶辫触锛岃繑鍥炰俊鎭細" + response);
+ } else {
+ success = true;
+ }
+ } catch (Exception e) {
+ throw new CoolException("璋冪敤AGV鍝嶅簲閿欒");
+ } finally {
+ apiLogService.save(
+ "璐ф灦涓庝綅缃В缁�",
+ url + locStsUrl,
+ null,
+ "127.0.0.1",
+ JSON.toJSONString(data),
+ response,
+ success
+ );
+ }
+ }
+ } catch (Exception e) {
+
+ }
}
return R.ok();
}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 2260832..22b11f4 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -84,6 +84,8 @@
containerMoveInPath: /expand/api/moveIn/container
containerMoveOutPath: /expand/api/moveOut/container
containerArrivedPath: /conveyor/containerArrived
+ locStsUrl: rcms/services/rest/hikRpcService/bindPodAndBerth
+
u8:
report: false
diff --git a/src/main/resources/application-loc.yml b/src/main/resources/application-loc.yml
index 10e73e4..3315398 100644
--- a/src/main/resources/application-loc.yml
+++ b/src/main/resources/application-loc.yml
@@ -85,6 +85,8 @@
# containerMoveInPath: /expand/api/moveIn/container
# containerMoveOutPath: /expand/api/moveOut/container
# containerArrivedPath: /conveyor/containerArrived
+ locStsUrl: rcms/services/rest/hikRpcService/bindPodAndBerth
+
u8:
report: false
diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml
index bc3efee..57f7131 100644
--- a/src/main/resources/application-prod.yml
+++ b/src/main/resources/application-prod.yml
@@ -84,6 +84,7 @@
containerMoveInPath: /expand/api/moveIn/container
containerMoveOutPath: /expand/api/moveOut/container
containerArrivedPath: /conveyor/containerArrived
+ locStsUrl: rcms/services/rest/hikRpcService/bindPodAndBerth
u8:
report: true
--
Gitblit v1.9.1