MES Tool Lifecycle Model (models/tool.py)

kuaigeyun-mes · riveredge-backend/src/apps/kuaizhizao/models/tool.py · python · Apache-2.0
database, pos, lang:python, tag:tortoise, tag:manufacturing

Defines database models for manufacturing tools, usage, maintenance, and calibration using Tortoise ORM. Reuse when building manufacturing execution systems or asset management applications.

# Source: https://github.com/kuaigeyun/kuaigeyun-mes | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""
工装模型模块

定义工装及其生命周期相关的记录模型(领用、维保、校验),支持多组织隔离。

Author: Antigravity
Date: 2026-02-02
"""

from tortoise import fields
from core.models.base import BaseModel


class Tool(BaseModel):
    """
    工装基础信息模型
    
    用于管理工装(夹具、治具、检具、刀具等)的基础信息。
    """
    
    class Meta:
        table = "apps_kuaizhizao_tools"
        table_description = "快格轻制造 - 工装"
        indexes = [
            ("tenant_id",),
            ("code",),
            ("type",),
            ("status",),
        ]
        unique_together = [("tenant_id", "code")]
    
    id = fields.IntField(pk=True, description="主键ID")


... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key