Commit 389633da authored by wanghao's avatar wanghao

1 扫托盘 上料 测试

parent 8b565379
...@@ -104,10 +104,11 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService ...@@ -104,10 +104,11 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
robotArmCommandMapper.selectPendingUnloadingCommands(); robotArmCommandMapper.selectPendingUnloadingCommands();
if (!unloadingCommands.isEmpty()) { if (!unloadingCommands.isEmpty()) {
boolean[] roboticArmExitConveyorData = Modbus4jUtils.getRoboticArmExitConveyorData(); // boolean[] roboticArmExitConveyorData = Modbus4jUtils.getRoboticArmExitConveyorData();
if(roboticArmExitConveyorData[1]) { // if(roboticArmExitConveyorData[1]) {
log.info("开始处理上料指令: {}", loadingCommands.get(0));
sendCommand(unloadingCommands.get(0), "UNLOAD"); sendCommand(unloadingCommands.get(0), "UNLOAD");
} // }
} }
} }
......
...@@ -12,6 +12,7 @@ import com.zehong.system.mapper.TStoreyInfoMapper; ...@@ -12,6 +12,7 @@ import com.zehong.system.mapper.TStoreyInfoMapper;
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.websocket.RobotArmWebSocketHandler;
import org.quartz.*; import org.quartz.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -29,6 +30,8 @@ import java.util.Date; ...@@ -29,6 +30,8 @@ import java.util.Date;
public class FinalExecutionJob implements Job { public class FinalExecutionJob implements Job {
private static final Logger log = LoggerFactory.getLogger(FinalExecutionJob.class); private static final Logger log = LoggerFactory.getLogger(FinalExecutionJob.class);
@Resource
private RobotArmWebSocketHandler robotArmWebSocketHandler;
@Resource @Resource
private ITEquipmentAlarmDataService alarmDataService; private ITEquipmentAlarmDataService alarmDataService;
@Resource @Resource
...@@ -75,7 +78,7 @@ public class FinalExecutionJob implements Job { ...@@ -75,7 +78,7 @@ public class FinalExecutionJob implements Job {
cleanUpJobs(fStoreyId,context); cleanUpJobs(fStoreyId,context);
// 4. 发送 下料指令 // 4. 发送 下料指令
createRoboticArm(tStoreyInfo.getfTrayCode(),tStoreyInfo.getfStoreyCode()); createRoboticArm(tStoreyInfo.getfTrayCode(),tStoreyInfo.getfStoreyCode(),tStoreyInfo.getBlankingCommand());
log.info("设备[{}]最终业务逻辑执行完成", fStoreyId); log.info("设备[{}]最终业务逻辑执行完成", fStoreyId);
} catch (Exception e) { } catch (Exception e) {
...@@ -89,7 +92,7 @@ public class FinalExecutionJob implements Job { ...@@ -89,7 +92,7 @@ public class FinalExecutionJob implements Job {
} }
} }
private void createRoboticArm(String trayCode,String storeyCode) { private void createRoboticArm(String trayCode,String storeyCode,String command) {
// 创建机械臂任务 // 创建机械臂任务
RobotArmCommand robotArmCommand = new RobotArmCommand(); RobotArmCommand robotArmCommand = new RobotArmCommand();
robotArmCommand.setType("1"); robotArmCommand.setType("1");
...@@ -97,7 +100,9 @@ public class FinalExecutionJob implements Job { ...@@ -97,7 +100,9 @@ public class FinalExecutionJob implements Job {
robotArmCommand.setTrayCode(trayCode); robotArmCommand.setTrayCode(trayCode);
robotArmCommand.setStoreyCode(storeyCode); robotArmCommand.setStoreyCode(storeyCode);
robotArmCommand.setCreateTime(new Date()); robotArmCommand.setCreateTime(new Date());
robotArmCommand.setCommand(command);
robotArmCommandMapper.insertRobotArmCommand(robotArmCommand); robotArmCommandMapper.insertRobotArmCommand(robotArmCommand);
notifyCommandsUpdate();
} }
private void cleanUpJobs(String deviceId,JobExecutionContext context) throws SchedulerException { private void cleanUpJobs(String deviceId,JobExecutionContext context) throws SchedulerException {
...@@ -120,4 +125,7 @@ public class FinalExecutionJob implements Job { ...@@ -120,4 +125,7 @@ public class FinalExecutionJob implements Job {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
private void notifyCommandsUpdate() {
robotArmWebSocketHandler.broadcastCommandUpdate();
}
} }
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