前面一篇文章介绍了C#和secs集成的例子
springboot与secs例子下载-----> 更多详细资料





$('#S5F1ERR').click(function(){
$.ajax({
type: 'GET',
url: '/S5F1ERR',
data: {
id: 1
},
success: function (res) {
$('#msg').text("发送成功");
hideMsg()
}
})
});
$('#S5F1CanclERR').click(function(){
$.ajax({
type: 'GET',
url: '/S5F1CanclERR',
data: {
id: 1
},
success: function (res) {
$('#msg').text("发送成功");
hideMsg()
}
})
});
@RequestMapping("/S5F1ERR")
@ResponseBody
public String S5F1ERR() throws InterruptedException {
SecsMessage msg = null;
Secs2 secs2=null;
Optional<SecsMessage> reply=null;
byte result=0x00;
try {
secs2=Secs2.list(
Secs2.binary((byte) 0x08), /* 0 */
Secs2.uint2(6), /* 1 */
Secs2.ascii("The boiler temperature exceeds the range")
);
reply = SecsBase.comm.send(5, 1, true,secs2);
msg = reply.get();
secs2 = reply.get().secs2();
try{
result=secs2.getByte(0);
} catch (Secs2Exception e ) {
SecsBase.comm.gem().s9f7(msg);
}
}catch (SecsException e){
return "secs设备还没有连接上主机";
}
return "OK";
}
@RequestMapping("/S5F1CanclERR")
@ResponseBody
public String S5F1Cancl() throws InterruptedException {
SecsMessage msg = null;
Secs2 secs2=null;
Optional<SecsMessage> reply=null;
byte result=0x00;
try {
secs2=Secs2.list(
Secs2.binary((byte) 0x00), /* 0 */
Secs2.uint2(6), /* 1 */
Secs2.ascii("The boiler temperature exceeds the range")
);
reply = SecsBase.comm.send(5, 1, true,secs2);
msg = reply.get();
secs2 = reply.get().secs2();
try{
result=secs2.getByte(0);
} catch (Secs2Exception e ) {
SecsBase.comm.gem().s9f7(msg);
}
}catch (SecsException e){
return "secs设备还没有连接上主机";
}
return "OK";
}
