| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.DeviceConfig; |
| | | import com.zy.asrs.service.DeviceConfigService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.ShuttleSlave; |
| | | import com.zy.core.model.protocol.ShuttleProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.ShuttleThread; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 小车电量预警检测 => 强制预警 |
| | |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | private DeviceConfigService deviceConfigService; |
| | | |
| | | /** |
| | | * 小车电量预警检测 => 强制预警 |
| | |
| | | buffer.append("【通知】四向库\n");//消息标题 |
| | | |
| | | boolean hasReport = false;//是否有需要报告的数据 |
| | | for (ShuttleSlave slave : slaveProperties.getShuttle()) { |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId()); |
| | | List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() |
| | | .eq("device_type", String.valueOf(SlaveType.Shuttle))); |
| | | for (DeviceConfig device : shuttleList) { |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo()); |
| | | if (shuttleThread == null) { |
| | | continue; |
| | | } |
| | |
| | | continue;//充电中,无需通知 |
| | | } |
| | | |
| | | if (shuttleProtocol.getBatteryPower() == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (Integer.parseInt(shuttleProtocol.getBatteryPower()) < shuttlePowerEarlyValue) { |
| | | buffer.append(shuttleProtocol.getShuttleNo()).append("号小车,电量").append(shuttleProtocol.getBatteryPower()).append(",请注意。\n"); |
| | | hasReport = true; |