手持机

This commit is contained in:
张怡蓉
2025-08-14 15:41:35 +08:00
parent b9c78e05de
commit 337cbbe43e
8 changed files with 233 additions and 29 deletions

View File

@@ -56,6 +56,7 @@ import com.ruoyi.stock.stock.domain.BasStock;
import com.ruoyi.stock.stock.service.IBasStockService;
import com.ruoyi.system.service.ISysRoleService;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -668,11 +669,17 @@ public class PdaServiceImp implements PdaService {
String startPoint = basContainer1.getPortName();
//todo 调用agv搬运接口
//使用HttpUtil post请求,参数为startPoint,endPoint,和containerCode
return agvRequest(basContainer.getContainerId(), startPoint, endPoint);
}
private @NotNull AjaxResult agvRequest(String containerId, String startPoint, String endPoint) {
String taskNo = IdUtil.fastSimpleUUID();
AgvMoveParam agvMoveParam =new AgvMoveParam();
agvMoveParam.setStartPoint(startPoint);
agvMoveParam.setEndPoint(endPoint);
agvMoveParam.setContainerCode(basContainer1.getContainerId());
agvMoveParam.setContainerCode(containerId);
agvMoveParam.setTaskNo(taskNo);
String result = HttpUtil.post("http://192.168.1.100:8080/agv/api/receiveAgvMoveJob", JSONUtil.toJsonStr( agvMoveParam));
//接口的返回结果为AjaxResult,从result中获取code
@@ -680,7 +687,7 @@ public class PdaServiceImp implements PdaService {
int code = JSONObject.parseObject(result).getIntValue("code");
if (code == 200) {
AgvContainerTask agvContainerTask = new AgvContainerTask();
agvContainerTask.setContainer(basContainer.getContainerId());
agvContainerTask.setContainer(containerId);
agvContainerTask.setStartPoint(startPoint);
agvContainerTask.setEndPoint(endPoint);
agvContainerTask.setStatus("0");
@@ -691,8 +698,6 @@ public class PdaServiceImp implements PdaService {
} else {
return AjaxResult.warn(JSONObject.parseObject(result).getString("msg"));
}
}
@@ -867,17 +872,19 @@ public class PdaServiceImp implements PdaService {
return AjaxResult.error(MessageUtils.message("error.message31"));
}
BasContainerDetails basContainer = basContainerDetails1.get(0);
return agvRequest(basContainer.getContainerId(), startPoint, endPoint);
String result = HttpUtil.post("http://192.168.1.100:8080/agv/api/receiveAgvMoveJob", "startPoint=" + startPoint + "&endPoint=" + endPoint + "&containerCode=" + basContainer.getContainerId());
//接口的返回结果为AjaxResult,从result中获取code
//获取code
int code = JSONObject.parseObject(result).getIntValue("code");
if (code == 200) {
return AjaxResult.success(result);
} else {
return AjaxResult.warn(JSONObject.parseObject(result).getString("msg"));
}
//
// String result = HttpUtil.post("http://192.168.1.100:8080/agv/api/receiveAgvMoveJob", "startPoint=" + startPoint + "&endPoint=" + endPoint + "&containerCode=" + basContainer.getContainerId());
// //接口的返回结果为AjaxResult,从result中获取code
//
// //获取code
// int code = JSONObject.parseObject(result).getIntValue("code");
// if (code == 200) {
// return AjaxResult.success(result);
// } else {
// return AjaxResult.warn(JSONObject.parseObject(result).getString("msg"));
// }
}