add-首页计划界面按钮添加IsEnable、参数配置界面添加密码权限

dev
liuwf 1 month ago
parent 249d0c6be0
commit 58815381fe

@ -158,5 +158,16 @@ namespace SlnMesnac.Config
set { iniHelper.IniWriteValue("system", "ProcessName", value); }
}
/// <summary>
///参数配置界面密码
/// </summary>
public string ConfigInfoPassWprd
{
get { return iniHelper.IniReadValue("system", "ConfigInfoPassWprd"); }
set { iniHelper.IniWriteValue("system", "ConfigInfoPassWprd", value); }
}
}
}

@ -168,5 +168,12 @@ namespace SlnMesnac.Model.dto
///</summary>
[SugarColumn(ColumnName = "material_unit")]
public string MaterialUnit { get; set; }
public bool StartEnable { get; set; }
public bool StopEnable { get; set; }
}
}

@ -8,9 +8,14 @@
xmlns:local1="clr-namespace:SlnMesnac.WPF.Converter.ProdMgmt"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent">
<Control.Resources>
<Control.Resources>
<local1:PlanStatusConverter x:Key="PlanStatusConverter" />
<local1:PlanAmountConverter x:Key="PlanAmountConverter" />
</Control.Resources>
<Grid Margin="5,5">
<Grid.ColumnDefinitions>
@ -240,8 +245,8 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button Content="开始" CommandParameter="{Binding PlanCode}" IsEnabled="{Binding StartEnable}" Background="#007DFA" Foreground="White" Margin="10,0,0,0" Height="25" BorderBrush="DeepSkyBlue" BorderThickness="0" Width="45" Command="{Binding DataContext.StartProdPlanCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid }}"/>
<Button Content="暂停" CommandParameter="{Binding PlanCode}" IsEnabled="{Binding StopEnable}" Background="#007DFA" Foreground="White" Margin="10,0,0,0" Height="25" BorderBrush="DeepSkyBlue" BorderThickness="0" Width="45" Command="{Binding DataContext.StopProdPlanCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid }}" />
<Button Content="开始" CommandParameter="{Binding PlanCode}" IsEnabled="{Binding StartEnable}" Background="LimeGreen" Foreground="Gray" Margin="10,0,0,0" Height="25" BorderBrush="DeepSkyBlue" BorderThickness="0" Width="45" Command="{Binding DataContext.StartProdPlanCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid }}"/>
<Button Content="暂停" CommandParameter="{Binding PlanCode}" IsEnabled="{Binding StopEnable}" Background="Red" Foreground="Gray" Margin="10,0,0,0" Height="25" BorderBrush="DeepSkyBlue" BorderThickness="0" Width="45" Command="{Binding DataContext.StopProdPlanCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid }}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>

@ -334,9 +334,18 @@ namespace SlnMesnac.WPF.ViewModel
UserContent = generateControl;
break;
case "ConfigInfo":
UserContent = configInfoPage;
PageName = "参数配置";
string password = Microsoft.VisualBasic.Interaction.InputBox("请输入密码:", "密码验证", "", -1, -1);
if (password == debugConfig.ConfigInfoPassWprd) // 检查密码是否正确
{
UserContent = configInfoPage;
PageName = "参数配置";
}
else if(!string.IsNullOrEmpty(password))
{
MessageBox.Show("密码错误,请重试!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
//UserContent = configInfoPage;
//PageName = "参数配置";
break;
case "RecipeManage":
UserContent = recipeManagePage;

@ -302,6 +302,37 @@ namespace SlnMesnac.WPF.ViewModel
PlanInfoDataGrid = new ObservableCollection<MesProductPlanDto>();
if (list != null)
{
#region 按钮状态
// 假设初始状态所有计划的按钮状态
list.ForEach(plan =>
{
plan.StartEnable = true;
plan.StopEnable = false;
});
// 查找是否存在正在执行的计划
var executingPlan = list.FirstOrDefault(x => x.PlanStatus == PlanStatusEnum.);
if (executingPlan != null)
{
// 如果有正在执行的计划,只有该计划的暂停按钮可以点击,其他计划的按钮都不能点击
foreach (var plan in list)
{
if (plan == executingPlan)
{
plan.StopEnable = true; // 执行中的计划可以暂停
plan.StartEnable = false;
}
else
{
plan.StartEnable = false; // 其他计划不能开始
}
}
}
#endregion
list.OrderByDescending(x => x.PlanStatus);
list.ForEach(
arg =>

Loading…
Cancel
Save