连线逻辑修改
This commit is contained in:
commit
3b6ab69a71
5 files changed
+32
-65
No files matched your search
@@ -21,17 +21,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
|
||||
{
|
||||
string i = value.ToString();
|
||||
|
||||
if (i == "201") return "green";
|
||||
else if (i == "202") return "yellow";
|
||||
else if (i == "309") return "Red";
|
||||
else if (i == "800") return "Red";
|
||||
else return "block";
|
||||
if (i == "201") return "#FF00FF00";
|
||||
else if (i == "202") return "#FFFFFF00";
|
||||
else if (i == "309") return "#FFFF0000";
|
||||
else if (i == "800") return "#FFFF0000";
|
||||
else return "#FF000000";
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return "Gray";
|
||||
return "#FFF0F0F0";
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-3
@@ -206,9 +206,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
|
||||
{
|
||||
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
|
||||
{
|
||||
if (MainWindowViewModel.Machines.Select("NAME = '" + comboBoxMachine.Text + "'").First().Field<string>("WorkOrder") != "------")
|
||||
{ orders.Text = MainWindowViewModel.Machines.Select("NAME = '" + comboBoxMachine.Text + "'").First().Field<string>("WorkOrder"); }
|
||||
else { orders.Text = dyelot.Text; }
|
||||
string Macht= MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "WorkOrder", "NAME = '" + comboBoxMachine.Text + "'").ToString();
|
||||
|
||||
if (Macht != "------")
|
||||
{
|
||||
orders.Text = Macht;
|
||||
}
|
||||
else
|
||||
{
|
||||
orders.Text = dyelot.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
//TcpClient tcpClient = new TcpClient();
|
||||
tcpClient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到服务器,此时已经创建socket,但是还未建立tcp
|
||||
tcpClient.Connected = (client, e) =>
|
||||
{
|
||||
lock (MainWindowViewModel.Machines)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -59,13 +57,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
}
|
||||
|
||||
return EasyTask.CompletedTask;
|
||||
};//成功连接到服务器
|
||||
tcpClient.Closing = (client, e) =>
|
||||
{
|
||||
lock (MainWindowViewModel.Machines)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -87,12 +82,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
}
|
||||
return EasyTask.CompletedTask;
|
||||
};//即将从服务器断开连接。此处仅主动断开才有效。
|
||||
tcpClient.Closed = (client, e) =>
|
||||
{
|
||||
lock (MainWindowViewModel.Machines)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -114,7 +106,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
}
|
||||
return EasyTask.CompletedTask;
|
||||
};//从服务器断开连接,当连接不成功时不会触发。
|
||||
tcpClient.Received = (client, e) =>
|
||||
@@ -123,15 +114,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
string SYSAPI = e.ByteBlock.Span.ToString(Encoding.ASCII).Substring(0, 5);
|
||||
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8);
|
||||
if (SYSAPI == "SC800")
|
||||
{
|
||||
lock (MainWindowViewModel.Machines)
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
|
||||
drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
|
||||
@@ -144,7 +133,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (SYSAPI == "SC810")
|
||||
{
|
||||
@@ -172,16 +161,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
|
||||
"WorkOrder ='" + DAT + "'", null);
|
||||
SQLiteHelpers.Close();
|
||||
}catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}
|
||||
else if (SYSAPI == "SC830")
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
||||
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["Message"] = _new.GetValue("Status");
|
||||
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder");
|
||||
@@ -191,7 +182,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
drEmployee["Step"] = _new.GetValue("Step");
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
|
||||
if (_new.GetValue("Status").ToString() != "----------")
|
||||
{
|
||||
@@ -216,6 +206,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
SQLiteHelpers.InsertData("Chart", Chart_new);// 执行插入
|
||||
SQLiteHelpers.Close();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}
|
||||
@@ -316,7 +307,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
else if (SYSAPI == "SC980")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MessageBox.Show(DAT,"SCCM", MessageBoxButton.OK, MessageBoxImage.Question);
|
||||
MessageBox.Show(DAT, "SCCM", MessageBoxButton.OK, MessageBoxImage.Question);
|
||||
}
|
||||
|
||||
return EasyTask.CompletedTask;
|
||||
@@ -331,7 +322,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
a.UseCheckClear()
|
||||
.SetCheckClearType(CheckClearType.All)
|
||||
.SetTick(TimeSpan.FromSeconds(30))
|
||||
.SetTick(TimeSpan.FromSeconds(60))
|
||||
.SetOnClose((c, t) =>
|
||||
{
|
||||
c.TryShutdown();
|
||||
|
||||
@@ -62,11 +62,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
||||
|
||||
Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd");
|
||||
|
||||
Picture.Content = new View.CurveDiagram(false,"","","", CurveDiagram);
|
||||
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
||||
}
|
||||
|
||||
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
|
||||
DispatcherTimer dis50ms = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(50) //毫秒
|
||||
Interval = TimeSpan.FromMilliseconds(10) //毫秒
|
||||
};
|
||||
dis50ms.Tick += new EventHandler(DisTimer_50MS);//每一秒执行的方法
|
||||
dis50ms.Start();//计时开始
|
||||
@@ -346,9 +346,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
return index;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
// LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
||||
LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
||||
return "ERR";
|
||||
}
|
||||
}
|
||||
@@ -363,44 +363,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
drEmployee[name] = Value;
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
// drEmployee.ClearErrors();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
// LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
||||
LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
||||
}
|
||||
}
|
||||
public static void UpdataMachines(string key, DataRow Value)//更新数据
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (Machines)
|
||||
{
|
||||
DataRow drEmployee = Machines.Select("IP='" + key + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
|
||||
if (Value["State"] != null) drEmployee["State"] = Value["State"];
|
||||
if (Value["WorkOrder"] != null) drEmployee["WorkOrder"] = Value["WorkOrder"];
|
||||
if (Value["Dyelot"] != null) drEmployee["Dyelot"] = Value["Dyelot"];
|
||||
if (Value["Temperature"] != null) drEmployee["Temperature"] = Value["WorkOrder"];
|
||||
if (Value["WaterLevel"] != null) drEmployee["WaterLevel"] = Value["WaterLevel"];
|
||||
if (Value["Process"] != null) drEmployee["Process"] = Value["Process"];
|
||||
if (Value["Step"] != null) drEmployee["Step"] = Value["Step"];
|
||||
if (Value["Message"] != null) drEmployee["Message"] = Value["Message"];
|
||||
if (Value["SYSKEY"] != null) drEmployee["SYSKEY"] = Value["SYSKEY"];
|
||||
if (Value["Groups"] != null) drEmployee["Groups"] = Value["Groups"];
|
||||
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static DataTable dt_d = new DataTable("DIO");
|
||||
public static DataTable dt_a = new DataTable("AIO");
|
||||
|
||||
Reference in new issue
Block a user