Commit 2a1ab005 authored by wanghao's avatar wanghao

1 老化过程中 获取卡号,获取IOT状态调整中

parent a7ca757c
...@@ -203,7 +203,6 @@ ...@@ -203,7 +203,6 @@
<artifactId>zhmes-agecal-common</artifactId> <artifactId>zhmes-agecal-common</artifactId>
<version>${zehong.version}</version> <version>${zehong.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
...@@ -134,6 +134,11 @@ ...@@ -134,6 +134,11 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId> <artifactId>spring-boot-starter-websocket</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.2.0-jre</version> <!-- 建议使用最新稳定版 -->
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -134,6 +134,8 @@ public class Constants ...@@ -134,6 +134,8 @@ public class Constants
public static final String IOT_LOGIN_USERNAME = "iot.login.username"; public static final String IOT_LOGIN_USERNAME = "iot.login.username";
public static final String IOT_LOGIN_ADDRESS = "iot.login.url";
public static final String IOT_LOGIN_PASSWORD = "iot.login.password"; public static final String IOT_LOGIN_PASSWORD = "iot.login.password";
public static final String IOT_LOGIN_TOKEN = "iot.login.token"; public static final String IOT_LOGIN_TOKEN = "iot.login.token";
......
...@@ -219,7 +219,7 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -219,7 +219,7 @@ public class PalletDeviceBinding extends BaseEntity
/** /**
* iot状态 * iot状态
* 0-异常 1-正常 * 0-异常 1-正常 2-Nb码为空 3-网络状态异常
*/ */
private Integer iotStatus; private Integer iotStatus;
......
...@@ -86,6 +86,8 @@ public interface PalletDeviceBindingMapper ...@@ -86,6 +86,8 @@ public interface PalletDeviceBindingMapper
public int batchUpdateNbCode(@Param("palletDeviceBindingList") List<PalletDeviceBinding> palletDeviceBindingList); public int batchUpdateNbCode(@Param("palletDeviceBindingList") List<PalletDeviceBinding> palletDeviceBindingList);
public int batchUpdateIotStatus(@Param("palletDeviceBindingList") List<PalletDeviceBinding> palletDeviceBindingList);
public int batchUpdateDeviceCodeAndUnbindingTime(@Param("palletDeviceBindingList") List<PalletDeviceBinding> palletDeviceBindingList); public int batchUpdateDeviceCodeAndUnbindingTime(@Param("palletDeviceBindingList") List<PalletDeviceBinding> palletDeviceBindingList);
public int unbindAllDevice(Long trayId); public int unbindAllDevice(Long trayId);
......
...@@ -41,6 +41,8 @@ public interface IPalletDeviceBindingService ...@@ -41,6 +41,8 @@ public interface IPalletDeviceBindingService
public void batchUpdateNbCode(List<PalletDeviceBinding> palletDeviceBindingList); public void batchUpdateNbCode(List<PalletDeviceBinding> palletDeviceBindingList);
public void batchUpdateIotStatus(List<PalletDeviceBinding> palletDeviceBindingList);
/** /**
* 新增托盘绑定的设备列 * 新增托盘绑定的设备列
* *
......
...@@ -142,6 +142,11 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi ...@@ -142,6 +142,11 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi
palletDeviceBindingMapper.batchUpdateNbCode(palletDeviceBindingList); palletDeviceBindingMapper.batchUpdateNbCode(palletDeviceBindingList);
} }
@Override
public void batchUpdateIotStatus(List<PalletDeviceBinding> palletDeviceBindingList) {
palletDeviceBindingMapper.batchUpdateIotStatus(palletDeviceBindingList);
}
/** /**
* 新增托盘绑定的设备列 * 新增托盘绑定的设备列
* *
......
...@@ -190,6 +190,8 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService ...@@ -190,6 +190,8 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
Modbus4jUtils.writeCoil(master, 1, registerOffsetInt, false); Modbus4jUtils.writeCoil(master, 1, registerOffsetInt, false);
log.info("已发送断电指令 - 设备:{} 层:{}", tEquipmentInfo.getfEquipmentCode(), layer); log.info("已发送断电指令 - 设备:{} 层:{}", tEquipmentInfo.getfEquipmentCode(), layer);
master.destroy(); master.destroy();
// 如果正常 则发送 IOT请求
} catch (ModbusTransportException | ModbusInitException e) { } catch (ModbusTransportException | ModbusInitException e) {
log.info("下料发送断电指令失败 - 设备:{} 层:{}", tEquipmentInfo.getfEquipmentCode(), layer); log.info("下料发送断电指令失败 - 设备:{} 层:{}", tEquipmentInfo.getfEquipmentCode(), layer);
throw new RuntimeException(e); throw new RuntimeException(e);
......
package com.zehong.system.task.event; package com.zehong.system.task.event;
import org.springframework.context.ApplicationEvent;
/** /**
* @author lenovo * @author lenovo
* @date 2026/7/18 * @date 2026/7/18
* @description IOTstatus event * @description IOT status event
*/ */
public class IotStatusEvent{ public class IotStatusEvent extends ApplicationEvent {
private String storeyCode;
public IotStatusEvent(Object source, String storeyCode) {
super(source);
this.storeyCode = storeyCode;
}
public String getStoreyCode() {
return storeyCode;
}
public void setStoreyCode(String storeyCode) {
this.storeyCode = storeyCode;
}
} }
...@@ -154,10 +154,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -154,10 +154,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="listByTrayCode" parameterType="string" resultMap="PalletDeviceBindingResult"> <select id="listByTrayCode" parameterType="string" resultMap="PalletDeviceBindingResult">
<include refid="selectPalletDeviceBindingVo"/> <include refid="selectPalletDeviceBindingVo"/>
where trayInfo.f_tray_code = #{trayCode} where trayInfo.f_tray_code = #{trayCode}
and palDeviceBinding.f_motherboard_code is not null
and palDeviceBinding.f_motherboard_code != ''
</select> </select>
<select id="listByStoreyCode" parameterType="string" resultMap="PalletDeviceBindingResult"> <select id="listByStoreyCode" parameterType="string" resultMap="PalletDeviceBindingResult">
<include refid="selectPalletDeviceBindingVo"/> <include refid="selectPalletDeviceBindingVo"/>
where palDeviceBinding.f_storey_code = #{storeyCode} where palDeviceBinding.f_storey_code = #{storeyCode}
and palDeviceBinding.f_motherboard_code is not null
and palDeviceBinding.f_motherboard_code != ''
</select> </select>
<select id="selectPalletDeviceBindingById" parameterType="Long" resultMap="PalletDeviceBindingResult"> <select id="selectPalletDeviceBindingById" parameterType="Long" resultMap="PalletDeviceBindingResult">
...@@ -437,6 +441,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -437,6 +441,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where f_pallet_device_binding_id = #{item.palletDeviceBindingId} and f_motherboard_code is not null where f_pallet_device_binding_id = #{item.palletDeviceBindingId} and f_motherboard_code is not null
</foreach> </foreach>
</update> </update>
<update id="batchUpdateIotStatus" parameterType="list">
<foreach collection="palletDeviceBindingList" item="item" index="index" separator=";">
UPDATE t_pallet_device_binding
SET f_iot_status = #{item.iotStatus}
where f_pallet_device_binding_id = #{item.palletDeviceBindingId}
</foreach>
</update>
<update id="batchUpdateDeviceCodeAndUnbindingTime" parameterType="list"> <update id="batchUpdateDeviceCodeAndUnbindingTime" parameterType="list">
<foreach collection="palletDeviceBindingList" item="item" index="index" separator=";"> <foreach collection="palletDeviceBindingList" item="item" index="index" separator=";">
UPDATE t_pallet_device_binding UPDATE t_pallet_device_binding
......
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