From 8257d89c461f6553d66fad1e5e3df3d172a00924 Mon Sep 17 00:00:00 2001
From: 1 <1>
Date: 星期六, 29 十一月 2025 18:10:18 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/controller/OpenController.java | 91 ++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 81 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index e378cb2..e5847dc 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -5,11 +5,13 @@
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.asrs.entity.param.*;
+import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.service.OpenService;
import com.zy.common.model.DetlDto;
import com.zy.common.web.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@@ -402,6 +404,9 @@
} catch (Exception e){
return R.error("鍗曟嵁缂栧彿[order_id]浠� "+sign_arm_sku+" 涓� "+sign_arm_order+" 浣滀负鎷嗗垎鏍囪鎷嗗垎澶辫触锛侊紒锛�");
}
+ if (param.getArm_no()>4){
+ return R.ok().add(true);
+ }
boolean taskArmWorkOrderSign = openService.TaskArmWorkOrderSign(param);
return R.ok().add(taskArmWorkOrderSign);
@@ -416,21 +421,36 @@
public synchronized R TaskAgvReport(@RequestHeader(required = false) String appkey,
@RequestBody TaskAgvReportParam param,
HttpServletRequest request) {
- auth(appkey, param, request);
+// auth(appkey, param, request);
+ // 鏃ュ織璁板綍
+ ApiLogService apiLogService = SpringUtils.getBean(ApiLogService.class);
+ apiLogService.save(
+ "AGV涓婃姤鎺ユ敹",
+ "/open/asrs/agv/task/v1/agvCallback",
+ null,
+ request.getRemoteAddr(),
+ JSON.toJSONString(param),
+ null,
+ true
+ );
if (Cools.isEmpty(param)) {
return R.parse(BaseRes.PARAM);
}
if (Cools.isEmpty(param.getReqCode())) {
return R.error("WMS浠诲姟鍙穂reqCode]涓嶈兘涓虹┖");
}
- String reqCode = param.getReqCode();
- String[] split = reqCode.split("-");
- param.setTaskNo(Integer.parseInt(split[0]));
-// if (Cools.isEmpty(param.getTimestamp())) {
-// return R.error("RGV浠诲姟鍙穂timestamp]涓嶈兘涓虹┖");
-// }
+ if (Cools.isEmpty(param.getTaskCode())) {
+ return R.error("WMS浠诲姟鍙穂reqCode]涓嶈兘涓虹┖");
+ }
+ String taskCode = param.getTaskCode();
+ if (taskCode == null || !taskCode.matches("^\\d+-.*$")) {
+ throw new CoolException("taskCode 鏍煎紡閿欒锛岄渶涓� 鏁板瓧-xxx锛屼緥濡� 123-ABC");
+ }
+
+ param.setTaskNo(Integer.parseInt(taskCode.substring(0, taskCode.indexOf("-"))));
boolean taskAgvReport = openService.TaskAgvReport(param);
if (taskAgvReport){
+ agvBindAndBin(String.valueOf(param.getTaskNo()));
return R.ok();
}
return R.error("浠诲姟鍙蜂笉瀛樺湪");
@@ -465,9 +485,7 @@
HttpServletRequest request) {
auth(appkey, param, request);
- if (Cools.isEmpty(param)) {
- return R.parse(BaseRes.PARAM);
- }
+
List<AgvLocListDetlParam> list = openService.getAgvLocList(param);
if (!list.isEmpty()) {
return R.ok(list);
@@ -494,4 +512,57 @@
return R.error("搴撲綅涓嶅瓨鍦ㄦ垨鏃犳槑缁�");
}
+ /**
+ * AGV鐢宠杩囧厜鏍�
+ */
+ @PostMapping("/agv/arm/grating/v1/agvCallback")
+ @AppAuth(memo = "AGV鐢宠杩囧厜鏍�")
+ public synchronized R agvGrating(@RequestHeader(required = false) String appkey,
+ @RequestBody AgvGoTheArnParam param,
+ HttpServletRequest request) {
+// auth(appkey, param, request);
+ if (Cools.isEmpty(param)) {
+ return R.parse(BaseRes.PARAM);
+ }
+ if (Cools.isEmpty(param.getCurrentPositionCode())) {
+ return R.error("浣嶇疆[currentPositionCode]涓嶈兘涓虹┖");
+ }
+ boolean bindCtnrAndBin = true;
+ List<ArmAgvGratingParam> armList = param.getArmNo();
+ if (armList.isEmpty()){
+ return R.error("搴撲綅涓嶅瓨鍦ㄦ垨鏃犳槑缁�");
+ }
+ for (ArmAgvGratingParam arm : armList){
+ if (bindCtnrAndBin){
+ bindCtnrAndBin = openService.agvApplicationPassedTheGrating(arm);
+// System.out.println("璇锋眰閫氳繃鍏夋爡"+armNo);
+ }
+ }
+ if (bindCtnrAndBin) {
+ asyncProcessAfterValidation(param);
+ return new R(0,"鎴愬姛");
+ }
+ return R.error("搴撲綅涓嶅瓨鍦ㄦ垨鏃犳槑缁�");
+ }
+
+ @Async
+ public void agvBindAndBin(String taskNo) {
+ try {
+ Thread.sleep(500);
+ openService.agvBindAndBin(taskNo);
+ } catch (Exception e) {
+ log.error("寮傛澶勭悊AGV鍏夋爡鍚庣画閫昏緫澶辫触", e);
+ }
+ }
+
+ @Async
+ public void asyncProcessAfterValidation(AgvGoTheArnParam param) {
+ try {
+ Thread.sleep(500);
+ openService.agvApplicationPassedTheGrating(param);
+ } catch (Exception e) {
+ log.error("寮傛澶勭悊AGV鍏夋爡鍚庣画閫昏緫澶辫触", e);
+ }
+ }
+
}
--
Gitblit v1.9.1