Initial commit: Industrial HMI system with component architecture

- Implement WebView2-based HMI frontend with React + TypeScript + Vite
- Add C# .NET backend with WebSocket communication layer
- Separate UI components into modular structure:
  * RecipePanel: Recipe selection and management
  * IOPanel: I/O monitoring and control (32 inputs/outputs)
  * MotionPanel: Servo control for X/Y/Z axes
  * CameraPanel: Vision system feed with HUD overlay
  * SettingsModal: System configuration management
- Create reusable UI components (CyberPanel, TechButton, PanelHeader)
- Implement dual-mode communication (WebView2 native + WebSocket fallback)
- Add 3D visualization with Three.js/React Three Fiber
- Fix JSON parsing bug in configuration save handler
- Include comprehensive .gitignore for .NET and Node.js projects

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-24 20:40:45 +09:00
commit 8dc6b0f921
78 changed files with 126978 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Newtonsoft.Json;
namespace HMIWeb
{
// Important: Allows JavaScript to see this class
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class MachineBridge
{
// Reference to the main form to update logic
private MainForm _host;
public MachineBridge(MainForm host)
{
_host = host;
}
// --- Methods called from React (App.tsx) ---
public void MoveAxis(string axis, double value)
{
// In real app, call DLL here: Motion.Move(axis, value)
Console.WriteLine($"[C#] Moving {axis} to {value}");
// For simulation, update host state directly
_host.SetTargetPosition(axis, value);
}
public void SetIO(int id, bool isInput, bool state)
{
Console.WriteLine($"[C#] Set IO {id} to {state}");
_host.SetOutput(id, state);
}
public void SystemControl(string command)
{
Console.WriteLine($"[C#] CMD: {command}");
_host.HandleCommand(command);
}
public void LoadRecipe(string recipeId)
{
Console.WriteLine($"[C#] Loading Recipe: {recipeId}");
}
public string GetConfig()
{
// Generate 20 Mock Settings
var settings = new System.Collections.Generic.List<object>();
// Core Settings
settings.Add(new { Key = "Site Name", Value = "Smart Factory A-1", Group = "System Information", Type = "String", Description = "The display name of the factory site." });
settings.Add(new { Key = "Line ID", Value = "L-2024-001", Group = "System Information", Type = "String", Description = "Unique identifier for this production line." });
settings.Add(new { Key = "API Endpoint", Value = "https://api.factory.local/v1", Group = "Network Configuration", Type = "String", Description = "Base URL for the backend API." });
settings.Add(new { Key = "Support Contact", Value = "010-1234-5678", Group = "System Information", Type = "String", Description = "Emergency contact number for maintenance." });
settings.Add(new { Key = "Debug Mode", Value = "false", Group = "System Information", Type = "Boolean", Description = "Enable detailed logging for debugging." });
settings.Add(new { Key = "Max Speed", Value = "1500", Group = "Motion Control", Type = "Number", Description = "Maximum velocity in mm/s." });
settings.Add(new { Key = "Acceleration", Value = "500", Group = "Motion Control", Type = "Number", Description = "Acceleration ramp in mm/s²." });
// Generated Settings
for (int i = 1; i <= 5; i++)
{
settings.Add(new {
Key = $"Sensor_{i}_Threshold",
Value = (i * 10).ToString(),
Group = "Sensor Calibration",
Type = "Number",
Description = $"Trigger threshold for Sensor {i}."
});
}
for (int i = 1; i <= 3; i++)
{
settings.Add(new {
Key = $"Safety_Zone_{i}",
Value = "true",
Group = "Safety Settings",
Type = "Boolean",
Description = $"Enable monitoring for Safety Zone {i}."
});
}
Console.WriteLine("get config (20 items)");
return Newtonsoft.Json.JsonConvert.SerializeObject(settings);
}
public void SaveConfig(string configJson)
{
Console.WriteLine($"[Backend] SAVE CONFIG REQUEST RECEIVED");
Console.WriteLine($"[Backend] Data: {configJson}");
// In a real app, we would save this to a file or database
}
}
}