From aea629d098bdab0918d90e0c51af9d7b099bca12 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 31 五月 2024 20:45:51 +0800
Subject: [PATCH] #新旧物料更新接口
---
src/main/java/com/zy/asrs/controller/BasShuttleController.java | 136 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 136 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/BasShuttleController.java b/src/main/java/com/zy/asrs/controller/BasShuttleController.java
index 5309bde..7ea785f 100644
--- a/src/main/java/com/zy/asrs/controller/BasShuttleController.java
+++ b/src/main/java/com/zy/asrs/controller/BasShuttleController.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;
@@ -12,8 +13,10 @@
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
+import com.zy.common.utils.HttpHandler;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@@ -23,6 +26,9 @@
@Autowired
private BasShuttleService basShuttleService;
+
+ @Value("${wcs-slave.url}")
+ private String wcsUrl;
@RequestMapping(value = "/basShuttle/{id}/auth")
@ManagerAuth
@@ -122,4 +128,134 @@
return R.ok();
}
+ @RequestMapping(value = "/basShuttle/command/list/auth")
+ @ManagerAuth
+ public R shuttleCommandQuery(@RequestParam Integer wrkNo) {
+ HashMap<String, Object> hashMap = new HashMap<>();
+ hashMap.put("total", 0);
+ hashMap.put("records", null);
+ try {
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("wrkNo", wrkNo);
+ String response = new HttpHandler.Builder()
+ .setUri(wcsUrl)
+ .setPath("/shuttle/command/query")
+ .setParams(map)
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ Integer code = jsonObject.getInteger("code");
+ if (code.equals(200)) {
+ JSONObject data = jsonObject.getJSONObject("data");
+ JSONObject assignCommand = data.getJSONObject("assignCommand");
+ JSONArray commands = assignCommand.getJSONArray("commands");
+ Integer commandStep = data.getInteger("commandStep");//褰撳墠姝ュ簭
+ for (int i = 0; i < commands.size(); i++) {
+ JSONObject object = commands.getJSONObject(i);
+ object.put("commandStep", commandStep);//褰撳墠姝ュ簭
+ commands.set(i, object);
+ }
+ hashMap.put("total", commands.size());
+ hashMap.put("records", commands);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.error();
+ }
+
+ return R.ok().add(hashMap);
+ }
+
+ //鍥為��鍛戒护
+ @RequestMapping(value = "/basShuttle/command/rollback/auth")
+ @ManagerAuth
+ public R shuttleCommandRollback(@RequestBody JSONObject param) {
+ try {
+ String response = new HttpHandler.Builder()
+ .setUri(wcsUrl)
+ .setPath("/shuttle/command/rollback")
+ .setParams(param)
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ Integer code = jsonObject.getInteger("code");
+ if (code.equals(200)) {
+ return R.ok();
+ }
+ return R.error();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.error();
+ }
+ }
+
+ //鍛戒护瀹屾垚鐘舵�佸垏鎹�
+ @RequestMapping(value = "/basShuttle/command/completeSwitch/auth")
+ @ManagerAuth
+ public R shuttleCommandCompleteSwitch(@RequestBody JSONObject param) {
+ try {
+ String response = new HttpHandler.Builder()
+ .setUri(wcsUrl)
+ .setPath("/shuttle/command/completeSwitch")
+ .setParams(param)
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ Integer code = jsonObject.getInteger("code");
+ if (code.equals(200)) {
+ return R.ok();
+ }
+ return R.error();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.error();
+ }
+ }
+
+ //閲嶅惎浠诲姟(鍛戒护)
+ @RequestMapping(value = "/basShuttle/command/restart/auth")
+ @ManagerAuth
+ public R shuttleCommandRestart(@RequestBody JSONObject param) {
+ try {
+ String response = new HttpHandler.Builder()
+ .setUri(wcsUrl)
+ .setPath("/shuttle/command/restart")
+ .setParams(param)
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ Integer code = jsonObject.getInteger("code");
+ if (code.equals(200)) {
+ return R.ok();
+ }
+ return R.error("閲嶅惎澶辫触");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.error();
+ }
+ }
+
+ //鍒犻櫎浠诲姟(鍛戒护)
+ @RequestMapping(value = "/basShuttle/command/del/auth")
+ @ManagerAuth
+ public R shuttleCommandDel(@RequestBody JSONObject param) {
+ try {
+ String response = new HttpHandler.Builder()
+ .setUri(wcsUrl)
+ .setPath("/shuttle/command/del")
+ .setParams(param)
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ Integer code = jsonObject.getInteger("code");
+ if (code.equals(200)) {
+ return R.ok();
+ }
+ return R.error("鍒犻櫎澶辫触");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.error();
+ }
+ }
+
}
--
Gitblit v1.9.1