|
@@ -11,6 +11,7 @@ import org.slf4j.Logger;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
@@ -432,6 +433,7 @@ public class CommSendService {
|
|
simService.listAllOnline().forEach(s -> {
|
|
simService.listAllOnline().forEach(s -> {
|
|
AjaxResult ar = debugClearAllFaultBySimNum(s.getSimNum());
|
|
AjaxResult ar = debugClearAllFaultBySimNum(s.getSimNum());
|
|
});
|
|
});
|
|
|
|
+ debugFaultService.deleteAll();
|
|
return AjaxResult.success("清除成功,清除所有在线模拟器所有故障!");
|
|
return AjaxResult.success("清除成功,清除所有在线模拟器所有故障!");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -441,29 +443,31 @@ public class CommSendService {
|
|
* @param simNum
|
|
* @param simNum
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
|
|
+ @Transactional
|
|
public AjaxResult debugClearAllFaultBySimNum(final String simNum) {
|
|
public AjaxResult debugClearAllFaultBySimNum(final String simNum) {
|
|
- Sim s1 = simService.uniqueBySimNum(simNum);
|
|
|
|
|
|
+ Sim s = simService.uniqueBySimNum(simNum);
|
|
{
|
|
{
|
|
- AjaxResult arE3 = checkOneSimStateActive(s1);
|
|
|
|
|
|
+ AjaxResult arE3 = checkOneSimStateActive(s);
|
|
if (arE3.isError()) {
|
|
if (arE3.isError()) {
|
|
return arE3;
|
|
return arE3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- s1 = simService.uniqueBySimNum(simNum);
|
|
|
|
- if (s1 == null) {
|
|
|
|
|
|
+ s = simService.uniqueBySimNum(simNum);
|
|
|
|
+ if (s == null) {
|
|
return AjaxResult.error("清除失败,对应simNum模拟器不存在!");
|
|
return AjaxResult.error("清除失败,对应simNum模拟器不存在!");
|
|
}
|
|
}
|
|
- if (!Sim.State.ONLINE.equals(s1.getSimState())) {
|
|
|
|
|
|
+ if (!Sim.State.ONLINE.equals(s.getSimState())) {
|
|
return AjaxResult.error("清除失败,模拟器尚未在线!");
|
|
return AjaxResult.error("清除失败,模拟器尚未在线!");
|
|
}
|
|
}
|
|
List<SimMsg> list = new ArrayList<>();
|
|
List<SimMsg> list = new ArrayList<>();
|
|
- for (String b : getGZBWBySimType(s1.getSimType())) {
|
|
|
|
|
|
+ for (String b : getGZBWBySimType(s.getSimType())) {
|
|
SimMsg sm = debugClearOneFault(simNum, b);
|
|
SimMsg sm = debugClearOneFault(simNum, b);
|
|
list.add(sm);
|
|
list.add(sm);
|
|
if (sm != null && !sm.getOk()) {
|
|
if (sm != null && !sm.getOk()) {
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ debugFaultService.deleteAll();
|
|
return AjaxResult.success("清除成功,清除当前模拟器所有故障!");
|
|
return AjaxResult.success("清除成功,清除当前模拟器所有故障!");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -540,6 +544,7 @@ public class CommSendService {
|
|
* @param checkReplace 是否进行可换件检查
|
|
* @param checkReplace 是否进行可换件检查
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
|
|
+ @Transactional
|
|
public AjaxResult debugWriteSelectedFaultBySimNum(final String simNum,
|
|
public AjaxResult debugWriteSelectedFaultBySimNum(final String simNum,
|
|
final String[] faultIds,
|
|
final String[] faultIds,
|
|
final Boolean checkReplace) {
|
|
final Boolean checkReplace) {
|
|
@@ -842,14 +847,16 @@ public class CommSendService {
|
|
for (int i = 0; i < length; i++) {
|
|
for (int i = 0; i < length; i++) {
|
|
sbHex.append(String.format("%02X", buffer[i]));
|
|
sbHex.append(String.format("%02X", buffer[i]));
|
|
}
|
|
}
|
|
- sm.setReceiveMsg(sbHex.toString());
|
|
|
|
|
|
+ String receiveWith0 = sbHex.toString();
|
|
|
|
+ sm.setReceiveOriginalMsg(receiveWith0);
|
|
|
|
+ sm.setReceiveMsg(commReceiveService.removeRrefix0(receiveWith0));
|
|
sm.setReceiveTime(DateUtils.getNowDate());
|
|
sm.setReceiveTime(DateUtils.getNowDate());
|
|
// log.
|
|
// log.
|
|
{
|
|
{
|
|
l.info("####ReceiveMsg#### = [{}]", sm);
|
|
l.info("####ReceiveMsg#### = [{}]", sm);
|
|
}
|
|
}
|
|
{
|
|
{
|
|
- AjaxResult ar = commReceiveService.checkReceiveMsg(sm.getReceiveMsg());
|
|
|
|
|
|
+ AjaxResult ar = commReceiveService.checkReceiveMsg(sm.getReceiveMsg());
|
|
if (ar.isError()) {
|
|
if (ar.isError()) {
|
|
// todo:
|
|
// todo:
|
|
l.warn("####Fail#### = {}", sm);
|
|
l.warn("####Fail#### = {}", sm);
|