|
@@ -19,10 +19,7 @@ import java.io.OutputStream;
|
|
import java.net.InetAddress;
|
|
import java.net.InetAddress;
|
|
import java.net.Socket;
|
|
import java.net.Socket;
|
|
import java.net.UnknownHostException;
|
|
import java.net.UnknownHostException;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
import static com.ruoyi.sim.service.impl.CommConst.*;
|
|
import static com.ruoyi.sim.service.impl.CommConst.*;
|
|
|
|
|
|
@@ -386,6 +383,7 @@ public class CommSendService {
|
|
}
|
|
}
|
|
|
|
|
|
public AjaxResult debugClearAllOnlineSimAllFault() {
|
|
public AjaxResult debugClearAllOnlineSimAllFault() {
|
|
|
|
+ l.info("debugClearAllOnlineSimAllFault");
|
|
simService.listAllOnline().forEach(s -> {
|
|
simService.listAllOnline().forEach(s -> {
|
|
AjaxResult ar = debugClearAllFaultBySimNum(s.getSimNum());
|
|
AjaxResult ar = debugClearAllFaultBySimNum(s.getSimNum());
|
|
});
|
|
});
|
|
@@ -504,7 +502,7 @@ public class CommSendService {
|
|
return ar1;
|
|
return ar1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // 主动查询一次模拟器状态
|
|
|
|
|
|
+ // Step 1 主动查询一次模拟器状态。
|
|
{
|
|
{
|
|
checkOneSimState(s, true);
|
|
checkOneSimState(s, true);
|
|
// 如果模拟器离线
|
|
// 如果模拟器离线
|
|
@@ -537,7 +535,7 @@ public class CommSendService {
|
|
}
|
|
}
|
|
// Step 5 读取
|
|
// Step 5 读取
|
|
{
|
|
{
|
|
- readOneSimAllFaultFirstTimeBySim(s);
|
|
|
|
|
|
+ readOneSimAllFaultFirstTimeBySim(s, faultIds);
|
|
}
|
|
}
|
|
return AjaxResult.success("下发故障流程执行成功!");
|
|
return AjaxResult.success("下发故障流程执行成功!");
|
|
}
|
|
}
|
|
@@ -634,6 +632,7 @@ public class CommSendService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public AjaxResult readOneSimOneFaultCheck(Sim s, Fault f) {
|
|
public AjaxResult readOneSimOneFaultCheck(Sim s, Fault f) {
|
|
|
|
+ l.info("readOneSimOneFaultCheck s = {},f = {}", s, f);
|
|
SimMsg sm1 = commBuildService.buildSendMsgReadFaultResistance(s.getSimNum(), f.getBindHardwareMsg());
|
|
SimMsg sm1 = commBuildService.buildSendMsgReadFaultResistance(s.getSimNum(), f.getBindHardwareMsg());
|
|
SimMsg sm2 = send(sm1, s, RETRY_COUNT_CHECK_ONE_FAULT, SLEEP_LONG);
|
|
SimMsg sm2 = send(sm1, s, RETRY_COUNT_CHECK_ONE_FAULT, SLEEP_LONG);
|
|
return simReceiveService.getOneFaultCheck(sm2, s, f);
|
|
return simReceiveService.getOneFaultCheck(sm2, s, f);
|
|
@@ -645,18 +644,26 @@ public class CommSendService {
|
|
* @param re
|
|
* @param re
|
|
*/
|
|
*/
|
|
public void readOneSimAllFaultFirstTimeByExam(RealExam re) {
|
|
public void readOneSimAllFaultFirstTimeByExam(RealExam re) {
|
|
|
|
+ l.info("readOneSimAllFaultFirstTimeByExam re = {}", re);
|
|
List<RealExamFault> list = realExamFaultService.listAllType2(re.getExamId());
|
|
List<RealExamFault> list = realExamFaultService.listAllType2(re.getExamId());
|
|
for (RealExamFault ref : list) {
|
|
for (RealExamFault ref : list) {
|
|
Sim s = simService.selectSimBySimId(re.getSimId());
|
|
Sim s = simService.selectSimBySimId(re.getSimId());
|
|
Fault f = faultService.selectFaultByFaultId(ref.getFaultId());
|
|
Fault f = faultService.selectFaultByFaultId(ref.getFaultId());
|
|
- readOneSimOneFaultFirstTime(s, ref, f);
|
|
|
|
|
|
+ readOneSimOneFaultFirstTime(s, ref, f, null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public void readOneSimAllFaultFirstTimeBySim(Sim s) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 第一次读取,作为出题值。debug模式。
|
|
|
|
+ *
|
|
|
|
+ * @param s
|
|
|
|
+ * @param faultIds
|
|
|
|
+ */
|
|
|
|
+ public void readOneSimAllFaultFirstTimeBySim(Sim s, final String[] faultIds) {
|
|
|
|
+ l.info("readOneSimAllFaultFirstTimeBySim s = {}", s);
|
|
List<Fault> list = faultService.listType3(s.getSimType());
|
|
List<Fault> list = faultService.listType3(s.getSimType());
|
|
for (Fault f : list) {
|
|
for (Fault f : list) {
|
|
- readOneSimOneFaultFirstTime(s, null, f);
|
|
|
|
|
|
+ readOneSimOneFaultFirstTime(s, null, f, faultIds);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -664,18 +671,16 @@ public class CommSendService {
|
|
* 第一次读取,作为出题值。
|
|
* 第一次读取,作为出题值。
|
|
*
|
|
*
|
|
* @param s
|
|
* @param s
|
|
- * @param ref debug调试模式为空。
|
|
|
|
|
|
+ * @param ref debug调试模式为空。可以为空。
|
|
* @param f
|
|
* @param f
|
|
|
|
+ * @param faultIds debug调试模式为空。
|
|
*/
|
|
*/
|
|
- public void readOneSimOneFaultFirstTime(Sim s, RealExamFault ref, Fault f) {
|
|
|
|
|
|
+ public void readOneSimOneFaultFirstTime(Sim s, RealExamFault ref, Fault f, String[] faultIds) {
|
|
|
|
+ l.info("readOneSimOneFaultFirstTime");
|
|
// 读取一次当前电阻代表值作为出题值。
|
|
// 读取一次当前电阻代表值作为出题值。
|
|
SimMsg sm1 = commBuildService.buildSendMsgReadFaultResistance(s.getSimNum(), f.getBindHardwareMsg());
|
|
SimMsg sm1 = commBuildService.buildSendMsgReadFaultResistance(s.getSimNum(), f.getBindHardwareMsg());
|
|
SimMsg sm2 = send(sm1, s, RETRY_COUNT_WRITE_ONE_FAULT, SLEEP_LONG);
|
|
SimMsg sm2 = send(sm1, s, RETRY_COUNT_WRITE_ONE_FAULT, SLEEP_LONG);
|
|
- if (ref != null) {
|
|
|
|
- simReceiveService.setFaultQuestionValue(sm2, s, ref, f);
|
|
|
|
- } else {
|
|
|
|
- l.info("ref is null");
|
|
|
|
- }
|
|
|
|
|
|
+ simReceiveService.setFaultQuestionValue(sm2, s, ref, f, faultIds);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -711,10 +716,10 @@ public class CommSendService {
|
|
* @param s
|
|
* @param s
|
|
* @param reF
|
|
* @param reF
|
|
* @param f
|
|
* @param f
|
|
- * @param refState 中间轮询是null,交卷最后一次读取为finish状态。用来修改状态的。
|
|
|
|
|
|
+ * @param refState 中间轮询是null,交卷最后一次读取为finish状态。用来修改状态的。debug模式下执行为null。
|
|
*/
|
|
*/
|
|
public void readOneSimOneFaultResistance(Sim s, RealExamFault reF, Fault f, String refState) {
|
|
public void readOneSimOneFaultResistance(Sim s, RealExamFault reF, Fault f, String refState) {
|
|
- l.info("readOneFaultResistance");
|
|
|
|
|
|
+ l.info("readOneSimOneFaultResistance");
|
|
SimMsg sm1 = commBuildService.buildSendMsgReadFaultResistance(s.getSimNum(), f.getBindHardwareMsg());
|
|
SimMsg sm1 = commBuildService.buildSendMsgReadFaultResistance(s.getSimNum(), f.getBindHardwareMsg());
|
|
SimMsg sm2 = null;
|
|
SimMsg sm2 = null;
|
|
if (reF != null && refState != null) {
|
|
if (reF != null && refState != null) {
|
|
@@ -729,6 +734,8 @@ public class CommSendService {
|
|
simReceiveService.setFaultAnswerValue(sm2, s, reF, f, refState);
|
|
simReceiveService.setFaultAnswerValue(sm2, s, reF, f, refState);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // private long shangyige_sleep = 0
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* send hex message
|
|
* send hex message
|
|
*
|
|
*
|
|
@@ -769,7 +776,7 @@ public class CommSendService {
|
|
if (s != null) {
|
|
if (s != null) {
|
|
simService.updateLastSentTime(s);
|
|
simService.updateLastSentTime(s);
|
|
}
|
|
}
|
|
- byte[] buffer = new byte[LENGTH_20];
|
|
|
|
|
|
+ byte[] buffer = new byte[LENGTH_24];
|
|
int length = is.read(buffer);
|
|
int length = is.read(buffer);
|
|
StringBuffer sbHex = new StringBuffer();
|
|
StringBuffer sbHex = new StringBuffer();
|
|
for (int i = 0; i < length; i++) {
|
|
for (int i = 0; i < length; i++) {
|