Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement
This commit is contained in:
commit
b15d8a1eab
4 files changed
+67
-14
No files matched your search
@@ -162,7 +162,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
a.UseCheckClear()
|
||||
.SetCheckClearType(CheckClearType.All)
|
||||
.SetTick(TimeSpan.FromSeconds(10))
|
||||
.SetTick(TimeSpan.FromSeconds(30))
|
||||
.SetOnClose((c, t) =>
|
||||
{
|
||||
c.TryShutdown();
|
||||
|
||||
+19
-1
@@ -7,9 +7,13 @@
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
||||
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="1000" d:DesignWidth="1900">
|
||||
<UserControl.Resources>
|
||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="300"/>
|
||||
@@ -54,7 +58,21 @@
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="150" IsReadOnly="True"/>
|
||||
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="150" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="200" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Temperature}" Binding="{Binding Temperature}" Width="100" IsReadOnly="True"/>
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
machine = (Griddata.Columns[0].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
workOrder = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
dyelot = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
machine = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
workOrder = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
dyelot = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
|
||||
machin_LOG.Text = Properties.Resources.Machine+":"+machine+" "+Properties.Resources.WorkOrder+":"+workOrder;
|
||||
}
|
||||
@@ -224,7 +224,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
if (machines_info == 0)
|
||||
{
|
||||
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC832" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index));
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString { ID=index,DAT= "SC832" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) });
|
||||
|
||||
// MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC832" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index));
|
||||
}//信息
|
||||
else if (machines_info == 1)
|
||||
{
|
||||
@@ -232,7 +234,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}//输送状态
|
||||
else if (machines_info == 2)
|
||||
{
|
||||
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC833" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index));
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString { ID = index, DAT = "SC833" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) });
|
||||
|
||||
// MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC833" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index));
|
||||
}//单据
|
||||
}
|
||||
else
|
||||
@@ -242,7 +246,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
|
||||
{
|
||||
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC831" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index));
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString { ID = index, DAT = "SC831" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) });
|
||||
|
||||
// MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC831" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -101,6 +101,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
};
|
||||
disTimer.Tick += new EventHandler(DisTimer_500MS);//每一秒执行的方法
|
||||
disTimer.Start();//计时开始
|
||||
|
||||
DispatcherTimer dis50ms = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(50) //毫秒
|
||||
};
|
||||
dis50ms.Tick += new EventHandler(DisTimer_50MS);//每一秒执行的方法
|
||||
dis50ms.Start();//计时开始
|
||||
}//时间周期初始化
|
||||
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||
{
|
||||
@@ -116,13 +123,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
//Updata_Machines(Machines, Convert.ToInt16(dt["ID"]), "State", "800");
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < Machinesdata_Count; i++)
|
||||
for (int i = 0; i < Machinesdata_Count; i++)
|
||||
{
|
||||
string mac_s = Selet_Machines(Machines, "State", i).ToString();
|
||||
if ((mac_s == "101") || (mac_s == "201") || (mac_s == "202") || (mac_s == "309"))//获取信息
|
||||
{
|
||||
MachiensTcpClient[i].SendAsync("SC830" + Selet_Machines(Machines, "SYSKEY", i).ToString());
|
||||
stringQueue.Enqueue(new QueueString { ID = i, DAT = "SC830" + Selet_Machines(Machines, "SYSKEY", i).ToString() });//信息插入队列
|
||||
|
||||
// MachiensTcpClient[i].SendAsync("SC830" + Selet_Machines(Machines, "SYSKEY", i).ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,15 +142,22 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
if (Selet_Machines(Machines, "State", i).ToString() == "801")
|
||||
{
|
||||
MachiensTcpClient[i].SendAsync("SC800:SCCM[" + MachiensTcpClient[i].IP + ";" + MachiensTcpClient[i].Port + "]");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
void DisTimer_500MS(object sender, EventArgs e)//Tick_Event周期执行事件500MS
|
||||
{
|
||||
DATA_view();
|
||||
|
||||
|
||||
|
||||
}
|
||||
void DisTimer_50MS(object sender, EventArgs e)//Tick_Event周期执行事件50MS
|
||||
{
|
||||
if (stringQueue.Count > 0) //信息发送队列
|
||||
{
|
||||
QueueString t= stringQueue.Dequeue();
|
||||
MachiensTcpClient[t.ID].SendAsync(t.DAT);
|
||||
}
|
||||
}
|
||||
|
||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
@@ -369,7 +384,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
public string Process { get; set; }
|
||||
public string Step { get; set; }
|
||||
public string Message { get; set; }
|
||||
|
||||
public string State { get; set; }
|
||||
|
||||
}
|
||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||
{
|
||||
@@ -418,5 +434,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
//通讯队列
|
||||
public class QueueString
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string DAT { get; set; }
|
||||
}
|
||||
public static class Queue
|
||||
{
|
||||
public static int ID { get; set; }
|
||||
public static string DAT { get; set; }
|
||||
}
|
||||
// 创建一个字符串类型的队列
|
||||
public static Queue<QueueString> stringQueue = new Queue<QueueString>();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user