Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement
This commit is contained in:
commit
35ea203af1
4 files changed
+58
-10
No files matched your search
@@ -106,6 +106,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
drEmployee.ClearErrors();
|
drEmployee.ClearErrors();
|
||||||
}
|
}
|
||||||
|
else if (SYSAPI == "SC832")
|
||||||
|
{
|
||||||
|
MonitorView.Sys_log = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
|
||||||
|
}//当前细节信息
|
||||||
else if (SYSAPI == "SC851")
|
else if (SYSAPI == "SC851")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
<DataGridTextColumn Binding="{Binding DYELOT}" Width="0" MinWidth="0" MaxWidth="0"/>
|
<DataGridTextColumn Binding="{Binding DYELOT}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<TextBlock x:Name="log" HorizontalAlignment="Left" Margin="0,300,0,50" TextWrapping="Wrap" Width="700" FontSize="25" Background="White" Text="{Binding Sys_log}"/>
|
<TextBlock x:Name="log" HorizontalAlignment="Left" Margin="0,300,0,50" TextWrapping="Wrap" Width="700" FontSize="25" Background="White"/>
|
||||||
<StackPanel x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="700" HorizontalAlignment="Left">
|
<StackPanel x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="700" HorizontalAlignment="Left">
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_DyeingMachine">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_DyeingMachine">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -13,6 +14,10 @@ using System.Windows.Media;
|
|||||||
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 System.Xml.Linq;
|
||||||
|
using TouchSocket.Sockets;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
|
||||||
|
|
||||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||||
{
|
{
|
||||||
@@ -25,14 +30,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
||||||
|
CountDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private string machine;
|
||||||
|
private string workOrder;
|
||||||
|
private string dyelot;
|
||||||
|
public static string Sys_log;
|
||||||
|
|
||||||
|
private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)//设备列表
|
||||||
{
|
{
|
||||||
|
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;//定位第列,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Gridstep_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void Gridstep_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -80,5 +95,35 @@ namespace SunlightCentralizedControlManagement_SCCM_.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 (!string.IsNullOrEmpty(machine))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
|
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
|
||||||
|
{
|
||||||
|
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC832" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index));
|
||||||
|
log.Text = Sys_log;
|
||||||
|
}
|
||||||
|
else { log.Text = null; }
|
||||||
|
}
|
||||||
|
catch (Exception ) { log.Text = null; }//返回错误为空
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
MachiensTcpClient[i].SendAsync("SC800:SCCM[" + MachiensTcpClient[i].IP + ";" + MachiensTcpClient[i].Port + "]");
|
MachiensTcpClient[i].SendAsync("SC800:SCCM[" + MachiensTcpClient[i].IP + ";" + MachiensTcpClient[i].Port + "]");
|
||||||
}
|
}
|
||||||
// MachiensTcpClient[1].SendAsync("SC851BED2E58B6EBB4BD4");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,12 +103,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < Machinesdata_Count; i++)
|
for (int i = 0; i < Machinesdata_Count; i++)
|
||||||
{
|
{
|
||||||
if (Selet_Machines(Machines, "State", i).ToString() == "101")
|
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());
|
MachiensTcpClient[i].SendAsync("SC830" + Selet_Machines(Machines, "SYSKEY", i).ToString());
|
||||||
|
|
||||||
// DataRow dt = machinesdata[i];
|
|
||||||
//Updata_Machines(Machines, Convert.ToInt16(dt["ID"]), "State", "800");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +127,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
TcpClientNEW();
|
TcpClientNEW();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly TcpClient[] MachiensTcpClient = new TcpClient[999];
|
public static TcpClient[] MachiensTcpClient = new TcpClient[999];
|
||||||
public int Machinesdata_Count;
|
public int Machinesdata_Count;
|
||||||
public void TcpClientNEW()
|
public void TcpClientNEW()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user