错误修正
This commit is contained in:
commit
7c744f72f6
4 files changed
+64
-38
No files matched your search
@@ -65,8 +65,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
|
|
||||||
for (int i = 0; i < sArray.Length; i++)
|
for (int i = 0; i < sArray.Length; i++)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(sArray[i]))
|
if (sArray[i].Length>5)
|
||||||
{
|
{
|
||||||
|
return EasyTask.CompletedTask; ;
|
||||||
string SYSAPI = sArray[i].Substring(0, 5);
|
string SYSAPI = sArray[i].Substring(0, 5);
|
||||||
string Station = ClipBetween(sArray[i], '[', ']');
|
string Station = ClipBetween(sArray[i], '[', ']');
|
||||||
string DAT = sArray[i].Substring(sArray[i].IndexOf("]") + 1);
|
string DAT = sArray[i].Substring(sArray[i].IndexOf("]") + 1);
|
||||||
@@ -129,7 +130,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// return EasyTask.CompletedTask; ;
|
|
||||||
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
||||||
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
|
||||||
|
|||||||
+25
-4
@@ -126,19 +126,40 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="150" IsReadOnly="True">
|
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="80" IsReadOnly="True">
|
||||||
<DataGridTextColumn.ElementStyle>
|
<DataGridTextColumn.ElementStyle>
|
||||||
<Style TargetType="{x:Type TextBlock}">
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
<Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
<Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</DataGridTextColumn.ElementStyle>
|
</DataGridTextColumn.ElementStyle>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
|
||||||
|
<Setter Property="ToolTip" Value="{Binding WorkOrder}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="0" MaxWidth="0" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="0" MaxWidth="0" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Temperature}" Binding="{Binding Temperature}" Width="100" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.Temperature}" Binding="{Binding Temperature}" Width="100" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.WaterLevel}" Binding="{Binding WaterLevel}" Width="100" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.WaterLevel}" Binding="{Binding WaterLevel}" Width="100" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.process}" Binding="{Binding Process}" Width="300" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.process}" Binding="{Binding Process}" Width="300" IsReadOnly="True">
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="300" IsReadOnly="True"/>
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
|
||||||
|
<Setter Property="ToolTip" Value="{Binding Process}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="300" IsReadOnly="True">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
|
||||||
|
<Setter Property="ToolTip" Value="{Binding Step}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.message}" Binding="{Binding Message}" Width="*" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.message}" Binding="{Binding Message}" Width="*" IsReadOnly="True"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
CrosshairSnapEnabled = true,
|
CrosshairSnapEnabled = true,
|
||||||
Position = LiveChartsCore.Measure.AxisPosition.End
|
Position = LiveChartsCore.Measure.AxisPosition.End
|
||||||
}, //液位轴
|
}, //液位轴
|
||||||
new Axis //
|
/* new Axis //
|
||||||
{
|
{
|
||||||
MinLimit =0,
|
MinLimit =0,
|
||||||
MaxLimit =14,
|
MaxLimit =14,
|
||||||
@@ -106,7 +106,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
DrawTicksPath = true,
|
DrawTicksPath = true,
|
||||||
CrosshairSnapEnabled = true,
|
CrosshairSnapEnabled = true,
|
||||||
Position = LiveChartsCore.Measure.AxisPosition.End
|
Position = LiveChartsCore.Measure.AxisPosition.End
|
||||||
}, //PH轴
|
},*/ //PH轴
|
||||||
};
|
};
|
||||||
|
|
||||||
private static Random _r = new Random();
|
private static Random _r = new Random();
|
||||||
@@ -136,10 +136,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
if (mode)
|
if (mode)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(w)) return;
|
if (string.IsNullOrEmpty(w)) return;
|
||||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
CDB = MainWindowViewModel.SQLiteChartAdress.ExecuteDataSet("select * from Chart where WorkOrder = '" + w + "'order by Time", null).Tables[0];
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
|
||||||
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where WorkOrder = '" + w + "'order by Time", null).Tables[0];
|
|
||||||
SQLiteHelpers.Close();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -147,18 +144,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
if (string.IsNullOrEmpty(m)) return;
|
if (string.IsNullOrEmpty(m)) return;
|
||||||
if (string.IsNullOrEmpty(s)) return;
|
if (string.IsNullOrEmpty(s)) return;
|
||||||
if (string.IsNullOrEmpty(e)) return;
|
if (string.IsNullOrEmpty(e)) return;
|
||||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where Machine = '" + m + "'" +
|
CDB = MainWindowViewModel.SQLiteChartAdress.ExecuteDataSet("select * from Chart where Machine = '" + m + "'" +
|
||||||
" and Time > '" + s + "' and Time < '" + e + "' order by Time", null).Tables[0];
|
" and Time > '" + s + "' and Time < '" + e + "' order by Time", null).Tables[0];
|
||||||
SQLiteHelpers.Close();
|
// SQLiteHelpers.Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CDB_Count = CDB.Rows.Count;
|
CDB_Count = CDB.Rows.Count;
|
||||||
var MTT_items = new List<DateTimePoint>();
|
var MTT_items = new List<DateTimePoint>();
|
||||||
var MTL_items = new List<DateTimePoint>();
|
var MTL_items = new List<DateTimePoint>();
|
||||||
var MTH_items = new List<DateTimePoint>();
|
// var MTH_items = new List<DateTimePoint>();
|
||||||
var MST_items = new List<DateTimePoint>();
|
var MST_items = new List<DateTimePoint>();
|
||||||
var MUT_items = new List<DateTimePoint>();
|
var MUT_items = new List<DateTimePoint>();
|
||||||
var STTA_items = new List<DateTimePoint>();
|
var STTA_items = new List<DateTimePoint>();
|
||||||
@@ -167,12 +164,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
var STLB_items = new List<DateTimePoint>();
|
var STLB_items = new List<DateTimePoint>();
|
||||||
var STTC_items = new List<DateTimePoint>();
|
var STTC_items = new List<DateTimePoint>();
|
||||||
var STLC_items = new List<DateTimePoint>();
|
var STLC_items = new List<DateTimePoint>();
|
||||||
for (var i = 0; i < CDB_Count; i++)
|
for (var i = 0; i < CDB_Count; i=i+10)
|
||||||
{
|
{
|
||||||
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
|
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
|
||||||
MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT")));
|
MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT")));
|
||||||
MTL_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTL")));
|
MTL_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTL")));
|
||||||
MTH_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTH")));
|
// MTH_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTH")));
|
||||||
MST_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MST")));
|
MST_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MST")));
|
||||||
MUT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MUT")));
|
MUT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MUT")));
|
||||||
STTA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTA")));
|
STTA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTA")));
|
||||||
@@ -186,7 +183,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
|
|
||||||
MTT_values = new ObservableCollection<DateTimePoint>(MTT_items);
|
MTT_values = new ObservableCollection<DateTimePoint>(MTT_items);
|
||||||
MTL_values = new ObservableCollection<DateTimePoint>(MTL_items);
|
MTL_values = new ObservableCollection<DateTimePoint>(MTL_items);
|
||||||
MTH_values = new ObservableCollection<DateTimePoint>(MTH_items);
|
// MTH_values = new ObservableCollection<DateTimePoint>(MTH_items);
|
||||||
MST_values = new ObservableCollection<DateTimePoint>(MST_items);
|
MST_values = new ObservableCollection<DateTimePoint>(MST_items);
|
||||||
MUT_values = new ObservableCollection<DateTimePoint>(MUT_items);
|
MUT_values = new ObservableCollection<DateTimePoint>(MUT_items);
|
||||||
STTA_values = new ObservableCollection<DateTimePoint>(STTA_items);
|
STTA_values = new ObservableCollection<DateTimePoint>(STTA_items);
|
||||||
@@ -198,7 +195,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
|
|
||||||
Series = new ISeries[]
|
Series = new ISeries[]
|
||||||
{
|
{
|
||||||
new LineSeries<DateTimePoint>
|
/* new LineSeries<DateTimePoint>
|
||||||
{
|
{
|
||||||
Name = Properties.Resources.MasterCylinder +"PH",
|
Name = Properties.Resources.MasterCylinder +"PH",
|
||||||
Values = MTH_values,
|
Values = MTH_values,
|
||||||
@@ -208,7 +205,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
Fill = null,
|
Fill = null,
|
||||||
LineSmoothness = 0,
|
LineSmoothness = 0,
|
||||||
ScalesYAt = 2,
|
ScalesYAt = 2,
|
||||||
}, //PH
|
}, *///PH
|
||||||
new LineSeries<DateTimePoint>
|
new LineSeries<DateTimePoint>
|
||||||
{
|
{
|
||||||
Name = Resources.Target + Resources.Temperature,
|
Name = Resources.Target + Resources.Temperature,
|
||||||
|
|||||||
@@ -1062,8 +1062,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD1")));
|
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD1")));
|
||||||
AsyncSerialPortClient._responseEvent.Set();
|
AsyncSerialPortClient._responseEvent.Set();
|
||||||
|
|
||||||
Thread myThread1 = new Thread(Port1_link);
|
Port1_link();
|
||||||
myThread1.Start();
|
|
||||||
}
|
}
|
||||||
if (Machines.Select("Type='false' AND Serial='PORT2'").Length > 0)
|
if (Machines.Select("Type='false' AND Serial='PORT2'").Length > 0)
|
||||||
{
|
{
|
||||||
@@ -1075,8 +1074,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD2")));
|
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD2")));
|
||||||
AsyncSerialPortClient._responseEvent2.Set();
|
AsyncSerialPortClient._responseEvent2.Set();
|
||||||
|
|
||||||
Thread myThread2 = new Thread(Port2_link);
|
Port2_link();
|
||||||
myThread2.Start();
|
|
||||||
}
|
}
|
||||||
if (Machines.Select("Type='false' AND Serial='PORT3'").Length > 0)
|
if (Machines.Select("Type='false' AND Serial='PORT3'").Length > 0)
|
||||||
{
|
{
|
||||||
@@ -1088,8 +1086,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD3")));
|
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD3")));
|
||||||
AsyncSerialPortClient._responseEvent3.Set();
|
AsyncSerialPortClient._responseEvent3.Set();
|
||||||
|
|
||||||
Thread myThread3 = new Thread(Port3_link);
|
Port3_link();
|
||||||
myThread3.Start();
|
|
||||||
}
|
}
|
||||||
if (Machines.Select("Type='false' AND Serial='PORT4'").Length > 0)
|
if (Machines.Select("Type='false' AND Serial='PORT4'").Length > 0)
|
||||||
{
|
{
|
||||||
@@ -1101,13 +1098,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD4")));
|
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD4")));
|
||||||
AsyncSerialPortClient._responseEvent4.Set();
|
AsyncSerialPortClient._responseEvent4.Set();
|
||||||
|
|
||||||
Thread myThread4 = new Thread(Port4_link);
|
Port4_link();
|
||||||
myThread4.Start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void Port1_link()
|
private async void Port1_link()
|
||||||
{
|
{
|
||||||
while (true)
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
while (MachiensPortClient[0].Online )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1150,10 +1148,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}//发送
|
}//发送
|
||||||
private void Port2_link()
|
private async void Port2_link()
|
||||||
{
|
{
|
||||||
while (true)
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
while (MachiensPortClient[1].Online)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1196,10 +1197,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}//发送
|
}//发送
|
||||||
private void Port3_link()
|
private async void Port3_link()
|
||||||
{
|
{
|
||||||
while (true)
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
while (MachiensPortClient[2].Online)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1242,10 +1246,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}//发送
|
}//发送
|
||||||
private void Port4_link()
|
private async void Port4_link()
|
||||||
{
|
{
|
||||||
while (true)
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
while (MachiensPortClient[3].Online)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1288,6 +1295,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}//发送
|
}//发送
|
||||||
|
|
||||||
public static string SYS_WorkNumder; //工单号
|
public static string SYS_WorkNumder; //工单号
|
||||||
|
|||||||
Reference in new issue
Block a user