sc 1 year ago
parent
commit
142e653276
  1. 2
      App.xaml.cs
  2. 45
      UserClass/AsyncTcpServer.cs
  3. 7
      View/TechnologicalProcessView.xaml.cs
  4. 100
      ViewModel/MainWindowViewModel.cs

2
App.xaml.cs

@ -84,7 +84,7 @@ namespace DyeingComputer
void App_Startup(object sender, StartupEventArgs e)
{
bool ret;
mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret);//程序只允许启动一次
mutex = new System.Threading.Mutex(true, "800System", out ret);//程序只允许启动一次
if (!ret)
{
LogGing.LogGingDATA("800_The program has been launched");

45
UserClass/AsyncTcpServer.cs

@ -169,16 +169,33 @@ namespace DyeingComputer.UserClass
{
SQLDATA.TechnologicalProcess_START(dat_821.GetValue("ProgramID").ToString());
}
else if (dat_821.GetValue("INSTRUCTION").ToString() == "STOP") { }
else if (dat_821.GetValue("INSTRUCTION").ToString() == "PAUSE") { }
else if (dat_821.GetValue("INSTRUCTION").ToString() == "CONTINUE") { }
else if (dat_821.GetValue("INSTRUCTION").ToString() == "STOP")
{
MainWindowViewModel.WORK_RUN = 0;//停止
MainWindowViewModel.DIDETime = 0;
}
else if (dat_821.GetValue("INSTRUCTION").ToString() == "PAUSE")
{
MainWindowViewModel.WORK_RUN = 1;//暂停
}
else if (dat_821.GetValue("INSTRUCTION").ToString() == "CONTINUE")
{
MainWindowViewModel.WORK_RUN = 2;//暂停
}
else if (dat_821.GetValue("INSTRUCTION").ToString() == "JUMP")
{
MainWindowViewModel.RUN_DATATABLE = TechnologicalProcessView.sql.Tables[0];//缓存表
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(dat_821.GetValue("ID").ToString());//插入步骤号
MainWindowViewModel.STEP_START(dat_821.GetValue("Numder").ToString(), Convert.ToDouble(dat_821.GetValue("P1")),
Convert.ToDouble(dat_821.GetValue("P2")), Convert.ToDouble(dat_821.GetValue("P3")),
Convert.ToDouble(dat_821.GetValue("P4")), Convert.ToDouble(dat_821.GetValue("P5")));
}
client.SendAsync("SC821" + SYSKEY + SYSDAT);
}
catch { client.SendAsync("SC921"); }
}
else { client.SendAsync("SC999"); }
}//启停指令
}//启停跳步指令
else if (SYSAPI == "SC830")
{
if (SYSKEY == MainWindowViewModel.SYSKEY)
@ -201,6 +218,24 @@ namespace DyeingComputer.UserClass
}
else { client.SendAsync("SC999"); }
}//当前信息
else if (SYSAPI == "SC831")
{
if (SYSKEY == MainWindowViewModel.SYSKEY)
{
client.SendAsync("[" + MainWindowViewModel.S01 + "]" +TechnologicalProcessView.sql.Tables[0].ToJsonString());
}
else { client.SendAsync("SC999"); }
}//当前工作表
else if (SYSAPI == "SC832")
{
if (SYSKEY == MainWindowViewModel.SYSKEY)
{
client.SendAsync("[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.SYSlog);
}
else { client.SendAsync("SC999"); }
}//当前细节信息
else if (SYSAPI == "SC851")
{
if (SYSKEY == MainWindowViewModel.SYSKEY)

7
View/TechnologicalProcessView.xaml.cs

@ -118,6 +118,12 @@ namespace DyeingComputer.View
if ((MainWindowViewModel.WORK_RUN == 1) || (MainWindowViewModel.WORK_RUN == 0))//停止暂停时可以启用开始
{
if (e.Key == Key.Y) //按键y
{
if (string.IsNullOrEmpty(Numder))
{
MainWindowViewModel.WORK_RUN = 2;
}
else
{
MainWindowViewModel.RUN_DATATABLE = sql.Tables[0];//缓存表
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(ID);//插入步骤号
@ -126,6 +132,7 @@ namespace DyeingComputer.View
}
}
}
}
private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)//编辑按钮
{

100
ViewModel/MainWindowViewModel.cs

@ -1470,90 +1470,94 @@ namespace DyeingComputer.ViewModel
});
}
}
public static string SYSlog;
void LOG_view()//细节页面
{
Sys_log = Resources.Target + Resources.Temperature + " : " + string.Format(" {0:###.#}", TEMP_tar) + "°C";//显示目标温度
Sys_log = Sys_log + " | " + Resources.MasterCylinder + Resources.Temperature + " : " + string.Format(" {0:###.#}", Convert.ToDouble(Selet_dtm("1010"))) + "°C";//显示实际温度
Sys_log = Sys_log + "\n" + Resources.Compute + Resources.Temperature + " : " + string.Format(" {0:###.#}", Convert.ToDouble(Selet_dtm("1005"))) + "°C";//显示计算温度
Sys_log = Sys_log + " | " + Resources.ProportionalValves + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1004")) / 10) + "%";//显示比例
SYSlog = Resources.Target + Resources.Temperature + " : " + string.Format(" {0:###.#}", TEMP_tar) + "°C";//显示目标温度
SYSlog = SYSlog + " | " + Resources.MasterCylinder + Resources.Temperature + " : " + string.Format(" {0:###.#}", Convert.ToDouble(Selet_dtm("1010"))) + "°C";//显示实际温度
SYSlog = SYSlog + "\n" + Resources.Compute + Resources.Temperature + " : " + string.Format(" {0:###.#}", Convert.ToDouble(Selet_dtm("1005"))) + "°C";//显示计算温度
SYSlog = SYSlog + " | " + Resources.ProportionalValves + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1004")) / 10) + "%";//显示比例
int IO1015 = Convert.ToInt16(Selet_dtm("1015"));
if (IO1015 < MT39)
{
Sys_log = Sys_log + "\n" + Resources.MasterCylinder + Resources.WaterLevel + " : " + string.Format("{0:D4}", IO1015) + "L =>[" + Resources.Low_waterlevel + "]";//显示水位
SYSlog = SYSlog + "\n" + Resources.MasterCylinder + Resources.WaterLevel + " : " + string.Format("{0:D4}", IO1015) + "L =>[" + Resources.Low_waterlevel + "]";//显示水位
}
else if ((IO1015 > MT39) && (IO1015 < MT38))
{
Sys_log = Sys_log + "\n" + Resources.MasterCylinder + Resources.WaterLevel + " : " + string.Format("{0:D4}", IO1015) + "L =>[" + Resources.Mid_waterlevel + "]";//显示水位
SYSlog = SYSlog + "\n" + Resources.MasterCylinder + Resources.WaterLevel + " : " + string.Format("{0:D4}", IO1015) + "L =>[" + Resources.Mid_waterlevel + "]";//显示水位
}
else if (IO1015 > MT38)
{
Sys_log = Sys_log + "\n" + Resources.MasterCylinder + Resources.WaterLevel + " : " + string.Format("{0:D4}", IO1015) + "L =>[" + Resources.High_waterlevel + "]";//显示水位
SYSlog = SYSlog + "\n" + Resources.MasterCylinder + Resources.WaterLevel + " : " + string.Format("{0:D4}", IO1015) + "L =>[" + Resources.High_waterlevel + "]";//显示水位
}
if (Selet_dtd("3011")) //主泵状态
{
Sys_log = Sys_log + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStart + "]";//主泵状态
SYSlog = SYSlog + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStart + "]";//主泵状态
}//主泵状态
else
{
Sys_log = Sys_log + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStops + "]";//主泵状态
SYSlog = SYSlog + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStops + "]";//主泵状态
}
Sys_log = Sys_log + "\n" + Resources.MasterCylinder + Resources.Pressure + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1042"))) + "Bar";
Sys_log = Sys_log + " | " + Resources.Nozzle + Resources.Pressure + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1043"))) + "Bar";
Sys_log = Sys_log + "\n-------------------------------------------------------";
SYSlog = SYSlog + "\n" + Resources.MasterCylinder + Resources.Pressure + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1042"))) + "Bar";
SYSlog = SYSlog + " | " + Resources.Nozzle + Resources.Pressure + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1043"))) + "Bar";
SYSlog = SYSlog + "\n-------------------------------------------------------";
if (S16 == 0)
{
Sys_log = Sys_log + "\n" + Resources.ClothWheel + "M/min";
Sys_log = Sys_log + "\n" + "1 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1022")));
if (MT18 >= 2) Sys_log = Sys_log + " | " + "2 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1023")));
if (MT18 >= 3) Sys_log = Sys_log + " | " + "3 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1024")));
if (MT18 >= 4) Sys_log = Sys_log + "\n" + "4 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1025")));
if (MT18 >= 5) Sys_log = Sys_log + " | " + "5 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1026")));
if (MT18 >= 6) Sys_log = Sys_log + " | " + "6 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1027")));
if (MT18 >= 7) Sys_log = Sys_log + "\n" + "7 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1028")));
if (MT18 >= 8) Sys_log = Sys_log + " | " + "8 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1029")));
if (MT18 >= 9) Sys_log = Sys_log + " | " + "9 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1030")));
if (MT18 >= 10) Sys_log = Sys_log + "\n" + "10 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1031")));
Sys_log = Sys_log + "\n" + Resources.Cycletime + "Sec";
Sys_log = Sys_log + "\n" + "1 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1032")));
if (MT18 >= 2) Sys_log = Sys_log + " | " + "2 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1033")));
if (MT18 >= 3) Sys_log = Sys_log + " | " + "3 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1034")));
if (MT18 >= 4) Sys_log = Sys_log + "\n" + "4 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1035")));
if (MT18 >= 5) Sys_log = Sys_log + " | " + "5 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1036")));
if (MT18 >= 6) Sys_log = Sys_log + " | " + "6 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1037")));
if (MT18 >= 7) Sys_log = Sys_log + "\n" + "7 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1038")));
if (MT18 >= 8) Sys_log = Sys_log + " | " + "8 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1039")));
if (MT18 >= 9) Sys_log = Sys_log + " | " + "9 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1040")));
if (MT18 >= 10) Sys_log = Sys_log + "\n" + "10 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1041")));
SYSlog = SYSlog + "\n" + Resources.ClothWheel + "M/min";
SYSlog = SYSlog + "\n" + "1 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1022")));
if (MT18 >= 2) SYSlog = SYSlog + " | " + "2 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1023")));
if (MT18 >= 3) SYSlog = SYSlog + " | " + "3 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1024")));
if (MT18 >= 4) SYSlog = SYSlog + "\n" + "4 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1025")));
if (MT18 >= 5) SYSlog = SYSlog + " | " + "5 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1026")));
if (MT18 >= 6) SYSlog = SYSlog + " | " + "6 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1027")));
if (MT18 >= 7) SYSlog = SYSlog + "\n" + "7 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1028")));
if (MT18 >= 8) SYSlog = SYSlog + " | " + "8 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1029")));
if (MT18 >= 9) SYSlog = SYSlog + " | " + "9 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1030")));
if (MT18 >= 10) SYSlog = SYSlog + "\n" + "10 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1031")));
SYSlog = SYSlog + "\n" + Resources.Cycletime + "Sec";
SYSlog = SYSlog + "\n" + "1 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1032")));
if (MT18 >= 2) SYSlog = SYSlog + " | " + "2 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1033")));
if (MT18 >= 3) SYSlog = SYSlog + " | " + "3 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1034")));
if (MT18 >= 4) SYSlog = SYSlog + "\n" + "4 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1035")));
if (MT18 >= 5) SYSlog = SYSlog + " | " + "5 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1036")));
if (MT18 >= 6) SYSlog = SYSlog + " | " + "6 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1037")));
if (MT18 >= 7) SYSlog = SYSlog + "\n" + "7 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1038")));
if (MT18 >= 8) SYSlog = SYSlog + " | " + "8 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1039")));
if (MT18 >= 9) SYSlog = SYSlog + " | " + "9 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1040")));
if (MT18 >= 10) SYSlog = SYSlog + "\n" + "10 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1041")));
}//溢流/o型
else if (S16 == 1) //气流
{
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("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.Nozzle + Resources.Flowmeter + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1045"))) + "L/min";
SYSlog = SYSlog + "\n" + Resources.DifferentialPressure + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1044"))) + "%";
SYSlog = SYSlog + "\n" + Resources.Blower + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1021"))) + "%";
SYSlog = SYSlog + "\n" + Resources.GuidingWheel + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1046"))) + "M/min";
SYSlog = SYSlog + "\n" + Resources.Nozzle + Resources.Flowmeter + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1045"))) + "L/min";
}
else if (S16 == 2) //桶纱
{ }
Sys_log = Sys_log + "\n-------------------------------------------------------";
SYSlog = SYSlog + "\n-------------------------------------------------------";
if (SM01 == 1)
{
Sys_log = Sys_log + "\n" + Resources.Medicine + Resources.Tank + "1 => [" + Resources.WaterLevel + ":" + string.Format("{0:D4}", Convert.ToInt16(Selet_dtm("1017"))) + "L][" + Resources.Temperature + ":" + string.Format(" {0:###.#}", Convert.ToInt16(Selet_dtm("1012"))) + "°C]";
Sys_log = Sys_log + "\n" + Resources.Dyelot + " : " + TANK1_DYELOT +"_"+ TANK1_REDYE + " => "+ TANK1_STEP;
Sys_log = Sys_log + "\n" + Resources.WorkingStatus + " : "+TANK1;
SYSlog = SYSlog + "\n" + Resources.Medicine + Resources.Tank + "1 => [" + Resources.WaterLevel + ":" + string.Format("{0:D4}", Convert.ToInt16(Selet_dtm("1017"))) + "L][" + Resources.Temperature + ":" + string.Format(" {0:###.#}", Convert.ToInt16(Selet_dtm("1012"))) + "°C]";
SYSlog = SYSlog + "\n" + Resources.Dyelot + " : " + TANK1_DYELOT + "_" + TANK1_REDYE + " => " + TANK1_STEP;
SYSlog = SYSlog + "\n" + Resources.WorkingStatus + " : " + TANK1;
}//附缸1
if (SM02 == 1)
{
Sys_log = Sys_log + "\n" + Resources.Medicine + Resources.Tank + "2 => [" + Resources.WaterLevel + ":" + string.Format("{0:D4}", Convert.ToInt16(Selet_dtm("1018"))) + "L][" + Resources.Temperature + ":" + string.Format(" {0:###.#}", Convert.ToInt16(Selet_dtm("1013"))) + "°C]";
Sys_log = Sys_log + "\n" + Resources.Dyelot + " : " + TANK2_DYELOT + "_" + TANK1_REDYE + " => " + TANK2_STEP;
Sys_log = Sys_log + "\n" + Resources.WorkingStatus + " : "+TANK2;
SYSlog = SYSlog + "\n" + Resources.Medicine + Resources.Tank + "2 => [" + Resources.WaterLevel + ":" + string.Format("{0:D4}", Convert.ToInt16(Selet_dtm("1018"))) + "L][" + Resources.Temperature + ":" + string.Format(" {0:###.#}", Convert.ToInt16(Selet_dtm("1013"))) + "°C]";
SYSlog = SYSlog + "\n" + Resources.Dyelot + " : " + TANK2_DYELOT + "_" + TANK1_REDYE + " => " + TANK2_STEP;
SYSlog = SYSlog + "\n" + Resources.WorkingStatus + " : " + TANK2;
}//附缸2
if (SM03 == 1)
{
Sys_log = Sys_log + "\n" + Resources.Medicine + Resources.Tank + "3 => [" + Resources.WaterLevel + ":" + string.Format("{0:D4}", Convert.ToInt16(Selet_dtm("1019"))) + "L][" + Resources.Temperature + ":" + string.Format(" {0:###.#}", Convert.ToInt16(Selet_dtm("1014"))) + "°C]";
Sys_log = Sys_log + "\n" + Resources.Dyelot + " : " + TANK3_DYELOT + "_" + TANK1_REDYE + " => " + TANK3_STEP;
Sys_log = Sys_log + "\n" + Resources.WorkingStatus + " : "+TANK3;
SYSlog = SYSlog + "\n" + Resources.Medicine + Resources.Tank + "3 => [" + Resources.WaterLevel + ":" + string.Format("{0:D4}", Convert.ToInt16(Selet_dtm("1019"))) + "L][" + Resources.Temperature + ":" + string.Format(" {0:###.#}", Convert.ToInt16(Selet_dtm("1014"))) + "°C]";
SYSlog = SYSlog + "\n" + Resources.Dyelot + " : " + TANK3_DYELOT + "_" + TANK1_REDYE + " => " + TANK3_STEP;
SYSlog = SYSlog + "\n" + Resources.WorkingStatus + " : " + TANK3;
}//附缸3
Sys_log = SYSlog;
}
public static DataTable dt_d = new DataTable("DIO");
public static DataTable dt_a = new DataTable("AIO");
public static DataTable dt_m = new DataTable("M");

Loading…
Cancel
Save