Commit 389633da authored by wanghao's avatar wanghao

1 扫托盘 上料 测试

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