sc 1 year ago
parent
commit
39cfa44d60
  1. 15
      View/TechnologicalProcessView.xaml.cs
  2. 244
      ViewModel/MainWindowViewModel.cs
  3. 12
      Windows/ViewStep.xaml.cs

15
View/TechnologicalProcessView.xaml.cs

@ -18,6 +18,7 @@ using System.Windows.Media.Animation;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Threading;
using static DyeingComputer.UserClass.SqliteHelper; using static DyeingComputer.UserClass.SqliteHelper;
using static DyeingComputer.Windows.ViewStep; using static DyeingComputer.Windows.ViewStep;
@ -106,6 +107,7 @@ namespace DyeingComputer.View
{ {
if (MainWindowViewModel.WORK_RUN != 0) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示 if (MainWindowViewModel.WORK_RUN != 0) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
} }
CountDown();
} }
private void UserControl_KeyDown(object sender, KeyEventArgs e) //键盘监控 private void UserControl_KeyDown(object sender, KeyEventArgs e) //键盘监控
@ -244,5 +246,18 @@ namespace DyeingComputer.View
} }
} }
public void CountDown()
{
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
{
Interval = TimeSpan.FromSeconds(1)//秒
};
timer1s.Tick += Tick_Event_1S;
timer1s.Start();
}
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{
if (MainWindowViewModel.WORK_RUN == 2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
}
} }
} }

244
ViewModel/MainWindowViewModel.cs

@ -80,6 +80,7 @@ namespace DyeingComputer.ViewModel
private int MT38;//高水位 private int MT38;//高水位
private int MT39;//中水位 private int MT39;//中水位
private int MT40;//低水位 private int MT40;//低水位
private int MT41;//安全水位
private static int MT90;//呼叫操作员 private static int MT90;//呼叫操作员
private int S16;//机型 private int S16;//机型
@ -111,6 +112,7 @@ namespace DyeingComputer.ViewModel
MT38 = Convert.ToInt16(Selet_con("MT38"));// MT38 = Convert.ToInt16(Selet_con("MT38"));//
MT39 = Convert.ToInt16(Selet_con("MT39"));// MT39 = Convert.ToInt16(Selet_con("MT39"));//
MT40 = Convert.ToInt16(Selet_con("MT40"));// MT40 = Convert.ToInt16(Selet_con("MT40"));//
MT41 = Convert.ToInt16(Selet_con("MT41"));//
MT90 = Convert.ToInt16(Selet_con("MT90"));//呼叫操作员 MT90 = Convert.ToInt16(Selet_con("MT90"));//呼叫操作员
S16 = Convert.ToInt16(Selet_sys("S16"));//工作信息 S16 = Convert.ToInt16(Selet_sys("S16"));//工作信息
@ -226,7 +228,7 @@ namespace DyeingComputer.ViewModel
STEP_RUN(); STEP_RUN();
LOG_view(); LOG_view();
// IO_view(); IO_view();
if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString(); if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString();
} }
@ -242,7 +244,7 @@ namespace DyeingComputer.ViewModel
{ {
if (LINK_OK) Modbus_link(); if (LINK_OK) Modbus_link();
if (LINK_OK) IO_data(); if (LINK_OK) IO_data();
IO_view();
if (!string.IsNullOrEmpty(Name_err.ToString()) && (!ERR_JOG)) //有故障信息,无故障保持 if (!string.IsNullOrEmpty(Name_err.ToString()) && (!ERR_JOG)) //有故障信息,无故障保持
{ {
ERR_JOG = true; ERR_JOG = true;
@ -268,7 +270,6 @@ namespace DyeingComputer.ViewModel
private static int THL_mode = 0; //温控模式 0保温 1加热 2降 private static int THL_mode = 0; //温控模式 0保温 1加热 2降
private static double TEMP_co = 0; //计算温度 private static double TEMP_co = 0; //计算温度
private static double TEMP_tar = 16.5; //目标温度 private static double TEMP_tar = 16.5; //目标温度
private bool Pump_M = false;//主泵状态
private bool Alert_yellow = false; //警报黄灯 private bool Alert_yellow = false; //警报黄灯
private bool Alert_red = false; //警报红灯 private bool Alert_red = false; //警报红灯
private bool Alert_bell = false; //警报铃声 private bool Alert_bell = false; //警报铃声
@ -287,7 +288,7 @@ namespace DyeingComputer.ViewModel
if (STEP_P1 > t_t) { THL_mode = 1; } if (STEP_P1 > t_t) { THL_mode = 1; }
else if (STEP_P1 < t_t) { THL_mode = 2; } else if (STEP_P1 < t_t) { THL_mode = 2; }
TEMP_co = t_t; TEMP_co = t_t;
updata_dtm("1003", STEP_P2 / 600); Updata_dtm("1003", STEP_P2 / 600);
STEP_TIME = Convert.ToInt16(STEP_P3) * 60; STEP_TIME = Convert.ToInt16(STEP_P3) * 60;
WORK_RUN = 2; WORK_RUN = 2;
SETP_runtime = true; SETP_runtime = true;
@ -380,13 +381,23 @@ namespace DyeingComputer.ViewModel
break;//主缸减压 break;//主缸减压
case "054": case "054":
STEP_P1 = Convert.ToDouble(P1);
STEP_P2 = Convert.ToDouble(P2);
STEP_P3 = Convert.ToDouble(P3);
WORK_RUN = 2;
SETP_runtime = true;
STEP_finish = false;
break;//主泵/风机速度 break;//主泵/风机速度
case "055": case "055":
STEP_TIME = 10;
WORK_RUN = 2;
SETP_runtime = true;
STEP_finish = false;
break;//主泵启动 break;//主泵启动
case "056": case "056":
WORK_RUN = 2;
SETP_runtime = true;
STEP_finish = false;
break;//主泵停止 break;//主泵停止
case "064": case "064":
@ -506,17 +517,17 @@ namespace DyeingComputer.ViewModel
} }
} }
} }
updata_dtm("1004", TO); Updata_dtm("1004", TO);
updata_dtm("1005", TEMP_co); Updata_dtm("1005", TEMP_co);
if (MT12 == 1)//输出类型0开关1模拟 if (MT12 == 1)//输出类型0开关1模拟
{ {
if (THL_mode == 2) if (THL_mode == 2)
{ {
updata_dta("5002", Convert.ToInt16(TO)); Updata_dta("5002", Convert.ToInt16(TO));
} }
else else
{ {
updata_dta("5001", Convert.ToInt16(TO)); Updata_dta("5001", Convert.ToInt16(TO));
} }
} }
else else
@ -525,57 +536,57 @@ namespace DyeingComputer.ViewModel
if (THL_mode == 2) if (THL_mode == 2)
{ {
if ((temp_time10s <= Convert.ToInt16(TO)/100)) if ((temp_time10s <= Convert.ToInt16(TO)/100))
{ updata_dtd("3010", true); } { Updata_dtd("3010", true); }
else { updata_dtd("3010", false); }//降温 else { Updata_dtd("3010", false); }//降温
} }
else else
{ {
if ((temp_time10s <= Convert.ToInt16(TO)/100)) if ((temp_time10s <= Convert.ToInt16(TO)/100))
{ updata_dtd("3009", true); } { Updata_dtd("3009", true); }
else { updata_dtd("3009", false); }//升温 else { Updata_dtd("3009", false); }//升温
} }
} }
break;//功能模块001温度控制 break;//功能模块001温度控制
case "007": case "007":
if (STEP_P1.ToString() == "1") if (STEP_P1.ToString() == "1")
{ {
updata_dtd("3012", true); Updata_dtd("3012", true);
updata_dtd("3013", false); Updata_dtd("3013", false);
updata_dtd("3014", false); Updata_dtd("3014", false);
updata_dtd("3015", false); Updata_dtd("3015", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "1"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "1";
} }
else if (STEP_P1.ToString() == "2") else if (STEP_P1.ToString() == "2")
{ {
updata_dtd("3012", false); Updata_dtd("3012", false);
updata_dtd("3013", true); Updata_dtd("3013", true);
updata_dtd("3014", false); Updata_dtd("3014", false);
updata_dtd("3015", false); Updata_dtd("3015", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "2"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "2";
} }
else if (STEP_P1.ToString() == "3") else if (STEP_P1.ToString() == "3")
{ {
updata_dtd("3012", false); Updata_dtd("3012", false);
updata_dtd("3013", false); Updata_dtd("3013", false);
updata_dtd("3014", true); Updata_dtd("3014", true);
updata_dtd("3015", false); Updata_dtd("3015", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "3"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "3";
} }
else if (STEP_P1.ToString() == "4") else if (STEP_P1.ToString() == "4")
{ {
updata_dtd("3012", false); Updata_dtd("3012", false);
updata_dtd("3013", false); Updata_dtd("3013", false);
updata_dtd("3014", false); Updata_dtd("3014", false);
updata_dtd("3015", true); Updata_dtd("3015", true);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "4"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "4";
} }
if (Selet_dtm("1015") >= STEP_P2) //到达水位 if (Selet_dtm("1015") >= STEP_P2) //到达水位
{ {
updata_dtd("3012", false); Updata_dtd("3012", false);
updata_dtd("3013", false); Updata_dtd("3013", false);
updata_dtd("3014", false); Updata_dtd("3014", false);
updata_dtd("3015", false); Updata_dtd("3015", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.Finish; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.Finish;
STEP_finish = true; STEP_finish = true;
} }
@ -583,44 +594,44 @@ namespace DyeingComputer.ViewModel
case "008": case "008":
if (STEP_P1.ToString() == "1") if (STEP_P1.ToString() == "1")
{ {
updata_dtd("3012", true); Updata_dtd("3012", true);
updata_dtd("3013", false); Updata_dtd("3013", false);
updata_dtd("3014", false); Updata_dtd("3014", false);
updata_dtd("3015", false); Updata_dtd("3015", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "1"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "1";
} }
else if (STEP_P1.ToString() == "2") else if (STEP_P1.ToString() == "2")
{ {
updata_dtd("3012", false); Updata_dtd("3012", false);
updata_dtd("3013", true); Updata_dtd("3013", true);
updata_dtd("3014", false); Updata_dtd("3014", false);
updata_dtd("3015", false); Updata_dtd("3015", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "2"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "2";
} }
else if (STEP_P1.ToString() == "3") else if (STEP_P1.ToString() == "3")
{ {
updata_dtd("3012", false); Updata_dtd("3012", false);
updata_dtd("3013", false); Updata_dtd("3013", false);
updata_dtd("3014", true); Updata_dtd("3014", true);
updata_dtd("3015", false); Updata_dtd("3015", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "3"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "3";
} }
else if (STEP_P1.ToString() == "4") else if (STEP_P1.ToString() == "4")
{ {
updata_dtd("3012", false); Updata_dtd("3012", false);
updata_dtd("3013", false); Updata_dtd("3013", false);
updata_dtd("3014", false); Updata_dtd("3014", false);
updata_dtd("3015", true); Updata_dtd("3015", true);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "4"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "4";
} }
if (Selet_dtm("1016") >= STEP_P2) //到达水量 if (Selet_dtm("1016") >= STEP_P2) //到达水量
{ {
updata_dtd("3012", false); Updata_dtd("3012", false);
updata_dtd("3013", false); Updata_dtd("3013", false);
updata_dtd("3014", false); Updata_dtd("3014", false);
updata_dtd("3015", false); Updata_dtd("3015", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.Finish; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.Finish;
STEP_finish = true; STEP_finish = true;
} }
@ -637,24 +648,24 @@ namespace DyeingComputer.ViewModel
case "020": case "020":
if (STEP_P1.ToString() == "1") if (STEP_P1.ToString() == "1")
{ {
updata_dtd("3016", true); Updata_dtd("3016", true);
updata_dtd("3017", false); Updata_dtd("3017", false);
updata_dtd("3018", false); Updata_dtd("3018", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "1"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "1";
} }
else if (STEP_P1.ToString() == "2") else if (STEP_P1.ToString() == "2")
{ {
updata_dtd("3016", false); Updata_dtd("3016", false);
updata_dtd("3017", true); Updata_dtd("3017", true);
updata_dtd("3018", false); Updata_dtd("3018", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "2"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "2";
} }
else if (STEP_P1.ToString() == "3") else if (STEP_P1.ToString() == "3")
{ {
updata_dtd("3016", false); Updata_dtd("3016", false);
updata_dtd("3017", false); Updata_dtd("3017", false);
updata_dtd("3018", true); Updata_dtd("3018", true);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3";
} }
@ -662,9 +673,9 @@ namespace DyeingComputer.ViewModel
{ {
if (STEP_TIME == 0)//排水延时 if (STEP_TIME == 0)//排水延时
{ {
updata_dtd("3016", false); Updata_dtd("3016", false);
updata_dtd("3017", false); Updata_dtd("3017", false);
updata_dtd("3018", false); Updata_dtd("3018", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Finish; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Finish;
STEP_finish = true; STEP_finish = true;
} }
@ -678,36 +689,36 @@ namespace DyeingComputer.ViewModel
case "022": case "022":
if (STEP_P1.ToString() == "1") if (STEP_P1.ToString() == "1")
{ {
updata_dtd("3016", true); Updata_dtd("3016", true);
updata_dtd("3017", false); Updata_dtd("3017", false);
updata_dtd("3018", false); Updata_dtd("3018", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "1"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "1";
} }
else if (STEP_P1.ToString() == "2") else if (STEP_P1.ToString() == "2")
{ {
updata_dtd("3016", false); Updata_dtd("3016", false);
updata_dtd("3017", true); Updata_dtd("3017", true);
updata_dtd("3018", false); Updata_dtd("3018", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "2"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "2";
} }
else if (STEP_P1.ToString() == "3") else if (STEP_P1.ToString() == "3")
{ {
updata_dtd("3016", false); Updata_dtd("3016", false);
updata_dtd("3017", false); Updata_dtd("3017", false);
updata_dtd("3018", true); Updata_dtd("3018", true);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3"; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3";
} }
updata_dtd("3019", true);//开排水泵 Updata_dtd("3019", true);//开排水泵
if (Selet_dtm("1015") <= STEP_P2) //排水状态完成 if (Selet_dtm("1015") <= STEP_P2) //排水状态完成
{ {
if (STEP_TIME == 0)//排水延时 if (STEP_TIME == 0)//排水延时
{ {
updata_dtd("3016", false); Updata_dtd("3016", false);
updata_dtd("3017", false); Updata_dtd("3017", false);
updata_dtd("3018", false); Updata_dtd("3018", false);
updata_dtd("3019", false);//开排水泵 Updata_dtd("3019", false);//开排水泵
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Finish; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Finish;
STEP_finish = true; STEP_finish = true;
} }
@ -816,7 +827,6 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Sampling; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Sampling;
break;//取样 break;//取样
case "041": case "041":
STEP_finish = true; STEP_finish = true;
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.End; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.End;
break;//结束 break;//结束
@ -848,13 +858,34 @@ namespace DyeingComputer.ViewModel
break;//主缸减压 break;//主缸减压
case "054": case "054":
Updata_dtm("1020", STEP_P1);
Updata_dtm("1021", STEP_P2);
Updata_dtm("1008", STEP_P3);
STEP_finish = true;
break;//主泵/风机速度 break;//主泵/风机速度
case "055": case "055":
if (Selet_dtm("1015") > MT41)
{
Updata_dtd("3011", true);//主泵启动
if (S16 == 1) Updata_dtd("3012", true);//风机启动
STEP_TIME--;
if (STEP_TIME == 0)
{
STEP_finish = true;
}
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.PumpStart + "("+ STEP_TIME + "S)";
}
else
{
Updata_dtd("3011", false);
Updata_dtd("3012", false);
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.MasterCylinder + Resources.Low_waterlevel;
}
break;//主泵启动 break;//主泵启动
case "056": case "056":
Updata_dtd("3011", false);//主泵
if (S16 == 1) Updata_dtd("3012", false);//风机
STEP_finish = true;
break;//主泵停止 break;//主泵停止
case "064": case "064":
@ -910,8 +941,6 @@ namespace DyeingComputer.ViewModel
} }
else if (WORK_RUN == 1) else if (WORK_RUN == 1)
{ {
for (ushort i = 0; i < 100; i++) { updata_dtd((i + 3011).ToString(), false); }
SETP_runtime = false; SETP_runtime = false;
STEP_finish = false; STEP_finish = false;
Status_Str = Resources.Paused; Status_Str = Resources.Paused;
@ -919,6 +948,15 @@ namespace DyeingComputer.ViewModel
else else
if (WORK_RUN == 0) if (WORK_RUN == 0)
{ {
if (Status_Str == Resources.Paused)
{
Updata_dtm("1004", 0);
Updata_dtm("1005", Selet_dtm("1010"));
for (int i = 1; i <128; i++)
{
Updata_dtd((3000+i).ToString(), false);
}
}//清除输出状态
if (string.IsNullOrEmpty(Name_err.ToString())) if (string.IsNullOrEmpty(Name_err.ToString()))
{ {
int TIMEH = DIDETime / 3600; int TIMEH = DIDETime / 3600;
@ -1007,10 +1045,10 @@ namespace DyeingComputer.ViewModel
{ {
Sys_log = Sys_log + "\n" + Resources.MasterCylinder + Resources.WaterLevel + " : " + string.Format("{0:D4}", IO1015) + "L =>[" + Resources.High_waterlevel + "]";//显示水位 Sys_log = Sys_log + "\n" + Resources.MasterCylinder + Resources.WaterLevel + " : " + string.Format("{0:D4}", IO1015) + "L =>[" + Resources.High_waterlevel + "]";//显示水位
} }
if (Pump_M) //主泵状态 if (Selet_dtd("3011")) //主泵状态
{ {
Sys_log = Sys_log + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStart + "]";//主泵状态 Sys_log = Sys_log + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStart + "]";//主泵状态
} }//主泵状态
else else
{ {
Sys_log = Sys_log + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStops + "]";//主泵状态 Sys_log = Sys_log + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStops + "]";//主泵状态
@ -1045,14 +1083,13 @@ namespace DyeingComputer.ViewModel
}//溢流/o型 }//溢流/o型
else if (S16 == 1) //气流 else if (S16 == 1) //气流
{ {
Sys_log = Sys_log + "\n" + Resources.DifferentialPressure + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1021"))) + "%"; Sys_log = Sys_log + "\n" + Resources.DifferentialPressure + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1044"))) + "%";
Sys_log = Sys_log + "\n" + Resources.Blower + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1044"))) + "%"; Sys_log = Sys_log + "\n" + Resources.Blower + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1021"))) + "%";
Sys_log = Sys_log + "\n" + Resources.GuidingWheel + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1046"))) + "M/min"; Sys_log = Sys_log + "\n" + Resources.GuidingWheel + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1046"))) + "M/min";
Sys_log = Sys_log + "\n" + Resources.Nozzle + Resources.Flowmeter + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1045"))) + "L/min"; Sys_log = Sys_log + "\n" + Resources.Nozzle + Resources.Flowmeter + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1045"))) + "L/min";
} }
else if (S16 == 2) //桶纱 else if (S16 == 2) //桶纱
{ } { }
Sys_log = Sys_log + "\n-------------------------------------------------------"; Sys_log = Sys_log + "\n-------------------------------------------------------";
if (SM01 == 1) if (SM01 == 1)
{ {
@ -1096,19 +1133,18 @@ namespace DyeingComputer.ViewModel
} }
private async void IO_data()//刷新 private async void IO_data()//刷新
{ {
Updata_dtm("1001", LINK_RUN);
updata_dtm("1001", LINK_RUN); Updata_dtm("1002", LINK_ERR);
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("1006", Selet_dta("4006")); Updata_dtm("1015", Selet_dta("4007"));
updata_dtm("1015", Selet_dta("4007")); Updata_dtm("1016", Selet_dta("4006") * MT16);
updata_dtm("1016", Selet_dta("4006") * MT16);
await Task.Run(() => await Task.Run(() =>
{ {
for (ushort i = 0; i < DO_L; i++) { updata_dtd((i + 2001).ToString(), DO[i]); } for (ushort i = 0; i < DO_L; i++) { Updata_dtd((i + 2001).ToString(), DO[i]); }
for (ushort i = 0; i < DQ_L; i++) { DQ[i] = Selet_dtd((i + 3001).ToString()); } for (ushort i = 0; i < DQ_L; i++) { DQ[i] = Selet_dtd((i + 3001).ToString()); }
for (ushort i = 0; i < RW_L; i++) { updata_dta((i + 4001).ToString(), RW[i]); } for (ushort i = 0; i < RW_L; i++) { Updata_dta((i + 4001).ToString(), RW[i]); }
for (ushort i = 0; i < DW_L; i++) { DW[i] = Convert.ToUInt16(Selet_dta((i + 5001).ToString())); } for (ushort i = 0; i < DW_L; i++) { DW[i] = Convert.ToUInt16(Selet_dta((i + 5001).ToString())); }
}); });
} }
@ -1192,7 +1228,7 @@ namespace DyeingComputer.ViewModel
return -1; return -1;
} }
} }
public static void updata_dtm(string key,double Value)//更新M寄存器 public static void Updata_dtm(string key,double Value)//更新M寄存器
{ {
try try
{ {
@ -1212,7 +1248,7 @@ namespace DyeingComputer.ViewModel
} }
} }
public static void updata_dtd(string key, bool Value)//更新D寄存器 public static void Updata_dtd(string key, bool Value)//更新D寄存器
{ {
try try
{ {
@ -1231,7 +1267,7 @@ namespace DyeingComputer.ViewModel
LogGing.LogGingDATA("UDTD:" + ex.ToString()); LogGing.LogGingDATA("UDTD:" + ex.ToString());
} }
} }
public static void updata_dta(string key, int Value)//更新A寄存器 public static void Updata_dta(string key, int Value)//更新A寄存器
{ {
try try
{ {

12
Windows/ViewStep.xaml.cs

@ -363,19 +363,17 @@ namespace DyeingComputer.Windows
case 17: case 17:
P1N.Text = Properties.Resources.PumpSpeed; P1N.Text = Properties.Resources.PumpSpeed;
P2N.Text = Properties.Resources.Blower; P2N.Text = Properties.Resources.Blower;
P3N.Text = Properties.Resources.Pressure; P3N.Text = Properties.Resources.Nozzle;
P4N.Text = Properties.Resources.Nozzle;
P5N.Text = Properties.Resources.Wiggle;
P1.Visibility = Visibility.Visible; P1.Visibility = Visibility.Visible;
P1N.Visibility = Visibility.Visible; P1N.Visibility = Visibility.Visible;
P2.Visibility = Visibility.Visible; P2.Visibility = Visibility.Visible;
P2N.Visibility = Visibility.Visible; P2N.Visibility = Visibility.Visible;
P3.Visibility = Visibility.Visible; P3.Visibility = Visibility.Visible;
P3N.Visibility = Visibility.Visible; P3N.Visibility = Visibility.Visible;
P4.Visibility = Visibility.Visible; P4.Visibility = Visibility.Collapsed;
P4N.Visibility = Visibility.Visible; P4N.Visibility = Visibility.Collapsed;
P5.Visibility = Visibility.Visible; P5.Visibility = Visibility.Collapsed;
P5N.Visibility = Visibility.Visible; P5N.Visibility = Visibility.Collapsed;
break; break;
case 20: case 20:
P1N.Text = Properties.Resources.Medicine + Properties.Resources.Tank; P1N.Text = Properties.Resources.Medicine + Properties.Resources.Tank;

Loading…
Cancel
Save