feat: Implement recipe selection with backend integration
Backend changes (C#): - Add SelectRecipe method to MachineBridge for recipe selection - Add currentRecipeId tracking in MainForm - Implement SELECT_RECIPE handler in WebSocketServer Frontend changes (React/TypeScript): - Add selectRecipe method to communication layer - Update handleSelectRecipe to call backend and handle response - Recipe selection updates ModelInfoPanel automatically - Add error handling and logging for recipe operations Layout improvements: - Add Layout component with persistent Header and Footer - Create separate IOMonitorPage for full-screen I/O monitoring - Add dynamic IO tab switcher in Header (Inputs/Outputs) - Ensure consistent UI across all pages 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -41,9 +41,25 @@ namespace HMIWeb
|
||||
_host.HandleCommand(command);
|
||||
}
|
||||
|
||||
public void LoadRecipe(string recipeId)
|
||||
public string SelectRecipe(string recipeId)
|
||||
{
|
||||
Console.WriteLine($"[C#] Loading Recipe: {recipeId}");
|
||||
Console.WriteLine($"[C#] Selecting Recipe: {recipeId}");
|
||||
|
||||
// In real app, load recipe settings here
|
||||
// For now, just return success
|
||||
try
|
||||
{
|
||||
// Simulate recipe loading logic
|
||||
_host.SetCurrentRecipe(recipeId);
|
||||
|
||||
var response = new { success = true, message = "Recipe selected successfully", recipeId = recipeId };
|
||||
return JsonConvert.SerializeObject(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new { success = false, message = ex.Message };
|
||||
return JsonConvert.SerializeObject(response);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetConfig()
|
||||
@@ -93,5 +109,49 @@ namespace HMIWeb
|
||||
Console.WriteLine($"[Backend] Data: {configJson}");
|
||||
// In a real app, we would save this to a file or database
|
||||
}
|
||||
public string GetIOList()
|
||||
{
|
||||
var ioList = new System.Collections.Generic.List<object>();
|
||||
|
||||
// Outputs (0-31)
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
string name = $"DOUT_{i:D2}";
|
||||
if (i == 0) name = "Tower Lamp Red";
|
||||
if (i == 1) name = "Tower Lamp Yel";
|
||||
if (i == 2) name = "Tower Lamp Grn";
|
||||
|
||||
ioList.Add(new { id = i, name = name, type = "output", state = false });
|
||||
}
|
||||
|
||||
// Inputs (0-31)
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
string name = $"DIN_{i:D2}";
|
||||
bool initialState = false;
|
||||
if (i == 0) name = "Front Door Sensor";
|
||||
if (i == 1) name = "Right Door Sensor";
|
||||
if (i == 2) name = "Left Door Sensor";
|
||||
if (i == 3) name = "Back Door Sensor";
|
||||
if (i == 4) { name = "Main Air Pressure"; initialState = true; }
|
||||
if (i == 5) { name = "Vacuum Generator"; initialState = true; }
|
||||
if (i == 6) { name = "Emergency Stop Loop"; initialState = true; }
|
||||
|
||||
ioList.Add(new { id = i, name = name, type = "input", state = initialState });
|
||||
}
|
||||
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(ioList);
|
||||
}
|
||||
public string GetRecipeList()
|
||||
{
|
||||
var recipes = new System.Collections.Generic.List<object>();
|
||||
recipes.Add(new { id = "1", name = "Wafer_Proc_300_Au", lastModified = "2023-10-25" });
|
||||
recipes.Add(new { id = "2", name = "Wafer_Insp_200_Adv", lastModified = "2023-10-26" });
|
||||
recipes.Add(new { id = "3", name = "Glass_Gen5_Bonding", lastModified = "2023-10-27" });
|
||||
recipes.Add(new { id = "4", name = "Solar_Cell_Cut_A", lastModified = "2023-11-01" });
|
||||
recipes.Add(new { id = "5", name = "LED_Mount_HighSpeed", lastModified = "2023-11-15" });
|
||||
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(recipes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user