Commit 6f17ee6f by wuwenlong

设备参数解析

parent a9330450
package com.baosight.hpjx.equipment.hp.domain;
import com.baosight.hpjx.xml.IXml;
import com.baosight.hpjx.xml.XmlUtils;
import lombok.Data;
import java.util.List;
/**
* @Author wwl
* @Date 2024/3/29 11:22
*/
@Data
public class CutterbarStatus {
@IXml(nodeName = "status")
private Integer status;
public static void main(String[] args) {
List<CutterbarStatus> list = XmlUtils.readXml("<ncda><status>1</status></ncda>",CutterbarStatus.class);
System.out.println(list);
}
}
package com.baosight.hpjx.equipment.hp.domain;
import com.baosight.hpjx.xml.IXml;
import com.baosight.hpjx.xml.XmlUtils;
import lombok.Data;
import java.util.List;
import java.util.Objects;
/**
* @Author wwl
* @Date 2024/3/29 12:25
*/
@Data
public class CutterbarWarning {
/**
* 异常编码
*/
private String errorCode;
/**
* 异常登记
*/
private String prio;
/**
* 程序号
*/
private String programNo;
/**
* 行号
*/
private String rowNo;
/**
* 不存在跳转行
*/
private String gotoRowNone;
/**
* 文件名
*/
private String fileName;
public static CutterbarWarning convertBase(CutterbarWarningBase base){
CutterbarWarning warning = null;
if(Objects.nonNull(base)&&Objects.nonNull(base.getNo())){
Integer no = base.getNo();
warning = new CutterbarWarning();
warning.setErrorCode(no.toString());
warning.setPrio(base.getPrio());
if(no.compareTo(new Integer(200))>=0&&no.compareTo(new Integer(299))<=0){
warning.setProgramNo(base.getArg1());
warning.setRowNo(base.getArg2());
warning.setGotoRowNone(base.getArg3());
warning.setFileName(base.getFileName());
}else if(no.compareTo(new Integer(300))>=0&&no.compareTo(new Integer(399))<=0){
warning.setRowNo(base.getArg1());
warning.setFileName(warning.getFileName());
}
}
return warning;
}
}
package com.baosight.hpjx.equipment.hp.domain;
import com.baosight.hpjx.xml.IXml;
import com.baosight.hpjx.xml.XmlUtils;
import lombok.Data;
import java.util.List;
/**
* @Author wwl
* @Date 2024/3/29 12:25
*/
@Data
public class CutterbarWarningBase {
@IXml(nodeName = "no")
private Integer no;
@IXml(nodeName = "prio")
private String prio;
@IXml(nodeName = "arg1")
private String arg1;
@IXml(nodeName = "arg2")
private String arg2;
@IXml(nodeName = "arg3")
private String arg3;
@IXml(nodeName = "fileName")
private String fileName;
public static void main(String[] args) {
List<CutterbarWarningBase> list = XmlUtils.readXml("<alarm><no>0</no><prio>0</prio><arg1>0</arg1><arg2>0</arg2><fileName></fileName></alarm>", CutterbarWarningBase.class);
System.out.println(list);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment