编辑 | blame | 历史 | 原始文档

CLAUDE.md

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

Project Overview

This is a PDA (Personal Digital Assistant) web application for the LongWei MES (Manufacturing Execution System). It's built as an ASP.NET Web Forms application targeting .NET Framework 4.8, designed for mobile/PDA devices used in manufacturing environments.

The application handles various manufacturing operations including:
- Material receiving/shipping (收货/发货)
- Production reporting (生产报工)
- Quality control inspections (质量检验)
- Barcode scanning and printing
- Bluetooth device integration

Architecture & Technology Stack

Backend

  • ASP.NET Web Forms (.NET Framework 4.8)
  • Master Page: Mst.master - provides common layout and references
  • Code-behind: C# files in App_Code/ (e.g., Utility.cs)
  • Configuration: Web.config for app settings, Scripts/config.js for API endpoints

Frontend

  • Vue.js 2.x - primary frontend framework
  • Vant UI - mobile UI component library for Vue
  • Axios - HTTP client for API calls
  • Flexible.js - mobile responsive layout
  • Custom components: Navigation, loading, back button functionality

API Integration

  • Primary API: Configurable in Scripts/config.js (currently localhost:5204/api/)
  • PC Backend: Separate API for PC-related operations (192.168.0.51:8081/)
  • Authentication: Cookie-based with loginGuid and loginAccount
  • HTTP wrapper: Vue.prototype.AxiosHttp for standardized API calls

Directory Structure

/H5/                    - Main application pages (.aspx files)
/H5/Js/                 - Page-specific JavaScript/Vue.js files
/Scripts/               - Shared JavaScript libraries and config
/Images/                - Static assets and CSS
/App_Code/              - Server-side utility classes
/audio/                 - Sound files for success/error feedback

Development Workflow

Building & Running

  • Development: Open GsPdaApp.sln in Visual Studio
  • Debug mode: Set in Web.config (debug="true")
  • Local server: Uses IIS Express (typically port 51933)
  • No build scripts: Standard ASP.NET Web Forms compilation

Key Configuration Files

  • Web.config - Server configuration, compilation settings
  • Scripts/config.js - API endpoints, global Vue.js extensions
  • Mst.master - Common page layout and script references

Code Conventions

  • Page structure: Each .aspx page has corresponding .aspx.cs (C#) and .js (Vue.js) files
  • Vue instances: Named vm, mounted to #app element
  • API calls: Use this.AxiosHttp(method, url, params) wrapper
  • Authentication: Check with this.CHECKLOGIN() or this.GetLoginInfor()
  • Navigation: Use this.GoBack() for consistent back navigation
  • Styling: Mobile-first with Vant UI components, custom CSS in /Images/Style.css

Common Development Patterns

Page Structure Template

var vm = new Vue({
    el: '#app',
    data: function() {
        return {
            isLoading: false,
            // page-specific data
        }
    },
    mounted() {
        this.CHECKLOGIN(); // Verify user authentication
        // initialization logic
    },
    methods: {
        // page-specific methods
    }
});

API Integration

// Standard API call pattern
this.AxiosHttp('get', 'endpoint', params).then(res => {
    if (res.success) {
        // handle success
        this.$playSound('success');
    } else {
        // handle error  
        this.$playSound('error');
        this.$toast.fail(res.message);
    }
});

Audio Feedback

  • Success operations: this.$playSound('success') (plays /audio/OK.wav)
  • Error operations: this.$playSound('error') (plays /audio/NG.wav)

Barcode/Printing Integration

  • Printing functionality integrated via uni.webView.postMessage()
  • Print templates defined in Vue.prototype.sendPrintMessage
  • Barcode scanning integrated with mobile hardware

Bluetooth Integration

  • Located in /H5/Bluetooth/ directory
  • Configuration via BluetoothConfig.xml
  • MAC address management through dedicated pages

Authentication & Session Management

  • Login page: /UserLogin.aspx
  • Session storage: Browser cookies (loginGuid, loginAccount)
  • Auto-redirect: Unauthenticated users redirected to login
  • Session validation: CHECKLOGIN() method on each page

Mobile Optimization

  • Viewport: Configured for mobile devices, no user scaling
  • Responsive: Uses lib-flexible for different screen sizes
  • Touch-friendly: Vant UI components optimized for touch
  • Performance: Minimized resource loading, efficient Vue.js patterns