Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
5739ae92dd
5 files changed
+195
-4
No files matched your search
@@ -138,6 +138,9 @@
|
|||||||
<Compile Include="Windows\InputBox.xaml.cs">
|
<Compile Include="Windows\InputBox.xaml.cs">
|
||||||
<DependentUpon>InputBox.xaml</DependentUpon>
|
<DependentUpon>InputBox.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Windows\ViewProgram.xaml.cs">
|
||||||
|
<DependentUpon>ViewProgram.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\ViewStep.xaml.cs">
|
<Compile Include="Windows\ViewStep.xaml.cs">
|
||||||
<DependentUpon>ViewStep.xaml</DependentUpon>
|
<DependentUpon>ViewStep.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -205,6 +208,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Windows\ViewProgram.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Windows\ViewStep.xaml">
|
<Page Include="Windows\ViewStep.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
xmlns:ConvertMoels="clr-namespace:DyeingComputer.ConvertMoels"
|
xmlns:ConvertMoels="clr-namespace:DyeingComputer.ConvertMoels"
|
||||||
d:DataContext="{d:DesignInstance Type=viewmodel:WorkOrderViewModel}"
|
d:DataContext="{d:DesignInstance Type=viewmodel:WorkOrderViewModel}"
|
||||||
mc:Ignorable="d" KeyDown="UserControl_KeyDown"
|
mc:Ignorable="d" KeyDown="UserControl_KeyDown"
|
||||||
|
Loaded="UserControl_Loaded"
|
||||||
d:DesignHeight="630" d:DesignWidth="1280" >
|
d:DesignHeight="630" d:DesignWidth="1280" >
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ConvertMoels:StatenConvert x:Key="StatenConvert"/>
|
<ConvertMoels:StatenConvert x:Key="StatenConvert"/>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using DyeingComputer.UserClass;
|
using DyeingComputer.UserClass;
|
||||||
using DyeingComputer.ViewModel;
|
using DyeingComputer.ViewModel;
|
||||||
|
using DyeingComputer.Windows;
|
||||||
using ScottPlot;
|
using ScottPlot;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -19,6 +20,7 @@ using System.Windows.Navigation;
|
|||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using static DyeingComputer.UserClass.SqliteHelper;
|
using static DyeingComputer.UserClass.SqliteHelper;
|
||||||
|
using static DyeingComputer.Windows.ViewProgram;
|
||||||
using static System.Collections.Specialized.BitVector32;
|
using static System.Collections.Specialized.BitVector32;
|
||||||
|
|
||||||
namespace DyeingComputer.View
|
namespace DyeingComputer.View
|
||||||
@@ -33,11 +35,23 @@ namespace DyeingComputer.View
|
|||||||
DataContext = new WorkOrderViewModel();
|
DataContext = new WorkOrderViewModel();
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Workorder_sql();
|
|
||||||
WpfPlot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Workorder_sql();
|
||||||
|
WpfPlot();
|
||||||
|
|
||||||
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
string S09 = SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S09'", null).ToString(); //读取
|
||||||
|
string S10 = SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S10'", null).ToString();
|
||||||
|
string S11 = SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S11'", null).ToString();
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
if (S09 == "0") WorkOrderView_new.IsEnabled = false;//禁止用户新建
|
||||||
|
if (S10 == "0") WorkOrderView_del.IsEnabled = false;
|
||||||
|
if (S11 == "0") WorkOrderView_redy.IsEnabled = false;
|
||||||
|
}
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
DataSet sql; //内存数据缓存
|
DataSet sql; //内存数据缓存
|
||||||
@@ -109,9 +123,18 @@ namespace DyeingComputer.View
|
|||||||
|
|
||||||
private void WorkOrderView_new_Click(object sender, RoutedEventArgs e)//新建按钮
|
private void WorkOrderView_new_Click(object sender, RoutedEventArgs e)//新建按钮
|
||||||
{
|
{
|
||||||
|
ViewProgram viewProgram = new ViewProgram();
|
||||||
|
viewProgram.AddressUpdated += new ViewProgram.AddressUpdateHandler(Address_ButtonClicked);
|
||||||
|
viewProgram.ShowDialog();
|
||||||
}
|
}
|
||||||
|
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||||
|
{
|
||||||
|
MainWindowViewModel.WorkNumder = DateTime.Now.ToString("yyMMddHHmmss");
|
||||||
|
TechnologicalProcessView.workName = e.ID;
|
||||||
|
|
||||||
|
var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;//跨页面
|
||||||
|
_mainWindow.container.Content = new TechnologicalProcessView();//获取控件
|
||||||
|
}
|
||||||
private void WorkOrderView_del_Click(object sender, RoutedEventArgs e)//删除按钮
|
private void WorkOrderView_del_Click(object sender, RoutedEventArgs e)//删除按钮
|
||||||
{
|
{
|
||||||
if (WorkOrder_Numder == null) return;
|
if (WorkOrder_Numder == null) return;
|
||||||
@@ -188,5 +211,7 @@ namespace DyeingComputer.View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<Window x:Class="DyeingComputer.Windows.ViewProgram"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:DyeingComputer.Windows"
|
||||||
|
xmlns:lang="clr-namespace:DyeingComputer.Properties"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="SUNLIGHT 800" Height="400" Width="400">
|
||||||
|
<Grid>
|
||||||
|
<DataGrid x:Name="Grid" AlternationCount="2" IsReadOnly="True" SelectionChanged="Grid_SelectionChanged"
|
||||||
|
Margin="0,0,0,50" d:ItemsSource="{d:SampleData ItemCount=20}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
||||||
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||||
|
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column"
|
||||||
|
Background="White" SelectionMode="Single" FontSize="15" >
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<Setter Property="Height" Value="30" />
|
||||||
|
<Setter Property="FontSize" Value="25" />
|
||||||
|
<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 Header="ProcessID" Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.ProcessName}" Width="330" Binding="{Binding ProgramName}" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Width="50" Binding="{Binding Step}" IsReadOnly="True"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
|
||||||
|
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using static DyeingComputer.Windows.ViewStep;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Net;
|
||||||
|
using System.Data;
|
||||||
|
using static DyeingComputer.UserClass.SqliteHelper;
|
||||||
|
|
||||||
|
namespace DyeingComputer.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ViewProgram.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ViewProgram : Window
|
||||||
|
{
|
||||||
|
public ViewProgram()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Programgroup_sql();
|
||||||
|
}
|
||||||
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
|
DataSet sql; //内存数据缓存
|
||||||
|
public void Programgroup_sql()
|
||||||
|
{
|
||||||
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
|
||||||
|
string sql_script = "select * from ProgramName order by ProgramID desc";
|
||||||
|
|
||||||
|
if (sql != null) sql.Clear(); //清空缓存
|
||||||
|
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
||||||
|
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
||||||
|
|
||||||
|
SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
|
//sql.Clear(); //清除缓存
|
||||||
|
//System.GC.Collect();
|
||||||
|
}
|
||||||
|
public delegate void AddressUpdateHandler(object sender, AddressUpdateEventArgs e);
|
||||||
|
//声明一个更新Address的事件
|
||||||
|
public event AddressUpdateHandler AddressUpdated;
|
||||||
|
|
||||||
|
private void YES_Click(object sender, RoutedEventArgs e)//确认
|
||||||
|
{
|
||||||
|
var args = new AddressUpdateEventArgs(Program_STEP, Program_ID,Program_STEP);
|
||||||
|
AddressUpdated(this, args);
|
||||||
|
this.Close(); //关闭窗口
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NO_Click(object sender, RoutedEventArgs e)//关闭
|
||||||
|
{
|
||||||
|
this.Close(); //关闭窗口
|
||||||
|
}
|
||||||
|
|
||||||
|
string Program_ID;
|
||||||
|
string Program_NAME;
|
||||||
|
string Program_STEP;
|
||||||
|
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件
|
||||||
|
{
|
||||||
|
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
Program_ID = (Grid.Columns[0].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
Program_NAME = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
Program_STEP = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AddressUpdateEventArgs : System.EventArgs
|
||||||
|
{
|
||||||
|
public AddressUpdateEventArgs(string dStep, string dID, string dNAME)
|
||||||
|
{
|
||||||
|
this.ID = dID;
|
||||||
|
this.Step = dStep;
|
||||||
|
this.NAME = dNAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Step { get; set; }
|
||||||
|
public string ID { get; set; }
|
||||||
|
public string NAME { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user