优化调整
This commit is contained in:
@@ -105,27 +105,75 @@ public class MsgDdjController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public record StackerStatus(
|
||||||
|
String id, String mode, String taskNo, String deviceStatus, String forkStatus, String executionPhase, String permission, String position){}
|
||||||
|
/**
|
||||||
|
* 请求获取堆垛机状态
|
||||||
|
* @param id 堆垛机编号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("/getStackerStatus/{id}")
|
@GetMapping("/getStackerStatus/{id}")
|
||||||
public StackerStatus getStackerStatus(@PathVariable Long id){
|
public StackerStatus getStackerStatus(@PathVariable Long id){
|
||||||
//返回堆垛机部分参数的状态映射
|
//返回堆垛机部分参数的状态映射
|
||||||
if (id == 1) {
|
if (id == 1) {
|
||||||
MsgDdj msg = msgDdjService.selectMsgDdjById(id);
|
MsgDdj msg = msgDdjService.selectMsgDdjById(id);
|
||||||
StackerStatus status = new StackerStatus();
|
com.ruoyi.device.ddj.domain.StackerStatus status = new com.ruoyi.device.ddj.domain.StackerStatus();
|
||||||
status.setId(msg.getId());
|
|
||||||
status.setName(msg.getName());
|
|
||||||
status.setMode(msg.getCzfs());
|
|
||||||
status.setTaskNo(msg.getRwh());
|
|
||||||
status.setDeviceStatus(msg.getSbzt());
|
|
||||||
status.setForkStatus(msg.getHczt());
|
|
||||||
status.setExecutionPhase(msg.getJdbz());
|
|
||||||
status.setPermission(msg.getYxxf());
|
|
||||||
status.setCurrentRow(msg.getCurrentRow());
|
|
||||||
status.setCurrentColumn(msg.getCurrentColumn());
|
|
||||||
status.setCurrentFloor(msg.getCurrentFloor());
|
|
||||||
// status.setCurrentRoad(msg.getId());
|
|
||||||
status.setCurrentPosition(msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层");
|
|
||||||
|
|
||||||
return status;
|
//操作模式
|
||||||
|
String mode = "其他";
|
||||||
|
switch (msg.getCzfs()){
|
||||||
|
case 1 -> mode = "手动";
|
||||||
|
case 5 -> mode = "联机自动";
|
||||||
|
}
|
||||||
|
|
||||||
|
//设备状态
|
||||||
|
String deviceStatus = "待机";
|
||||||
|
switch (msg.getSbzt()){
|
||||||
|
case 0 -> deviceStatus = "待机";
|
||||||
|
case 1 -> deviceStatus = "运行中";
|
||||||
|
default -> deviceStatus = "运行报警";
|
||||||
|
}
|
||||||
|
|
||||||
|
//设备状态
|
||||||
|
String forkState = "货叉无货";
|
||||||
|
if (msg.getHczt() > 0){
|
||||||
|
forkState = "货叉无货";
|
||||||
|
}
|
||||||
|
|
||||||
|
//设备状态
|
||||||
|
String executionPhase = "待机";
|
||||||
|
switch (msg.getJdbz()){
|
||||||
|
case 1 -> executionPhase = "取货途中";
|
||||||
|
case 2 -> executionPhase = "取货中";
|
||||||
|
case 3 -> executionPhase = "放货途中";
|
||||||
|
case 4 -> executionPhase = "放货中";
|
||||||
|
case 5 -> executionPhase = "放货完成";
|
||||||
|
}
|
||||||
|
|
||||||
|
StackerStatus statusContent = new StackerStatus(
|
||||||
|
String.valueOf(id),
|
||||||
|
mode,
|
||||||
|
String.valueOf(msg.getRwh()),
|
||||||
|
deviceStatus,
|
||||||
|
forkState,
|
||||||
|
executionPhase,
|
||||||
|
msg.getYxxf() == 1 ? "允许下发" : "禁止下发",
|
||||||
|
msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层"
|
||||||
|
);
|
||||||
|
// status.setId(msg.getId());
|
||||||
|
// status.setMode(msg.getCzfs());
|
||||||
|
// status.setTaskNo(msg.getRwh());
|
||||||
|
// status.setDeviceStatus(msg.getSbzt());
|
||||||
|
// status.setForkStatus(msg.getHczt());
|
||||||
|
// status.setExecutionPhase(msg.getJdbz());
|
||||||
|
// status.setPermission(msg.getYxxf());
|
||||||
|
// status.setCurrentRow(msg.getCurrentRow());
|
||||||
|
// status.setCurrentColumn(msg.getCurrentColumn());
|
||||||
|
// status.setCurrentFloor(msg.getCurrentFloor());
|
||||||
|
// status.setCurrentRoad(msg.getId());
|
||||||
|
// status.setCurrentPosition(msg.getCurrentRow() + "排" + msg.getCurrentColumn() + "列" + msg.getCurrentFloor() + "层");
|
||||||
|
|
||||||
|
return statusContent;
|
||||||
}else{
|
}else{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,3 +86,4 @@ public class StackerStatus {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ 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.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;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -101,4 +103,30 @@ public class DeviceSsjController extends BaseController
|
|||||||
{
|
{
|
||||||
return toAjax(deviceSsjService.deleteDeviceSsjByIds(ids));
|
return toAjax(deviceSsjService.deleteDeviceSsjByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回的输送机状态
|
||||||
|
*/
|
||||||
|
private record ConvStatus(String id, String mode, String free, String inPosition, String taskNo){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求返回输送机状态
|
||||||
|
* @param id 输送机编号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getConvStatus/{id}")
|
||||||
|
public ConvStatus getConvStatus(@PathVariable String id){
|
||||||
|
DeviceSsj msgSsj = deviceSsjService.selectDeviceSsjByDeviceCode(id);
|
||||||
|
ConvStatus status = new ConvStatus(
|
||||||
|
id,
|
||||||
|
msgSsj.getMode() == 1 ? "自动模式" : "手动模式",
|
||||||
|
msgSsj.getKx() == 1 ? "占用" : "空闲",
|
||||||
|
msgSsj.getDw() == 1 ? "输送到位" : "未到位",
|
||||||
|
String.valueOf(msgSsj.getTaskNo())
|
||||||
|
);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.ruoyi.device.ssj.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class ConvStatus {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 输送机编号
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手/自动模式
|
||||||
|
*/
|
||||||
|
private String mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0-空闲 1-占用
|
||||||
|
*/
|
||||||
|
private String free;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0-未到位 1-到位
|
||||||
|
*/
|
||||||
|
private String inPosition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务号
|
||||||
|
*/
|
||||||
|
private String taskNo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -105,4 +105,9 @@ public class DeviceSsj extends BaseEntity
|
|||||||
*/
|
*/
|
||||||
private String weight;
|
private String weight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手/自动
|
||||||
|
*/
|
||||||
|
private int mode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ public interface DeviceSsjMapper
|
|||||||
*/
|
*/
|
||||||
public DeviceSsj selectDeviceSsjById(Long id);
|
public DeviceSsj selectDeviceSsjById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询输送机
|
||||||
|
*
|
||||||
|
* @param deviceCode 输送机编号
|
||||||
|
* @return 输送机
|
||||||
|
*/
|
||||||
|
public DeviceSsj selectDeviceSsjByDeviceCode(String deviceCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询输送机列表
|
* 查询输送机列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ public interface IDeviceSsjService
|
|||||||
*/
|
*/
|
||||||
public DeviceSsj selectDeviceSsjById(Long id);
|
public DeviceSsj selectDeviceSsjById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询输送机
|
||||||
|
*
|
||||||
|
* @param deviceCode 输送机编号
|
||||||
|
* @return 输送机
|
||||||
|
*/
|
||||||
|
public DeviceSsj selectDeviceSsjByDeviceCode(String deviceCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询输送机列表
|
* 查询输送机列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -32,6 +32,18 @@ public class DeviceSsjServiceImpl implements IDeviceSsjService
|
|||||||
return deviceSsjMapper.selectDeviceSsjById(id);
|
return deviceSsjMapper.selectDeviceSsjById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询输送机
|
||||||
|
*
|
||||||
|
* @param deviceCode 输送机主键
|
||||||
|
* @return 输送机
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DeviceSsj selectDeviceSsjByDeviceCode(String deviceCode)
|
||||||
|
{
|
||||||
|
return deviceSsjMapper.selectDeviceSsjByDeviceCode(deviceCode);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询输送机列表
|
* 查询输送机列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ public class PlcSsjRead implements Runnable {
|
|||||||
ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
||||||
ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1));
|
ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1));
|
||||||
ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
||||||
|
ssjDevice.setMode(ParseUtil.optInt(30, ddsx1));//todo 输送机操作模式
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeviceSsjByDeviceCode" parameterType="string" resultMap="DeviceSsjResult">
|
||||||
|
<include refid="selectDeviceSsjVo"/>
|
||||||
|
where device_code = #{deviceCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertDeviceSsj" parameterType="DeviceSsj" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertDeviceSsj" parameterType="DeviceSsj" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into device_ssj
|
insert into device_ssj
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|||||||
Reference in New Issue
Block a user