加热器适配
This commit is contained in:
parent
74fa687caa
commit
bae6cad25e
|
|
@ -6,25 +6,13 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.ifish.socket.model.receive.*;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ifish.socket.model.receive.BackBytes128;
|
||||
import com.ifish.socket.model.receive.BackBytes128_2;
|
||||
import com.ifish.socket.model.receive.BackBytes28;
|
||||
import com.ifish.socket.model.receive.BackBytes57;
|
||||
import com.ifish.socket.model.receive.BackBytes71;
|
||||
import com.ifish.socket.model.receive.BackBytes72;
|
||||
import com.ifish.socket.model.receive.BackBytes73;
|
||||
import com.ifish.socket.model.receive.BackBytes74;
|
||||
import com.ifish.socket.model.receive.BackBytes84;
|
||||
import com.ifish.socket.model.receive.BackBytes85;
|
||||
import com.ifish.socket.model.receive.BackBytes86;
|
||||
import com.ifish.socket.model.receive.BackBytes86ByRuixinDuli;
|
||||
import com.ifish.socket.model.receive.BackBytes99;
|
||||
import com.ifish.socket.model.receive.BackFunctionCode8;
|
||||
import com.ifish.socket.model.send.BackFunctionCode1;
|
||||
import com.ifish.socket.model.send.OrderFunctionCode1;
|
||||
import com.ifish.socket.model.send.OrderFunctionCode14;
|
||||
|
|
@ -57,6 +45,10 @@ public class SomeServer {
|
|||
* @param message
|
||||
*/
|
||||
public void doSome(IoSession session, Object message) {
|
||||
NioSocketAcceptor acceptor = new NioSocketAcceptor();
|
||||
Map<Long, IoSession> managedSessions = acceptor.getManagedSessions();
|
||||
|
||||
|
||||
//松诺5控返回信息
|
||||
if (message instanceof BackBytes86) {
|
||||
BackBytes86 receive = (BackBytes86) message;
|
||||
|
|
@ -81,7 +73,28 @@ public class SomeServer {
|
|||
} else {
|
||||
sendTest(session, strSrc, null);
|
||||
}
|
||||
} //松诺8控返回信息
|
||||
} else if (message instanceof BackBytes87) {
|
||||
//睿美4控
|
||||
BackBytes87 receive = (BackBytes87) message;
|
||||
String strSrc = ByteUtil.bytesToHexString(receive.getSrc());
|
||||
if (receive.getCheck_code() != 8) {
|
||||
Map<String, Object> json = new HashMap<String, Object>();
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
//灯1-灯5状态
|
||||
dataMap.put(strSrc + "Result1", receive.getOnoff1() == 1 ? "开" : "关");
|
||||
dataMap.put(strSrc + "Result2", receive.getOnoff2() == 1 ? "开" : "关");
|
||||
dataMap.put(strSrc + "Result3", receive.getOnoff3() == 1 ? "开" : "关");
|
||||
dataMap.put(strSrc + "Result4", receive.getOnoff4() == 1 ? "开" : "关");
|
||||
dataMap.put(strSrc + "Result5", receive.getOnoff5() == 1 ? "开" : "关");
|
||||
dataMap.put(strSrc + "Wendu", "水温:" + (float) receive.getWendu() / 10 + "<br/><br/>室温:" + (float) receive.getRoomTemperature() / 10);
|
||||
json.put("result", "onoff");
|
||||
json.put("data", dataMap);
|
||||
//返回结果给客户端
|
||||
sendTest(session, strSrc, json);
|
||||
} else {
|
||||
sendTest(session, strSrc, null);
|
||||
}
|
||||
}//松诺8控返回信息
|
||||
else if (message instanceof BackBytes128) {
|
||||
BackBytes128 receive = (BackBytes128) message;
|
||||
String strSrc = ByteUtil.bytesToHexString(receive.getSrc());
|
||||
|
|
@ -534,11 +547,11 @@ public class SomeServer {
|
|||
this.isReplay = isReplay;
|
||||
System.out.println("心跳回复" + this.isReplay);
|
||||
//类型
|
||||
String[] str1 = new String[]{"01", "0a", "1a", "0b", "0c", "0d", "0e", "0f", "bb", "aa", "bd", "bc", "1c", "cc", "2a"};
|
||||
String[] str1 = new String[]{"01", "0a", "1a", "0b", "0c", "0d", "0e", "0f", "bb", "aa", "bd", "bc", "1c", "cc", "2a","2b","3a"};
|
||||
//类型名称
|
||||
String[] str2 = new String[]{"3控(陈工)", "0控大屏", "0控小屏", "2控普通", "3控(张工)", "2控闽江", "4控", "绚多", "松诺(8控无屏)", "可丽爱", "松诺(5控)", "松诺(有屏)", "3控(温控)", "四川巨能", "睿芯独立"};
|
||||
String[] str2 = new String[]{"3控(陈工)", "0控大屏", "0控小屏", "2控普通", "3控(张工)", "2控闽江", "4控", "绚多", "松诺(8控无屏)", "可丽爱", "松诺(5控)", "松诺(有屏)", "3控(温控)", "四川巨能", "睿芯独立","睿美4控","加热棒"};
|
||||
//型号对应指令数量
|
||||
Integer[] str3 = new Integer[]{4, 1, 1, 4, 5, 3, 5, 7, 10, 6, 7, 10, 7, 7, 8};
|
||||
Integer[] str3 = new Integer[]{4, 1, 1, 4, 5, 3, 5, 7, 10, 6, 7, 10, 7, 7, 8,5,1};
|
||||
//默认显示的厂家
|
||||
if (factoryCode.equals("0a")) {
|
||||
controlType = str1[0];
|
||||
|
|
@ -703,5 +716,21 @@ public class SomeServer {
|
|||
map14.put("onOff7Checkbox", "加热制冷切换");
|
||||
showNameMap.put(str1[14], map14);
|
||||
orderNumberMap.put(str1[14], new int[]{-1, 14, 1, 2, 3, 4, 13, 5});
|
||||
|
||||
//睿美4控
|
||||
Map<String, String> map15 = new HashMap<String, String>();
|
||||
map15.put("onOff0Checkbox", "灯1");
|
||||
map15.put("onOff1Checkbox", "灯2");
|
||||
map15.put("onOff2Checkbox", "杀菌灯");
|
||||
map15.put("onOff3Checkbox", "氧泵");
|
||||
map15.put("onOff4Checkbox", "自定义模式");
|
||||
showNameMap.put(str1[15], map15);
|
||||
orderNumberMap.put(str1[15], new int[]{1, 2, 3, 4, 5});
|
||||
|
||||
//加热棒
|
||||
Map<String, String> map16 = new HashMap<String, String>();
|
||||
map15.put("onOff0Checkbox", "总开关");
|
||||
showNameMap.put(str1[16], map16);
|
||||
orderNumberMap.put(str1[16], new int[]{1});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ public class PublicAction {
|
|||
public ModelAndView login(ModelMap map) {
|
||||
String port = "8080";
|
||||
String ip = address.getIp();
|
||||
if (address.getServerPort().equals("7080")) {
|
||||
port = "7080";
|
||||
if (address.getServerPort().equals("8080")) {
|
||||
port = "8080";
|
||||
map.put("socketAddress", ip + ":" + port + "//ifishTools" + "/");
|
||||
return new ModelAndView("index", map);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ifish.socket.codeFactory;
|
|||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import com.ifish.socket.model.receive.*;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.session.AttributeKey;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
|
|
@ -11,19 +12,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ifish.socket.SomeServer;
|
||||
import com.ifish.socket.model.receive.BackBytes128;
|
||||
import com.ifish.socket.model.receive.BackBytes128_2;
|
||||
import com.ifish.socket.model.receive.BackBytes28;
|
||||
import com.ifish.socket.model.receive.BackBytes57;
|
||||
import com.ifish.socket.model.receive.BackBytes71;
|
||||
import com.ifish.socket.model.receive.BackBytes72;
|
||||
import com.ifish.socket.model.receive.BackBytes73;
|
||||
import com.ifish.socket.model.receive.BackBytes74;
|
||||
import com.ifish.socket.model.receive.BackBytes84;
|
||||
import com.ifish.socket.model.receive.BackBytes85;
|
||||
import com.ifish.socket.model.receive.BackBytes86;
|
||||
import com.ifish.socket.model.receive.BackBytes86ByRuixinDuli;
|
||||
import com.ifish.socket.model.receive.BackBytes99;
|
||||
import com.ifish.socket.model.send.BackFunctionCode7_11;
|
||||
import com.ifish.socket.model.send.OrderFunctionCode0;
|
||||
import com.ifish.socket.model.send.OrderFunctionCode1;
|
||||
|
|
@ -280,6 +268,21 @@ public class ServerDecode implements ProtocolDecoder {
|
|||
decode128(buf, out);
|
||||
}
|
||||
break;
|
||||
}case 87: {
|
||||
String hexDump = buf.getHexDump();
|
||||
byte[] hexByte = ByteUtil.hexStringToBytes(hexDump);
|
||||
//mac地址
|
||||
byte[] srcByte = new byte[6];
|
||||
for (int i = 2; i < 8; i++) {
|
||||
srcByte[i - 2] = hexByte[i];
|
||||
}
|
||||
String strSrc = ByteUtil.bytesToHexString(srcByte);
|
||||
String type = SomeServer.hardwareTypeMap.get(strSrc);
|
||||
//睿美4控
|
||||
if (type != null && type.equals("2b")) {
|
||||
decode87(buf, out);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
|
|
@ -2125,6 +2128,157 @@ public class ServerDecode implements ProtocolDecoder {
|
|||
out.write(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备返回信息87(睿美4控)
|
||||
*
|
||||
* @param buf
|
||||
* @param out
|
||||
*/
|
||||
private void decode87(IoBuffer buf, ProtocolDecoderOutput out) {
|
||||
//实例化一个对象
|
||||
BackBytes87 model = new BackBytes87();
|
||||
|
||||
//buf.get()取到的都是通信协议中从上往下的每段字节信息,所以要对应通信协议去插入每段数据,特别要注意前后顺序,不然会将A功能的状态插入到B功能
|
||||
//读取15字节头开始插入数据
|
||||
//发送消息类型,1回复类型,0发送类型
|
||||
model.setType(buf.get());
|
||||
|
||||
//功能码 对应通信协议的暗红、黄色部分发送、返回的功能码
|
||||
model.setCheck_code(buf.get());
|
||||
|
||||
//读取发送端的mac地址对象结构
|
||||
byte[] src = model.getSrc();
|
||||
//循环读取每一字节插入mac地址对象结构中
|
||||
for (int i = 0; i < src.length; i++) {
|
||||
src[i] = buf.get();
|
||||
}
|
||||
//将mac地址插入到对象中
|
||||
model.setSrc(src);
|
||||
|
||||
//读取接收端的mac地址,如上
|
||||
byte[] dest = model.getDest();
|
||||
for (int i = 0; i < dest.length; i++) {
|
||||
dest[i] = buf.get();
|
||||
}
|
||||
model.setDest(dest);
|
||||
|
||||
//整个包长度
|
||||
model.setRemote_len(buf.get());
|
||||
|
||||
//灯1编号和开关
|
||||
model.setNumber1(buf.get());
|
||||
model.setOnoff1(buf.get());
|
||||
|
||||
//灯2编号和开关
|
||||
model.setNumber2(buf.get());
|
||||
model.setOnoff2(buf.get());
|
||||
|
||||
//灯3编号和开关
|
||||
model.setNumber3(buf.get());
|
||||
model.setOnoff3(buf.get());
|
||||
|
||||
//灯4编号和开关
|
||||
model.setNumber4(buf.get());
|
||||
model.setOnoff4(buf.get());
|
||||
|
||||
//加热制冷开关
|
||||
model.setNumber5(buf.get());
|
||||
model.setOnoff5(buf.get());
|
||||
|
||||
//定时器编号
|
||||
byte timer_number1 = model.getTimer_number1();
|
||||
byte timer_number2 = model.getTimer_number2();
|
||||
byte timer_number3 = model.getTimer_number3();
|
||||
byte timer_number4 = model.getTimer_number4();
|
||||
byte timer_number5 = model.getTimer_number5();
|
||||
byte timer_number6 = model.getTimer_number6();
|
||||
byte timer_number7 = model.getTimer_number7();
|
||||
byte timer_number8 = model.getTimer_number8();
|
||||
|
||||
//定时器开关
|
||||
byte timer_onoff1 = model.getTimer_onoff1();
|
||||
byte timer_onoff2 = model.getTimer_onoff2();
|
||||
byte timer_onoff3 = model.getTimer_onoff3();
|
||||
byte timer_onoff4 = model.getTimer_onoff4();
|
||||
byte timer_onoff5 = model.getTimer_onoff5();
|
||||
byte timer_onoff6 = model.getTimer_onoff6();
|
||||
byte timer_onoff7 = model.getTimer_onoff7();
|
||||
byte timer_onoff8 = model.getTimer_onoff8();
|
||||
|
||||
//定时器时间
|
||||
byte[] timer_time1 = model.getTimer_time1();
|
||||
byte[] timer_time2 = model.getTimer_time2();
|
||||
byte[] timer_time3 = model.getTimer_time3();
|
||||
byte[] timer_time4 = model.getTimer_time4();
|
||||
byte[] timer_time5 = model.getTimer_time5();
|
||||
byte[] timer_time6 = model.getTimer_time6();
|
||||
byte[] timer_time7 = model.getTimer_time7();
|
||||
byte[] timer_time8 = model.getTimer_time8();
|
||||
|
||||
byte[] timer_numbers = {timer_number1, timer_number2, timer_number3, timer_number4, timer_number5, timer_number6, timer_number7, timer_number8};
|
||||
byte[] timer_onoffs = {timer_onoff1, timer_onoff2, timer_onoff3, timer_onoff4, timer_onoff5, timer_onoff6, timer_onoff7, timer_onoff8};
|
||||
byte[][] timers = {timer_time1, timer_time2, timer_time3, timer_time4, timer_time5, timer_time6, timer_time7, timer_time8};
|
||||
|
||||
for (int i = 0; i < timer_numbers.length; i++) {
|
||||
//定时器编号
|
||||
timer_numbers[i] = buf.get();
|
||||
//定时器开关
|
||||
timer_onoffs[i] = buf.get();
|
||||
for (int j = 0; j < timers[i].length; j++) {
|
||||
timers[i][j] = buf.get();
|
||||
}
|
||||
}
|
||||
//定时器编号
|
||||
model.setTimer_number1(timer_numbers[0]);
|
||||
model.setTimer_number2(timer_numbers[1]);
|
||||
model.setTimer_number3(timer_numbers[2]);
|
||||
model.setTimer_number4(timer_numbers[3]);
|
||||
model.setTimer_number5(timer_numbers[4]);
|
||||
model.setTimer_number6(timer_numbers[5]);
|
||||
model.setTimer_number7(timer_numbers[6]);
|
||||
model.setTimer_number8(timer_numbers[7]);
|
||||
//定时器开关
|
||||
model.setTimer_onoff1(timer_onoffs[0]);
|
||||
model.setTimer_onoff2(timer_onoffs[1]);
|
||||
model.setTimer_onoff3(timer_onoffs[2]);
|
||||
model.setTimer_onoff4(timer_onoffs[3]);
|
||||
model.setTimer_onoff5(timer_onoffs[4]);
|
||||
model.setTimer_onoff6(timer_onoffs[5]);
|
||||
model.setTimer_onoff7(timer_onoffs[6]);
|
||||
model.setTimer_onoff8(timer_onoffs[7]);
|
||||
//定时器时间
|
||||
model.setTimer_time1(timers[0]);
|
||||
model.setTimer_time2(timers[1]);
|
||||
model.setTimer_time3(timers[2]);
|
||||
model.setTimer_time4(timers[3]);
|
||||
model.setTimer_time5(timers[4]);
|
||||
model.setTimer_time6(timers[5]);
|
||||
model.setTimer_time7(timers[6]);
|
||||
model.setTimer_time8(timers[7]);
|
||||
//加热状态
|
||||
model.setHeatStatus(buf.get());
|
||||
//温度
|
||||
model.setWendu(buf.getShort());
|
||||
//加热温度
|
||||
model.setHeatWendu(buf.getShort());
|
||||
//室温
|
||||
model.setRoomTemperature(buf.getShort());
|
||||
//报警开关
|
||||
model.setWarn_onoff(buf.get());
|
||||
//最低报警温度
|
||||
model.setLow_wendu(buf.getShort());
|
||||
//最高报警温度
|
||||
model.setHigh_wendu(buf.getShort());
|
||||
|
||||
//15字节头的校验码
|
||||
byte[] crc16_code = model.getCrc16_code();
|
||||
for (int i = 0; i < crc16_code.length; i++) {
|
||||
crc16_code[i] = buf.get();
|
||||
}
|
||||
out.write(model);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dispose(IoSession session) throws Exception {
|
||||
Context ctx = (Context) session.getAttribute(CONTEXT);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,430 @@
|
|||
package com.ifish.socket.model.receive;
|
||||
|
||||
import com.ifish.socket.model.HeadModel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 查询反馈信息87字节 睿美四控
|
||||
* @author guogw
|
||||
*
|
||||
*/
|
||||
public class BackBytes87 extends HeadModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2740442296642889777L;
|
||||
/*********灯和开关(8字节)**********/
|
||||
//灯编号1
|
||||
private byte number1;
|
||||
//灯编号2
|
||||
private byte number2;
|
||||
//灯编号3
|
||||
private byte number3;
|
||||
//灯编号4
|
||||
private byte number4;
|
||||
//自定义模式
|
||||
private byte number5;
|
||||
//灯1开关
|
||||
private byte onoff1;
|
||||
//灯2开关
|
||||
private byte onoff2;
|
||||
//灯3开关
|
||||
private byte onoff3;
|
||||
//灯4开关
|
||||
private byte onoff4;
|
||||
//自定义模式
|
||||
private byte onoff5;
|
||||
/*********定时器编号(6字节)灯1对应定时器1-2,灯2对应定时器3-4,灯3对应定时器5-6.....**********/
|
||||
//定时器1编号
|
||||
private byte timer_number1;
|
||||
//定时器2编号
|
||||
private byte timer_number2;
|
||||
//定时器3编号
|
||||
private byte timer_number3;
|
||||
//定时器4编号
|
||||
private byte timer_number4;
|
||||
//定时器5编号
|
||||
private byte timer_number5;
|
||||
//定时器6编号
|
||||
private byte timer_number6;
|
||||
//定时器7编号
|
||||
private byte timer_number7;
|
||||
//定时器8编号
|
||||
private byte timer_number8;
|
||||
/*********定时器开关(6字节)**********/
|
||||
//定时器1开关
|
||||
private byte timer_onoff1;
|
||||
//定时器2开关
|
||||
private byte timer_onoff2;
|
||||
//定时器3开关
|
||||
private byte timer_onoff3;
|
||||
//定时器4开关
|
||||
private byte timer_onoff4;
|
||||
//定时器5开关
|
||||
private byte timer_onoff5;
|
||||
//定时器6开关
|
||||
private byte timer_onoff6;
|
||||
//定时器7开关
|
||||
private byte timer_onoff7;
|
||||
//定时器8开关
|
||||
private byte timer_onoff8;
|
||||
/*********定时器时间(24字节)**********/
|
||||
//定时器1时间
|
||||
private byte[] timer_time1 = new byte[4];
|
||||
//定时器2时间
|
||||
private byte[] timer_time2 = new byte[4];
|
||||
//定时器3时间
|
||||
private byte[] timer_time3 = new byte[4];
|
||||
//定时器4时间
|
||||
private byte[] timer_time4 = new byte[4];
|
||||
//定时器5时间
|
||||
private byte[] timer_time5 = new byte[4];
|
||||
//定时器6时间
|
||||
private byte[] timer_time6 = new byte[4];
|
||||
//定时器7时间
|
||||
private byte[] timer_time7 = new byte[4];
|
||||
//定时器8时间
|
||||
private byte[] timer_time8 = new byte[4];
|
||||
//加热状态
|
||||
private byte heatStatus;
|
||||
//温度
|
||||
private short wendu;
|
||||
//加热温度
|
||||
private short heatWendu;
|
||||
//室温
|
||||
private short roomTemperature;
|
||||
//报警开关,0关,1开
|
||||
private byte warn_onoff;
|
||||
//最低报警温度
|
||||
private short low_wendu;
|
||||
//最高报警温度
|
||||
private short high_wendu;
|
||||
|
||||
public byte getNumber1() {
|
||||
return number1;
|
||||
}
|
||||
|
||||
public void setNumber1(byte number1) {
|
||||
this.number1 = number1;
|
||||
}
|
||||
|
||||
public byte getNumber2() {
|
||||
return number2;
|
||||
}
|
||||
|
||||
public void setNumber2(byte number2) {
|
||||
this.number2 = number2;
|
||||
}
|
||||
|
||||
public byte getNumber3() {
|
||||
return number3;
|
||||
}
|
||||
|
||||
public void setNumber3(byte number3) {
|
||||
this.number3 = number3;
|
||||
}
|
||||
|
||||
public byte getNumber4() {
|
||||
return number4;
|
||||
}
|
||||
|
||||
public void setNumber4(byte number4) {
|
||||
this.number4 = number4;
|
||||
}
|
||||
|
||||
public byte getOnoff1() {
|
||||
return onoff1;
|
||||
}
|
||||
|
||||
public void setOnoff1(byte onoff1) {
|
||||
this.onoff1 = onoff1;
|
||||
}
|
||||
|
||||
public byte getOnoff2() {
|
||||
return onoff2;
|
||||
}
|
||||
|
||||
public void setOnoff2(byte onoff2) {
|
||||
this.onoff2 = onoff2;
|
||||
}
|
||||
|
||||
public byte getOnoff3() {
|
||||
return onoff3;
|
||||
}
|
||||
|
||||
public void setOnoff3(byte onoff3) {
|
||||
this.onoff3 = onoff3;
|
||||
}
|
||||
|
||||
public byte getOnoff4() {
|
||||
return onoff4;
|
||||
}
|
||||
|
||||
public void setOnoff4(byte onoff4) {
|
||||
this.onoff4 = onoff4;
|
||||
}
|
||||
|
||||
public byte getTimer_number1() {
|
||||
return timer_number1;
|
||||
}
|
||||
|
||||
public void setTimer_number1(byte timer_number1) {
|
||||
this.timer_number1 = timer_number1;
|
||||
}
|
||||
|
||||
public byte getTimer_number2() {
|
||||
return timer_number2;
|
||||
}
|
||||
|
||||
public void setTimer_number2(byte timer_number2) {
|
||||
this.timer_number2 = timer_number2;
|
||||
}
|
||||
|
||||
public byte getTimer_number3() {
|
||||
return timer_number3;
|
||||
}
|
||||
|
||||
public void setTimer_number3(byte timer_number3) {
|
||||
this.timer_number3 = timer_number3;
|
||||
}
|
||||
|
||||
public byte getTimer_number4() {
|
||||
return timer_number4;
|
||||
}
|
||||
|
||||
public void setTimer_number4(byte timer_number4) {
|
||||
this.timer_number4 = timer_number4;
|
||||
}
|
||||
|
||||
public byte getTimer_number5() {
|
||||
return timer_number5;
|
||||
}
|
||||
|
||||
public void setTimer_number5(byte timer_number5) {
|
||||
this.timer_number5 = timer_number5;
|
||||
}
|
||||
|
||||
public byte getTimer_number6() {
|
||||
return timer_number6;
|
||||
}
|
||||
|
||||
public void setTimer_number6(byte timer_number6) {
|
||||
this.timer_number6 = timer_number6;
|
||||
}
|
||||
|
||||
public byte getTimer_onoff1() {
|
||||
return timer_onoff1;
|
||||
}
|
||||
|
||||
public void setTimer_onoff1(byte timer_onoff1) {
|
||||
this.timer_onoff1 = timer_onoff1;
|
||||
}
|
||||
|
||||
public byte getTimer_onoff2() {
|
||||
return timer_onoff2;
|
||||
}
|
||||
|
||||
public void setTimer_onoff2(byte timer_onoff2) {
|
||||
this.timer_onoff2 = timer_onoff2;
|
||||
}
|
||||
|
||||
public byte getTimer_onoff3() {
|
||||
return timer_onoff3;
|
||||
}
|
||||
|
||||
public void setTimer_onoff3(byte timer_onoff3) {
|
||||
this.timer_onoff3 = timer_onoff3;
|
||||
}
|
||||
|
||||
public byte getTimer_onoff4() {
|
||||
return timer_onoff4;
|
||||
}
|
||||
|
||||
public void setTimer_onoff4(byte timer_onoff4) {
|
||||
this.timer_onoff4 = timer_onoff4;
|
||||
}
|
||||
|
||||
public byte getTimer_onoff5() {
|
||||
return timer_onoff5;
|
||||
}
|
||||
|
||||
public void setTimer_onoff5(byte timer_onoff5) {
|
||||
this.timer_onoff5 = timer_onoff5;
|
||||
}
|
||||
|
||||
public byte getTimer_onoff6() {
|
||||
return timer_onoff6;
|
||||
}
|
||||
|
||||
public void setTimer_onoff6(byte timer_onoff6) {
|
||||
this.timer_onoff6 = timer_onoff6;
|
||||
}
|
||||
|
||||
public byte[] getTimer_time1() {
|
||||
return timer_time1;
|
||||
}
|
||||
|
||||
public void setTimer_time1(byte[] timer_time1) {
|
||||
this.timer_time1 = timer_time1;
|
||||
}
|
||||
|
||||
public byte[] getTimer_time2() {
|
||||
return timer_time2;
|
||||
}
|
||||
|
||||
public void setTimer_time2(byte[] timer_time2) {
|
||||
this.timer_time2 = timer_time2;
|
||||
}
|
||||
|
||||
public byte[] getTimer_time3() {
|
||||
return timer_time3;
|
||||
}
|
||||
|
||||
public void setTimer_time3(byte[] timer_time3) {
|
||||
this.timer_time3 = timer_time3;
|
||||
}
|
||||
|
||||
public byte[] getTimer_time4() {
|
||||
return timer_time4;
|
||||
}
|
||||
|
||||
public void setTimer_time4(byte[] timer_time4) {
|
||||
this.timer_time4 = timer_time4;
|
||||
}
|
||||
|
||||
public byte[] getTimer_time5() {
|
||||
return timer_time5;
|
||||
}
|
||||
|
||||
public void setTimer_time5(byte[] timer_time5) {
|
||||
this.timer_time5 = timer_time5;
|
||||
}
|
||||
|
||||
public byte[] getTimer_time6() {
|
||||
return timer_time6;
|
||||
}
|
||||
|
||||
public void setTimer_time6(byte[] timer_time6) {
|
||||
this.timer_time6 = timer_time6;
|
||||
}
|
||||
|
||||
public short getWendu() {
|
||||
return wendu;
|
||||
}
|
||||
|
||||
public void setWendu(short wendu) {
|
||||
this.wendu = wendu;
|
||||
}
|
||||
|
||||
public short getHeatWendu() {
|
||||
return heatWendu;
|
||||
}
|
||||
|
||||
public void setHeatWendu(short heatWendu) {
|
||||
this.heatWendu = heatWendu;
|
||||
}
|
||||
|
||||
public byte getHeatStatus() {
|
||||
return heatStatus;
|
||||
}
|
||||
|
||||
public void setHeatStatus(byte heatStatus) {
|
||||
this.heatStatus = heatStatus;
|
||||
}
|
||||
|
||||
public byte getWarn_onoff() {
|
||||
return warn_onoff;
|
||||
}
|
||||
|
||||
public void setWarn_onoff(byte warn_onoff) {
|
||||
this.warn_onoff = warn_onoff;
|
||||
}
|
||||
|
||||
public short getLow_wendu() {
|
||||
return low_wendu;
|
||||
}
|
||||
|
||||
public void setLow_wendu(short low_wendu) {
|
||||
this.low_wendu = low_wendu;
|
||||
}
|
||||
|
||||
public short getHigh_wendu() {
|
||||
return high_wendu;
|
||||
}
|
||||
|
||||
public void setHigh_wendu(short high_wendu) {
|
||||
this.high_wendu = high_wendu;
|
||||
}
|
||||
|
||||
public short getRoomTemperature() {
|
||||
return roomTemperature;
|
||||
}
|
||||
|
||||
public void setRoomTemperature(short roomTemperature) {
|
||||
this.roomTemperature = roomTemperature;
|
||||
}
|
||||
|
||||
public byte[] getTimer_time8() {
|
||||
return timer_time8;
|
||||
}
|
||||
|
||||
public void setTimer_time8(byte[] timer_time8) {
|
||||
this.timer_time8 = timer_time8;
|
||||
}
|
||||
|
||||
public byte[] getTimer_time7() {
|
||||
return timer_time7;
|
||||
}
|
||||
|
||||
public void setTimer_time7(byte[] timer_time7) {
|
||||
this.timer_time7 = timer_time7;
|
||||
}
|
||||
|
||||
public byte getTimer_onoff8() {
|
||||
return timer_onoff8;
|
||||
}
|
||||
|
||||
public void setTimer_onoff8(byte timer_onoff8) {
|
||||
this.timer_onoff8 = timer_onoff8;
|
||||
}
|
||||
|
||||
public byte getTimer_onoff7() {
|
||||
return timer_onoff7;
|
||||
}
|
||||
|
||||
public void setTimer_onoff7(byte timer_onoff7) {
|
||||
this.timer_onoff7 = timer_onoff7;
|
||||
}
|
||||
|
||||
public byte getTimer_number8() {
|
||||
return timer_number8;
|
||||
}
|
||||
|
||||
public void setTimer_number8(byte timer_number8) {
|
||||
this.timer_number8 = timer_number8;
|
||||
}
|
||||
|
||||
public byte getTimer_number7() {
|
||||
return timer_number7;
|
||||
}
|
||||
|
||||
public void setTimer_number7(byte timer_number7) {
|
||||
this.timer_number7 = timer_number7;
|
||||
}
|
||||
|
||||
public byte getNumber5() {
|
||||
return number5;
|
||||
}
|
||||
|
||||
public void setNumber5(byte number5) {
|
||||
this.number5 = number5;
|
||||
}
|
||||
|
||||
public byte getOnoff5() {
|
||||
return onoff5;
|
||||
}
|
||||
|
||||
public void setOnoff5(byte onoff5) {
|
||||
this.onoff5 = onoff5;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -49,11 +49,16 @@ public class WebSocketServer {
|
|||
UdpReceiveThread rt = new UdpReceiveThread(ds);
|
||||
Thread thread2 = new Thread(rt);
|
||||
thread2.start();
|
||||
log.info("start...");
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public WebSocketServer() {
|
||||
log.info("socket..");
|
||||
}
|
||||
|
||||
@OnMessage
|
||||
public void onMessage(String s, Session session) throws Exception{
|
||||
JSONObject json = new JSONObject(s);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{50} %msg%n</pattern>
|
||||
<charset>GBK</charset>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<!-- @Controller注解的使用前提配置 -->
|
||||
<mvc:annotation-driven />
|
||||
<!-- 扫描指定包 -->
|
||||
<context:component-scan base-package="com.ifish.socket.action" />
|
||||
<context:component-scan base-package="com.ifish.socket.action,com.ifish.redis" />
|
||||
<!-- 静态资源访问,资源缓存一年 -->
|
||||
<mvc:resources mapping="/static/**" location="/js/" cache-period="1500" />
|
||||
<!-- 默认的Servlet来响应静态文件 -->
|
||||
|
|
@ -40,4 +40,27 @@
|
|||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- 导入外部的properties文件-->
|
||||
<context:property-placeholder location="classpath*:redis.properties" ignore-unresolvable="true"/>
|
||||
|
||||
<!-- 使用redis缓存 -->
|
||||
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
|
||||
<property name="maxTotal" value="${redis.maxTotal}" />
|
||||
<property name="maxIdle" value="${redis.maxIdle}" />
|
||||
<property name="minIdle" value="${redis.minIdle}" />
|
||||
<property name="maxWaitMillis" value="${redis.maxWaitMillis}"/>
|
||||
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
|
||||
<property name="testOnReturn" value="${redis.testOnReturn}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
|
||||
<constructor-arg name="poolConfig" ref="jedisPoolConfig" />
|
||||
<constructor-arg name="host" value="${redis.host}" />
|
||||
<constructor-arg name="port" value="${redis.port}" type="int" />
|
||||
<constructor-arg name="timeout" value="${redis.timeout}" type="int" />
|
||||
<constructor-arg name="password" value="${redis.pass}" />
|
||||
<constructor-arg name="database" value="${redis.dbIndex2}" type="int" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
|
@ -7,16 +7,16 @@ $(function () {
|
|||
$("#socketText").hide();
|
||||
//模态框
|
||||
$("#assignModel,#resultModel,#myModal").modal({
|
||||
backdrop: 'static',
|
||||
show: false
|
||||
});
|
||||
backdrop: 'static',
|
||||
show: false
|
||||
});
|
||||
disabled(true);
|
||||
//websocket初始化
|
||||
try {
|
||||
$('#serverModal').modal({
|
||||
backdrop: 'static',
|
||||
show: true
|
||||
});
|
||||
backdrop: 'static',
|
||||
show: true
|
||||
});
|
||||
websocket = new WebSocket("ws://" + $("#socketAddress").val() + "/webSokcetServer");
|
||||
websocket.onopen = function () {
|
||||
disabled(false);
|
||||
|
|
@ -38,7 +38,8 @@ $(function () {
|
|||
var json = eval('(' + evt.data + ')');
|
||||
jsonToView(json);
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
catch (e) {
|
||||
$("#socketText").show();
|
||||
//alert("ERROR:"+e.message+",请升级你的浏览器。");
|
||||
}
|
||||
|
|
@ -60,7 +61,8 @@ $(function () {
|
|||
if (!isLine) {
|
||||
alert("没有在线的设备");
|
||||
return false;
|
||||
} else if ($("#selectTypeCount").val() == "0") {
|
||||
}
|
||||
else if ($("#selectTypeCount").val() == "0") {
|
||||
alert("没有匹配的测试类型");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -89,7 +91,8 @@ $(function () {
|
|||
if (i >= tt) {
|
||||
var timeId = setTimeout("setTime('<span class=\"glyphicon glyphicon-play\"></span>开始测试')", i);
|
||||
timeIds.push(timeId);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ttime -= 1000;
|
||||
var timeId = setTimeout("setTime('倒计时" + (ttime / 1000) + "s','" + order[num / interval] + "')", i);
|
||||
timeIds.push(timeId);
|
||||
|
|
@ -146,7 +149,8 @@ $(function () {
|
|||
if (macArray.toString() == "") {
|
||||
alert("没有选中的设备");
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
send("{caozuo:'clear',type:'choice',macs:'" + macArray.toString() + "'}");
|
||||
$('#myModal').modal("show");
|
||||
setTimeout("location.reload(true)", 1000);
|
||||
|
|
@ -229,7 +233,8 @@ $(function () {
|
|||
if (!isLine) {
|
||||
alert("没有在线的设备");
|
||||
return false;
|
||||
} else if ($("#selectTypeCount").val() == "0") {
|
||||
}
|
||||
else if ($("#selectTypeCount").val() == "0") {
|
||||
alert("没有匹配的测试类型");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -260,15 +265,18 @@ $(function () {
|
|||
}
|
||||
$("#executeCount").append("<option value='10000'>10000</option>");
|
||||
});
|
||||
|
||||
//websocket发送消息
|
||||
function send(data) {
|
||||
websocket.send(data);
|
||||
}
|
||||
|
||||
//保存参数
|
||||
function sendParam() {
|
||||
var checked = $("#isCompare").is(":checked");
|
||||
send("{caozuo:'selectType',type:'" + $("#controlType").val() + "',interval:'" + $("#interval").val() + "',executeCount:'" + $("#executeCount").val() + "',floatValue:'" + $("#floatValue").val() + "',isCompare:'" + checked + "'}");
|
||||
}
|
||||
|
||||
//清除设置域名状态
|
||||
function clearSetTcpStatus() {
|
||||
var setTcp = $("span[id$='Set']");
|
||||
|
|
@ -276,6 +284,7 @@ function clearSetTcpStatus() {
|
|||
$(setTcp[i]).addClass("hide");
|
||||
}
|
||||
}
|
||||
|
||||
//按钮禁用
|
||||
function disabled(bln) {
|
||||
$("#controlType").attr("disabled", bln);
|
||||
|
|
@ -290,10 +299,12 @@ function disabled(bln) {
|
|||
$("#assign").attr("disabled", bln);
|
||||
$("#refresh").attr("disabled", bln);
|
||||
}
|
||||
|
||||
//IP格式化/0.0.0.0:14556 ->0.0.0.0
|
||||
function formatAddress(val) {
|
||||
return val.substring(1, val.indexOf(":"));
|
||||
}
|
||||
|
||||
//bln 是否设置本地
|
||||
function getIps(bln) {
|
||||
var ipArray = new Array();
|
||||
|
|
@ -309,7 +320,8 @@ function getIps(bln) {
|
|||
if (status != '<span class="label label-success">连接正常</span>') {
|
||||
ipArray.push(ip);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ipArray.push(ip);
|
||||
}
|
||||
}
|
||||
|
|
@ -317,16 +329,19 @@ function getIps(bln) {
|
|||
}
|
||||
return ipArray.toString();
|
||||
}
|
||||
|
||||
//bln布尔值,n第几个命令
|
||||
function returnResult(id, bln, n) {
|
||||
if (bln) {
|
||||
$("#" + id + "Result" + n).addClass("label-success");
|
||||
$("#" + id + "Result" + n).html("<span class='glyphicon glyphicon-ok'></span>");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#" + id + "Result" + n).addClass("label-danger");
|
||||
$("#" + id + "Result" + n).html("<span class='glyphicon glyphicon-remove'></span>");
|
||||
}
|
||||
}
|
||||
|
||||
//超时,返回命令失败结果,n表示第几个命令
|
||||
function returnFailed(n) {
|
||||
var result = $("span[id$='Result" + n + "']");
|
||||
|
|
@ -342,6 +357,7 @@ function returnFailed(n) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//倒计时
|
||||
function setTime(tt, id) {
|
||||
if (tt == "<span class=\"glyphicon glyphicon-play\"></span>开始测试") {
|
||||
|
|
@ -353,9 +369,11 @@ function setTime(tt, id) {
|
|||
//继续执行
|
||||
$("#noexecute").val(executeCount);
|
||||
setTimeout("beginTest()", 1000);
|
||||
} else if (executeCount == -1) {
|
||||
}
|
||||
else if (executeCount == -1) {
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#executeCount").change();
|
||||
}
|
||||
}
|
||||
|
|
@ -365,6 +383,7 @@ function setTime(tt, id) {
|
|||
}
|
||||
$("#allBut").html(tt);
|
||||
}
|
||||
|
||||
//标记错误状态
|
||||
function errorStatus() {
|
||||
var isError = false;
|
||||
|
|
@ -397,7 +416,8 @@ function errorStatus() {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#averageValue").val("0.0");
|
||||
}
|
||||
//列数
|
||||
|
|
@ -415,7 +435,8 @@ function errorStatus() {
|
|||
$(results[i]).parent().addClass("label-warning");
|
||||
isError = true;
|
||||
}
|
||||
} else if (result == "关") {
|
||||
}
|
||||
else if (result == "关") {
|
||||
if (onOff) {
|
||||
$(results[i]).parent().addClass("label-warning");
|
||||
isError = true;
|
||||
|
|
@ -434,7 +455,8 @@ function errorStatus() {
|
|||
$(results[i]).parent().addClass("label-warning");
|
||||
isError = true;
|
||||
}
|
||||
} else if (result == "0.0") {
|
||||
}
|
||||
else if (result == "0.0") {
|
||||
if (onOff) {
|
||||
$(results[i]).parent().addClass("label-warning");
|
||||
isError = true;
|
||||
|
|
@ -446,7 +468,8 @@ function errorStatus() {
|
|||
$(results[i]).parent().addClass("label-warning");
|
||||
isError = true;
|
||||
}
|
||||
} else if (result == "0") {
|
||||
}
|
||||
else if (result == "0") {
|
||||
if (onOff) {
|
||||
$(results[i]).parent().addClass("label-warning");
|
||||
isError = true;
|
||||
|
|
@ -457,6 +480,7 @@ function errorStatus() {
|
|||
}
|
||||
return isError;
|
||||
}
|
||||
|
||||
//清空结果
|
||||
function clearResult(bln) {
|
||||
var result = $(".result");
|
||||
|
|
@ -472,6 +496,7 @@ function clearResult(bln) {
|
|||
$(wendu[i]).html("");
|
||||
}
|
||||
}
|
||||
|
||||
//开始测试
|
||||
function beginTest() {
|
||||
$("#allBut").click();
|
||||
|
|
@ -490,9 +515,11 @@ function jsonToView(json) {
|
|||
for (var p in data) {
|
||||
if (p == "isCompare") {
|
||||
$("#isCompare").prop("checked", data[p]);
|
||||
} else if (p == "floatValue") {
|
||||
}
|
||||
else if (p == "floatValue") {
|
||||
$("#floatValue").val(data[p].toFixed(1));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#" + p).val(data[p]);
|
||||
}
|
||||
}
|
||||
|
|
@ -507,7 +534,7 @@ function jsonToView(json) {
|
|||
/**
|
||||
* 设备参数
|
||||
*/
|
||||
//连接状态
|
||||
//连接状态
|
||||
var statusMap = json["statusMap"];
|
||||
//硬件型号
|
||||
var hardTypeMap = json["hardTypeMap"];
|
||||
|
|
@ -524,133 +551,135 @@ function jsonToView(json) {
|
|||
//显示
|
||||
if (showName == "加热状态") {
|
||||
$("#" + p).parent("td").html(showNameMap[p]);
|
||||
} else if (showName == "室温") {
|
||||
$("#" + p).parent("td").html(showNameMap[p]);
|
||||
}
|
||||
//手动模式
|
||||
else if (showName == "手动模式") {
|
||||
$("#" + p).bootstrapSwitch({
|
||||
"onColor": "success",
|
||||
"offColor": "success",
|
||||
"onText": "开",
|
||||
"offText": "开",
|
||||
"labelText": showName,
|
||||
"onSwitchChange": function (event, state) {
|
||||
var number = this.value;
|
||||
var singleTest = false;
|
||||
//单个测试
|
||||
var cb = $(".checkboxList:checked");
|
||||
if (cb.length > 0) {
|
||||
var trClass = $(cb[0]).parents("tr").attr("class");
|
||||
if (trClass == "marryType") {
|
||||
var macAddress = $(cb[0]).parents("tr").find("td:eq(2)").html();
|
||||
singleTest = true;
|
||||
send("{caozuo:'onoffTest',number:'" + number + "',checked:false,macAddress:'" + macAddress + "',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
if (!singleTest) {
|
||||
//多个测试
|
||||
var marryType = $(".marryType");
|
||||
if (marryType.length > 0) {
|
||||
send("{caozuo:'onoffTest',number:'" + number + "',checked:'false',macAddress:'',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
"onColor": "success",
|
||||
"offColor": "success",
|
||||
"onText": "开",
|
||||
"offText": "开",
|
||||
"labelText": showName,
|
||||
"onSwitchChange": function (event, state) {
|
||||
var number = this.value;
|
||||
var singleTest = false;
|
||||
//单个测试
|
||||
var cb = $(".checkboxList:checked");
|
||||
if (cb.length > 0) {
|
||||
var trClass = $(cb[0]).parents("tr").attr("class");
|
||||
if (trClass == "marryType") {
|
||||
var macAddress = $(cb[0]).parents("tr").find("td:eq(2)").html();
|
||||
singleTest = true;
|
||||
send("{caozuo:'onoffTest',number:'" + number + "',checked:false,macAddress:'" + macAddress + "',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
if (!singleTest) {
|
||||
//多个测试
|
||||
var marryType = $(".marryType");
|
||||
if (marryType.length > 0) {
|
||||
send("{caozuo:'onoffTest',number:'" + number + "',checked:'false',macAddress:'',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//设置加热温度
|
||||
else if (showName == "加热温度") {
|
||||
$("#" + p).bootstrapSwitch({
|
||||
"onColor": "success",
|
||||
"offColor": "danger",
|
||||
"onText": "32.0",
|
||||
"offText": "0.0",
|
||||
"labelText": showName,
|
||||
"onSwitchChange": function (event, state) {
|
||||
var number = this.value;
|
||||
var checked = this.checked;
|
||||
var singleTest = false;
|
||||
//单个测试
|
||||
var cb = $(".checkboxList:checked");
|
||||
if (cb.length > 0) {
|
||||
var trClass = $(cb[0]).parents("tr").attr("class");
|
||||
if (trClass == "marryType") {
|
||||
var macAddress = $(cb[0]).parents("tr").find("td:eq(2)").html();
|
||||
singleTest = true;
|
||||
send("{caozuo:'setHeat',number:'" + number + "',checked:'" + checked + "',macAddress:'" + macAddress + "',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
if (!singleTest) {
|
||||
//多个测试
|
||||
var marryType = $(".marryType");
|
||||
if (marryType.length > 0) {
|
||||
send("{caozuo:'setHeat',number:'" + number + "',checked:'" + checked + "',macAddress:'',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
"onColor": "success",
|
||||
"offColor": "danger",
|
||||
"onText": "32.0",
|
||||
"offText": "0.0",
|
||||
"labelText": showName,
|
||||
"onSwitchChange": function (event, state) {
|
||||
var number = this.value;
|
||||
var checked = this.checked;
|
||||
var singleTest = false;
|
||||
//单个测试
|
||||
var cb = $(".checkboxList:checked");
|
||||
if (cb.length > 0) {
|
||||
var trClass = $(cb[0]).parents("tr").attr("class");
|
||||
if (trClass == "marryType") {
|
||||
var macAddress = $(cb[0]).parents("tr").find("td:eq(2)").html();
|
||||
singleTest = true;
|
||||
send("{caozuo:'setHeat',number:'" + number + "',checked:'" + checked + "',macAddress:'" + macAddress + "',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
if (!singleTest) {
|
||||
//多个测试
|
||||
var marryType = $(".marryType");
|
||||
if (marryType.length > 0) {
|
||||
send("{caozuo:'setHeat',number:'" + number + "',checked:'" + checked + "',macAddress:'',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//调整背光亮度
|
||||
else if (showName == "背光亮度") {
|
||||
$("#" + p).bootstrapSwitch({
|
||||
"labelText": showName,
|
||||
"onColor": "success",
|
||||
"offColor": "danger",
|
||||
"onText": "250",
|
||||
"offText": "0",
|
||||
"onSwitchChange": function (event, state) {
|
||||
var number = this.value;
|
||||
var checked = this.checked;
|
||||
var singleTest = false;
|
||||
//单个测试
|
||||
var cb = $(".checkboxList:checked");
|
||||
if (cb.length > 0) {
|
||||
var trClass = $(cb[0]).parents("tr").attr("class");
|
||||
if (trClass == "marryType") {
|
||||
var macAddress = $(cb[0]).parents("tr").find("td:eq(2)").html();
|
||||
singleTest = true;
|
||||
send("{caozuo:'changeLightness',number:'" + number + "',checked:'" + checked + "',macAddress:'" + macAddress + "',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
if (!singleTest) {
|
||||
//多个测试
|
||||
var marryType = $(".marryType");
|
||||
if (marryType.length > 0) {
|
||||
send("{caozuo:'changeLightness',number:'" + number + "',checked:'" + checked + "',macAddress:'',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
"labelText": showName,
|
||||
"onColor": "success",
|
||||
"offColor": "danger",
|
||||
"onText": "250",
|
||||
"offText": "0",
|
||||
"onSwitchChange": function (event, state) {
|
||||
var number = this.value;
|
||||
var checked = this.checked;
|
||||
var singleTest = false;
|
||||
//单个测试
|
||||
var cb = $(".checkboxList:checked");
|
||||
if (cb.length > 0) {
|
||||
var trClass = $(cb[0]).parents("tr").attr("class");
|
||||
if (trClass == "marryType") {
|
||||
var macAddress = $(cb[0]).parents("tr").find("td:eq(2)").html();
|
||||
singleTest = true;
|
||||
send("{caozuo:'changeLightness',number:'" + number + "',checked:'" + checked + "',macAddress:'" + macAddress + "',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
if (!singleTest) {
|
||||
//多个测试
|
||||
var marryType = $(".marryType");
|
||||
if (marryType.length > 0) {
|
||||
send("{caozuo:'changeLightness',number:'" + number + "',checked:'" + checked + "',macAddress:'',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//普通开关
|
||||
else {
|
||||
$("#" + p).bootstrapSwitch({
|
||||
"onColor": "success",
|
||||
"offColor": "danger",
|
||||
"onText": "开",
|
||||
"offText": "关",
|
||||
"labelText": showName,
|
||||
"onSwitchChange": function (event, state) {
|
||||
var number = this.value;
|
||||
var checked = this.checked;
|
||||
var singleTest = false;
|
||||
//单个测试
|
||||
var cb = $(".checkboxList:checked");
|
||||
if (cb.length > 0) {
|
||||
var trClass = $(cb[0]).parents("tr").attr("class");
|
||||
if (trClass == "marryType") {
|
||||
var macAddress = $(cb[0]).parents("tr").find("td:eq(2)").html();
|
||||
singleTest = true;
|
||||
send("{caozuo:'onoffTest',number:'" + number + "',checked:'" + checked + "',macAddress:'" + macAddress + "',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
if (!singleTest) {
|
||||
//多个测试
|
||||
var marryType = $(".marryType");
|
||||
if (marryType.length > 0) {
|
||||
send("{caozuo:'onoffTest',number:'" + number + "',checked:'" + checked + "',macAddress:'',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
"onColor": "success",
|
||||
"offColor": "danger",
|
||||
"onText": "开",
|
||||
"offText": "关",
|
||||
"labelText": showName,
|
||||
"onSwitchChange": function (event, state) {
|
||||
var number = this.value;
|
||||
var checked = this.checked;
|
||||
var singleTest = false;
|
||||
//单个测试
|
||||
var cb = $(".checkboxList:checked");
|
||||
if (cb.length > 0) {
|
||||
var trClass = $(cb[0]).parents("tr").attr("class");
|
||||
if (trClass == "marryType") {
|
||||
var macAddress = $(cb[0]).parents("tr").find("td:eq(2)").html();
|
||||
singleTest = true;
|
||||
send("{caozuo:'onoffTest',number:'" + number + "',checked:'" + checked + "',macAddress:'" + macAddress + "',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
if (!singleTest) {
|
||||
//多个测试
|
||||
var marryType = $(".marryType");
|
||||
if (marryType.length > 0) {
|
||||
send("{caozuo:'onoffTest',number:'" + number + "',checked:'" + checked + "',macAddress:'',singleTest:'" + singleTest + "'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//发送指令顺序
|
||||
|
|
@ -669,18 +698,18 @@ function jsonToView(json) {
|
|||
str = str + "<td><span class='result label' id='" + id + "Result" + i + "'></span></td>";
|
||||
}
|
||||
$("#tab").append("<tr>" +
|
||||
//<input type='checkbox' class='checkboxList'/>
|
||||
"<td style='text-align:center;'><span class='label label-success hide' id='" + id + "Set'><i class='glyphicon glyphicon-ok'></i></span><input type='checkbox' class='checkboxList'/></td>" +
|
||||
"<td style='text-align:center;' class='index'></td>" +
|
||||
"<td id='" + id + "Mac'>" + id + "</td>" +
|
||||
"<td style='display:none' id='" + id + "HardType'>" + hardTypeMap[id] + "</td>" +
|
||||
"<td id='" + id + "ControlType'>" + controlTypeMap[id] + "</td>" +
|
||||
"<td id='" + id + "Ip'>" + ipMap[id] + "</td>" +
|
||||
"<td id='" + id + "ResetCount'>" + resetCountMap[id] + "</td>" +
|
||||
"<td id='" + id + "Status'>" + statusMap[id] + "</td>" +
|
||||
"<td><span class='result label' id='" + id + "Wendu'></span></td>" +
|
||||
str +
|
||||
"</tr>");
|
||||
//<input type='checkbox' class='checkboxList'/>
|
||||
"<td style='text-align:center;'><span class='label label-success hide' id='" + id + "Set'><i class='glyphicon glyphicon-ok'></i></span><input type='checkbox' class='checkboxList'/></td>" +
|
||||
"<td style='text-align:center;' class='index'></td>" +
|
||||
"<td id='" + id + "Mac'>" + id + "</td>" +
|
||||
"<td style='display:none' id='" + id + "HardType'>" + hardTypeMap[id] + "</td>" +
|
||||
"<td id='" + id + "ControlType'>" + controlTypeMap[id] + "</td>" +
|
||||
"<td id='" + id + "Ip'>" + ipMap[id] + "</td>" +
|
||||
"<td id='" + id + "ResetCount'>" + resetCountMap[id] + "</td>" +
|
||||
"<td id='" + id + "Status'>" + statusMap[id] + "</td>" +
|
||||
"<td><span class='result label' id='" + id + "Wendu'></span></td>" +
|
||||
str +
|
||||
"</tr>");
|
||||
}
|
||||
//断开的移动到最后一行
|
||||
var ipList = $("td[id$='Ip']");
|
||||
|
|
@ -709,24 +738,25 @@ function jsonToView(json) {
|
|||
str = str + "<td><span class='result label' id='" + id + "Result" + i + "'></span></td>";
|
||||
}
|
||||
$("#tab").append("<tr>" +
|
||||
//<input type='checkbox' class='checkboxList'/>
|
||||
"<td style='text-align:center;'><span class='label label-success hide' id='" + id + "Set'><i class='glyphicon glyphicon-ok'></i></span><input type='checkbox' class='checkboxList'/></td>" +
|
||||
"<td style='text-align:center;' class='index'></td>" +
|
||||
"<td id='" + id + "Mac'></td>" +
|
||||
"<td style='display:none' id='" + id + "HardType'></td>" +
|
||||
"<td id='" + id + "ControlType'></td>" +
|
||||
"<td id='" + id + "Ip'></td>" +
|
||||
"<td id='" + id + "ResetCount'></td>" +
|
||||
"<td id='" + id + "Status'></td>" +
|
||||
"<td><span class='result label' id='" + id + "Wendu'></span></td>" +
|
||||
str +
|
||||
"</tr>");
|
||||
//<input type='checkbox' class='checkboxList'/>
|
||||
"<td style='text-align:center;'><span class='label label-success hide' id='" + id + "Set'><i class='glyphicon glyphicon-ok'></i></span><input type='checkbox' class='checkboxList'/></td>" +
|
||||
"<td style='text-align:center;' class='index'></td>" +
|
||||
"<td id='" + id + "Mac'></td>" +
|
||||
"<td style='display:none' id='" + id + "HardType'></td>" +
|
||||
"<td id='" + id + "ControlType'></td>" +
|
||||
"<td id='" + id + "Ip'></td>" +
|
||||
"<td id='" + id + "ResetCount'></td>" +
|
||||
"<td id='" + id + "Status'></td>" +
|
||||
"<td><span class='result label' id='" + id + "Wendu'></span></td>" +
|
||||
str +
|
||||
"</tr>");
|
||||
}
|
||||
//赋值
|
||||
for (var p in data) {
|
||||
if (p == "lineCount") {
|
||||
$("#lineCount").val(data[p]);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#" + p).html(data[p]);
|
||||
}
|
||||
}
|
||||
|
|
@ -753,18 +783,18 @@ function jsonToView(json) {
|
|||
str = str + "<td><span class='result label' id='" + id + "Result" + i + "'></span></td>";
|
||||
}
|
||||
$("#tab").append("<tr>" +
|
||||
//<input type='checkbox' class='checkboxList'/>
|
||||
"<td style='text-align:center;'><span class='label label-success hide' id='" + id + "Set'><i class='glyphicon glyphicon-ok'></i></span><input type='checkbox' class='checkboxList'/></td>" +
|
||||
"<td style='text-align:center;' class='index'></td>" +
|
||||
"<td id='" + id + "Mac'></td>" +
|
||||
"<td style='display:none' id='" + id + "HardType'></td>" +
|
||||
"<td id='" + id + "ControlType'></td>" +
|
||||
"<td id='" + id + "Ip'></td>" +
|
||||
"<td id='" + id + "ResetCount'></td>" +
|
||||
"<td id='" + id + "Status'></td>" +
|
||||
"<td><span class='result label' id='" + id + "Wendu'></span></td>" +
|
||||
str +
|
||||
"</tr>");
|
||||
//<input type='checkbox' class='checkboxList'/>
|
||||
"<td style='text-align:center;'><span class='label label-success hide' id='" + id + "Set'><i class='glyphicon glyphicon-ok'></i></span><input type='checkbox' class='checkboxList'/></td>" +
|
||||
"<td style='text-align:center;' class='index'></td>" +
|
||||
"<td id='" + id + "Mac'></td>" +
|
||||
"<td style='display:none' id='" + id + "HardType'></td>" +
|
||||
"<td id='" + id + "ControlType'></td>" +
|
||||
"<td id='" + id + "Ip'></td>" +
|
||||
"<td id='" + id + "ResetCount'></td>" +
|
||||
"<td id='" + id + "Status'></td>" +
|
||||
"<td><span class='result label' id='" + id + "Wendu'></span></td>" +
|
||||
str +
|
||||
"</tr>");
|
||||
//赋值
|
||||
for (var p in data) {
|
||||
$("#" + p).html(data[p]);
|
||||
|
|
@ -785,7 +815,8 @@ function jsonToView(json) {
|
|||
for (var p in data) {
|
||||
if (p == "lineCount") {
|
||||
$("#lineCount").val(data[p]);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#" + p).html(data[p]);
|
||||
}
|
||||
}
|
||||
|
|
@ -804,13 +835,16 @@ function jsonToView(json) {
|
|||
if (v == "开") {
|
||||
$("#" + p).addClass("label-success");
|
||||
$("#" + p).html(v);
|
||||
} else if (v == "关") {
|
||||
}
|
||||
else if (v == "关") {
|
||||
$("#" + p).addClass("label-danger");
|
||||
$("#" + p).html(v);
|
||||
} else if (v == "手动") {
|
||||
}
|
||||
else if (v == "手动") {
|
||||
$("#" + p).addClass("label-success");
|
||||
$("#" + p).html(v);
|
||||
} else if (v == "自动") {
|
||||
}
|
||||
else if (v == "自动") {
|
||||
$("#" + p).addClass("label-danger");
|
||||
$("#" + p).html(v);
|
||||
}
|
||||
|
|
@ -823,7 +857,8 @@ function jsonToView(json) {
|
|||
else if (v == "0" || v == "0.0") {
|
||||
$("#" + p).addClass("label-danger");
|
||||
$("#" + p).html(v);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#" + p).addClass("label-default");
|
||||
$("#" + p).html(v);
|
||||
}
|
||||
|
|
@ -851,6 +886,7 @@ function jsonToView(json) {
|
|||
returnResult(id, control, result);
|
||||
}
|
||||
}
|
||||
|
||||
//重新编号
|
||||
function renumber() {
|
||||
var indexList = $(".index");
|
||||
|
|
@ -858,6 +894,7 @@ function renumber() {
|
|||
$(indexList[i]).html(i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
//匹配测试类型变换颜色
|
||||
function changeColor() {
|
||||
var count = 0;
|
||||
|
|
@ -870,7 +907,8 @@ function changeColor() {
|
|||
//移动到首行
|
||||
$("#tab").find("tr:first").before($(controls[i]).parent());
|
||||
count++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$(controls[i]).parent().css("background-color", "");
|
||||
$(controls[i]).parent().removeClass("marryType");
|
||||
}
|
||||
|
|
@ -878,40 +916,42 @@ function changeColor() {
|
|||
//匹配测试类型的数量
|
||||
$("#selectTypeCount").val(count);
|
||||
}
|
||||
|
||||
function getFactoryInfo() {
|
||||
$.ajax({
|
||||
//url: "https://bg.zhangxinyanv5.top/page/public/getVenderList.do?rm=" + Math.random() + "&factoryCode=" + $("#factoryCode").val(),
|
||||
//url: "http://192.168.199.129:7080/page/public/getVenderList.do?rm=" + Math.random() + "&factoryCode=" + $("#factoryCode").val(),
|
||||
//url: "http://192.168.199.129:8080/IfishSystem/page/public/getVenderList.do?rm=" + Math.random() + "&factoryCode=" + $("#factoryCode").val(),
|
||||
url: "https://bg.ifish7.com/page/public/getVenderList.do?rm=" + Math.random() + "&factoryCode=" + $("#factoryCode").val(),
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
success: function (evt) {
|
||||
var data = evt.venderMap;
|
||||
var data1 = evt.hardwareMap;
|
||||
var trs = "";
|
||||
var i = 1;
|
||||
$.each(data1, function (k, v) {
|
||||
$("#controlType").append('<option value="' + k + '">' + v + '</option>');
|
||||
});
|
||||
$("#controlType").val($("#hardwareType").val());
|
||||
$.each(data, function (k, v) {
|
||||
if (i % 2 == 1) {
|
||||
trs = trs + '<tr class="success"><td style="vertical-align:middle; width:25%"><div style="margin-left:10%;"><input type="radio" style="width:20px;height:20px" value="' + k + '" name="radio"/> <b><font style="font-size: 15px">' + v + '</b></font></div></td>'
|
||||
+ '<td style="vertical-align:middle; text-align:center;width:25%"><img width="80" src="http://app.ifish7.com/vender/' + k + '_logo.png"/></td>';
|
||||
} else {
|
||||
trs = trs + '<td style="vertical-align:middle; width:25%"><div style="margin-left:10%;"><input type="radio" style="width:20px;height:20px" value="' + k + '" name="radio"/> <b><font style="font-size: 15px">' + v + '</b></font></div></td>'
|
||||
+ '<td style="vertical-align:middle; text-align:center;width:25%"><img width="80" src="http://app.ifish7.com/vender/' + k + '_logo.png"/></td></tr>';
|
||||
}
|
||||
i++;
|
||||
});
|
||||
if (i % 2 == 0) {
|
||||
trs = trs + '<td></td><td></td></tr>';
|
||||
}
|
||||
$("#venderTbale").append(trs);
|
||||
},
|
||||
error: function () {
|
||||
alert("获取厂家信息失败");
|
||||
}
|
||||
});
|
||||
//url: "https://bg.zhangxinyanv5.top/page/public/getVenderList.do?rm=" + Math.random() + "&factoryCode=" + $("#factoryCode").val(),
|
||||
//url: "http://192.168.199.129:7080/page/public/getVenderList.do?rm=" + Math.random() + "&factoryCode=" + $("#factoryCode").val(),
|
||||
//url: "http://192.168.199.129:8080/IfishSystem/page/public/getVenderList.do?rm=" + Math.random() + "&factoryCode=" + $("#factoryCode").val(),
|
||||
url: "https://bg.ifish7.com/page/public/getVenderList.do?rm=" + Math.random() + "&factoryCode=" + $("#factoryCode").val(),
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
success: function (evt) {
|
||||
var data = evt.venderMap;
|
||||
var data1 = evt.hardwareMap;
|
||||
var trs = "";
|
||||
var i = 1;
|
||||
$.each(data1, function (k, v) {
|
||||
$("#controlType").append('<option value="' + k + '">' + v + '</option>');
|
||||
});
|
||||
$("#controlType").val($("#hardwareType").val());
|
||||
$.each(data, function (k, v) {
|
||||
if (i % 2 == 1) {
|
||||
trs = trs + '<tr class="success"><td style="vertical-align:middle; width:25%"><div style="margin-left:10%;"><input type="radio" style="width:20px;height:20px" value="' + k + '" name="radio"/> <b><font style="font-size: 15px">' + v + '</b></font></div></td>'
|
||||
+ '<td style="vertical-align:middle; text-align:center;width:25%"><img width="80" src="http://app.ifish7.com/vender/' + k + '_logo.png"/></td>';
|
||||
}
|
||||
else {
|
||||
trs = trs + '<td style="vertical-align:middle; width:25%"><div style="margin-left:10%;"><input type="radio" style="width:20px;height:20px" value="' + k + '" name="radio"/> <b><font style="font-size: 15px">' + v + '</b></font></div></td>'
|
||||
+ '<td style="vertical-align:middle; text-align:center;width:25%"><img width="80" src="http://app.ifish7.com/vender/' + k + '_logo.png"/></td></tr>';
|
||||
}
|
||||
i++;
|
||||
});
|
||||
if (i % 2 == 0) {
|
||||
trs = trs + '<td></td><td></td></tr>';
|
||||
}
|
||||
$("#venderTbale").append(trs);
|
||||
},
|
||||
error: function () {
|
||||
alert("获取厂家信息失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue