|
|
|
@ -13,6 +13,7 @@ using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using static Rs.MotionPlat.Commom.SchedulingAlarms;
|
|
|
|
|
using static Rs.MotionPlat.Commom.SchedulingSilo;
|
|
|
|
|
using static System.Windows.Forms.AxHost;
|
|
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
@ -24,6 +25,7 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
TcpClientHelper client = new TcpClientHelper("127.0.0.1",2048);
|
|
|
|
|
SchedulingResult schedulResult = new SchedulingResult();
|
|
|
|
|
SchedulingMaterial sm;
|
|
|
|
|
Dictionary<int, AlarmItem> alarmInfos = new Dictionary<int, AlarmItem>();
|
|
|
|
|
public event Action<string> ReciveTaskEvent;
|
|
|
|
|
public event Action<string> ReplayTaskEvent;
|
|
|
|
|
private TestCenter() {
|
|
|
|
@ -244,6 +246,17 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
case EInstruction.SetAlarms:
|
|
|
|
|
break;
|
|
|
|
|
case EInstruction.CancelAlarms:
|
|
|
|
|
SchedulingAlarms alarms= JsonConvert.DeserializeObject<SchedulingAlarms>(msg);
|
|
|
|
|
if(alarms!=null&&alarms.Alarms!=null&&alarms.Alarms.Count>0)
|
|
|
|
|
{
|
|
|
|
|
foreach (AlarmItem alarm in alarms.Alarms)
|
|
|
|
|
{
|
|
|
|
|
if(!alarmInfos.ContainsKey(alarm.NO))
|
|
|
|
|
{
|
|
|
|
|
alarmInfos.Add(alarm.NO, alarm);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EInstruction.TakingError:
|
|
|
|
|
break;
|
|
|
|
@ -262,6 +275,18 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlarmItem? GetAlarm(int no)
|
|
|
|
|
{
|
|
|
|
|
AlarmItem? ret = null;
|
|
|
|
|
if (alarmInfos.ContainsKey(no))
|
|
|
|
|
{
|
|
|
|
|
ret = alarmInfos[no];
|
|
|
|
|
alarmInfos.Remove(no);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 重排
|
|
|
|
|
/// </summary>
|
|
|
|
@ -484,30 +509,34 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
public bool LoadResult()
|
|
|
|
|
{
|
|
|
|
|
string content = LoadAndUnloadTask.Instance.GetLoadString();
|
|
|
|
|
return Send(content) > 0;
|
|
|
|
|
return Send(content, Encoding.ASCII) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool LoadTestLoadResult()
|
|
|
|
|
{
|
|
|
|
|
string content = LoadAndUnloadTask.Instance.GetTestLoadString();
|
|
|
|
|
return Send(content) > 0;
|
|
|
|
|
return Send(content, Encoding.ASCII) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool LoadTestUnLoadResult()
|
|
|
|
|
{
|
|
|
|
|
string content = LoadAndUnloadTask.Instance.GetTestUnLoadString();
|
|
|
|
|
return Send(content) > 0;
|
|
|
|
|
return Send(content, Encoding.ASCII) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Send(string content,bool writeLog=true)
|
|
|
|
|
public int Send(string content,Encoding encode,bool writeLog=true)
|
|
|
|
|
{
|
|
|
|
|
int len = client.Send(content);
|
|
|
|
|
if(len>0 && writeLog)
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Debug(" <<< " + content);
|
|
|
|
|
return len;
|
|
|
|
|
int len = client.Send(content, encode);
|
|
|
|
|
if (len > 0 && writeLog)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Debug(" <<< " + content);
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 上报信息给中控
|
|
|
|
@ -519,12 +548,12 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
if(scheduing.Instruction== EInstruction.InquireStatus)
|
|
|
|
|
{
|
|
|
|
|
string content = JsonConvert.SerializeObject(scheduing, new StringEnumConverter());
|
|
|
|
|
return Send(content,false);
|
|
|
|
|
return Send(content, Encoding.ASCII,false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string content = JsonConvert.SerializeObject(scheduing, new StringEnumConverter());
|
|
|
|
|
return Send(content);
|
|
|
|
|
return Send(content, Encoding.ASCII);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -533,7 +562,7 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
Scheduling s = new Scheduling();
|
|
|
|
|
s.Instruction = EInstruction.EndInput;
|
|
|
|
|
string content = JsonConvert.SerializeObject(s, new StringEnumConverter());
|
|
|
|
|
Send(content);
|
|
|
|
|
Send(content, Encoding.ASCII);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|