CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a uni-app mobile application project for Quality Control (QC) and Warehouse management in a Manufacturing
Execution System (MES). The application is built for PDA devices and supports quality inspection processes and warehouse
operations.
- Framework: uni-app (Vue 2.x based)
- App Name: GS-MES-AP (广深科技 MES Application)
- Target Platform: Android mobile/PDA devices
- UI Framework: uView UI library
Build and Development Commands
This is a uni-app project that builds through HBuilderX IDE or uni-app CLI. The build output is generated in the
unpackage/ directory:
- Development Build: Use HBuilderX IDE or
npm run dev:app-plus for development
- Production Build: APK files are generated in
unpackage/release/apk/
- Cache: Build cache and temporary files are stored in
unpackage/cache/
- Testing: Use HBuilderX IDE's built-in testing tools or deploy to PDA devices for testing
Note: This project does not have traditional npm scripts. Development and building are primarily done through
HBuilderX IDE.
Architecture Overview
Core Structure
- Entry Point:
main.js - Contains Vue prototypes, global mixins, and API configuration
- State Management:
store/index.js - Vuex store with server configuration and minimal state
- Routing:
pages.json - uni-app page configuration with tabBar navigation
- Global Config:
manifest.json - App configuration including permissions and build settings
Key Directories
pages/BasePages/ - Core app pages (login, main menu, user profile)
pages/QC/ - Quality Control modules (来料检验 LLJ, 巡检 XJ, 首检 SJ, 入库检 RKJ)
pages/Warehouse/ - Warehouse operations (inventory, purchasing, allocation)
components/ - Reusable UI components and third-party integrations
static/ - Static assets (images, audio files, CSS)
uni_modules/ - uni-app plugin modules including uView UI
API Architecture
- Base API: Configured in Vuex store with environment-specific URLs
- Request Methods: Custom Vue prototypes (
$post, $get, $uni_request) with loading states
- Authentication: User login state managed globally via
$loginInfo
- Error Handling: Centralized error handling with toast messages
Main Features
Quality Control (QC):
- 来料检验 (LLJ) - Incoming Material Inspection
- 巡检 (XJ) - Patrol Inspection
- 首检 (SJ) - First Article Inspection
- 入库检 (RKJ) - Warehouse Inspection
Warehouse Operations:
- Purchase inventory management
- Material allocation and transfers
- Barcode printing and scanning
Common Functions:
- Barcode/QR code scanning
- Photo capture and upload
- Bluetooth printing integration
- Offline data synchronization
Navigation Structure
- Tab Bar: 2 main tabs (首页/Home, 我的/Profile) - Message Center tab is commented out
- Menu System: Dynamic menu loading based on user permissions via
$getUserMenu()
- Page Flow: List → Detail → Form pattern for most workflows
Development Guidelines
Server Configuration
The app connects to different servers based on environment:
- Current active:
http://192.168.1.104:10056/api (configured in store/index.js)
- Internal network:
http://192.168.11.251:10054
- Local development:
http://localhost:10054
- Testing:
http://192.168.1.104:10057/api
- Switch between environments by updating
serverAPI in the Vuex store
Global Utilities
$showMessage() - Display toast notifications
$showDialog() - Show confirmation dialogs
$camera() - Camera/photo selection functionality
$getDate() - Date formatting utilities
$getUrlParams() - URL parameter parsing
Component Dependencies
- uView UI: Primary UI component library
- Custom Components: Scanner, printer utilities in
components/kk-printer/
- Third-party: Charts (u-charts), maps (amap), markdown parsing
File Upload System
Image uploads use base64 encoding via $fileUpload() method, sending to /Base/saveImage endpoint. The $camera()
method handles photo capture with optional automatic upload via the isUpload parameter.
Authentication System
- User authentication is managed through
$loginInfo object in main.js
- Login state persists using
uni.getStorageSync() and uni.setStorageSync()
- Global mixin
globalMixin.js provides checkUserAuth() for automatic login verification
- Users are redirected to
/pages/BasePages/login if not authenticated
Request Architecture
- $post() and $get(): Standard API requests with automatic loading indicators
- $uni_request(): Core request method with error handling and status checking
- $toERP(): External ERP system integration requests
- $postSyncPost(): Promise-based synchronous POST requests
- $uni_requestNew(): Alternative request method for external API calls
- All requests automatically handle loading states, error messages, and network failures
Hardware Integration
- Camera: Native camera access via
$camera() with image compression options
- Barcode Scanner: QR/barcode scanning capabilities for PDA devices
- Bluetooth Printing: Printer integration through
components/kk-printer/
- Device Permissions: Configured in
manifest.json for camera, storage, network, and Bluetooth access
Page Architecture Patterns
- List Pages: Pagination with pull-to-refresh and infinite scroll
- Detail Pages: Read-only view with navigation to edit forms
- Add/Edit Forms: Input validation and submission with photo upload capabilities
- Scan Pages: Barcode scanning with immediate data processing
Important Development Notes
- Vue Version: Uses Vue 2.x (configured in manifest.json)
- Build Platform: Primarily targets Android PDA devices with specific hardware permissions
- State Persistence: User data persists using uni.getStorageSync/setStorageSync
- Error Handling: Network failures clear local storage and redirect to login
- Image Processing: Base64 encoding with PNG format prefix for uploads
- Hardware Modules: Camera, Barcode scanning, and Bluetooth printing are configured in manifest.json