Commit 04b02950 authored by wanghao's avatar wanghao

1测试上电断电操作

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