Browse Source

呼叫相关功能

master
sc 2 months ago
parent
commit
3d501babf9
  1. 19
      UserClass/AsyncTcpClient.cs
  2. 7
      View/MonitorView.xaml
  3. 18
      ViewModel/MainWindowViewModel.cs

19
UserClass/AsyncTcpClient.cs

@ -25,6 +25,7 @@ using System.Xml.Linq;
using TouchSocket.Core; using TouchSocket.Core;
using TouchSocket.Sockets; using TouchSocket.Sockets;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static SunlightCentralizedControlManagement_SCCM_.View.MachinesView;
using static System.Windows.Forms.AxHost; using static System.Windows.Forms.AxHost;
using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock; using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
@ -128,7 +129,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.BeginEdit(); drEmployee.BeginEdit();
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString(); drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
// drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString(); // drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString(); drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString();
drEmployee["State"] = "802"; drEmployee["State"] = "802";
drEmployee.EndEdit(); drEmployee.EndEdit();
@ -168,11 +169,21 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
} }
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") else if (SYSAPI == "SC827")
{ {
try try
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MainWindowViewModel.Dyelot_CALL = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//呼叫领料单
else if (SYSAPI == "SC830")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
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);//反序列化
@ -244,9 +255,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{ {
try try
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MonitorView.Product_DAT = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化 MonitorView.Product_DAT = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
MonitorView.Product_bool=true; MonitorView.Product_bool = true;
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//当前领料单信息 }//当前领料单信息

7
View/MonitorView.xaml

@ -120,16 +120,15 @@
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition Width="5"/> <ColumnDefinition Width="5"/>
<ColumnDefinition/> <ColumnDefinition MinWidth="1200"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" SelectionChanged="Gridstep_SelectionChanged" <DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" SelectionChanged="Gridstep_SelectionChanged"
d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30" d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White"
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" BorderBrush="{x:Null}" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" BorderBrush="{x:Null}"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" AllowDrop="False" CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" CanUserAddRows="False">
HeadersVisibility ="Column" >
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="IsHitTestVisible" Value="{Binding DataContext.IsInteractive, <Setter Property="IsHitTestVisible" Value="{Binding DataContext.IsInteractive,

18
ViewModel/MainWindowViewModel.cs

@ -73,6 +73,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
public static DataTable Machines = new DataTable(); //设备表缓存 public static DataTable Machines = new DataTable(); //设备表缓存
// public static DataRow MachinesROW; // public static DataRow MachinesROW;
public static DataTable USER_data = new DataTable(); public static DataTable USER_data = new DataTable();
public static DataTable Dyelot_CALL = new DataTable();
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡 public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
public static int ERR_c = 0;//错误计数器 public static int ERR_c = 0;//错误计数器
public static bool[] USER_Capacity { set; get; } = new bool[99]; public static bool[] USER_Capacity { set; get; } = new bool[99];
@ -318,7 +319,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
/**染机用户信息**/ /**染机用户信息**/
try try
{ {
if (Selet_Machines(Machines, "UserInfoStart", "ID='" + i + "'").ToString() == "901") if ((int)Selet_Machines(Machines, "UserInfoStart", "ID='" + i + "'") == 901)
{ {
MainWindow.InfData.Rows.Add(new object[] { MainWindow.InfData.Rows.Add(new object[] {
Selet_Machines(Machines, "Name", "ID='" + i + "'"), Selet_Machines(Machines, "Name", "ID='" + i + "'"),
@ -333,9 +334,22 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
} }
} }
catch (Exception) { } catch (Exception) { }
try
{
if ((bool)Selet_Machines(Machines, "CALL", "ID='" + i + "'"))
{
stringQueue.Enqueue(new QueueString
{
ID = i,
DAT = "SC827" + Selet_Machines(Machines, "SYSKEY", "ID='" + i + "'")
});
}
}
catch (Exception) { }
}
}
} }
void Tick_Event_60S() void Tick_Event_60S()
{ {

Loading…
Cancel
Save