Files
AutoBOM/CLAUDE.md
Misaka_Company bc5ea92c52 feat: add implementation plan for order material extraction functionality
- Introduced a comprehensive document detailing the project overview, goals, core functionalities, and technical architecture for the order material extraction feature.
- Defined the product model coding rules and extraction logic for selection conditions.
- Designed class structures for model parsing, condition evaluation, and order material list management.
- Outlined implementation steps, testing plans, and risk assessments for the development process.
2026-01-20 10:45:23 +08:00

3.7 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

AutoBOM is an Excel VBA-based Bill of Materials (BOM) Management System for manufacturing environments. It manages material hierarchies and procurement logic, supporting both assembled components and individual parts sourcing strategies.

Architecture

Core Classes (VBA/ClassModules/)

  • clsBOMManager - Central controller managing the entire BOM data structure

    • Loads data from two Excel worksheets: "领料配置" (Configuration) and "平台配置清单" (Platform Configuration)
    • Builds hierarchical category trees with parent-child relationships
    • Provides material querying interfaces
    • Key methods: LoadData(), GetMaterialsForPicking(), GetCategory()
  • clsCategory - Represents material categories with hierarchical relationships

    • Contains collections of materials and sub-categories
    • Tracks parent category for tree navigation
    • Properties: categoryName, ParentCategoryName, Materials, SubCategories, IsLeafCategory
  • clsMaterialItem - Represents individual material items

    • Properties: code (物料代号), Name (物料名称), Quantity, Condition (选择条件), Category, ParentCategory

Data Structure Design

The system uses a dual-layer approach:

  1. dictAllMaterials - Complete material database loaded from platform configuration sheet
  2. dictCategories - Hierarchical category structure with materials filtered by configuration sheet

Only materials appearing in the "领料配置" worksheet are marked for procurement. Materials in the platform database but not in configuration are ignored.

Business Logic

Dual-Sourcing Strategy (via GetMaterialsForPicking(categoryName, useParent)):

  • Parent Mode (useParent=True): Retrieves parent category materials (assembled components)

    • Default procurement method
    • Example: "低压接头部件" (Low-pressure connector assembly)
  • Child Mode (useParent=False): Retrieves child category materials (individual parts)

    • Used when parent materials are insufficient
    • Recursively expands all sub-categories
    • Example: "径向低压接头" + "弹簧管" + "螺旋管" (individual components)

Running the Code

  1. Open YTHN-100.A0.532-BOM-1.2版 Claude.xlsm in Microsoft Excel
  2. Enable macros when prompted
  3. Press Alt+F8 to open the Macro dialog
  4. Run procedures from modBOMProcessor.bas:
    • TestBOMStructure - Test data loading and verify structure
    • GeneratePickingList - Generate procurement lists to new worksheet
    • GetCategoryMaterials - Demo material retrieval logic
    • QueryMaterialInfo - Query specific category information

Data Worksheet Format

领料配置 (Configuration):

  • Column A: 物料代号 (Material Code)
  • Column C: 类别 (Category)
  • Column D: 上层类别 (Parent Category)
  • Row 1: Header, data starts from row 2

平台配置清单 (Platform Configuration):

  • Column C: 代号 (Code)
  • Column D: 名称 (Name)
  • Column E: 数量 (Quantity)
  • Column F: 选择条件 (Selection Condition)
  • Rows 1-3: Headers, data starts from row 4

VBA Metadata

The VBA module structure is tracked in VBA/vba_metadata.json. This file is automatically maintained and should not be manually edited.

Code Style

  • All comments are in Chinese, explaining business logic and data structures
  • Extensive inline documentation for complex logic
  • Dictionary objects used for O(1) lookups by category name and material code
  • Collection objects used for ordered iteration of materials and categories

Version Control

The .gitignore excludes .xlsm files from version control. Only VBA source code and metadata files are tracked in Git.