| | |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.DateUtils; |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import com.zy.asrs.entity.Devp; |
| | | import com.zy.asrs.service.DevpService; |
| | | import com.zy.asrs.utils.SpringContextUtil; |
| | |
| | | OperateResult connect = siemensS7Net.ConnectServer(); |
| | | if (connect.IsSuccess) { |
| | | result = true; |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | //OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | News.info("SiemensDevp" + " - 1" + " - 输送线plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | |
| | | devps.add(staProtocol.toSqlModel()); |
| | | } |
| | | DevpService devpService = SpringContextUtil.getBean(DevpService.class); |
| | | if (null != devpService && !devpService.updateBatchById(devps)) { |
| | | if (null != devpService) { |
| | | devpService.updateBatchByDevpNo(devps); |
| | | } else { |
| | | throw new Exception("更新数据库数据失败"); |
| | | } |
| | | } catch (Exception e) { |