diff --git a/PetWash.Api/petwash.db b/PetWash.Api/petwash.db
index acef599..847d615 100644
Binary files a/PetWash.Api/petwash.db and b/PetWash.Api/petwash.db differ
diff --git a/PetWash.Api/petwash.db-shm b/PetWash.Api/petwash.db-shm
index cff27ec..fe9ac28 100644
Binary files a/PetWash.Api/petwash.db-shm and b/PetWash.Api/petwash.db-shm differ
diff --git a/PetWash.Api/petwash.db-wal b/PetWash.Api/petwash.db-wal
index ffbb270..e69de29 100644
Binary files a/PetWash.Api/petwash.db-wal and b/PetWash.Api/petwash.db-wal differ
diff --git a/PetWashControl/Services/ConfigurationService.cs b/PetWashControl/Services/ConfigurationService.cs
index e65a5db..c9bf6ab 100644
--- a/PetWashControl/Services/ConfigurationService.cs
+++ b/PetWashControl/Services/ConfigurationService.cs
@@ -9,4 +9,16 @@ public class ConfigurationService
public int PaymentCheckIntervalSeconds { get; set; } = 2;
public int WashSimulationSeconds { get; set; } = 10;
+
+ // 洗护流程时间参数(单位:分钟)
+ public int FirstSprayWaterTime { get; set; } = 2; // 首次喷水时间
+ public int AfterShampoo1SprayTime { get; set; } = 2; // 沐浴1后喷水时间
+ public int AfterShampoo2SprayTime { get; set; } = 2; // 沐浴2后喷水时间
+ public int AfterShampoo3SprayTime { get; set; } = 2; // 沐浴3后喷水时间
+ public int SprayShampoo1Time { get; set; } = 1; // 喷沐浴露1时间
+ public int SprayShampoo2Time { get; set; } = 1; // 喷沐浴露2时间
+ public int SprayShampoo3Time { get; set; } = 1; // 喷沐浴露3时间
+ public int SprayWaterTime { get; set; } = 2; // 喷水时间(保留用于兼容)
+ public int ColdAirTime { get; set; } = 2; // 冷风机时间
+ public int HotAirTime { get; set; } = 5; // 热风机时间
}
diff --git a/PetWashControl/ViewModels/MainViewModel.cs b/PetWashControl/ViewModels/MainViewModel.cs
index 8ff2097..ff88fb0 100644
--- a/PetWashControl/ViewModels/MainViewModel.cs
+++ b/PetWashControl/ViewModels/MainViewModel.cs
@@ -91,6 +91,36 @@ public partial class MainViewModel : ObservableObject
[ObservableProperty]
private bool _isCustomerServiceDialogOpen;
+ [ObservableProperty]
+ private int _firstSprayWaterTime = 2;
+
+ [ObservableProperty]
+ private int _afterShampoo1SprayTime = 2;
+
+ [ObservableProperty]
+ private int _afterShampoo2SprayTime = 2;
+
+ [ObservableProperty]
+ private int _afterShampoo3SprayTime = 2;
+
+ [ObservableProperty]
+ private int _sprayShampoo1Time = 1;
+
+ [ObservableProperty]
+ private int _sprayShampoo2Time = 1;
+
+ [ObservableProperty]
+ private int _sprayShampoo3Time = 1;
+
+ [ObservableProperty]
+ private int _sprayWaterTime = 2;
+
+ [ObservableProperty]
+ private int _coldAirTime = 2;
+
+ [ObservableProperty]
+ private int _hotAirTime = 5;
+
private readonly System.Timers.Timer _carouselTimer;
private readonly System.Timers.Timer _clockTimer;
private readonly string[] _carouselImages = { "/Images/dog.png", "/Images/dog1.png", "/Images/dog2.png" };
@@ -104,6 +134,18 @@ public partial class MainViewModel : ObservableObject
_mqttService = new MqttClientService(_config);
_mqttService.MessageReceived += OnMqttMessageReceived;
+ // 从配置加载时间参数
+ FirstSprayWaterTime = _config.FirstSprayWaterTime;
+ AfterShampoo1SprayTime = _config.AfterShampoo1SprayTime;
+ AfterShampoo2SprayTime = _config.AfterShampoo2SprayTime;
+ AfterShampoo3SprayTime = _config.AfterShampoo3SprayTime;
+ SprayShampoo1Time = _config.SprayShampoo1Time;
+ SprayShampoo2Time = _config.SprayShampoo2Time;
+ SprayShampoo3Time = _config.SprayShampoo3Time;
+ SprayWaterTime = _config.SprayWaterTime;
+ ColdAirTime = _config.ColdAirTime;
+ HotAirTime = _config.HotAirTime;
+
// 初始化洗护步骤
InitializeWashSteps();
@@ -140,6 +182,8 @@ public partial class MainViewModel : ObservableObject
WashSteps.Add(new WashStep { Name = "第二次冲水", Status = "等待中" });
WashSteps.Add(new WashStep { Name = "香波喷洒", Status = "等待中" });
WashSteps.Add(new WashStep { Name = "第三次冲水", Status = "等待中" });
+ WashSteps.Add(new WashStep { Name = "护理液喷洒", Status = "等待中" });
+ WashSteps.Add(new WashStep { Name = "第四次冲水", Status = "等待中" });
WashSteps.Add(new WashStep { Name = "热风吹毛", Status = "等待中" });
WashSteps.Add(new WashStep { Name = "冷热风混合", Status = "等待中" });
}
@@ -237,6 +281,34 @@ public partial class MainViewModel : ObservableObject
_logger.LogInfo("关闭联系客服");
}
+ [RelayCommand]
+ private void SaveSettings()
+ {
+ try
+ {
+ // 更新配置
+ _config.FirstSprayWaterTime = FirstSprayWaterTime;
+ _config.AfterShampoo1SprayTime = AfterShampoo1SprayTime;
+ _config.AfterShampoo2SprayTime = AfterShampoo2SprayTime;
+ _config.AfterShampoo3SprayTime = AfterShampoo3SprayTime;
+ _config.SprayShampoo1Time = SprayShampoo1Time;
+ _config.SprayShampoo2Time = SprayShampoo2Time;
+ _config.SprayShampoo3Time = SprayShampoo3Time;
+ _config.SprayWaterTime = SprayWaterTime;
+ _config.ColdAirTime = ColdAirTime;
+ _config.HotAirTime = HotAirTime;
+
+ _logger.LogInfo($"系统参数已保存 - 首次喷水:{FirstSprayWaterTime}min, 沐浴1后喷水:{AfterShampoo1SprayTime}min, 沐浴2后喷水:{AfterShampoo2SprayTime}min, 沐浴3后喷水:{AfterShampoo3SprayTime}min, 喷沐浴露1:{SprayShampoo1Time}min, 喷沐浴露2:{SprayShampoo2Time}min, 喷沐浴露3:{SprayShampoo3Time}min, 喷水:{SprayWaterTime}min, 冷风:{ColdAirTime}min, 热风:{HotAirTime}min");
+
+ MessageBox.Show("系统参数保存成功!", "成功", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError("保存系统参数失败", ex);
+ MessageBox.Show($"保存失败: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ }
+
[RelayCommand]
private void BackToIdle()
{
@@ -446,15 +518,18 @@ public partial class MainViewModel : ObservableObject
{
try
{
+ // 将分钟转换为秒
var steps = new[]
{
- ("第一次冲水", 120),
- ("沐浴露喷洒", 30),
- ("第二次冲水", 180),
- ("香波喷洒", 30),
- ("第三次冲水", 180),
- ("热风吹毛", 300),
- ("冷热风混合", 120)
+ ("第一次冲水", FirstSprayWaterTime * 60),
+ ("沐浴露喷洒", SprayShampoo1Time * 60),
+ ("第二次冲水", AfterShampoo1SprayTime * 60),
+ ("香波喷洒", SprayShampoo2Time * 60),
+ ("第三次冲水", AfterShampoo2SprayTime * 60),
+ ("护理液喷洒", SprayShampoo3Time * 60),
+ ("第四次冲水", AfterShampoo3SprayTime * 60),
+ ("热风吹毛", HotAirTime * 60),
+ ("冷热风混合", ColdAirTime * 60)
};
int totalDuration = steps.Sum(s => s.Item2);
@@ -464,7 +539,7 @@ public partial class MainViewModel : ObservableObject
{
var (stepName, duration) = steps[stepIndex];
CurrentStep = stepName;
- _logger.LogInfo($"开始步骤: {stepName}");
+ _logger.LogInfo($"开始步骤: {stepName}, 时长: {duration / 60}分钟");
// 更新步骤状态
Application.Current.Dispatcher.Invoke(() =>
diff --git a/PetWashControl/Views/MainWindow.xaml b/PetWashControl/Views/MainWindow.xaml
index 20881a0..9159b8b 100644
--- a/PetWashControl/Views/MainWindow.xaml
+++ b/PetWashControl/Views/MainWindow.xaml
@@ -1550,79 +1550,482 @@
Foreground="#2E7D32"
Margin="0,0,0,20"/>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+