寄存器更新逻辑修改
This commit is contained in:
commit
1a9a4fea62
1 file changed
+140
-171
+140
-171
@@ -73,6 +73,103 @@ namespace DyeingComputer.ViewModel
|
||||
public static string SYSKEY;
|
||||
public static UInt32 RX = 0;
|
||||
public static UInt32 TX = 0;
|
||||
public ICommand ProgramgroupView_stop { get; }
|
||||
bool _isInteractive;
|
||||
public bool IsInteractive//步骤表交互选择
|
||||
{
|
||||
get => _isInteractive;
|
||||
set
|
||||
{
|
||||
_isInteractive = value;
|
||||
OnPropertyChanged("IsInteractive");
|
||||
}
|
||||
}
|
||||
bool _UserButton;
|
||||
public bool UserButton//步骤按钮交互选择
|
||||
{
|
||||
get => _UserButton;
|
||||
set
|
||||
{
|
||||
_UserButton = value;
|
||||
OnPropertyChanged("UserButton");
|
||||
}
|
||||
}
|
||||
public static bool _Lock_bool;
|
||||
Visibility _Lock_bool_xml;
|
||||
public Visibility Lock_bool//锁图标
|
||||
{
|
||||
get => _Lock_bool_xml;
|
||||
set
|
||||
{
|
||||
_Lock_bool_xml = value;
|
||||
OnPropertyChanged("Lock_bool");
|
||||
}
|
||||
}
|
||||
bool _Link_bool;
|
||||
Visibility _Link_bool_xml;
|
||||
public Visibility Link_bool//连接图标
|
||||
{
|
||||
get => _Link_bool_xml;
|
||||
set
|
||||
{
|
||||
_Link_bool_xml = value;
|
||||
OnPropertyChanged("Link_bool");
|
||||
}
|
||||
}
|
||||
public string work_Temp; //显示温度
|
||||
public string Work_Temp //通知UI控件参数改变
|
||||
{
|
||||
get { return work_Temp; }
|
||||
set { work_Temp = value; OnPropertyChanged("Work_Temp"); }
|
||||
}
|
||||
public string work_Numder; //显示工单号
|
||||
public string Work_Numder //通知UI控件参数改变
|
||||
{
|
||||
get { return work_Numder; }
|
||||
set { work_Numder = value; OnPropertyChanged("Work_Numder"); }
|
||||
}
|
||||
public string status_Str = "-"; //显示状态
|
||||
public string Status_Str //通知UI控件参数改变
|
||||
{
|
||||
get { return status_Str; }
|
||||
set { status_Str = value; OnPropertyChanged("Status_Str"); }
|
||||
}
|
||||
public string sys_Time; //显示系统时间
|
||||
public string Sys_Time //通知UI控件参数改变
|
||||
{
|
||||
get { return sys_Time; }
|
||||
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
|
||||
}
|
||||
public int sys_workSTEPID; //
|
||||
public int Sys_workSTEPID //通知UI控件参数改变
|
||||
{
|
||||
get { return sys_workSTEPID; }
|
||||
set { sys_workSTEPID = value; OnPropertyChanged("Sys_workSTEPID"); }
|
||||
}
|
||||
public string sys_log; //
|
||||
public string Sys_log //通知UI控件参数改变
|
||||
{
|
||||
get { return sys_log; }
|
||||
set { sys_log = value; OnPropertyChanged("Sys_log"); }
|
||||
}
|
||||
public string program_Name;
|
||||
public string Program_Name //通知UI控件参数改变
|
||||
{
|
||||
get { return program_Name; }
|
||||
set { program_Name = value; OnPropertyChanged("Program_Name"); }
|
||||
}
|
||||
public static int ViewID = 0;//页面id
|
||||
|
||||
public static object Name_err = "";
|
||||
public static object SYSTime = "-----";
|
||||
public static object WorkNumder = "-----";
|
||||
public static object StatusStr = "-----";
|
||||
public static object Process_step = "-----";
|
||||
public static string ProgramName = "-----";//工艺名
|
||||
public static Int32 DIDETime; //空闲计时器
|
||||
bool ERR_JOG;//故障状态
|
||||
private int timer1s_ = 0;
|
||||
private int timer5s_ = 0;
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
SYSKEY = MD5check.MD5Encrypt16(HardwareSN.GetCPUSerialNumber()+HardwareSN.GetBIOSSerialNumber());
|
||||
@@ -90,9 +187,7 @@ namespace DyeingComputer.ViewModel
|
||||
if (messageBoxResult == MessageBoxResult.Yes)
|
||||
{
|
||||
DataRow drEmployee = dt_TP.Select("RUN=1").First();
|
||||
|
||||
RUN_STEPID = drEmployee.Field<int>("Step");
|
||||
|
||||
STEP_START(drEmployee.Field<string>("StepID"),
|
||||
drEmployee.Field<double>("Parameter1"),
|
||||
drEmployee.Field<double>("Parameter2"),
|
||||
@@ -100,6 +195,8 @@ namespace DyeingComputer.ViewModel
|
||||
drEmployee.Field<double>("Parameter4"),
|
||||
drEmployee.Field<double>("Parameter5")
|
||||
);
|
||||
|
||||
WORK_RUN = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -292,103 +389,7 @@ namespace DyeingComputer.ViewModel
|
||||
WorkNumder = "----------";
|
||||
}
|
||||
}
|
||||
public ICommand ProgramgroupView_stop { get; }
|
||||
bool _isInteractive;
|
||||
public bool IsInteractive//步骤表交互选择
|
||||
{
|
||||
get => _isInteractive;
|
||||
set
|
||||
{
|
||||
_isInteractive = value;
|
||||
OnPropertyChanged("IsInteractive");
|
||||
}
|
||||
}
|
||||
bool _UserButton;
|
||||
public bool UserButton//步骤按钮交互选择
|
||||
{
|
||||
get => _UserButton;
|
||||
set
|
||||
{
|
||||
_UserButton = value;
|
||||
OnPropertyChanged("UserButton");
|
||||
}
|
||||
}
|
||||
public static bool _Lock_bool;
|
||||
Visibility _Lock_bool_xml;
|
||||
public Visibility Lock_bool//锁图标
|
||||
{
|
||||
get => _Lock_bool_xml;
|
||||
set
|
||||
{
|
||||
_Lock_bool_xml = value;
|
||||
OnPropertyChanged("Lock_bool");
|
||||
}
|
||||
}
|
||||
bool _Link_bool;
|
||||
Visibility _Link_bool_xml;
|
||||
public Visibility Link_bool//连接图标
|
||||
{
|
||||
get => _Link_bool_xml;
|
||||
set
|
||||
{
|
||||
_Link_bool_xml = value;
|
||||
OnPropertyChanged("Link_bool");
|
||||
}
|
||||
}
|
||||
public string work_Temp; //显示温度
|
||||
public string Work_Temp //通知UI控件参数改变
|
||||
{
|
||||
get { return work_Temp; }
|
||||
set { work_Temp = value; OnPropertyChanged("Work_Temp"); }
|
||||
}
|
||||
public string work_Numder; //显示工单号
|
||||
public string Work_Numder //通知UI控件参数改变
|
||||
{
|
||||
get { return work_Numder; }
|
||||
set { work_Numder = value; OnPropertyChanged("Work_Numder"); }
|
||||
}
|
||||
public string status_Str ="-"; //显示状态
|
||||
public string Status_Str //通知UI控件参数改变
|
||||
{
|
||||
get { return status_Str; }
|
||||
set { status_Str = value; OnPropertyChanged("Status_Str"); }
|
||||
}
|
||||
public string sys_Time; //显示系统时间
|
||||
public string Sys_Time //通知UI控件参数改变
|
||||
{
|
||||
get { return sys_Time; }
|
||||
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
|
||||
}
|
||||
public int sys_workSTEPID; //
|
||||
public int Sys_workSTEPID //通知UI控件参数改变
|
||||
{
|
||||
get { return sys_workSTEPID; }
|
||||
set { sys_workSTEPID = value; OnPropertyChanged("Sys_workSTEPID"); }
|
||||
}
|
||||
public string sys_log; //
|
||||
public string Sys_log //通知UI控件参数改变
|
||||
{
|
||||
get { return sys_log; }
|
||||
set { sys_log = value; OnPropertyChanged("Sys_log"); }
|
||||
}
|
||||
public string program_Name;
|
||||
public string Program_Name //通知UI控件参数改变
|
||||
{
|
||||
get { return program_Name; }
|
||||
set { program_Name = value; OnPropertyChanged("Program_Name"); }
|
||||
}
|
||||
public static int ViewID = 0;//页面id
|
||||
|
||||
public static object Name_err = "";
|
||||
public static object SYSTime = "-----";
|
||||
public static object WorkNumder ="-----";
|
||||
public static object StatusStr = "-----";
|
||||
public static object Process_step = "-----";
|
||||
public static string ProgramName = "-----";//工艺名
|
||||
public static Int32 DIDETime; //空闲计时器
|
||||
bool ERR_JOG;//故障状态
|
||||
private int timer1s_ = 0;
|
||||
private int timer5s_ = 0;
|
||||
public void CountDown()
|
||||
{
|
||||
//设置定时器
|
||||
@@ -784,11 +785,9 @@ namespace DyeingComputer.ViewModel
|
||||
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
|
||||
updata_RUN.Clear();
|
||||
updata_RUN.Add("RUN", 0);
|
||||
SQLiteHelpers.Update("RUN", updata_RUN, "RUN ='1'", null);//更新
|
||||
|
||||
updata_RUN.Clear();
|
||||
updata_RUN.Add("RUN", 1);
|
||||
SQLiteHelpers.Update("RUN", updata_RUN, "Step ='"+ RUN_STEPID + "'", null);//更新
|
||||
@@ -930,43 +929,31 @@ namespace DyeingComputer.ViewModel
|
||||
case "007":
|
||||
if (STEP_P1.ToString() == "1")
|
||||
{
|
||||
Updata_dtd("3012", true);
|
||||
Updata_dtd("3013", false);
|
||||
Updata_dtd("3014", false);
|
||||
Updata_dtd("3015", false);
|
||||
Updata_dtd("3013", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "1";
|
||||
}
|
||||
else if (STEP_P1.ToString() == "2")
|
||||
{
|
||||
Updata_dtd("3012", false);
|
||||
Updata_dtd("3013", true);
|
||||
Updata_dtd("3014", false);
|
||||
Updata_dtd("3015", false);
|
||||
Updata_dtd("3014", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "2";
|
||||
}
|
||||
else if (STEP_P1.ToString() == "3")
|
||||
{
|
||||
Updata_dtd("3012", false);
|
||||
Updata_dtd("3013", false);
|
||||
Updata_dtd("3014", true);
|
||||
Updata_dtd("3015", false);
|
||||
Updata_dtd("3015", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "3";
|
||||
}
|
||||
else if (STEP_P1.ToString() == "4")
|
||||
{
|
||||
Updata_dtd("3012", false);
|
||||
Updata_dtd("3013", false);
|
||||
Updata_dtd("3014", false);
|
||||
Updata_dtd("3015", true);
|
||||
Updata_dtd("3016", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "4";
|
||||
}
|
||||
|
||||
if (Selet_dtm("1015") >= STEP_P2) //到达水位
|
||||
{
|
||||
Updata_dtd("3012", false);
|
||||
Updata_dtd("3013", false);
|
||||
Updata_dtd("3014", false);
|
||||
Updata_dtd("3015", false);
|
||||
Updata_dtd("3016", false);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.Finish;
|
||||
STEP_finish = true;
|
||||
}
|
||||
@@ -974,44 +961,32 @@ namespace DyeingComputer.ViewModel
|
||||
case "008":
|
||||
if (STEP_P1.ToString() == "1")
|
||||
{
|
||||
Updata_dtd("3012", true);
|
||||
Updata_dtd("3013", false);
|
||||
Updata_dtd("3014", false);
|
||||
Updata_dtd("3015", false);
|
||||
Updata_dtd("3013", true);
|
||||
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "1";
|
||||
}
|
||||
else if (STEP_P1.ToString() == "2")
|
||||
{
|
||||
Updata_dtd("3012", false);
|
||||
Updata_dtd("3013", true);
|
||||
Updata_dtd("3014", false);
|
||||
Updata_dtd("3015", false);
|
||||
Updata_dtd("3014", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "2";
|
||||
}
|
||||
else if (STEP_P1.ToString() == "3")
|
||||
{
|
||||
Updata_dtd("3012", false);
|
||||
Updata_dtd("3013", false);
|
||||
Updata_dtd("3014", true);
|
||||
Updata_dtd("3015", false);
|
||||
Updata_dtd("3015", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "3";
|
||||
}
|
||||
else if (STEP_P1.ToString() == "4")
|
||||
{
|
||||
Updata_dtd("3012", false);
|
||||
Updata_dtd("3013", false);
|
||||
Updata_dtd("3014", false);
|
||||
Updata_dtd("3015", true);
|
||||
Updata_dtd("3016", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "4";
|
||||
}
|
||||
|
||||
if (Selet_dtm("1016") >= STEP_P2) //到达水量
|
||||
{
|
||||
Updata_dtd("3012", false);
|
||||
Updata_dtd("3013", false);
|
||||
Updata_dtd("3014", false);
|
||||
Updata_dtd("3015", false);
|
||||
Updata_dtd("3016", false);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.Finish;
|
||||
STEP_finish = true;
|
||||
}
|
||||
@@ -1028,24 +1003,18 @@ namespace DyeingComputer.ViewModel
|
||||
case "020":
|
||||
if (STEP_P1.ToString() == "1")
|
||||
{
|
||||
Updata_dtd("3016", true);
|
||||
Updata_dtd("3017", false);
|
||||
Updata_dtd("3018", false);
|
||||
Updata_dtd("3017", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "1";
|
||||
|
||||
}
|
||||
else if (STEP_P1.ToString() == "2")
|
||||
{
|
||||
Updata_dtd("3016", false);
|
||||
Updata_dtd("3017", true);
|
||||
Updata_dtd("3018", false);
|
||||
Updata_dtd("3018", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "2";
|
||||
}
|
||||
else if (STEP_P1.ToString() == "3")
|
||||
{
|
||||
Updata_dtd("3016", false);
|
||||
Updata_dtd("3017", false);
|
||||
Updata_dtd("3018", true);
|
||||
Updata_dtd("3019", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3";
|
||||
}
|
||||
|
||||
@@ -1053,9 +1022,9 @@ namespace DyeingComputer.ViewModel
|
||||
{
|
||||
if (STEP_TIME <= 0)//排水延时
|
||||
{
|
||||
Updata_dtd("3016", false);
|
||||
Updata_dtd("3017", false);
|
||||
Updata_dtd("3018", false);
|
||||
Updata_dtd("3019", false);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Finish;
|
||||
STEP_finish = true;
|
||||
}
|
||||
@@ -1069,36 +1038,30 @@ namespace DyeingComputer.ViewModel
|
||||
case "022":
|
||||
if (STEP_P1.ToString() == "1")
|
||||
{
|
||||
Updata_dtd("3016", true);
|
||||
Updata_dtd("3017", false);
|
||||
Updata_dtd("3018", false);
|
||||
Updata_dtd("3017", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "1";
|
||||
|
||||
}
|
||||
else if (STEP_P1.ToString() == "2")
|
||||
{
|
||||
Updata_dtd("3016", false);
|
||||
Updata_dtd("3017", true);
|
||||
Updata_dtd("3018", false);
|
||||
Updata_dtd("3018", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "2";
|
||||
}
|
||||
else if (STEP_P1.ToString() == "3")
|
||||
{
|
||||
Updata_dtd("3016", false);
|
||||
Updata_dtd("3017", false);
|
||||
Updata_dtd("3018", true);
|
||||
Updata_dtd("3019", true);
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3";
|
||||
}
|
||||
|
||||
Updata_dtd("3019", true);//开排水泵
|
||||
Updata_dtd("3020", true);//开排水泵
|
||||
if (Selet_dtm("1015") <= STEP_P2) //排水状态完成
|
||||
{
|
||||
if (STEP_TIME <= 0)//排水延时
|
||||
{
|
||||
Updata_dtd("3016", false);
|
||||
Updata_dtd("3017", false);
|
||||
Updata_dtd("3018", false);
|
||||
Updata_dtd("3019", false);//开排水泵
|
||||
Updata_dtd("3019", false);
|
||||
Updata_dtd("3020", false);//开排水泵
|
||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Finish;
|
||||
STEP_finish = true;
|
||||
}
|
||||
@@ -2033,11 +1996,13 @@ namespace DyeingComputer.ViewModel
|
||||
lock (dt_m)
|
||||
{
|
||||
DataRow drEmployee = dt_m.Rows.Find(key);
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["Value"] = Value;
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
if (drEmployee.Field<double>("value") != Value)
|
||||
{
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["Value"] = Value;
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.ClearErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -2053,11 +2018,13 @@ namespace DyeingComputer.ViewModel
|
||||
lock (dt_d)//锁
|
||||
{
|
||||
DataRow drEmployee = dt_d.Rows.Find(key);
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["DIO"] = Value;
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
if (drEmployee.Field<bool>("DIO") != Value)
|
||||
{
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["DIO"] = Value;
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.ClearErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -2072,11 +2039,13 @@ namespace DyeingComputer.ViewModel
|
||||
lock (dt_a)
|
||||
{
|
||||
DataRow drEmployee = dt_a.Rows.Find(key);
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["AIO"] = Value;
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
if (drEmployee.Field<int>("AIO") != Value)
|
||||
{
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["AIO"] = Value;
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.ClearErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in new issue
Block a user