Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
37516e883e
4 files changed
+66
-20
No files matched your search
+15
-15
@@ -217,19 +217,22 @@ namespace DyeingComputer.UserClass
|
|||||||
/**编辑行信息**/
|
/**编辑行信息**/
|
||||||
DataRow drtt = TechnologicalProcessView.sql.Tables[0].Rows[d - 1];
|
DataRow drtt = TechnologicalProcessView.sql.Tables[0].Rows[d - 1];
|
||||||
drtt.BeginEdit();
|
drtt.BeginEdit();
|
||||||
drtt["StepID"] = dat_821.GetValue("STEPID").ToString();
|
drtt["StepID"] = dat_821.GetValue("StepID").ToString();
|
||||||
drtt["StepName"] = dat_821.GetValue("STEPNAME").ToString();
|
drtt["StepName"] = dat_821.GetValue("StepName").ToString();
|
||||||
drtt["ParameterName"] = dat_821.GetValue("PNAME").ToString();
|
drtt["ParameterName"] = dat_821.GetValue("ParameterName").ToString();
|
||||||
drtt["Parameter1"] = dat_821.GetValue("P1").ToString();
|
drtt["Parameter1"] = dat_821.GetValue("Parameter1").ToString();
|
||||||
drtt["Parameter2"] = dat_821.GetValue("P2").ToString();
|
drtt["Parameter2"] = dat_821.GetValue("Parameter2").ToString();
|
||||||
drtt["Parameter3"] = dat_821.GetValue("P3").ToString();
|
drtt["Parameter3"] = dat_821.GetValue("Parameter3").ToString();
|
||||||
drtt["Parameter4"] = dat_821.GetValue("P4").ToString();
|
drtt["Parameter4"] = dat_821.GetValue("Parameter4").ToString();
|
||||||
drtt["Parameter5"] = dat_821.GetValue("P5").ToString();
|
drtt["Parameter5"] = dat_821.GetValue("Parameter5").ToString();
|
||||||
|
|
||||||
|
drtt["RUN"] = "0";
|
||||||
|
drtt["DYELOT"] = MainWindowViewModel.WorkNumder;
|
||||||
drtt.EndEdit();
|
drtt.EndEdit();
|
||||||
|
|
||||||
var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面
|
// var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面
|
||||||
_TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView;
|
// _TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView;
|
||||||
_TechnologicalProcessView.Grid.SelectedIndex = -1;
|
//_TechnologicalProcessView.Grid.SelectedIndex = -1;
|
||||||
/**存入信息**/
|
/**存入信息**/
|
||||||
TechnologicalProcessView.SQLiteHelpers.Delete("RUN", null, null);
|
TechnologicalProcessView.SQLiteHelpers.Delete("RUN", null, null);
|
||||||
DataTable data_t = new DataTable();
|
DataTable data_t = new DataTable();
|
||||||
@@ -244,9 +247,6 @@ namespace DyeingComputer.UserClass
|
|||||||
DataRow drT = data_t.NewRow();
|
DataRow drT = data_t.NewRow();
|
||||||
drT.ItemArray = dt.ItemArray;
|
drT.ItemArray = dt.ItemArray;
|
||||||
data_t.Rows.InsertAt(drT, 0);
|
data_t.Rows.InsertAt(drT, 0);
|
||||||
drT.BeginEdit(); //添加订单号
|
|
||||||
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
|
|
||||||
drT.EndEdit();
|
|
||||||
|
|
||||||
TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||||
}
|
}
|
||||||
@@ -349,7 +349,7 @@ namespace DyeingComputer.UserClass
|
|||||||
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
||||||
{
|
{
|
||||||
|
|
||||||
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" +TechnologicalProcessView.sql.Tables[0].ToJsonString());
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" +MainWindowViewModel.dt_TP.ToJsonString());
|
||||||
}
|
}
|
||||||
else { client.SendAsync("SC999"); }
|
else { client.SendAsync("SC999"); }
|
||||||
}//当前工作表
|
}//当前工作表
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
d:DesignHeight="630" d:DesignWidth="1280">
|
d:DesignHeight="630" d:DesignWidth="1280">
|
||||||
<Grid Focusable="True">
|
<Grid Focusable="True">
|
||||||
<DataGrid x:Name="Grid" AlternationCount="2" IsReadOnly="True" SelectionChanged="Grid_SelectionChanged"
|
<DataGrid x:Name="Grid" AlternationCount="2" IsReadOnly="True" SelectionChanged="Grid_SelectionChanged"
|
||||||
Margin="630,40,0,0" d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
|
Margin="630,40,0,0" d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
|
ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="{x:Null}"
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="{x:Null}"
|
||||||
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
||||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using DyeingComputer.Windows;
|
|||||||
using ScottPlot;
|
using ScottPlot;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -20,7 +22,9 @@ using System.Windows.Navigation;
|
|||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using static DyeingComputer.UserClass.SqliteHelper;
|
using static DyeingComputer.UserClass.SqliteHelper;
|
||||||
|
using static DyeingComputer.ViewModel.MainWindowViewModel;
|
||||||
using static DyeingComputer.Windows.ViewStep;
|
using static DyeingComputer.Windows.ViewStep;
|
||||||
|
using static System.Net.WebRequestMethods;
|
||||||
|
|
||||||
namespace DyeingComputer.View
|
namespace DyeingComputer.View
|
||||||
{
|
{
|
||||||
@@ -49,7 +53,6 @@ namespace DyeingComputer.View
|
|||||||
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
public static DataSet sql; //内存数据缓存
|
public static DataSet sql; //内存数据缓存
|
||||||
|
|
||||||
private void TechnologicalProcess_Import()
|
private void TechnologicalProcess_Import()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
@@ -98,7 +101,7 @@ namespace DyeingComputer.View
|
|||||||
|
|
||||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// FocusManager.SetFocusedElement(Grid, Grid);
|
// FocusManager.SetFocusedElement(Grid, Grid);
|
||||||
// Grid.DataContext = new MainWindowViewModel();
|
// Grid.DataContext = new MainWindowViewModel();
|
||||||
if (workName != null)
|
if (workName != null)
|
||||||
{
|
{
|
||||||
@@ -300,7 +303,7 @@ namespace DyeingComputer.View
|
|||||||
{
|
{
|
||||||
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
||||||
{
|
{
|
||||||
Interval = TimeSpan.FromSeconds(1)//秒
|
Interval = TimeSpan.FromSeconds(3)//秒
|
||||||
};
|
};
|
||||||
timer1s.Tick += Tick_Event_1S;
|
timer1s.Tick += Tick_Event_1S;
|
||||||
timer1s.Start();
|
timer1s.Start();
|
||||||
@@ -310,7 +313,12 @@ namespace DyeingComputer.View
|
|||||||
if (MainWindowViewModel.WORK_RUN == 2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
|
if (MainWindowViewModel.WORK_RUN == 2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
|
||||||
if (sql != null)
|
if (sql != null)
|
||||||
{
|
{
|
||||||
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
// sqlDefaultView = sql.Tables[0].DefaultView;
|
||||||
|
// Grid.ItemsSource = null;
|
||||||
|
dt_TP= sql.Tables[0];
|
||||||
|
// MainWindowViewModel.TechnologicalProcess_View = MainWindowViewModel.ToObservableCollection<TechnologicalProcess>(sql.Tables[0]);
|
||||||
|
|
||||||
|
// Grid.ItemsSource = dt_m.DE sql.Tables[0].DefaultView; //转换显示计划表
|
||||||
name.Text = Program_Name;
|
name.Text = Program_Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1563,6 +1563,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
public static DataTable dt_d = new DataTable("DIO");
|
public static DataTable dt_d = new DataTable("DIO");
|
||||||
public static DataTable dt_a = new DataTable("AIO");
|
public static DataTable dt_a = new DataTable("AIO");
|
||||||
public static DataTable dt_m = new DataTable("M");
|
public static DataTable dt_m = new DataTable("M");
|
||||||
|
public static DataTable dt_TP = new DataTable();
|
||||||
public static void SQL_data()//获得io表
|
public static void SQL_data()//获得io表
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
@@ -1625,6 +1626,12 @@ namespace DyeingComputer.ViewModel
|
|||||||
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
||||||
}
|
}
|
||||||
catch (Exception ex) { Name_err = "IO_SYSData_D" + "(" + ex.Message + ")"; }
|
catch (Exception ex) { Name_err = "IO_SYSData_D" + "(" + ex.Message + ")"; }
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TechnologicalProcess_View = ToObservableCollection<TechnologicalProcess>(dt_TP);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public static double Selet_dtm(string key)//M寄存器
|
public static double Selet_dtm(string key)//M寄存器
|
||||||
@@ -1822,6 +1829,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
ObservableCollection<DATA_A> sysData_A = new ObservableCollection<DATA_A>();
|
ObservableCollection<DATA_A> sysData_A = new ObservableCollection<DATA_A>();
|
||||||
ObservableCollection<DATA_D> sysData_D = new ObservableCollection<DATA_D>();
|
ObservableCollection<DATA_D> sysData_D = new ObservableCollection<DATA_D>();
|
||||||
ObservableCollection<DATA_M> sysData_M = new ObservableCollection<DATA_M>();
|
ObservableCollection<DATA_M> sysData_M = new ObservableCollection<DATA_M>();
|
||||||
|
ObservableCollection<TechnologicalProcess> technologicalProcess_View = new ObservableCollection<TechnologicalProcess>();
|
||||||
public ObservableCollection<DATA_A> SYSData_A
|
public ObservableCollection<DATA_A> SYSData_A
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1852,6 +1860,16 @@ namespace DyeingComputer.ViewModel
|
|||||||
RaisePropertyChanged("SYSData_M");
|
RaisePropertyChanged("SYSData_M");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public ObservableCollection<TechnologicalProcess> TechnologicalProcess_View
|
||||||
|
{
|
||||||
|
|
||||||
|
get { return technologicalProcess_View; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
technologicalProcess_View = value;
|
||||||
|
RaisePropertyChanged("TechnologicalProcess_View");
|
||||||
|
}
|
||||||
|
}
|
||||||
public class DATA_A
|
public class DATA_A
|
||||||
{
|
{
|
||||||
public string IOName { get; set; }
|
public string IOName { get; set; }
|
||||||
@@ -1876,6 +1894,25 @@ namespace DyeingComputer.ViewModel
|
|||||||
public string PLC { get; set; }
|
public string PLC { get; set; }
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
}
|
}
|
||||||
|
public class TechnologicalProcess
|
||||||
|
{
|
||||||
|
public string Program { get; set; }
|
||||||
|
public double Step { get; set; }
|
||||||
|
public string StepID { get; set; }
|
||||||
|
public string StepName { get; set; }
|
||||||
|
public string ParameterName { get; set; }
|
||||||
|
public string Parameter1 { get; set; }
|
||||||
|
public string Parameter2 { get; set; }
|
||||||
|
public string Parameter3 { get; set; }
|
||||||
|
public string Parameter4 { get; set; }
|
||||||
|
public string Parameter5 { get; set; }
|
||||||
|
public string Parameter6 { get; set; }
|
||||||
|
public string Parameter7 { get; set; }
|
||||||
|
public string Parameter8 { get; set; }
|
||||||
|
public string Parameter9 { get; set; }
|
||||||
|
public string Parameter10 { get; set; }
|
||||||
|
public string DYELOT { get; set; }
|
||||||
|
}
|
||||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||||
{
|
{
|
||||||
Type t = typeof(T);
|
Type t = typeof(T);
|
||||||
|
|||||||
Reference in new issue
Block a user