repo_id
stringclasses
1 value
file_path
stringlengths
31
102
content
stringlengths
16
34k
__index_level_0__
int64
0
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\README.md
# WCS Adaptor ## 如何翻译文本 ![https://xyz-robotics.atlassian.net/wiki/spaces/Training/pages/935035175](https://xyz-robotics.atlassian.net/wiki/spaces/Training/pages/935035175) ## 如何配置 VS Code ![https://xyz-robotics.atlassian.net/wiki/spaces/Training/pages/909312178#%E9%85%8D%E7%BD%AE-VSCode](https://xyz-robotics.atlass...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\config\default.yaml
system: project_type: "dpt" db: sqlalchemy_track_modifications: false sqlalchemy_database_uri: "sqlite:///max_hmi.db?check_same_thread=false" listener: # 急停信号监听 estop: enable: false # 大于等于 1, 下同 interval: 1 # 三色灯监听 light: enable: true interval: 1 # VP 流图状态监听 vp_status: enable...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\config\mockoon.json
{ "uuid": "a1274e33-c740-4154-9183-4c17d3b96eea", "lastMigration": 28, "name": "FastAPI", "endpointPrefix": "", "latency": 0, "port": 12000, "hostname": "", "folders": [], "routes": [ { "uuid": "07648d7b-0402-4cff-bb5f-71f9dbc5d10e", "type": "http", "documentation": "Api", ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\globals.py
"""全局对象.""" from wcs_adaptor.entity import Workspace from xyz_max_hmi_server import ( MessagePusher, OrderManager, TaskManager, WorkspaceManager, ) from xyz_max_hmi_server.entity.order import LiteOrder from xyz_max_hmi_server.entity.task import LiteTask from xyz_max_hmi_server.globals import current_cy...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\listener.py
"""监听函数""" from typing import List from wcs_adaptor import globals from wcs_adaptor.workflows import workflow from xyz_max_hmi_server import g, logger, notify, plc_manager from xyz_max_hmi_server.modules.monitor import Listener # noqa: F401 from xyz_max_hmi_server.utils.vp import vp_utils # NOTE: # 下方定义的函数是内置的常用监...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\main.py
from fastapi.exceptions import RequestValidationError from fastapi.requests import Request from loguru import logger from wcs_adaptor import version from wcs_adaptor.api.max import router as max_router from wcs_adaptor.api.wcs import router as wcs_router from wcs_adaptor.api.wcs_xlhb import * # noqa: F403 from xyz_ma...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\mock.py
import os import random import uuid from loguru import logger from wcs_adaptor.entity import CMCPTask, Task from wcs_adaptor.globals import task_manager from xyz_max_hmi_server import db, enums from xyz_max_hmi_server.entity.order import CMCPOrder from xyz_max_hmi_server.utils.decorators import skip def is_skip(*ar...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\api\max.py
"""提供给 MAX-Studio 的 API""" from typing import Literal, Optional from fastapi import Path from wcs_adaptor.entity.task import XLHBTask from wcs_adaptor.globals import order_manager, task_manager from wcs_adaptor.schemas import ( ErrorDetailSchema, OrderInfoOutputSchema, OrderSKUListOutputSchema, ReportE...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\api\wcs.py
"""WCS 适配器接口. 对外接口 """ from typing import Any, Dict from fastapi import BackgroundTasks from loguru import logger from wcs_adaptor.entity.task import Task from wcs_adaptor.globals import ( mp, order_manager, task_manager, workspace_manager, ) from wcs_adaptor.schemas import ( OrderArriveSchema, ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\api\wcs_xlhb.py
"""老接口,兼容 xlhb 的接口.""" from typing import Any, Dict from loguru import logger from wcs_adaptor.globals import task_manager from wcs_adaptor.schemas import ( SingleDepalletizeCreateSchema, SinglePalletizeCreateSchema, ) from wcs_adaptor.workflows import xlhb_sd_workflow, xlhb_sp_workflow from xyz_max_hmi_serve...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\entity\order.py
from xyz_max_hmi_server.entity.order import ( CMCPOrder, LiteOrder, MCDOrder, MCPOrder, Order, RMCPOrder, RockyDualLoadingOrder, RockyDualUnloadingOrder, ) __all__ = [ "CMCPOrder", "LiteOrder", "RMCPOrder", "Order", "MCPOrder", "MCDOrder", "RockyDualUnloading...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\entity\task.py
"""Task entity.""" import copy from typing import List, Optional, Union from pydantic import BaseModel, Field, root_validator from sqlalchemy.orm.session import Session from typing_extensions import Final, Self, TypedDict from xyz_max_hmi_server import LiteTask, crud, enums, services from xyz_max_hmi_server.db.sessio...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\entity\workspace.py
from xyz_max_hmi_server.entity.workspace import Workspace __all__ = ["Workspace"]
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\entity\__init__.py
from .order import CMCPOrder, LiteOrder, MCPOrder, Order from .task import ( CMCPTask, MCDTask, MCPTask, RMCPTask, RockyDualUnloadingTask, Task, XLHBTask, ) from .workspace import Workspace __all__ = [ "Task", "CMCPTask", "RMCPTask", "XLHBTask", "MCPTask", "MCDTask",...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\schemas\max_schemas.py
from datetime import datetime from typing import Dict, List, Literal, Optional from pydantic import BaseModel, Field, root_validator, validator from wcs_adaptor.entity import Task from xyz_max_hmi_server import enums from xyz_max_hmi_server.entity.cmcp_planning_result import Result from xyz_max_hmi_server.entity.pre_...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\schemas\wcs_schemas.py
import uuid from typing import Final, List, Optional from pydantic import BaseModel, Field, validator from xyz_max_hmi_server import _, enums from xyz_max_hmi_server.entity import PreTask, SKUInfo class SKUInfoInputSchema(SKUInfo): """SKU信息输入模型.""" class Config: extra_schema = { "exampl...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\schemas\__init__.py
from .max_schemas import ( ErrorDetailSchema, OrderInfoOutputSchema, OrderSKUListOutputSchema, ReportErrorInputSchema, ReportPlanningResultInputSchema, ReportTaskEndingInputSchema, ReportTaskStatusInputSchema, ReportTaskStatusInputV2Schema, ReportTaskStatusOutputSchema, SKUInfoOu...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\base.py
"""工作流模块.""" from typing import Any, Literal, Optional, Tuple, TypeVar, Union from fastapi.encoders import jsonable_encoder from loguru import logger from wcs_adaptor.schemas.max_schemas import ( OrderInfoOutputSchema, ReportErrorInputSchema, ReportTaskEndingInputSchema, WorkspaceUpdateSchema, ) from ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\cmcp_workflow.py
"""控序混码(输送线来料)工作流.""" import collections import uuid from typing import TYPE_CHECKING, Dict, List, Literal, Union from fastapi import BackgroundTasks from fastapi.encoders import jsonable_encoder from loguru import logger from wcs_adaptor.schemas.max_schemas import ( OrderInfoOutputSchema, ReportPlanningResult...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\cmcp_workflow_pallet.py
"""控序混码(托盘来料)工作流.""" import collections import uuid from typing import TYPE_CHECKING, Dict, OrderedDict, cast from fastapi import BackgroundTasks from loguru import logger from wcs_adaptor.entity.task import CMCPTask from wcs_adaptor.schemas.max_schemas import ( ReportPlanningResultInputSchema, ReportTaskEndin...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\mcd_workflow.py
"""Mixed Case Depalletting, 混拆""" from typing import Optional from wcs_adaptor.entity.order import MCDOrder from wcs_adaptor.entity.task import MCDTask from wcs_adaptor.schemas.wcs_schemas import OrderCreateSchema from xyz_max_hmi_server import _ from xyz_max_hmi_server.exceptions import MAXException from xyz_max_hmi...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\rmcp_workflow.py
from fastapi import BackgroundTasks from loguru import logger from wcs_adaptor.entity.task import RMCPTask from wcs_adaptor.schemas.max_schemas import ( ReportTaskEndingInputSchema, ReportTaskStatusInputV2Schema, ) from wcs_adaptor.schemas.wcs_schemas import OrderCreateSchema from xyz_max_hmi_server import _, ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\rockydual_unloading_workflow.py
"""装卸车双臂工作流""" from typing import Optional from wcs_adaptor.entity.order import RockyDualUnloadingOrder from wcs_adaptor.entity.task import RockyDualUnloadingTask from wcs_adaptor.schemas.wcs_schemas import OrderCreateSchema from xyz_max_hmi_server import _ from xyz_max_hmi_server.exceptions import XYZValidationError...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\sd_workflow.py
from wcs_adaptor.entity.task import Task from wcs_adaptor.schemas.max_schemas import ( ReportTaskStatusInputSchema, ReportTaskStatusInputV2Schema, ) from wcs_adaptor.schemas.wcs_schemas import OrderCreateSchema from xyz_max_hmi_server import _, enums from xyz_max_hmi_server.entity.order import Order from xyz_m...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\sp_workflow.py
from wcs_adaptor.entity.task import Task from wcs_adaptor.schemas.max_schemas import ( ReportTaskStatusInputSchema, ReportTaskStatusInputV2Schema, ) from wcs_adaptor.schemas.wcs_schemas import OrderCreateSchema from xyz_max_hmi_server import _, enums from xyz_max_hmi_server.entity.order import Order from xyz_m...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\xlhb_sd_workflow.py
from typing import Optional from loguru import logger try: from wcs_adaptor.entity.task import XLHBTask as Task except ImportError: from wcs_adaptor.entity.task import Task as _Task class XLHBTask(_Task): pass Task = XLHBTask from wcs_adaptor.schemas.max_schemas import ( ReportTaskEndi...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\xlhb_sp_workflow.py
from typing import Optional from loguru import logger try: from wcs_adaptor.entity.task import XLHBTask as Task except ImportError: from wcs_adaptor.entity.task import Task as _Task class XLHBTask(_Task): pass Task = XLHBTask from wcs_adaptor.schemas.max_schemas import ( ReportTaskEndin...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\dpt\wcs_adaptor\workflows\__init__.py
from .base import Workflow workflow = Workflow() from .cmcp_workflow import cmcp_workflow from .cmcp_workflow_pallet import cmcp_workflow_pallet try: from .mcd_workflow import mcd_workflow from .rmcp_workflow import rmcp_workflow from .rockydual_unloading_workflow import rockydual_unloading_workflow ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\ind\config\default.yaml
system: project_type: "ind" db: sqlalchemy_track_modifications: false sqlalchemy_database_uri: "sqlite:///max_hmi.db?check_same_thread=false" listener: # VP 流图状态监听 vp_status: enable: true interval: 1 # TODO: replace `hmi` to `server` hmi: host: "0.0.0.0" port: 7002
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\ind\wcs_adaptor\listener.py
"""监听函数""" from xyz_max_hmi_server.modules.message_pusher.sender import BaseSender from xyz_max_hmi_server.modules.monitor import Listener # class PLCStatusSender(BaseSender): # """PLC 状态发送器""" # # event_type = "plc_status" # # def __call__(self, status): # self.send({"status": status}) # # # plc_s...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\ind\wcs_adaptor\main.py
from wcs_adaptor import version from xyz_max_hmi_server import Application from xyz_max_hmi_server.route import EnhancedAPIRoute app = Application( title="WCS Adaptor", version=version.__version__, description="WCS Adaptor", ) app.router.route_class = EnhancedAPIRoute
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\cv_convert.py
import sys import typing as t import cv2 import numpy as np if t.TYPE_CHECKING: from xyz_max_hmi_server.modules.cyber.msgs import sensor_msgs CV_TO_NUMPY_DTYPE = { "mono8": "uint8", "mono16": "uint16", "bgr8": "uint8", "rgb8": "uint8", "bgr16": "uint16", "rgb16": "uint16", "rgba8": "...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\db_util.py
import os from pathlib import Path from typing import Callable, Optional, Sequence, TypeVar, Union from alembic import command, config from fastapi_pagination import paginate as _paginate from fastapi_pagination.bases import AbstractPage, AbstractParams from fastapi_pagination.ext.sqlalchemy import paginate as _pagina...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\decorators.py
import time from functools import wraps from typing import Callable, Optional, Type, TypeVar from loguru import logger from typing_extensions import ParamSpec, TypeVar T = TypeVar("T") P = ParamSpec("P") # FIXME: 被装饰的方法/函数的返回值的类型没有被正确推导. def skip( condition: Callable[..., bool] ) -> Callable[[Callable[P, T]], C...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\generic_model.py
from typing import Any, Generic, Tuple, Type, TypeVar, Union from pydantic.generics import GenericModel as _GenericModel, GenericModelT T = TypeVar("T") # NOTICE: This is a workaround for the issue: # https://github.com/pydantic/pydantic/discussions/4904 class GenericModel(_GenericModel): def __class_getitem__(...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\i18n.py
from fastapi_babel import Babel, _ def change_locale( babel: Babel, locale: str, ): """修改语言.""" babel.locale = locale gettext = _
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\message2jsonschema.py
from typing import Dict, Optional, Sequence, Type, Union from google.protobuf.descriptor import FieldDescriptor from google.protobuf.message import Message from loguru import logger # PERF: lru_cache 无法缓存 Message,因为 Message 是 Unhashable 的. @logger.catch() def message2jsonschema( message: Union[Message, Type[Mess...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\openapi.py
import copy import textwrap from fastapi.openapi.utils import get_openapi from xyz_max_hmi_server.config import settings from xyz_max_hmi_server.route import EnhancedAPIRoute def init_app(app, subapp): """初始化应用""" def custom_openapi(): """自定义 OpenAPI 文档""" if app.openapi_schema: ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\request.py
import os import time from typing import Literal, Optional, Tuple, Union import requests from loguru import logger from xyz_max_hmi_server import _ from xyz_max_hmi_server.config import settings from xyz_max_hmi_server.exceptions import XYZException from xyz_max_hmi_server.utils.decorators import skip _session = req...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\signleton.py
"""单例元类""" class Singleton(type): """单例元类. Example: >>> class A(metaclass=Singleton): pass >>> a1 = A() >>> a2 = A() >>> assert a1 is a2 """ instances = {} def __call__(cls, *args, **kwargs): if cls not in cls.instances: cls.ins...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\studio_max.py
""" 用于 Studio Max 的一些工具函数 """ import configparser import os import re from pathlib import Path from typing import Optional, Union # 判断当前系统是否为 Windows IS_WINDOWS = os.name == "nt" unicode_pattern = re.compile(r"(?!\\u[0-9a-fA-F]{4})\\u([0-9a-fA-F]{2})") def read_hkey( key: str, path: str = r"Software\XYZ Robotics...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\subapp.py
"""Subapp reload module.""" import importlib import sys import threading import pydantic from loguru import logger from starlette.routing import Mount from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer from watchdog.utils.dirsnapshot import DirectorySnapshot, DirectorySnapshotDi...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\utils.py
"""Utils""" import asyncio import contextlib import enum import os import subprocess from concurrent.futures import Future from datetime import date, datetime from functools import partial from os import PathLike from pathlib import Path from typing import Any, Union import psutil from fastapi.encoders import jsonable...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\utils\vp.py
"""VP 工具库""" from typing import Dict # noqa: F401 from loguru import logger from xyz_max_hmi_server import enums, signals from xyz_max_hmi_server.exceptions import ( XYZGrpcError, XYZNotFoundGrpcServiceError, ) from xyz_max_hmi_server.modules.grpc.client.vp import VPClient from xyz_max_hmi_server.modules.grp...
0