Browse Source

排程页面添加新建功能_制作中

master
sc 10 months ago
parent
commit
1e75144916
  1. 9
      Properties/Resources.Designer.cs
  2. 3
      Properties/Resources.en-US.resx
  3. 3
      Properties/Resources.resx
  4. 3
      Properties/Resources.zh-CN.resx
  5. 9
      Properties/Resources.zh-TW.resx
  6. 2
      View/MachinesSet.xaml.cs
  7. 73
      View/ProductionPlanningEdit.xaml
  8. 35
      View/ProductionPlanningEdit.xaml.cs
  9. 1
      View/ProductionPlanningView.xaml
  10. 7
      View/ProductionPlanningView.xaml.cs

9
Properties/Resources.Designer.cs

@ -1302,6 +1302,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Multi 的本地化字符串。
/// </summary>
public static string Multi {
get {
return ResourceManager.GetString("Multi", resourceCulture);
}
}
/// <summary>
/// 查找类似 New 的本地化字符串。
/// </summary>

3
Properties/Resources.en-US.resx

@ -933,4 +933,7 @@
<data name="Delayed" xml:space="preserve">
<value>Delayed</value>
</data>
<data name="Multi" xml:space="preserve">
<value>Multi</value>
</data>
</root>

3
Properties/Resources.resx

@ -933,4 +933,7 @@
<data name="Delayed" xml:space="preserve">
<value>Delayed</value>
</data>
<data name="Multi" xml:space="preserve">
<value>Multi</value>
</data>
</root>

3
Properties/Resources.zh-CN.resx

@ -933,4 +933,7 @@
<data name="Delayed" xml:space="preserve">
<value>延后</value>
</data>
<data name="Multi" xml:space="preserve">
<value>多机</value>
</data>
</root>

9
Properties/Resources.zh-TW.resx

@ -927,4 +927,13 @@
<data name="Jump" xml:space="preserve">
<value>跳步</value>
</data>
<data name="View" xml:space="preserve">
<value>考量</value>
</data>
<data name="Delayed" xml:space="preserve">
<value>延遲</value>
</data>
<data name="Multi" xml:space="preserve">
<value>多机</value>
</data>
</root>

2
View/MachinesSet.xaml.cs

@ -37,6 +37,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
string[] ports = System.IO.Ports.SerialPort.GetPortNames();
comboBoxCOM0.ItemsSource = ports;
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM");
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
}
private SQLiteHelper SQLiteHelpers = null; //定义数据库

73
View/ProductionPlanningEdit.xaml

@ -7,15 +7,72 @@
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="900" d:DesignWidth="600">
<Grid>
<Button Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Right" Height="35" Margin="0,0,50,10" VerticalAlignment="Bottom" Width="80" Click="Button_Click"/>
d:DesignHeight="900" d:DesignWidth="550">
<Grid Background="White" Cursor="">
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,30,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" FontSize="20" IsEditable="True" BorderBrush="#FF673AB7" IsReadOnly="True" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<Button Content="{x:Static lang:Resources.Multi}" Height="35" Margin="450,30,0,0" VerticalAlignment="Top" Width="80" Click="Multi_Click" HorizontalAlignment="Left"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,80,0,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="270" FontSize="20" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxProgram_DropDownClosed"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=90}"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
GridLinesVisibility="All" ColumnHeaderHeight="40"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
Margin="0,200,0,60" >
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="25" />
<Setter Property="FontSize" Value="15" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="40" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="0" MinWidth="0" MaxWidth="0" Binding="{Binding StepID}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="200" Binding="{Binding StepName}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="*" Binding="{Binding ParameterName}" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter6}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter7}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter8}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter9}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter10}" Width="0" MinWidth="0" MaxWidth="0"/>
</DataGrid.Columns>
</DataGrid>
<Button Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Left" Height="35" Margin="450,0,0,10" VerticalAlignment="Bottom" Width="80" Click="Button_Click"/>
<Button HorizontalAlignment="Left" Height="35" Margin="0,0,50,10" VerticalAlignment="Bottom" Width="60" Click="Button_Quit" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}">
<materialDesign:PackIcon Kind="ArrowLeft" Foreground="#FF00204E" HorizontalAlignment="Center" VerticalAlignment="Center" Width="50" Height="35" />
<materialDesign:PackIcon Kind="ArrowRight" Foreground="#FF00204E" HorizontalAlignment="Center" VerticalAlignment="Center" Width="50" Height="35" />
</Button>
</Grid>
</UserControl>

35
View/ProductionPlanningEdit.xaml.cs

@ -1,5 +1,7 @@
using System;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -12,6 +14,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using TouchSocket.Core;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
namespace SunlightCentralizedControlManagement_SCCM_.View
{
@ -20,9 +24,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
/// </summary>
public partial class ProductionPlanningEdit : UserControl
{
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
DataTable ProgramName;
public ProductionPlanningEdit()
{
InitializeComponent();
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
ProgramName = SQLiteHelpers.ExecuteDataSet("select * from ProgramName order by ProgramID desc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Close(); //关闭连接
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramID")).ToList();//转换工艺代码
}
private void Multi_Click(object sender, RoutedEventArgs e)
{
}
private void Button_Click(object sender, RoutedEventArgs e)
@ -33,5 +52,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{
this.Visibility = Visibility.Collapsed;
}
private void comboBoxProgram_DropDownClosed(object sender, EventArgs e)//工艺选择事件
{
if (!string.IsNullOrEmpty(comboBoxProgram.SelectedValue.ToString()))
{
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
DataTable dat = SQLiteHelpers.ExecuteDataSet(
"select * from ProgramSteps where ProgramID='" + comboBoxProgram.SelectedValue + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Close(); //关闭连接
Grid_data.ItemsSource = dat.DefaultView;
}
}
}
}

1
View/ProductionPlanningView.xaml

@ -23,6 +23,7 @@
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Ngantt:GanttControl x:Name="GanttChart"/>
<ContentControl x:Name="Picture" HorizontalAlignment="Right" />
</Grid>
<StackPanel Grid.Row="1" Height="60" Background="#FF00204E" Orientation="Horizontal">

7
View/ProductionPlanningView.xaml.cs

@ -169,12 +169,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
}
private void ListViewItem_New(object sender, System.Windows.Input.MouseButtonEventArgs e)//新建事件
{
Picture.Width = 600;
Picture.Content = new ProductionPlanningEdit();
}
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e)
{
// Select_WorkOrderNumder.Text;

Loading…
Cancel
Save