mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 21:11:12 +00:00
更新物料接口
This commit is contained in:
@@ -66,7 +66,6 @@ class HTTPClient:
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
resources: 要添加的资源列表
|
resources: 要添加的资源列表
|
||||||
database_process_later: 后台处理资源
|
|
||||||
Returns:
|
Returns:
|
||||||
Response: API响应对象
|
Response: API响应对象
|
||||||
"""
|
"""
|
||||||
@@ -131,14 +130,19 @@ class HTTPClient:
|
|||||||
Returns:
|
Returns:
|
||||||
Response: API响应对象
|
Response: API响应对象
|
||||||
"""
|
"""
|
||||||
return self.resource_add(resources)
|
response = requests.put(
|
||||||
response = requests.patch(
|
f"{self.remote_addr}/lab/material",
|
||||||
f"{self.remote_addr}/lab/resource/batch_update/?edge_format=1",
|
|
||||||
json=resources,
|
json=resources,
|
||||||
headers={"Authorization": f"Lab {self.auth}"},
|
headers={"Authorization": f"Lab {self.auth}"},
|
||||||
timeout=100,
|
timeout=100,
|
||||||
)
|
)
|
||||||
return response
|
if response.status_code == 200:
|
||||||
|
res = response.json()
|
||||||
|
if "code" in res and res["code"] != 0:
|
||||||
|
logger.error(f"添加物料失败: {response.text}")
|
||||||
|
if response.status_code != 200:
|
||||||
|
logger.error(f"添加物料失败: {response.text}")
|
||||||
|
return response.json()
|
||||||
|
|
||||||
def upload_file(self, file_path: str, scene: str = "models") -> requests.Response:
|
def upload_file(self, file_path: str, scene: str = "models") -> requests.Response:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1093,7 +1093,7 @@ class WebSocketClient(BaseCommunicationClient):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
self.message_processor.send_message(message)
|
self.message_processor.send_message(message)
|
||||||
logger.trace(f"[WebSocketClient] Device status published: {device_id}.{property_name}")
|
logger.debug(f"[WebSocketClient] Device status published: {device_id}.{property_name}")
|
||||||
|
|
||||||
def publish_job_status(
|
def publish_job_status(
|
||||||
self, feedback_data: dict, item: QueueItem, status: str, return_info: Optional[dict] = None
|
self, feedback_data: dict, item: QueueItem, status: str, return_info: Optional[dict] = None
|
||||||
|
|||||||
Reference in New Issue
Block a user