修改工艺步骤编辑逻辑
This commit is contained in:
commit
d4918cd419
5 files changed
+111
-117
No files matched your search
@@ -15,14 +15,14 @@
|
||||
<ConvertMoels:StatenConvert x:Key="StatenConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<DataGrid x:Name="GridSTEP" AlternationCount="2" IsReadOnly="True" SelectionChanged="Grid_SelectionChanged"
|
||||
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}"
|
||||
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||
CanUserAddRows="True" CanUserDeleteRows="False" HeadersVisibility ="Column"
|
||||
Background="White" SelectionMode="Single" FontSize="15" MinHeight="632" TabIndex="1" Focusable="True" >
|
||||
<DataGrid x:Name="GridSTEP" AlternationCount="2" IsReadOnly="True" SelectionChanged="Grid_SelectionChanged"
|
||||
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}"
|
||||
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||
CanUserAddRows="True" CanUserDeleteRows="False" HeadersVisibility ="Column"
|
||||
Background="White" SelectionMode="Single" FontSize="15" MinHeight="632" TabIndex="1" Focusable="True" >
|
||||
<DataGrid.Resources>
|
||||
<Style TargetType="ScrollViewer">
|
||||
<Setter Property="PanningMode" Value="VerticalOnly"/>
|
||||
|
||||
@@ -23,9 +23,7 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using static DyeingComputer.UserClass.SqliteHelper;
|
||||
using static DyeingComputer.ViewModel.MainWindowViewModel;
|
||||
using static DyeingComputer.Windows.ViewStep;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace DyeingComputer.View
|
||||
{
|
||||
@@ -251,6 +249,9 @@ namespace DyeingComputer.View
|
||||
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||
public static DataSet sql; //内存数据缓存
|
||||
string Numder = null;
|
||||
string ID = null;
|
||||
string P1 = "0", P2 = "0", P3 = "0", P4 = "0", P5 = "0";
|
||||
private void TechnologicalProcess_Import()
|
||||
{
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
@@ -260,7 +261,7 @@ namespace DyeingComputer.View
|
||||
if (sql != null) sql.Clear(); //清空缓存
|
||||
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取表写入缓存
|
||||
MainWindowViewModel.ProgramName = SQLiteHelpers.ExecuteScalar("select ProgramName from WorkOrder where ProgramID = '" + workName + "'", null).ToString();
|
||||
if (sql != null) dt_TP = sql.Tables[0]; //转换显示计划表
|
||||
if (sql != null) MainWindowViewModel.dt_TP = sql.Tables[0]; //转换显示计划表
|
||||
|
||||
SQLiteHelpers.Delete("RUN", null, null); //删除run信息
|
||||
DataTable data_t = new DataTable();
|
||||
@@ -296,11 +297,9 @@ namespace DyeingComputer.View
|
||||
}
|
||||
catch (Exception) { }
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
|
||||
// if (sql != null)
|
||||
MainWindowViewModel.dt_TP = sql.Tables[0]; //转换显示计划表
|
||||
}
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// FocusManager.SetFocusedElement(Grid, Grid);
|
||||
@@ -308,7 +307,7 @@ namespace DyeingComputer.View
|
||||
}
|
||||
private void UserControl_KeyDown(object sender, KeyEventArgs e) //键盘监控
|
||||
{
|
||||
if (errTabler.Rows.Count == 0)//无错误信息
|
||||
if (MainWindowViewModel.errTabler.Rows.Count == 0)//无错误信息
|
||||
{
|
||||
if ((MainWindowViewModel.WORK_RUN == 1) || (MainWindowViewModel.WORK_RUN == 0))//停止暂停时可以启用开始
|
||||
{
|
||||
@@ -328,7 +327,6 @@ namespace DyeingComputer.View
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)//编辑按钮
|
||||
{
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
@@ -343,51 +341,57 @@ namespace DyeingComputer.View
|
||||
{
|
||||
int n = Convert.ToInt16(ID);
|
||||
ID = null;
|
||||
DataRow dr = sql.Tables[0].Rows[n - 1];
|
||||
dr.BeginEdit();
|
||||
dr["StepID"] = e.StepID;
|
||||
dr["StepName"] = e.StepNAME;
|
||||
dr["ParameterName"] = e.PNAME;
|
||||
dr["Parameter1"] = e.P1;
|
||||
dr["Parameter2"] = e.P2;
|
||||
dr["Parameter3"] = e.P3;
|
||||
dr["Parameter4"] = e.P4;
|
||||
dr["Parameter5"] = e.P5;
|
||||
dr.EndEdit();
|
||||
|
||||
dt_TP = sql.Tables[0];
|
||||
GridSTEP.SelectedIndex = -1;
|
||||
if (e.PNAME != "")
|
||||
{
|
||||
DataRow dr = sql.Tables[0].Rows[n - 1];
|
||||
dr.BeginEdit();
|
||||
dr["StepID"] = e.StepID;
|
||||
dr["StepName"] = e.StepNAME;
|
||||
dr["ParameterName"] = e.PNAME;
|
||||
dr["Parameter1"] = e.P1;
|
||||
dr["Parameter2"] = e.P2;
|
||||
dr["Parameter3"] = e.P3;
|
||||
dr["Parameter4"] = e.P4;
|
||||
dr["Parameter5"] = e.P5;
|
||||
dr.EndEdit();
|
||||
|
||||
MainWindowViewModel.dt_TP = sql.Tables[0];
|
||||
GridSTEP.SelectedIndex = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindowViewModel.dt_TP.Rows.RemoveAt(n - 1);
|
||||
Dat();
|
||||
GridSTEP.SelectedIndex = -1;
|
||||
}
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("RUN", null, null);
|
||||
DataTable data_t = dt_TP.Clone();
|
||||
for (int i = 0; i < dt_TP.Rows.Count; i++)
|
||||
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
||||
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
|
||||
DataRow dt = dt_TP.Rows[i];//行转换
|
||||
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
||||
DataRow drT = data_t.NewRow();
|
||||
drT.ItemArray = dt.ItemArray;
|
||||
data_t.Rows.InsertAt(drT, 0);
|
||||
drT.BeginEdit(); //添加订单号
|
||||
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
|
||||
drT.EndEdit();
|
||||
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "STEP = " + n,
|
||||
"StepID="+ e.StepID + ";StepName="+ e.StepNAME+";P1="+ e.P1+
|
||||
";P2="+ e.P2+";P3="+ e.P3+";P4="+ e.P4+";P5="+ e.P5);
|
||||
User_Button = true;
|
||||
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P1=" + e.P1 +
|
||||
";P2=" + e.P2 + ";P3=" + e.P3 + ";P4=" + e.P4 + ";P5=" + e.P5);
|
||||
MainWindowViewModel.User_Button = true;
|
||||
}
|
||||
public static void Dat()//行号刷新
|
||||
{
|
||||
int a = dt_TP.Rows.Count;
|
||||
int a = MainWindowViewModel.dt_TP.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
DataRow dr = dt_TP.Rows[i];
|
||||
DataRow dr = MainWindowViewModel.dt_TP.Rows[i];
|
||||
dr.BeginEdit();
|
||||
dr["Step"] = i + 1;
|
||||
dr.EndEdit();
|
||||
@@ -396,55 +400,47 @@ namespace DyeingComputer.View
|
||||
private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除
|
||||
{
|
||||
int d = 0;
|
||||
int a = dt_TP.Rows.Count;
|
||||
int a = MainWindowViewModel.dt_TP.Rows.Count;
|
||||
|
||||
if (ID != null) { d = Convert.ToInt16(ID); } else { return; }
|
||||
dt_TP.Rows.RemoveAt(d - 1);
|
||||
|
||||
MainWindowViewModel.dt_TP.Rows.RemoveAt(d - 1);
|
||||
Dat();
|
||||
GridSTEP.SelectedIndex = -1;
|
||||
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("RUN", null, null);
|
||||
DataTable data_t = dt_TP.Clone();
|
||||
a = dt_TP.Rows.Count;
|
||||
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
||||
a = MainWindowViewModel.dt_TP.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
|
||||
DataRow dt = dt_TP.Rows[i];//行转换
|
||||
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
||||
DataRow drT = data_t.NewRow();
|
||||
drT.ItemArray = dt.ItemArray;
|
||||
data_t.Rows.InsertAt(drT, 0);
|
||||
drT.BeginEdit(); //添加订单号
|
||||
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
|
||||
drT.EndEdit();
|
||||
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Delete", "STEP = " + ID);
|
||||
User_Button = true;
|
||||
MainWindowViewModel.User_Button = true;
|
||||
}
|
||||
|
||||
private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入
|
||||
{
|
||||
int d = 0;
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
|
||||
string ProgramID = SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString();
|
||||
string ProgramNAME = SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
|
||||
|
||||
SQLiteHelpers.Close();
|
||||
|
||||
if (ID != null) { d = Convert.ToInt16(ID); } else { return; }
|
||||
DataRow dr = MainWindowViewModel.dt_TP.NewRow();//添加表数据
|
||||
dr["ProgramID"] = ProgramID;
|
||||
dr["Program"] = ProgramNAME;
|
||||
|
||||
MainWindowViewModel.dt_TP.Rows.InsertAt(dr, d - 1);
|
||||
// ID = null;
|
||||
Dat();
|
||||
@@ -459,7 +455,6 @@ namespace DyeingComputer.View
|
||||
}
|
||||
private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(ID);//插入步骤号
|
||||
MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3),
|
||||
Convert.ToDouble(P4), Convert.ToDouble(P5));
|
||||
@@ -467,11 +462,6 @@ namespace DyeingComputer.View
|
||||
";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5);
|
||||
|
||||
}//跳步
|
||||
|
||||
string Numder = null;
|
||||
string ID = null;
|
||||
string P1 = "0", P2 = "0", P3 = "0", P4 = "0", P5 = "0";
|
||||
|
||||
private void DyeingMachine_Click(object sender, RoutedEventArgs e)//染色剂
|
||||
{
|
||||
Receip.Visibility = Visibility.Collapsed;
|
||||
@@ -491,8 +481,7 @@ namespace DyeingComputer.View
|
||||
{
|
||||
Parameter_set.Visibility = Visibility.Visible;
|
||||
Receip.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
}
|
||||
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
// if (MainWindowViewModel.WORK_RUN == 2) GridSTEP.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
|
||||
|
||||
@@ -5,6 +5,7 @@ using DyeingComputer.Properties;
|
||||
using DyeingComputer.UserClass;
|
||||
using DyeingComputer.View;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NModbus;
|
||||
using NModbus.Serial;
|
||||
using OpenTK.Graphics.ES11;
|
||||
@@ -26,12 +27,15 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using TouchSocket.Sockets;
|
||||
using static DyeingComputer.UserClass.SqliteHelper;
|
||||
using static DyeingComputer.ViewModel.MainWindowViewModel;
|
||||
using static DyeingComputer.Windows.ViewStep;
|
||||
using static System.Net.WebRequestMethods;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
||||
|
||||
|
||||
@@ -87,7 +91,7 @@ namespace DyeingComputer.ViewModel
|
||||
OnPropertyChanged("IsInteractive");
|
||||
}
|
||||
}
|
||||
bool _UserButton;
|
||||
public bool _UserButton;
|
||||
public bool UserButton//步骤按钮交互选择
|
||||
{
|
||||
get => _UserButton;
|
||||
@@ -96,7 +100,7 @@ namespace DyeingComputer.ViewModel
|
||||
_UserButton = value;
|
||||
OnPropertyChanged("UserButton");
|
||||
}
|
||||
}
|
||||
}//定义的委托
|
||||
public static bool _Lock_bool;
|
||||
Visibility _Lock_bool_xml;
|
||||
public Visibility Lock_bool//锁图标
|
||||
@@ -227,11 +231,10 @@ namespace DyeingComputer.ViewModel
|
||||
UserButton = false;
|
||||
_Lock_bool = false;
|
||||
_Link_bool = false;
|
||||
|
||||
ProgramgroupView_run = new RelayCommand(
|
||||
execute:ProgramgroupView_run_ );//开始/暂停事件
|
||||
ProgramgroupView_stop = new RelayCommand(
|
||||
execute: ProgramgroupView_stop_);//结束事件
|
||||
execute: ProgramgroupView_stop_);//结束事件
|
||||
}
|
||||
|
||||
DataTable dt_con = new DataTable();
|
||||
@@ -350,7 +353,6 @@ namespace DyeingComputer.ViewModel
|
||||
|
||||
SK5 = Selet_sys("SK5");//
|
||||
}
|
||||
|
||||
private void ProgramgroupView_run_()////运行/暂停
|
||||
{
|
||||
if (WORK_RUN == 2)
|
||||
@@ -367,6 +369,7 @@ namespace DyeingComputer.ViewModel
|
||||
IsInteractive = false;
|
||||
WORK_RUN = 2;//
|
||||
SETP_runtime = true;
|
||||
TechnologicalProcess_view();
|
||||
APILog.LOGlog(WorkNumder.ToString(), "UserActions", "WORK_RUN = RUN", WORK_RUN.ToString());
|
||||
}
|
||||
else
|
||||
@@ -399,7 +402,6 @@ namespace DyeingComputer.ViewModel
|
||||
WorkNumder = "----------";
|
||||
}
|
||||
}
|
||||
|
||||
public void CountDown()
|
||||
{
|
||||
//设置定时器
|
||||
@@ -418,14 +420,13 @@ namespace DyeingComputer.ViewModel
|
||||
Work_Numder = WorkNumder.ToString();
|
||||
StatusStr = Status_Str;
|
||||
Program_Name = ProgramName;
|
||||
if(dt_TP==null) Process_step = dt_TP.Select("Step=" + RUN_STEPID).First().Field<string>("ParameterName");
|
||||
if (set_) { set_ = false;SYS_SET(); }//设置更新
|
||||
if (dt_TP == null) Process_step = dt_TP.Select("Step=" + RUN_STEPID).First().Field<string>("ParameterName");
|
||||
if (set_) { set_ = false; SYS_SET(); }//设置更新
|
||||
if (!SETP_runtime) DIDETime++;
|
||||
|
||||
STEP_RUN();
|
||||
LOG_view();
|
||||
IO_view();
|
||||
TechnologicalProcess_view();
|
||||
|
||||
if (errTabler.Rows.Count != 0)
|
||||
{
|
||||
@@ -435,8 +436,7 @@ namespace DyeingComputer.ViewModel
|
||||
Status_Str_coloer = Status_red;
|
||||
}
|
||||
else { Status_Str_coloer = Status_Black; }
|
||||
|
||||
Updata_dtd("3001", Alert_red);
|
||||
Updata_dtd("3001", Alert_red);
|
||||
Updata_dtd("3003", Alert_yellow);
|
||||
Updata_dtd("3004", Alert_bell);
|
||||
|
||||
@@ -467,9 +467,9 @@ namespace DyeingComputer.ViewModel
|
||||
uint TX_t;
|
||||
void Tick_Event_5S()//Tick_Event周期执行事件5S
|
||||
{
|
||||
if (TX_t != TX) { _Link_bool = true; TX_t = TX; } else { _Link_bool = false; TX_t = TX; } //中央连接状态判断
|
||||
|
||||
if (TX_t != TX) { _Link_bool = true; TX_t = TX; } else { _Link_bool = false; TX_t = TX; } //中央连接状态判断
|
||||
if(WORK_RUN !=0) Chart();//写入记录
|
||||
if(!UserButton) TechnologicalProcess_view();
|
||||
|
||||
if ((Selet_dtm("1025") > 0) && (Selet_dtd("3021") || Selet_dtd("3022")))
|
||||
{
|
||||
@@ -570,12 +570,14 @@ namespace DyeingComputer.ViewModel
|
||||
}
|
||||
void DisTimer_500MS(object sender, EventArgs e)//Tick_Event周期执行事件200MS
|
||||
{
|
||||
if (User_Button) TechnologicalProcess_view();
|
||||
IOm_DATA();
|
||||
|
||||
timer1s_++;
|
||||
timer5s_++;
|
||||
|
||||
if (timer1s_ >= 2) { timer1s_ =0; Tick_Event_1S(); }
|
||||
if (timer5s_ >=10) { timer5s_ = 0; Tick_Event_5S(); }
|
||||
|
||||
if (LINK_OK) IO_data();
|
||||
}
|
||||
|
||||
@@ -1837,7 +1839,7 @@ namespace DyeingComputer.ViewModel
|
||||
|
||||
dt_d.RowChanged += new DataRowChangeEventHandler(ROW_changed_D);//添加行改变触发事件
|
||||
dt_a.RowChanged += new DataRowChangeEventHandler(ROW_changed_A);
|
||||
|
||||
|
||||
//创建dt_d主建
|
||||
DataColumn[] dt_dcols =new DataColumn[] { dt_d.Columns["ID"] };
|
||||
dt_d.PrimaryKey = dt_dcols;
|
||||
@@ -1848,18 +1850,20 @@ namespace DyeingComputer.ViewModel
|
||||
DataColumn[] dt_mcols = new DataColumn[] { dt_m.Columns["ID"] };
|
||||
dt_m.PrimaryKey = dt_mcols;
|
||||
}
|
||||
private async void IO_data()//刷新
|
||||
private void IOm_DATA()
|
||||
{
|
||||
Updata_dtm("1001", LINK_RUN);
|
||||
Updata_dtm("1002", LINK_ERR);
|
||||
Updata_dtm("1010", (Convert.ToDouble(Selet_dta("4001")) + MT33)/10);
|
||||
Updata_dtm("1010", (Convert.ToDouble(Selet_dta("4001")) + MT33) / 10);
|
||||
Updata_dtm("1006", Selet_dta("4006"));
|
||||
Updata_dtm("1015", Selet_dta("4007"));
|
||||
Updata_dtm("1016", Selet_dta("4006") * MT16);
|
||||
Updata_dtm("1012", (Convert.ToDouble(Selet_dta("4003")) + MS01) / 10);
|
||||
Updata_dtm("1013", (Convert.ToDouble(Selet_dta("4004")) + MS02) / 10);
|
||||
Updata_dtm("1014", (Convert.ToDouble(Selet_dta("4005")) + MS03) / 10);
|
||||
|
||||
}
|
||||
private async void IO_data()//刷新
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
for (ushort i = 0; i < DO_L; i++) { Upplc_dtd((i + 2001).ToString(), DO[i]); }
|
||||
@@ -1872,49 +1876,39 @@ namespace DyeingComputer.ViewModel
|
||||
public static object D_view=true;
|
||||
public static object A_view=true;
|
||||
public static bool User_Button = false;
|
||||
public async void IO_view()//IO显示
|
||||
public void IO_view()//IO显示
|
||||
{
|
||||
if (ViewID == 5)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
SYSData_M = ToObservableCollection<DATA_M>(dt_m);
|
||||
}
|
||||
catch (Exception ) { }
|
||||
|
||||
try
|
||||
{
|
||||
if ((bool)A_view) SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
||||
}
|
||||
catch (Exception ) { }
|
||||
|
||||
try
|
||||
{
|
||||
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
||||
}
|
||||
catch (Exception ) { }
|
||||
|
||||
});
|
||||
SYSData_M = ToObservableCollection<DATA_M>(dt_m);
|
||||
}
|
||||
catch (Exception) { }
|
||||
try
|
||||
{
|
||||
if ((bool)A_view) SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
||||
}
|
||||
catch (Exception) { }
|
||||
try
|
||||
{
|
||||
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
public async void TechnologicalProcess_view()//显示
|
||||
public void TechnologicalProcess_view()//显示
|
||||
{
|
||||
if (ViewID == 1 && (!UserButton|| User_Button))
|
||||
if (ViewID == 1)
|
||||
{
|
||||
User_Button = false;
|
||||
await Task.Run(() =>
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
TechnologicalProcess_View = ToObservableCollection<TechnologicalProcess>(dt_TP);
|
||||
|
||||
}
|
||||
catch (Exception) { }
|
||||
});
|
||||
TechnologicalProcess_View = ToObservableCollection<TechnologicalProcess>(dt_TP);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void ROW_changed_D(object sender, DataRowChangeEventArgs e)//开关量改变事件
|
||||
{
|
||||
try
|
||||
@@ -2073,7 +2067,7 @@ namespace DyeingComputer.ViewModel
|
||||
DataRow[] arrRows = dt_d.Select("PLC=" + key);
|
||||
foreach (DataRow row in arrRows)
|
||||
{
|
||||
row["DIO"] = Value;
|
||||
if ((bool)row["DIO"] != Value) row["DIO"] = Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2091,7 +2085,7 @@ namespace DyeingComputer.ViewModel
|
||||
DataRow[] arrRows = dt_a.Select("PLC=" + key);
|
||||
foreach (DataRow row in arrRows)
|
||||
{
|
||||
row["AIO"] = Value;
|
||||
if ((int)row["AIO"] != Value) row["AIO"] = Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2277,4 +2271,5 @@ namespace DyeingComputer.ViewModel
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
<Grid FocusManager.FocusedElement="{Binding ElementName=box}">
|
||||
<TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30" Margin="10,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.Function}" HorizontalAlignment="Left" Height="30" Margin="10,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
|
||||
<ComboBox x:Name="boxID" HorizontalAlignment="Right" Height="30" Margin="0,60,10,0" VerticalAlignment="Top" Width="230" FontSize="20" Text="12345125" SelectionChanged="BoxID_SelectionChanged"/>
|
||||
<ComboBox x:Name="boxID" HorizontalAlignment="Right" Height="30" Margin="0,60,10,0" VerticalAlignment="Top" Width="230" FontSize="20" SelectionChanged="BoxID_SelectionChanged"/>
|
||||
<TextBox x:Name="boxNAME" HorizontalAlignment="Right" Height="30" Margin="0,20,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
||||
TextChanged="TextBox_TextChanged" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"/>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,12 +12,13 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Forms;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Xml.Linq;
|
||||
using TouchSocket.Core;
|
||||
|
||||
namespace DyeingComputer.Windows
|
||||
{
|
||||
@@ -176,7 +178,13 @@ namespace DyeingComputer.Windows
|
||||
|
||||
private void YES_Click(object sender, RoutedEventArgs e)//确认
|
||||
{
|
||||
if (boxNAME.Text == null) return;
|
||||
if (string.IsNullOrEmpty(boxID.Text))
|
||||
{
|
||||
var args1 = new AddressUpdateEventArgs(data, "", "", "", "0", "0", "0", "0", "0");
|
||||
AddressUpdated(this, args1);
|
||||
this.Close(); //关闭窗口
|
||||
return;
|
||||
}
|
||||
string name = " ";
|
||||
if (P1N.Visibility == Visibility.Visible) name = P1N.Text +":["+P1.Text+"]";
|
||||
if (P2N.Visibility == Visibility.Visible) name += P2N.Text + ":[" + P2.Text + "]";
|
||||
@@ -191,6 +199,8 @@ namespace DyeingComputer.Windows
|
||||
|
||||
private void NO_Click(object sender, RoutedEventArgs e)//关闭
|
||||
{
|
||||
var args = new AddressUpdateEventArgs(data, "", "", "","0","0", "0", "0", "0");
|
||||
AddressUpdated(this, args);
|
||||
this.Close(); //关闭窗口
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user