CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
PadBrowse is a Uni-app manufacturing execution system (MES) application designed for industrial control machines and tablets used in injection molding production lines. It's developed for Guangshen Technology's manufacturing operations.
Framework and Technology Stack
- Framework: Uni-app (Vue 2)
- Build Target: App-Plus (Android/iOS native apps)
- State Management: Vuex
- UI Components: Uni-UI components library + custom components
- Languages: JavaScript, Vue.js, SCSS/CSS
- Key Modules: Camera, Barcode scanning, Bluetooth printing
Build and Development Commands
This is a Uni-app project built for native mobile platforms. Use HBuilderX IDE or Uni-app CLI for development:
Development (local testing):
- Open project in HBuilderX and use built-in preview/debugging tools
- For Android development: Build > Native App-Cloud Packaging
- For local debugging: Run > Run to Mobile Device
Key Development URLs:
- Local debug API: http://localhost:5106/api
- Internal network API (PRIMARY): http://192.168.0.94:8008/api
- Server health check: http://192.168.11.251:10054
No traditional npm scripts - this project uses Uni-app's build system through HBuilderX or uni CLI.
Architecture Overview
Core Application Flow
- App Startup (App.vue, pages/index.vue):
- Clear local storage (except critical device info)
- Detect device WiFi MAC address via Android native APIs
- Check for APK updates and install silently if available
- Load machine binding from
/DevMachine/GetDevMachineByPdaMac
- Work Order Selection (Tab 7):
- Display available work orders for the bound machine
- User selects up to 4 orders (must have same mold)
- Save selection via
/MesOrderSelect/Add
- Navigate to Tab 0 (Main Interface)
- Production Monitoring (Tab 0 - WorkOrder.vue):
- Display real-time order details and production metrics
- Show quality inspection results (首检/巡检)
- Auto-refresh every 120 seconds
- Production Operations (Tabs 2-6, 9):
- Mold changes, machine adjustments, barcode printing
- Quality inspections, e-SOP viewing, process parameters
- Equipment point checks
- Data Synchronization: All operations sync with backend MES system via RESTful APIs
Key API Endpoints
- Device info:
/DevMachine/GetDevMachineByPdaMac
- Work orders:
/Womdaa/GetWomdaasByShow, /Womdaa/GetWomdaasByMachine, /Womdaa/GetWomdaaById
- Order selection:
/MesOrderSelect/Add, /MesOrderSelect/Remove
- Order status:
/MesOrderSta/FindByOrderNo, /MesOrderSta/init, /MesOrderSta/Binding
- Quality inspection:
/MesQaItemsDetect02/FindSJByOrderNo (首检), /MesQaItemsDetect02/FindXJByOrderNo (巡检)
- Stored procedures:
/b/esp endpoint
API Response Format:
All API responses follow this structure:
javascript { status: 0, // 0 = success, non-zero = error message: "Operation message", data: { tbBillList: [...], // Primary data array/object ... } }
Tab Structure (pages/index.vue)
- Tab 7: Work Order Selection - Multi-order selection with mold validation (main entry point)
- Tab 0: Main Interface - Work order details and production monitoring (auto-refresh every 120 seconds)
- Tab 1: Start/Finish Work - Production time tracking (currently hidden)
- Tab 2: Mold Change - Mold management operations
- Tab 3: Machine Adjustment & Inspection - Equipment tuning and QC (调机送检)
- Tab 4: Barcode Printing & Reporting - Production quantity reporting
- Tab 5: e-SOP - Standard operating procedures (PDF viewer)
- Tab 6: Process Parameters - Production parameter management
- Tab 8: Printer Settings - Bluetooth printer configuration (hidden)
- Tab 9: Equipment Inspection - Equipment point checks (设备点检)
Component Architecture
- WorkOrder.vue: Main production interface component
- WorkOrderStatus.vue: Start/finish work operations
- WorkOrderPrint.vue: Barcode printing and reporting
- PrintInit.vue: Printer setup and Bluetooth connection
- Technology.vue: Process parameter management
- PDFShow.vue: e-SOP document viewer
- mold.vue: Mold change operations
- machine.vue: Machine adjustment and inspection
- EquipmentInspection.vue: Equipment inspection/点检
State Management (store/index.js)
- Server configuration with internal/external network switching
- Primary API endpoint configuration for different environments
- Network status and connection management
Utility Functions (main.js)
Global prototype methods available on all Vue instances:
- HTTP Requests: $post, $get, $uni_request methods for API communication
- $post(params): POST requests with loading spinner
- $get(params): GET requests
- $uni_request(params): Unified promise-based requests to serverAPI
- $toERP(params): Direct ERP endpoint calls
- Authentication: $login, $logout, user session management
- $loginInfo: User object with account, userName, deptNo, chineseName, id
- UI Helpers: $showMessage, $showDialog for user notifications
- File Operations: $camera, $fileUpload for image handling (uploads to /Base/saveImage)
- Date Utilities: $getDate with multiple format support ('yyyy-mm-dd hh24:mi:ss')
- Constants: $company ("广深科技"), $esp ("/b/esp"), $api ("/api")
Bluetooth Integration (utils/bluetooth.js)
- Native Android Bluetooth API integration via plus.android
- CPCL printing protocol support for industrial printers
- Device pairing and connection management
Key Development Considerations
- App targets Android industrial control machines with specific screen resolutions (1280x800, 1920x1080)
- Device MAC address is critical for machine binding and identification
- Primary method: WifiManager.getConnectionInfo().getMacAddress()
- Fallback (Android 6.0+): NetworkInterface.getByName("wlan0").getHardwareAddress()
- Data persistence via
uni.setStorageSync() and uni.getStorageSync()
- Stores: pdaMac, machineNo, machineName, account, userName, deptNo
- Auto-cleared on each app restart:
uni.clearStorageSync() in App.onLaunch
- Auto-update functionality with APK download and silent installation via
plus.runtime.install()
- Multi-work order support limited to 4 simultaneous orders with same mold requirements
- WorkOrder.vue auto-refreshes every 120 seconds to sync production data
Environment Configuration
- Configure
serverAPI in store for backend API endpoint
- Set device
pdaMac for machine identification
- Update
machineNo for production line assignment
- Bluetooth and camera permissions required for full functionality
File Structure Notes
components/: Production-specific Vue components for different manufacturing operations
utils/: Bluetooth, printing, scanning, and messaging utilities
common/: Global mixins, permissions, and utility functions
static/img/imgMenu/: Extensive collection of production operation icons and images
uni_modules/: Uni-app plugin ecosystem components
unpackage/: Build output and distribution files