package com.mes.service;
|
|
import cn.hutool.json.JSONArray;
|
import cn.hutool.json.JSONObject;
|
import com.mes.device.PlcParameterInfo;
|
import com.mes.tools.HexConversion;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
import java.io.*;
|
import java.net.Socket;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
/**
|
* Plc参数
|
*/
|
@Component
|
@Slf4j
|
public class PlcParameter {
|
|
|
/**
|
* 编号
|
*/
|
private String CodeId;
|
/**
|
* 起始地址
|
*/
|
private int addressStart=0;
|
/**
|
* 长度
|
*/
|
private int addressLength=0;
|
/**
|
* 类型
|
*/
|
private String type="int";
|
|
/**
|
* 实时读取的byte值
|
*/
|
private byte[] readByte=null;
|
/**
|
* 实时读取的byte值转换成 对应类型
|
*/
|
private Object readValue=null;
|
|
/**
|
* 需要写入的值
|
*/
|
private Object writeValue=null;
|
|
PlcParameter(){
|
|
}
|
PlcParameter(String codeId, int addressStart, int addressLength, String type){
|
this.CodeId=codeId;
|
this.addressStart=addressStart;
|
this.addressLength=addressLength;
|
this.type=type;
|
}
|
|
public String getCodeId() {
|
return CodeId;
|
}
|
|
public void setCodeId(String codeId) {
|
CodeId = codeId;
|
}
|
|
public int getAddressStart() {
|
return addressStart;
|
}
|
|
public void setAddressStart(int addressIndex) {
|
this.addressStart = addressStart;
|
}
|
|
public int getAddressLength() {
|
return addressLength;
|
}
|
|
public void setAddressLength(int addressLength) {
|
this.addressLength = addressLength;
|
}
|
|
public String getType() {
|
return type;
|
}
|
|
public void setType(String type) {
|
this.type = type;
|
}
|
|
public Object getReadValue() {
|
return readValue;
|
}
|
|
public void setReadValue(Object readValue) {
|
this.readValue = readValue;
|
}
|
|
public byte[] getReadByte() {
|
return this.readByte;
|
}
|
|
public void setReadByte(byte[] readByte) {
|
this.readByte = readByte;
|
}
|
|
public Object getWriteValue() {
|
return writeValue;
|
}
|
|
public void setWriteValue(Object writeValue) {
|
this.writeValue = writeValue;
|
}
|
}
|