diff --git a/app/src/main/assets/web/asset-manifest.json b/app/src/main/assets/web/asset-manifest.json
index 77c32b6..acac809 100644
--- a/app/src/main/assets/web/asset-manifest.json
+++ b/app/src/main/assets/web/asset-manifest.json
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.85138b91.css",
- "main.js": "/static/js/main.2487922d.js",
+ "main.js": "/static/js/main.deeffa60.js",
"static/js/453.e7f11a48.chunk.js": "/static/js/453.e7f11a48.chunk.js",
"static/media/icon_leftR.svg": "/static/media/icon_leftR.76cd3e03bb846b0bacb0a84808f24c36.svg",
"static/media/icon_tab3_u.svg": "/static/media/icon_tab3_u.6d18cbd7c4dc6a54f745fdfcc7716050.svg",
@@ -27,11 +27,11 @@
"static/media/power.svg": "/static/media/power.544f6ce9a5b3e930a515cf130f9f9551.svg",
"static/media/icon_check_s_u.svg": "/static/media/icon_check_s_u.2c5e20bec088338dc1cb2161b5cba37d.svg",
"main.85138b91.css.map": "/static/css/main.85138b91.css.map",
- "main.2487922d.js.map": "/static/js/main.2487922d.js.map",
+ "main.deeffa60.js.map": "/static/js/main.deeffa60.js.map",
"453.e7f11a48.chunk.js.map": "/static/js/453.e7f11a48.chunk.js.map"
},
"entrypoints": [
"static/css/main.85138b91.css",
- "static/js/main.2487922d.js"
+ "static/js/main.deeffa60.js"
]
}
\ No newline at end of file
diff --git a/app/src/main/assets/web/index.html b/app/src/main/assets/web/index.html
index e72bfea..82630c3 100644
--- a/app/src/main/assets/web/index.html
+++ b/app/src/main/assets/web/index.html
@@ -1 +1 @@
-
廓形仪
\ No newline at end of file
+廓形仪
\ No newline at end of file
diff --git a/app/src/main/java/com/iflytop/profilometer/api/measure/MeasureApi.java b/app/src/main/java/com/iflytop/profilometer/api/measure/MeasureApi.java
index 08fced0..95825fc 100644
--- a/app/src/main/java/com/iflytop/profilometer/api/measure/MeasureApi.java
+++ b/app/src/main/java/com/iflytop/profilometer/api/measure/MeasureApi.java
@@ -19,6 +19,7 @@ import com.iflytop.profilometer.core.migration.algo.type.RailProfileMeasureTaskS
import com.iflytop.profilometer.core.migration.algo.type.XYPoint;
import com.iflytop.profilometer.core.migration.type.DeviceAppearance;
import com.iflytop.profilometer.core.system.SystemService;
+import com.iflytop.profilometer.core.websocket.WebSocketManager;
import com.iflytop.profilometer.dao.BaseProfileRecordPointSetDao;
import com.iflytop.profilometer.dao.ProfileRecordDao;
import com.iflytop.profilometer.dao.ProfileRecordPointSetDao;
@@ -31,7 +32,9 @@ import com.iflytop.profilometer.service.RailProfileDrawerService;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import cn.hutool.json.JSONArray;
@@ -194,40 +197,50 @@ public class MeasureApi {
}
public String record() {
- RailProfileDrawerService railProfileDrawerService = SystemService.getInstance().getRailProfileDrawerService();
- RailProfileMeasureTaskState taskState = SystemService.getInstance().getTaskState();
- ProfilometerRecorder profilometerRecorder = railProfileDrawerService.getProfilometerRecorder();
- var report = ProfilometerPulleyPointPreProcesser.processRecord(
- profilometerRecorder.getConfig(),
- profilometerRecorder.getDeviceProfile(),
- profilometerRecorder.getDataCache1(),
- profilometerRecorder.getFirstSide(),
- profilometerRecorder.getDataCache2(),
- profilometerRecorder.getFirstSide().getOpposite());
- if (report.outline1Side == MeasureSide.LEFT) {
- taskState.setLeftPointSetList(report.outline1);
- } else {
- taskState.setRightPointSetList(report.outline1);
- }
- if (report.outline2Side == MeasureSide.LEFT) {
- taskState.setLeftPointSetList(report.outline2);
- } else {
- taskState.setRightPointSetList(report.outline2);
- }
- List allList = new ArrayList<>();
- List outline1List = new ArrayList<>(report.outline1);
- List outline2List = new ArrayList<>(report.outline2);
- if (report.outline1Side == MeasureSide.LEFT) {
- Collections.reverse(outline1List);
- allList.addAll(outline1List);
- allList.addAll(outline2List);
- } else {
- Collections.reverse(outline2List);
- allList.addAll(outline2List);
- allList.addAll(outline1List);
+ try {
+ RailProfileDrawerService railProfileDrawerService = SystemService.getInstance().getRailProfileDrawerService();
+ RailProfileMeasureTaskState taskState = SystemService.getInstance().getTaskState();
+ ProfilometerRecorder profilometerRecorder = railProfileDrawerService.getProfilometerRecorder();
+ var report = ProfilometerPulleyPointPreProcesser.processRecord(
+ profilometerRecorder.getConfig(),
+ profilometerRecorder.getDeviceProfile(),
+ profilometerRecorder.getDataCache1(),
+ profilometerRecorder.getFirstSide(),
+ profilometerRecorder.getDataCache2(),
+ profilometerRecorder.getFirstSide().getOpposite());
+ if (report.outline1Side == MeasureSide.LEFT) {
+ taskState.setLeftPointSetList(report.outline1);
+ } else {
+ taskState.setRightPointSetList(report.outline1);
+ }
+ if (report.outline2Side == MeasureSide.LEFT) {
+ taskState.setLeftPointSetList(report.outline2);
+ } else {
+ taskState.setRightPointSetList(report.outline2);
+ }
+ List allList = new ArrayList<>();
+ List outline1List = new ArrayList<>(report.outline1);
+ List outline2List = new ArrayList<>(report.outline2);
+ if (report.outline1Side == MeasureSide.LEFT) {
+ Collections.reverse(outline1List);
+ allList.addAll(outline1List);
+ allList.addAll(outline2List);
+ } else {
+ Collections.reverse(outline2List);
+ allList.addAll(outline2List);
+ allList.addAll(outline1List);
+ }
+ Log.i(LogTag.PROFILOMENTER, "本次测量一共" + allList.size() + "个点");
+ return Result.success(allList);
+ } catch (Exception e) {
+ Log.e(LogTag.PROFILOMENTER, "获取测量结果失败,请重新测量。", e);
+ Map toastMap = new HashMap<>();
+ toastMap.put("type", "msg-toast");
+ toastMap.put("data", "获取测量结果失败,请重新测量。");
+ WebSocketManager.send(JSONUtil.toJsonStr(toastMap));
+ return Result.failed("获取测量结果失败,请重新测量。");
}
- Log.i(LogTag.PROFILOMENTER, "本次测量一共" + allList.size() + "个点");
- return Result.success(allList);
+
}
}
diff --git a/app/src/main/java/com/iflytop/profilometer/api/record/RecordApi.java b/app/src/main/java/com/iflytop/profilometer/api/record/RecordApi.java
index 622e60e..98addd0 100644
--- a/app/src/main/java/com/iflytop/profilometer/api/record/RecordApi.java
+++ b/app/src/main/java/com/iflytop/profilometer/api/record/RecordApi.java
@@ -164,9 +164,13 @@ public class RecordApi {
}
Map toastMap = new HashMap<>();
toastMap.put("type", "msg-toast");
- toastMap.put("data", "导出成功\n" + "/Download/廓形导出/\n" + zipName);
+ toastMap.put("data", "导出成功" + "/Download/廓形导出/" + zipName);
WebSocketManager.send(JSONUtil.toJsonStr(toastMap));
} catch (Exception e) {
+ Map toastMap = new HashMap<>();
+ toastMap.put("type", "msg-toast");
+ toastMap.put("data", "导出失败");
+ WebSocketManager.send(JSONUtil.toJsonStr(toastMap));
throw new RuntimeException(e);
}
} else {
@@ -183,9 +187,13 @@ public class RecordApi {
FileUtil.writeTextToDownloadSubDir("廓形导出", fileName, sb.toString());
Map toastMap = new HashMap<>();
toastMap.put("type", "msg-toast");
- toastMap.put("data", "导出成功\n" + "/Download/廓形导出/\n" + fileName);
+ toastMap.put("data", "导出成功" + "/Download/廓形导出/" + fileName);
WebSocketManager.send(JSONUtil.toJsonStr(toastMap));
} catch (IOException e) {
+ Map toastMap = new HashMap<>();
+ toastMap.put("type", "msg-toast");
+ toastMap.put("data", "导出失败");
+ WebSocketManager.send(JSONUtil.toJsonStr(toastMap));
throw new RuntimeException(e);
}
}