| | |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | public class S7object extends Thread { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼读取plc数据开始时间:{}", startDate); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼读取plc数据结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | if (getplcvlues != null) { |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | } |