修改工艺步骤编辑逻辑
This commit is contained in:
commit
d4918cd419
5 files changed
+111
-117
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user