Commit 903d93b7 authored by wanghao's avatar wanghao

1 上料时 先判断 托盘是否绑定了设备

parent 6cf1eae8
......@@ -40,6 +40,8 @@ public interface PalletDeviceBindingMapper
public int countErrorByTrayId(Long trayId);
public int countByTrayId(Long trayId);
/**
* 新增托盘绑定的设备列
*
......
......@@ -104,7 +104,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
if (status != null) {
// 处理状态消息
processStatusMessage(status, packet.sender());
processStatusMessage(status);
// 检查是否为完全空闲状态
if (status.isFullyIdle()) {
......@@ -148,7 +148,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
}
}
private void processStatusMessage(RobotArmMessageParser.RobotArmStatus status, SocketAddress sender) {
private void processStatusMessage(RobotArmMessageParser.RobotArmStatus status) {
// 更新前端状态
if (status.isBusy()) {
sendStatusToWebSocket("running");
......
......@@ -16,9 +16,7 @@ import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.TEquipmentInfo;
import com.zehong.system.domain.TStoreyInfo;
import com.zehong.system.domain.TTrayInfo;
import com.zehong.system.mapper.TEquipmentInfoMapper;
import com.zehong.system.mapper.TStoreyInfoMapper;
import com.zehong.system.mapper.TTrayInfoMapper;
import com.zehong.system.mapper.*;
import com.zehong.system.modbus.util.Modbus4jUtils;
import com.zehong.system.netty.handler.NettyUdpServerHandler;
import com.zehong.system.service.websocket.RobotArmWebSocketHandler;
......@@ -30,7 +28,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.RobotArmCommandMapper;
import com.zehong.system.domain.RobotArmCommand;
import com.zehong.system.service.IRobotArmCommandService;
import org.springframework.transaction.annotation.Transactional;
......@@ -76,6 +73,9 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
@Resource
private ApplicationEventPublisher eventPublisher; // 新增事件发布器
@Resource
private PalletDeviceBindingMapper palletDeviceBindingMapper;
private SocketAddress getRobotAddress() {
try {
return new InetSocketAddress(
......@@ -218,8 +218,8 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
try {
String storeyCode = command.getStoreyCode();
String equitmentCode = "";
Integer registerOffset = null;
String equitmentCode;
Integer registerOffset;
if(storeyCode.contains("-")) {
log.info("storeyCode.contains(\"-\")");
String[] parts = storeyCode.split("-");
......@@ -364,6 +364,12 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
throw new RuntimeException("托盘不存在");
}
// 看看 此托盘绑定了数据了吗?
int i1 = palletDeviceBindingMapper.countByTrayId(tTrayInfo.getfTrayId());
if(i1 == 0) {
throw new RuntimeException("托盘未绑定设备");
}
// 20251104 上料 不需要看托盘状态了
// if(!"0".equals(tTrayInfo.getfStatus())) {
// throw new RuntimeException("托盘未解绑,请联系管理员");
......
......@@ -123,6 +123,8 @@ public class AllCommandHandler {
tStoreyInfo.setfStoreyCode(tStoreyInfo.getfStoreyCode());
tStoreyInfo.setUpdateTime(new Date());
tStoreyInfo.setfStatus("0");
tStoreyInfo.setfAgingStartTime(null);
tStoreyInfo.setfAgingEndTime(null);
tStoreyInfoMapper.unbindByCode(tStoreyInfo);
// 清理 托盘 和 层的关联关系
......
......@@ -57,6 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where palDeviceBinding.f_tray_id = #{trayId}
and (palDeviceBinding.f_status = '0' or palDeviceBinding.f_status = '5')
</select>
<select id="countByTrayId" parameterType="Long" resultType="int">
select count(1) from t_pallet_device_binding palDeviceBinding
where palDeviceBinding.f_tray_id = #{trayId}
</select>
<select id="selectPalletDeviceBindingList" parameterType="PalletDeviceBinding" resultMap="PalletDeviceBindingResult">
<include refid="selectPalletDeviceBindingVo"/>
<where>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment