Browse Source

细节页面的右键逻辑,添加语言

master
sc 2 months ago
parent
commit
435a54a61a
  1. 6
      Properties/Resources.zh-TW.resx
  2. 6
      UserClass/AsyncTcpClient.cs
  3. 52
      View/MonitorView.xaml
  4. 5
      View/MonitorView.xaml.cs
  5. 21
      ViewModel/MainWindowViewModel.cs

6
Properties/Resources.zh-TW.resx

@ -1069,12 +1069,12 @@
<value>音量</value> <value>音量</value>
</data> </data>
<data name="Pequest" xml:space="preserve"> <data name="Pequest" xml:space="preserve">
<value /> <value>請求</value>
</data> </data>
<data name="Subroutine" xml:space="preserve"> <data name="Subroutine" xml:space="preserve">
<value /> <value>副功能</value>
</data> </data>
<data name="DispenseException" xml:space="preserve"> <data name="DispenseException" xml:space="preserve">
<value /> <value>輸送異常</value>
</data> </data>
</root> </root>

6
UserClass/AsyncTcpClient.cs

@ -78,6 +78,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["Message"] = ""; drEmployee["Message"] = "";
drEmployee["SYSKEY"] = ""; drEmployee["SYSKEY"] = "";
drEmployee["WORK_RUN"] = "-1"; drEmployee["WORK_RUN"] = "-1";
drEmployee["ERR"] = false;
drEmployee.EndEdit(); drEmployee.EndEdit();
drEmployee.AcceptChanges(); drEmployee.AcceptChanges();
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP"); LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP");
@ -104,6 +105,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["Message"] = ""; drEmployee["Message"] = "";
drEmployee["SYSKEY"] = ""; drEmployee["SYSKEY"] = "";
drEmployee["WORK_RUN"] = "-1"; drEmployee["WORK_RUN"] = "-1";
drEmployee["ERR"] = false;
drEmployee.EndEdit(); drEmployee.EndEdit();
drEmployee.AcceptChanges(); drEmployee.AcceptChanges();
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT"); LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT");
@ -386,12 +388,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{ {
a.UseCheckClear() a.UseCheckClear()
.SetCheckClearType(CheckClearType.All) .SetCheckClearType(CheckClearType.All)
.SetTick(TimeSpan.FromSeconds(60)) .SetTick(TimeSpan.FromSeconds(5))
.SetOnClose((c, t) => .SetOnClose((c, t) =>
{ {
c.TryShutdown(); c.TryShutdown();
}); });
a.UseTcpReconnection();//触发型重连 // a.UseTcpReconnection();//触发型重连
}) })
.ConfigureContainer(a => .ConfigureContainer(a =>
{ {

52
View/MonitorView.xaml

@ -17,6 +17,14 @@
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/> <ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/> <ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/> <ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
<ContextMenu x:Key="PersoncontextMenu">
<MenuItem Header="{x:Static lang:Resources._lock}" Click="MenuItem_LOCK_XML"/>
</ContextMenu>
<ContextMenu x:Key="PersoncontextMenuStep">
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
<MenuItem Header="{x:Static lang:Resources.Insert}" Click="MenuItem_Insert"/>
<MenuItem Header="{x:Static lang:Resources.Delete}" Click="MenuItem_Delete"/>
</ContextMenu>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -51,6 +59,21 @@
<DataTrigger Binding="{Binding State}" Value="308"> <DataTrigger Binding="{Binding State}" Value="308">
<Setter Property="Background" Value="Yellow"/> <Setter Property="Background" Value="Yellow"/>
</DataTrigger> </DataTrigger>
<DataTrigger Binding="{Binding State}" Value="800">
<Setter Property="IsHitTestVisible" Value="False"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="101">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenu}"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="201">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenu}"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="202">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenu}"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="309">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenu}"/>
</DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</DataGrid.RowStyle> </DataGrid.RowStyle>
@ -74,7 +97,7 @@
<Setter Property="Background" Value="#FFFFFFFF"/> <Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/> <Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/> <Setter Property="Foreground" Value="#000000"/>
</Style> </Style>
</DataGrid.Resources> </DataGrid.Resources>
<DataGrid.Columns> <DataGrid.Columns>
<!--列信息绑定--> <!--列信息绑定-->
@ -152,6 +175,10 @@
<DataTrigger Binding="{Binding RUN}" Value="9"> <DataTrigger Binding="{Binding RUN}" Value="9">
<Setter Property="Background" Value="Red"/> <Setter Property="Background" Value="Red"/>
</DataTrigger> </DataTrigger>
<DataTrigger Binding="{Binding DataContext.IsInteractive,
RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="true">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenuStep}"/>
</DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</DataGrid.RowStyle> </DataGrid.RowStyle>
@ -167,13 +194,6 @@
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</DataGrid.CellStyle> </DataGrid.CellStyle>
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
<MenuItem Header="{x:Static lang:Resources.Insert}" Click="MenuItem_Insert"/>
<MenuItem Header="{x:Static lang:Resources.Delete}" Click="MenuItem_Delete"/>
</ContextMenu>
</DataGrid.ContextMenu>
<DataGrid.Columns> <DataGrid.Columns>
<!--列信息绑定--> <!--列信息绑定-->
<DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
@ -260,12 +280,14 @@
</DataGridTextColumn.ElementStyle> </DataGridTextColumn.ElementStyle>
</DataGridTextColumn> </DataGridTextColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/> <TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/>
<Grid Margin="0,40,0,0" Grid.ColumnSpan="2" Grid.Column="0" > <Grid Margin="0,40,0,0" Grid.ColumnSpan="2" Grid.Column="0" >
<rdp:RemoteDesktopWpf x:Name="rdp" Visibility="Collapsed" /> <rdp:RemoteDesktopWpf x:Name="rdp" Visibility="Collapsed" />
<ContentControl x:Name="Picture" Background="White"/> <ContentControl x:Name="Picture" Background="White"/>
<TextBlock x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White"/> <ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="VerticalOnly">
<TextBlock x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White"/>
</ScrollViewer>
</Grid> </Grid>
<GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/> <GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/>
</Grid> </Grid>
@ -301,15 +323,7 @@
<TextBlock Text="{x:Static lang:Resources.Receipt}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Receipt}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel> </StackPanel>
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_LOCK_XML" IsEnabled="False" x:Name="LOCK_XML">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="LinkLock" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources._lock}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel>
</ListViewItem>
</ListView>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="3" x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="800,0,0,0"> <StackPanel Grid.Row="3" x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="800,0,0,0">
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">

5
View/MonitorView.xaml.cs

@ -100,8 +100,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DyeingMachine.IsEnabled = true; DyeingMachine.IsEnabled = true;
Curve.IsEnabled = true; Curve.IsEnabled = true;
Screen.IsEnabled = true; Screen.IsEnabled = true;
Receipt.IsEnabled = true; Receipt.IsEnabled = true;
LOCK_XML.IsEnabled = true;
TechnologicalProcess_bool = true; TechnologicalProcess_bool = true;
IsInteractive = false; IsInteractive = false;
@ -226,7 +225,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dyelotView.DyelotDatatable(Product_DAT); dyelotView.DyelotDatatable(Product_DAT);
Picture.Content = dyelotView; Picture.Content = dyelotView;
}//单据 }//单据
private void ListViewItem_LOCK_XML(object sender, MouseButtonEventArgs e) private void MenuItem_LOCK_XML(object sender, RoutedEventArgs e)
{ {
string mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<string>("LOCK"); string mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<string>("LOCK");

21
ViewModel/MainWindowViewModel.cs

@ -336,7 +336,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
/**染机用户信息**/ /**染机用户信息**/
try try
{ {
if ((int)Selet_Machines(Machines, "UserInfoStart", "ID='" + i + "'") == 901) if ((int)Selet_Machines(Machines, "UserInfoStart", "ID='" + i + "'") == 901)//打开用户提示信息
{ {
MainWindow.InfData.Rows.Add(new object[] { MainWindow.InfData.Rows.Add(new object[] {
Selet_Machines(Machines, "Name", "ID='" + i + "'"), Selet_Machines(Machines, "Name", "ID='" + i + "'"),
@ -345,7 +345,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
Selet_Machines(Machines, "ID", "ID='" + i + "'")}); Selet_Machines(Machines, "ID", "ID='" + i + "'")});
Updata_Machines(Machines, "UserInfoStart", "ID='" + i + "'", "900"); Updata_Machines(Machines, "UserInfoStart", "ID='" + i + "'", "900");
} }
if (Selet_Machines(Machines, "UserInfoStart", "ID='" + i + "'").ToString() == "902") if (Selet_Machines(Machines, "UserInfoStart", "ID='" + i + "'").ToString() == "902")//删除用户提示信息
{ {
MainWindow.InfData.Select("ID='" + i + "'").First().Delete(); MainWindow.InfData.Select("ID='" + i + "'").First().Delete();
} }
@ -449,7 +449,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
dataRow["Redye"] + "' AND Step = '" + dataRow["Step"] + "'")) dataRow["Redye"] + "' AND Step = '" + dataRow["Step"] + "'"))
{ {
Row.BeginEdit(); Row.BeginEdit();
Row["State"] = 301; Row["State"] = 309;
Row["Amount"] = 0; Row["Amount"] = 0;
Row["DispenseEndTime"] = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); Row["DispenseEndTime"] = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
Row.EndEdit(); Row.EndEdit();
@ -501,13 +501,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
} }
} }
} }
else if (dt.Select("DyeState = 309").Count() > 0) else if (dt.Select("PowderState = 309").Count() > 0)
{ {
foreach (DataRow Row in Dyelot_CALL.Select("Dyelot='" + dataRow["Dyelot"] + "' and Redye ='" + foreach (DataRow Row in Dyelot_CALL.Select("Dyelot='" + dataRow["Dyelot"] + "' and Redye ='" +
dataRow["Redye"] + "' AND Step = '" + dataRow["Step"] + "'")) dataRow["Redye"] + "' AND Step = '" + dataRow["Step"] + "'"))
{ {
Row.BeginEdit(); Row.BeginEdit();
Row["State"] = 301; Row["State"] = 309;
Row["Amount"] = 0; Row["Amount"] = 0;
Row["DispenseEndTime"] = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); Row["DispenseEndTime"] = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
Row.EndEdit(); Row.EndEdit();
@ -552,13 +552,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
} }
} }
} }
else if (dt.Select("DyeState = 309").Count() > 0) else if (dt.Select("ChemicalState = 309").Count() > 0)
{ {
foreach (DataRow Row in Dyelot_CALL.Select("Dyelot='" + dataRow["Dyelot"] + "' and Redye ='" + foreach (DataRow Row in Dyelot_CALL.Select("Dyelot='" + dataRow["Dyelot"] + "' and Redye ='" +
dataRow["Redye"] + "' AND Step = '" + dataRow["Step"] + "'")) dataRow["Redye"] + "' AND Step = '" + dataRow["Step"] + "'"))
{ {
Row.BeginEdit(); Row.BeginEdit();
Row["State"] = 301; Row["State"] = 309;
Row["Amount"] = 0; Row["Amount"] = 0;
Row["DispenseEndTime"] = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); Row["DispenseEndTime"] = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
Row.EndEdit(); Row.EndEdit();
@ -591,6 +591,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
DAT = "SC828" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, DAT = "SC828" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines,
"SYSKEY", "Name='" + row.Field<string>("Machine") + "'") + Product_.ToJsonString() "SYSKEY", "Name='" + row.Field<string>("Machine") + "'") + Product_.ToJsonString()
}); });
if (row["State"].ToString() == "309")
{
MainWindow.InfData.Rows.Add(new object[] { row["Machine"],
Resources.Step + row["Step"]+ Resources.DispenseException,
Selet_Machines(Machines, "SYSKEY", "Name='" + row["Machine"] + "'"),
Selet_Machines(Machines, "ID", "Name='" + row["Machine"] + "'")});
}
Dyelot_CALL.Rows.Remove(row); Dyelot_CALL.Rows.Remove(row);
} }
} }

Loading…
Cancel
Save