# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview This is an industrial automation system for ATV (Automatic Test Vehicle) reel label attachment, modification, and transfer operations. The system is built in C# (.NET Framework 4.8) using Windows Forms and integrates with various hardware components including motion controllers, barcode readers, printers, and PLCs. ## Build Commands ```bash # Build the main solution msbuild "STDLabelAttach(ATV).sln" /p:Configuration=Debug /p:Platform="Any CPU" # Build for release msbuild "STDLabelAttach(ATV).sln" /p:Configuration=Release /p:Platform="Any CPU" # Build specific project (example) msbuild "Project\STDLabelAttach(ATV).csproj" /p:Configuration=Debug # Build for x86 platform (common configuration) msbuild "STDLabelAttach(ATV).sln" /p:Configuration=Debug /p:Platform=x86 ``` ## Architecture Overview ### Core Components - **Project/**: Main application with UI and business logic - Contains the primary Windows Forms application (`fMain.cs`) - Implements state machine logic in `RunCode/StateMachine/` and `RunCode/Step/` - Device interfaces in `Device/` folder (KeyenceBarcode, SATOPrinter, TowerLamp, etc.) - Dialog forms for user interactions - **Project_form2/**: Secondary receiver application for data handling - Handles SID (Serial ID) conversion and processing - Customer information management - Import/export functionality - **Sub/**: Shared libraries and utilities - `arCtl/`: Custom UI controls and components - `arAzinAxt/`: Motion controller interface (AzinAxt hardware) - `arRS232/`: Serial communication library - `AmkorRestfulService/`: RESTful API service for external integration - `CommSM/`: State machine communication library - `CommUtil/`: Common utilities and dialogs ### Key Technologies - **Hardware Integration**: Motion controllers (AzinAxt), barcode readers (Keyence), SATO printers - **Database**: Entity Framework 6.2.0 with SQL Server - **Communication**: Serial (RS232), RESTful APIs, WebSocket - **Vision**: EmguCV for image processing - **Protocols**: Custom state machine implementation for equipment control ### State Machine Architecture The application uses a comprehensive state machine pattern: - `RunCode/Step/`: Main operational steps (INIT, IDLE, RUN, HOME, FINISH) - `RunCode/StateMachine/`: Core state machine logic and event handling - `RunCode/RunSequence/`: Specific operation sequences (barcode reading, printing, picking) ### Device Management - Motion control through `arAzinAxt` library with position validation - Barcode reading with Keyence scanner integration - Label printing via SATO printer API - PLC communication for safety and I/O control ## Development Patterns ### Configuration Management - Settings stored in `Setting/` classes with UI forms for modification - System parameters in `System_Setting.cs` and `System_MotParameter.cs` - User-specific settings in `UserSetting.cs` ### Data Management - Entity Framework models in `Model1.edmx` - Database managers in `Manager/` folder for different data types - Component classes for reel information, results, and SID conversion ### UI Patterns - Custom controls in `UIControl/` folder - Consistent dialog patterns in `Dialog/` folder - Resource management with embedded images and icons ## Important Notes - The system requires specific hardware drivers (AzinAxt motion controller, Keyence SDK, SATO printer drivers) - Database connection strings are configured in `app.config` - Motion parameters are stored in `.swpp` and `.usrs` files in `MotParam/` - The application supports both Debug and Release configurations with different output paths - Platform target is typically x64 for hardware compatibility ## Testing No formal unit test projects are present. Testing is typically done through: - Manual operation using the main application - Hardware-in-the-loop testing with actual equipment - Debug dialogs and monitoring forms in the application ## Dependencies Key external dependencies include: - Entity Framework 6.2.0 - Newtonsoft.Json 13.0.3 - EmguCV 4.5.1 - Microsoft OWIN stack for web services - Various hardware-specific SDKs and drivers