| | |
| | | |
| | | import HslCommunication.Core.Types.OperateResult; |
| | | import HslCommunication.Core.Types.OperateResultExOne; |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | |
| | | |
| | | private List<ZyStationStatusEntity> statusList; |
| | | private List<ZyStationStatusEntity> barcodeStatusList; |
| | | private final SiemensS7Net siemensNet; |
| | | private final DeviceConfig deviceConfig; |
| | | private SiemensS7Net siemensNet; |
| | | private DeviceConfig deviceConfig; |
| | | private RedisUtil redisUtil; |
| | | |
| | | public ZyStationRealConnect(SiemensS7Net siemensNet, DeviceConfig deviceConfig) { |
| | | this.siemensNet = siemensNet; |
| | | public ZyStationRealConnect(DeviceConfig deviceConfig, RedisUtil redisUtil) { |
| | | this.deviceConfig = deviceConfig; |
| | | this.redisUtil = redisUtil; |
| | | } |
| | | |
| | | @Override |
| | | public boolean connect() { |
| | | boolean connected = false; |
| | | siemensNet = new SiemensS7Net(SiemensPLCS.S1200, deviceConfig.getIp()); |
| | | OperateResult connect = siemensNet.ConnectServer(); |
| | | if (connect.IsSuccess) { |
| | | connected = true; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ZyStationStatusEntity> getStatus() { |
| | | public List<ZyStationStatusEntity> getStatus(Integer deviceNo) { |
| | | if (statusList == null) { |
| | | BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (basDevpService == null) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CommandResponse sendCommand(StationCommand command) { |
| | | public CommandResponse sendCommand(Integer deviceNo, StationCommand command) { |
| | | CommandResponse commandResponse = new CommandResponse(false); |
| | | if (null == command) { |
| | | commandResponse.setMessage("命令为空"); |
| | |
| | | } |
| | | return -1; |
| | | } |
| | | } |
| | | } |