优化调整
This commit is contained in:
@@ -3,6 +3,7 @@ package com.ruoyi.device.ddj.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.ruoyi.device.ddj.domain.StackerStatus;
|
import com.ruoyi.device.ddj.domain.StackerStatus;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -105,15 +106,35 @@ public class MsgDdjController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回堆垛机状态的记录类型
|
||||||
|
* @param id 编号
|
||||||
|
* @param mode 操作模式
|
||||||
|
* @param taskNo 任务号
|
||||||
|
* @param deviceStatus 设备状态
|
||||||
|
* @param forkStatus 货叉状态
|
||||||
|
* @param executionPhase 执行阶段
|
||||||
|
* @param permission 允许下发
|
||||||
|
* @param position 当前位置
|
||||||
|
*/
|
||||||
public record StackerStatus(
|
public record StackerStatus(
|
||||||
String id, String mode, String taskNo, String deviceStatus, String forkStatus, String executionPhase, String permission, String position){}
|
@JsonProperty("堆垛机编号") String id,
|
||||||
|
@JsonProperty("操作模式") String mode,
|
||||||
|
@JsonProperty("任务号") String taskNo,
|
||||||
|
@JsonProperty("设备状态") String deviceStatus,
|
||||||
|
@JsonProperty("货叉状态") String forkStatus,
|
||||||
|
@JsonProperty("执行阶段") String executionPhase,
|
||||||
|
@JsonProperty("允许下发") String permission,
|
||||||
|
@JsonProperty("当前位置") String position){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求获取堆垛机状态
|
* 请求获取堆垛机状态
|
||||||
* @param id 堆垛机编号
|
* @param id 堆垛机编号
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getStackerStatus/{id}")
|
@GetMapping("/getStackerStatus/{id}")
|
||||||
public StackerStatus getStackerStatus(@PathVariable Long id){
|
public AjaxResult getStackerStatus(@PathVariable Long id){
|
||||||
//返回堆垛机部分参数的状态映射
|
//返回堆垛机部分参数的状态映射
|
||||||
if (id == 1) {
|
if (id == 1) {
|
||||||
MsgDdj msg = msgDdjService.selectMsgDdjById(id);
|
MsgDdj msg = msgDdjService.selectMsgDdjById(id);
|
||||||
@@ -134,13 +155,7 @@ public class MsgDdjController extends BaseController
|
|||||||
default -> deviceStatus = "运行报警";
|
default -> deviceStatus = "运行报警";
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备状态
|
//执行阶段
|
||||||
String forkState = "货叉无货";
|
|
||||||
if (msg.getHczt() > 0){
|
|
||||||
forkState = "货叉无货";
|
|
||||||
}
|
|
||||||
|
|
||||||
//设备状态
|
|
||||||
String executionPhase = "待机";
|
String executionPhase = "待机";
|
||||||
switch (msg.getJdbz()){
|
switch (msg.getJdbz()){
|
||||||
case 1 -> executionPhase = "取货途中";
|
case 1 -> executionPhase = "取货途中";
|
||||||
@@ -155,9 +170,9 @@ public class MsgDdjController extends BaseController
|
|||||||
mode,
|
mode,
|
||||||
String.valueOf(msg.getRwh()),
|
String.valueOf(msg.getRwh()),
|
||||||
deviceStatus,
|
deviceStatus,
|
||||||
forkState,
|
msg.getHczt() > 0 ? "货叉有货" : "货叉无货",
|
||||||
executionPhase,
|
executionPhase,
|
||||||
msg.getYxxf() == 1 ? "允许下发" : "禁止下发",
|
msg.getYxxf() == 1 ? "允许" : "禁止",
|
||||||
msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层"
|
msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层"
|
||||||
);
|
);
|
||||||
// status.setId(msg.getId());
|
// status.setId(msg.getId());
|
||||||
@@ -173,9 +188,9 @@ public class MsgDdjController extends BaseController
|
|||||||
// status.setCurrentRoad(msg.getId());
|
// status.setCurrentRoad(msg.getId());
|
||||||
// status.setCurrentPosition(msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层");
|
// status.setCurrentPosition(msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层");
|
||||||
|
|
||||||
return statusContent;
|
return AjaxResult.success(statusContent);
|
||||||
}else{
|
}else{
|
||||||
return null;
|
return AjaxResult.error("【查询堆垛机状态】设备编号:" + id + ",查询超出最大索引");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.device.ssj.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.ruoyi.device.ssj.domain.ConvStatus;
|
import com.ruoyi.device.ssj.domain.ConvStatus;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -107,7 +108,12 @@ public class DeviceSsjController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 返回的输送机状态
|
* 返回的输送机状态
|
||||||
*/
|
*/
|
||||||
private record ConvStatus(String id, String mode, String free, String inPosition, String taskNo){}
|
private record ConvStatus(
|
||||||
|
@JsonProperty("输送机编号") String id,
|
||||||
|
@JsonProperty("操作模式") String mode,
|
||||||
|
@JsonProperty("占用状态") String free,
|
||||||
|
@JsonProperty("输送状态") String inPosition,
|
||||||
|
@JsonProperty("任务号") String taskNo){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求返回输送机状态
|
* 请求返回输送机状态
|
||||||
@@ -115,17 +121,22 @@ public class DeviceSsjController extends BaseController
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getConvStatus/{id}")
|
@GetMapping("/getConvStatus/{id}")
|
||||||
public ConvStatus getConvStatus(@PathVariable String id){
|
public AjaxResult getConvStatus(@PathVariable String id){
|
||||||
DeviceSsj msgSsj = deviceSsjService.selectDeviceSsjByDeviceCode(id);
|
DeviceSsj msgSsj = deviceSsjService.selectDeviceSsjByDeviceCode(id);
|
||||||
|
|
||||||
|
if (msgSsj == null) {
|
||||||
|
return AjaxResult.error("【查询输送机状态】设备编号:" + id + ",该设备不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
ConvStatus status = new ConvStatus(
|
ConvStatus status = new ConvStatus(
|
||||||
id,
|
id,
|
||||||
msgSsj.getMode() == 1 ? "自动模式" : "手动模式",
|
msgSsj.getMode() == 1 ? "自动" : "手动",
|
||||||
msgSsj.getKx() == 1 ? "占用" : "空闲",
|
msgSsj.getKx() == 1 ? "占用" : "空闲",
|
||||||
msgSsj.getDw() == 1 ? "输送到位" : "未到位",
|
msgSsj.getDw() == 1 ? "输送到位" : "未到位",
|
||||||
String.valueOf(msgSsj.getTaskNo())
|
String.valueOf(msgSsj.getTaskNo())
|
||||||
);
|
);
|
||||||
|
|
||||||
return status;
|
return AjaxResult.success(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user