rambo пре 7 месеци
родитељ
комит
681a58900d
4 измењених фајлова са 25 додато и 122 уклоњено
  1. 0 100
      python/action.json
  2. 11 5
      python/api.py
  3. 14 0
      python/mcu/DeviceControl.py
  4. 0 17
      python/sockets/message_handler.py

+ 0 - 100
python/action.json

@@ -98,105 +98,5 @@
         "led_switch": false,
         "is_wait": false,
         "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "俯视",
-        "action_index": 10,
-        "picture_index": 99,
-        "camera_height": 200,
-        "camera_angle": 14.0,
-        "is_system": true,
-        "number_focus": 2,
-        "take_picture": true,
-        "turntable_position": 300.0,
-        "turntable_angle": -32.0,
-        "shoe_upturn": false,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "侧视",
-        "action_index": 20,
-        "picture_index": 99,
-        "camera_height": 0,
-        "camera_angle": 3.0,
-        "is_system": true,
-        "number_focus": 0,
-        "take_picture": true,
-        "turntable_position": 300.0,
-        "turntable_angle": 0.0,
-        "shoe_upturn": false,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "后跟",
-        "action_index": 30,
-        "picture_index": 99,
-        "is_system": true,
-        "camera_height": 0,
-        "camera_angle": 3.0,
-        "number_focus": 0,
-        "take_picture": true,
-        "turntable_position": 450.0,
-        "turntable_angle": 70.0,
-        "shoe_upturn": false,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "鞋底",
-        "action_index": 40,
-        "picture_index": 99,
-        "is_system": true,
-        "camera_height": 0,
-        "camera_angle": 3.0,
-        "number_focus": 0,
-        "take_picture": true,
-        "turntable_position": 100.0,
-        "turntable_angle": 0.0,
-        "shoe_upturn": true,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "内里",
-        "action_index": 50,
-        "picture_index": 99,
-        "is_system": true,
-        "camera_height": 0,
-        "camera_angle": 3.0,
-        "number_focus": 0,
-        "take_picture": true,
-        "turntable_position": 500.0,
-        "turntable_angle": 180.0,
-        "shoe_upturn": false,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
     }
 ]

+ 11 - 5
python/api.py

@@ -450,16 +450,22 @@ def get_device_configs(params: ModelGetDeviceConfigDetail):
 
 
 @app.post("/device_config_detail_query", description="通过条件获取可执行程序详情")
-def get_device_configs(params: ModelGetDeviceConfigDetailQuery):
-    tab_id = params.tab_id
-    action_name = params.action_name
+def device_config_detail_query():
+    # tab_id = params.tab_id
+    # action_name = params.action_name
+    sys = CRUD(SysConfigs)
+    action_configs = sys.read(session, conditions={"key": "action_configs"})
+    action_configs_value = json.loads(action_configs.value)
+    left_config = action_configs_value.get("left")
     session = SqlQuery()
     configModel = CRUD(DeviceConfig)
     model = configModel.read(
-        session, conditions={"tab_id": tab_id, "action_name": action_name}
+        session, conditions={"tab_id": left_config, "action_name": "侧视"}
     )
     if model == None:
-        return {"code": 1, "msg": "数据不存在", "data": None}
+        model = configModel.read(
+            session, conditions={"tab_id": left_config}
+        )
     return {"code": 0, "msg": "", "data": model}
 
 

+ 14 - 0
python/mcu/DeviceControl.py

@@ -15,6 +15,7 @@ from databases import insert_photo_records
 from .McuDeviationSet import McuDeviationSet
 from .OtherSet import OtherSet
 from .DebugUart import DebugUart
+import copy
 
 # mcu命令
 class DeviceControl(BaseClass, metaclass=SingletonType):
@@ -1370,6 +1371,19 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
         image_counts = 0
         if config_list:
             action_names = []
+            if len(config_list) > 1:
+                if config_list[-1]["take_picture"] is True:
+                    new_init_config = copy.copy(config_list[0])
+                    new_init_config["action_name"] = "移动到初始位"
+                    new_init_config["number_focus"] = 0
+                    new_init_config["take_picture"] = False
+                    new_init_config["shoe_upturn"] = False
+                    new_init_config["pre_delay"] = 0.0
+                    new_init_config["after_delay"] = 0.0
+                    new_init_config["led_switch"] = True
+                    new_init_config["is_wait"] = False
+                    new_init_config["is_need_confirm"] = False
+                    config_list.append(new_init_config)
             for idx, item in enumerate(config_list):
                 is_take_picture = item["take_picture"]
                 action_id = item["id"]

+ 0 - 17
python/sockets/message_handler.py

@@ -68,23 +68,6 @@ async def handlerSend(
             device_ctrl.is_stop_action = True
         case "run_mcu":
             msg_type = "run_mcu"
-            # try:
-            #     # 判断拍照软件是否初始化
-            #     digicam = DigiCam()
-            #     camera_is_connect = digicam.checkCameraConnect()
-            #     if camera_is_connect is not True:
-            #         data = manager.jsonMessage(
-            #             code=1, msg="相机未连接,请检查", msg_type=msg_type
-            #         )
-            #         await manager.send_personal_message(data, websocket)
-            #         return
-            #     digicam.getCaptureFolderPath()
-            # except:
-            #     data = manager.jsonMessage(
-            #         code=1, msg="digicam未初始化,请检查", msg_type=msg_type
-            #     )
-            #     await manager.send_personal_message(data, websocket)
-            #     return
             action_info = data.get("action", "执行左脚程序")
             goods_art_no = data.get("goods_art_no", None)
             if goods_art_no == None or goods_art_no =="":