Commit 04b02950 authored by wanghao's avatar wanghao

1测试上电断电操作

parent cddda129
...@@ -47,6 +47,8 @@ public interface TTrayInfoMapper ...@@ -47,6 +47,8 @@ public interface TTrayInfoMapper
*/ */
public int updateTTrayInfo(TTrayInfo tTrayInfo); public int updateTTrayInfo(TTrayInfo tTrayInfo);
public int updateStatusByTrayCode(TTrayInfo tTrayInfo);
public int unbindByCode(TTrayInfo tTrayInfo); public int unbindByCode(TTrayInfo tTrayInfo);
/** /**
* 删除托盘信息 * 删除托盘信息
......
...@@ -125,9 +125,9 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService ...@@ -125,9 +125,9 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
// 如果是下料,则 先断电再去下料 // 如果是下料,则 先断电再去下料
if("UNLOAD".equals(commandType)) { if("UNLOAD".equals(commandType)) {
String trayCode = command.getTrayCode(); String storeyCode = command.getStoreyCode();
if(StringUtils.isNotBlank(trayCode)) { if(StringUtils.isNotBlank(storeyCode)) {
String[] split = trayCode.split("-"); String[] split = storeyCode.split("-");
TEquipmentInfo tEquipmentInfo = equipmentInfoMapper.selectTEquipmentInfoByCode(split[0]); TEquipmentInfo tEquipmentInfo = equipmentInfoMapper.selectTEquipmentInfoByCode(split[0]);
......
...@@ -6,9 +6,11 @@ import com.serotonin.modbus4j.exception.ModbusInitException; ...@@ -6,9 +6,11 @@ import com.serotonin.modbus4j.exception.ModbusInitException;
import com.serotonin.modbus4j.exception.ModbusTransportException; import com.serotonin.modbus4j.exception.ModbusTransportException;
import com.zehong.system.domain.TEquipmentAlarmData; import com.zehong.system.domain.TEquipmentAlarmData;
import com.zehong.system.domain.TStoreyInfo; import com.zehong.system.domain.TStoreyInfo;
import com.zehong.system.domain.TTrayInfo;
import com.zehong.system.modbus.util.Modbus4jUtils; import com.zehong.system.modbus.util.Modbus4jUtils;
import com.zehong.system.service.ITEquipmentAlarmDataService; import com.zehong.system.service.ITEquipmentAlarmDataService;
import com.zehong.system.service.ITStoreyInfoService; import com.zehong.system.service.ITStoreyInfoService;
import com.zehong.system.service.ITTrayInfoService;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
...@@ -31,6 +33,9 @@ public class AllCommandHandler { ...@@ -31,6 +33,9 @@ public class AllCommandHandler {
@Resource @Resource
private ITStoreyInfoService tStoreyInfoService; private ITStoreyInfoService tStoreyInfoService;
@Resource
private ITTrayInfoService trayInfoService;
@Resource @Resource
private DeviceTaskScheduler deviceTaskScheduler; private DeviceTaskScheduler deviceTaskScheduler;
...@@ -66,6 +71,12 @@ public class AllCommandHandler { ...@@ -66,6 +71,12 @@ public class AllCommandHandler {
tStoreyInfo.setfAgingStartTime(new Date()); tStoreyInfo.setfAgingStartTime(new Date());
tStoreyInfoService.updateTStoreyInfo(tStoreyInfo); tStoreyInfoService.updateTStoreyInfo(tStoreyInfo);
// 同时 把 托盘的 状态更新
TTrayInfo tTrayInfo = new TTrayInfo();
tTrayInfo.setfStatus("1");
tTrayInfo.setfStoreyCode(storeyCode);
trayInfoService.updateTTrayInfo(tTrayInfo);
deviceTaskScheduler.scheduleDeviceMonitoring(tStoreyInfo.getfStoreyId(),fip,fport); deviceTaskScheduler.scheduleDeviceMonitoring(tStoreyInfo.getfStoreyId(),fip,fport);
} }
......
...@@ -10,6 +10,7 @@ import org.quartz.JobDataMap; ...@@ -10,6 +10,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Arrays; import java.util.Arrays;
...@@ -31,6 +32,9 @@ public class DeviceCommunicationJob implements Job { ...@@ -31,6 +32,9 @@ public class DeviceCommunicationJob implements Job {
@Resource @Resource
private TStoreyInfoMapper tStoreyInfoMapper; private TStoreyInfoMapper tStoreyInfoMapper;
@Autowired
private ModbusResultHandler resultHandler;
@Override @Override
public void execute(JobExecutionContext context) { public void execute(JobExecutionContext context) {
JobDataMap data = context.getJobDetail().getJobDataMap(); JobDataMap data = context.getJobDetail().getJobDataMap();
...@@ -42,7 +46,6 @@ public class DeviceCommunicationJob implements Job { ...@@ -42,7 +46,6 @@ public class DeviceCommunicationJob implements Job {
// 1. 执行Modbus通信 // 1. 执行Modbus通信
String s = tStoreyInfo.getfPort(); String s = tStoreyInfo.getfPort();
String ip = tStoreyInfo.getfIp(); String ip = tStoreyInfo.getfIp();
ModbusResultHandler resultHandler = new ModbusResultHandler();
// 501 的 27个 设备id // 501 的 27个 设备id
List<Integer> registerOffsetsOne = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27); List<Integer> registerOffsetsOne = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27);
// 501 对应 27个设备读取状态 并设置时间 // 501 对应 27个设备读取状态 并设置时间
......
...@@ -85,6 +85,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -85,6 +85,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</insert> </insert>
<update id="updateStatusByTrayCode" parameterType="TTrayInfo">
update t_tray_info
set f_status = #{fStatus}
where f_storey_code = #{fStoreyCode}
</update>
<update id="updateTTrayInfo" parameterType="TTrayInfo"> <update id="updateTTrayInfo" parameterType="TTrayInfo">
update t_tray_info update t_tray_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="location" label="位置" align="center"> <el-table-column prop="location" label="位置" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="location-text">{{ scope.row.location }}</div> <div class="location-text">{{ scope.row.fStoreyCode }}</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
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