Home > Back-end >  C
C

Time:10-19

Using CommonLib.com mon;
Using CommonLib. Data;
Using CommonLib. DataStruct;
Using CommonLib. StepData;
Using CommonLib;
Using DBCAnalysis;
Using BAT.Com mon. LocalResourcess;
Using LogRecord;
Using NetConnectHelper.Net Args.
Using NetConnectHelper.Net Data;
Using sinexcel. Actions;
Using sinexcel.com mon;
Using sinexcel. Data;
Using SqliteDataServer;
Using System;
Using System. Collections. Generic;
Using System. The Data;
Using System. Diagnostics;
Using System. Linq;
using System.Text;
Using System. The Threading;
Using System. The Threading. The Tasks;
Using SystemComBuffer;
Using BAT. TD;
Using System. IO;
Using CustomControls. Forms;
Using sinexcel. Client;
Using BAT. Framework;
Using NetConnectHelper. CmdPackage;
Using BAT. TD. Model;

The namespace sinexcel. Buffer
{
Public class RealDataBuffer
{
//private Dictionary ACWarmTimeRecord=new Dictionary (a);
//private Dictionary DCWarmTimeRecord=new Dictionary (a);
Private event ActionLogHandle ActionExcuteLog;
Private static RealDataBuffer _instance=null;
Public static RealDataBuffer Instance
{
The get
{
If (_instance==null)
{
_instance=new RealDataBuffer ();

}
Return _instance.
}
}

Task refrechTdControlTask=null;
Task refrechUiTask=null;
CancellationTokenSource canRefresh=new CancellationTokenSource ();
AutoResetEvent refrechUiEvent=new AutoResetEvent (false);
Public Action UpdateHandle=null;
Private object lockobj=new object ();
Bool ModifyFlag=false;
Private Dictionary _realDataQueue=new Dictionary (a);

Private DataTable realList=null;

Public Dictionary RealDataQueue
{
The get {return _realDataQueue; }
}
Public DataTable RealList
{
The get {return realList; }
}

Public void AddDeviceChannels (DeviceInfo dev)
{
Try
{
The lock (lockobj)
{
ModifyFlag=true;
List ParalleledSub=new List (a);
List PschList=new List (a);
Var odList=the from s in dev. ChInfo orderby s.c hId the select s;
Foreach (ChInfoEx chinfo odList) in//dev chinfo
{
The string key=dev. IpAddress + "-" + chinfo. ChId.
If (_realDataQueue. Either ContainsKey (key))
{
ChannelObject chobj=_realDataQueue [key];
Chobj. IsVisible=true;
Chobj. Addr=dev. IpAddress;
Chobj. Unit=dev. Unit;
Chobj. Chid=chinfo. Chid;
Chobj. RecordNum=chinfo. RecordNum;
Chobj. Stepguid=chinfo. Stepguid;
Chobj. Barcoder=chinfo. Barcode;
Chobj. Hisguid=chinfo. HisPath;
Chobj. Paralleled=false;

If (pschList. The Contains (chobj. Chid))
{
Chobj. Paralleled=true;
ParalleledSub. Add (key);
}
The else
{
List PSCHS=new List (a);
Foreach (Int16 ch in chinfo. PchMap)
{
If (chobj Chid!=ch)
{
PSCHS. Add (ch);
if (! PschList. The Contains (ch))
{
PschList. Add (ch);
String skey=dev. IpAddress + "-" + ch;
ParalleledSub. Add (skey);
}
}
}
Chobj. ParalleChannels=PSCHS. ToArray ();
}

If (chobj RealtimeAuxData=null https://bbs.csdn.net/topics/=
{
Chobj. RealtimeAuxData=https://bbs.csdn.net/topics/new RealtimeAuxData ();
}
Chobj. RealtimeAuxData. SingleSpecialV=dev. SingleSpecialV;
Chobj. RealtimeAuxData. SingleSpecialVFlag=dev. SingleSpecialVFlag;
Chobj. RealtimeAuxData. SingleSpecialT=dev. SingleSpecialT;
Chobj. RealtimeAuxData. SingleSpecialTFlag=dev. SingleSpecialTFlag;
Chobj. RealtimeAuxData. SingleSpecialP=dev. SingleSpecialP;
Chobj. RealtimeAuxData. Voice=dev. Voice;
Chobj. RealtimeAuxData. SingleSpecialPFlag=dev. SingleSpecialPFlag;

If (chobj RealtimeBmsData=null https://bbs.csdn.net/topics/=
{
Chobj. RealtimeBmsData=https://bbs.csdn.net/topics/new RealtimeBmsData ();
}
}
The else
{
ChannelObject chobj=new ChannelObject ();
Chobj. IsVisible=true;
Chobj. Addr=dev. IpAddress;
Chobj. Unit=dev. Unit;
Chobj. Chid=chinfo. Chid;
Chobj. RecordNum=chinfo. RecordNum;
Chobj. Stepguid=chinfo. Stepguid;
Chobj. Barcoder=chinfo. Barcode;
Chobj. Hisguid=chinfo. HisPath;
Chobj. Paralleled=false;
If (pschList. The Contains (chobj. Chid))//when the channel parallel subchannel
{
Chobj. Paralleled=true;
ParalleledSub. Add (key);
}
The else
{
List PSCHS=new List (a);
Foreach (Int16 ch in chinfo. PchMap)
{
If (chobj Chid!=ch)
{
PSCHS. Add (ch);
if (! nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull