Browse Source

feat: 优化体位选择流程并增强工作流文档

- 在bodyPositionSelection.ts中添加try-catch错误处理,为设备同步和曝光使能操作提供异常捕获
- 更新git-commit-and-push.md工作流文档,补充git diff使用指导

改动文件:
- .clinerules/workflows/git-commit-and-push.md
- src/domain/exam/bodyPositionSelection.ts
sw 2 days ago
parent
commit
2750f68d43

+ 1 - 1
.clinerules/workflows/git-commit-and-push.md

@@ -25,7 +25,7 @@ Automate the Git commit and push process by intelligently analyzing file changes
 
 
 1. For each changed file identified in git status:
 1. For each changed file identified in git status:
 
 
-   - Use the `read_file` tool to examine the content of modified files if needed for context
+   - Use the `read_file` tool to examine the content of modified files if needed for context  , you should use 'git diff' command to check the file modification detail ,not simplely read all the file contents, focus on the diff which is really important !
    - Analyze the type of changes (new features, bug fixes, documentation, refactoring, etc.)
    - Analyze the type of changes (new features, bug fixes, documentation, refactoring, etc.)
 
 
 2. Based on the file changes and any user-provided context information:
 2. Based on the file changes and any user-provided context information:

+ 2 - 2
config/dev.ts

@@ -11,7 +11,7 @@ export default {
     stats: true,
     stats: true,
   },
   },
   defineConstants: {
   defineConstants: {
-    MQTT_BROKER_URL_FROM_WEBPACK: '"ws://192.168.110.13:8083/mqtt"',
+    MQTT_BROKER_URL_FROM_WEBPACK: '"ws://192.168.110.245:8083/mqtt"',
   },
   },
   mini: {},
   mini: {},
   h5: {
   h5: {
@@ -20,7 +20,7 @@ export default {
     devServer: {
     devServer: {
       proxy: {
       proxy: {
         '/dr': {
         '/dr': {
-          target: 'http://192.168.110.13:6001', // 你的后端服务地址
+          target: 'http://192.168.110.245:6001', // 你的后端服务地址
           changeOrigin: true, // 允许跨域
           changeOrigin: true, // 允许跨域
           // pathRewrite: {
           // pathRewrite: {
           //   '^/dr/api': '' // 可选,用于重写路径
           //   '^/dr/api': '' // 可选,用于重写路径

+ 15 - 2
src/domain/exam/bodyPositionSelection.ts

@@ -53,10 +53,23 @@ export const selectBodyPositionWithFullLogic = async (
     if (currentKey === 'exam') {
     if (currentKey === 'exam') {
       if (bodyPosition.dview.expose_status === 'Unexposed') {
       if (bodyPosition.dview.expose_status === 'Unexposed') {
         // 未曝光体位:同步设备,使能曝光
         // 未曝光体位:同步设备,使能曝光
-        await changeBodyPosition(bodyPosition.sop_instance_uid);
+        try {
+          await changeBodyPosition(bodyPosition.sop_instance_uid);
+        } catch (error) {
+          message.error('同步新体位到服务时失败了',error);
+        }
+        
 
 
         // 切换体位成功后,使能发生器曝光
         // 切换体位成功后,使能发生器曝光
-        await setExpEnable();
+        try {
+          await setExpEnable();
+        } catch (error) {
+          console.error(
+            `[bodyPositionSelection] 使能曝光失败,目标体位是 ${bodyPosition.view_name}:`,
+            error
+          );
+          message.error('使能曝光失败,请检查设备连接或重试');
+        }
 
 
         const successMsg = `Body position changed successfully: ${bodyPosition.view_name}`;
         const successMsg = `Body position changed successfully: ${bodyPosition.view_name}`;
         console.log(`[bodyPositionSelection] ${successMsg}`);
         console.log(`[bodyPositionSelection] ${successMsg}`);