|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
using HalconDotNet;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Newtonsoft.Json.Converters;
|
|
|
|
|
using Rs.AutoDischarge.V3.Flow;
|
|
|
|
|
using Rs.Framework;
|
|
|
|
|
using Rs.MotionPlat.Commom;
|
|
|
|
|
using System;
|
|
|
|
@ -8,7 +9,9 @@ using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using static Rs.MotionPlat.Commom.SchedulingSilo;
|
|
|
|
|
using static System.Windows.Forms.AxHost;
|
|
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
|
|
|
|
|
@ -16,7 +19,7 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
{
|
|
|
|
|
public class TestCenter
|
|
|
|
|
{
|
|
|
|
|
TcpClientHelper client = new TcpClientHelper("10.86.15.67",2048);
|
|
|
|
|
TcpClientHelper client = new TcpClientHelper("127.0.0.1",2048);
|
|
|
|
|
SchedulingResult schedulResult = new SchedulingResult();
|
|
|
|
|
SchedulingMaterial sm;
|
|
|
|
|
public event Action<string> ReciveTaskEvent;
|
|
|
|
@ -79,11 +82,14 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
EInstruction eInstructioneInstruction = schedule.Instruction;
|
|
|
|
|
switch (eInstructioneInstruction)
|
|
|
|
|
{
|
|
|
|
|
case EInstruction.Rearrange:
|
|
|
|
|
Rearrange(json);
|
|
|
|
|
break;
|
|
|
|
|
case EInstruction.InquireSiloStatus:
|
|
|
|
|
InquireSiloStatus(json);
|
|
|
|
|
break;
|
|
|
|
|
case EInstruction.RequestSwitchTray:
|
|
|
|
|
|
|
|
|
|
RequestSwitchTray(json);
|
|
|
|
|
break;
|
|
|
|
|
case EInstruction.InquireConnectionInfo:
|
|
|
|
|
InquireConnectionInfo(json);
|
|
|
|
@ -193,10 +199,6 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
break;
|
|
|
|
|
case EInstruction.CancelTakingError:
|
|
|
|
|
break;
|
|
|
|
|
case EInstruction.Rearrange:
|
|
|
|
|
break;
|
|
|
|
|
case EInstruction.RearrangeResult:
|
|
|
|
|
break;
|
|
|
|
|
case EInstruction.ScanBarcode:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -210,6 +212,20 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Rearrange(string json)
|
|
|
|
|
{
|
|
|
|
|
MachineManage.Instance.RunState = ERunState.Busying;
|
|
|
|
|
SiloRearrange info = JsonConvert.DeserializeObject<SiloRearrange>(json);
|
|
|
|
|
Send(info);
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
|
|
|
|
|
|
TurnoverInfos tis = new TurnoverInfos();
|
|
|
|
|
tis.GroupID = 0;
|
|
|
|
|
tis.Instruction = EInstruction.RearrangeResult;
|
|
|
|
|
Send(tis);
|
|
|
|
|
MachineManage.Instance.RunState = ERunState.Waiting;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadAndUnload(string json)
|
|
|
|
|
{
|
|
|
|
@ -240,36 +256,65 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
private void InquireSiloStatus(string json)
|
|
|
|
|
{
|
|
|
|
|
SchedulingSilo inquireSilo = JsonConvert.DeserializeObject<SchedulingSilo>(json);
|
|
|
|
|
inquireSilo.SiloFloor = 1;
|
|
|
|
|
switch (inquireSilo.SiloType)
|
|
|
|
|
{
|
|
|
|
|
case SchedulingSiloBase.ESiloType.ToBeTested:
|
|
|
|
|
inquireSilo.SiloStatus = SchedulingSilo.ESiloStatus.Standby;
|
|
|
|
|
inquireSilo.SiloStatus = TranlateSiloStatus(StockManager.Instance.GetStockStatus(EStockType.Input));
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.Passed:
|
|
|
|
|
inquireSilo.SiloStatus = SchedulingSilo.ESiloStatus.Standby;
|
|
|
|
|
inquireSilo.SiloStatus = TranlateSiloStatus(StockManager.Instance.GetStockStatus(EStockType.Ok));
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.Failed:
|
|
|
|
|
inquireSilo.SiloStatus = SchedulingSilo.ESiloStatus.Standby;
|
|
|
|
|
inquireSilo.SiloStatus = TranlateSiloStatus(StockManager.Instance.GetStockStatus(EStockType.Ng));
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.Multifunction:
|
|
|
|
|
inquireSilo.SiloStatus = SchedulingSilo.ESiloStatus.Standby;
|
|
|
|
|
inquireSilo.SiloStatus = TranlateSiloStatus(StockManager.Instance.GetStockStatus(EStockType.Multi));
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.EmptyInput:
|
|
|
|
|
inquireSilo.SiloStatus = SchedulingSilo.ESiloStatus.Standby;// StockManager.Instance.GetStockStatus(EStockType.Empty1);
|
|
|
|
|
inquireSilo.SiloStatus = TranlateSiloStatus(StockManager.Instance.GetStockStatus(EStockType.Empty1));
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.EmptyOutput:
|
|
|
|
|
inquireSilo.SiloStatus = SchedulingSilo.ESiloStatus.Standby;
|
|
|
|
|
inquireSilo.SiloStatus = TranlateSiloStatus(StockManager.Instance.GetStockStatus(EStockType.Empty2));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
TestCenter.instance.Send(inquireSilo);
|
|
|
|
|
//查询料仓状态
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ESiloStatus TranlateSiloStatus(ETrayStatus status)
|
|
|
|
|
{
|
|
|
|
|
if (status == ETrayStatus.Loading || status == ETrayStatus.Unloading)
|
|
|
|
|
return ESiloStatus.Switching;
|
|
|
|
|
else if (status == ETrayStatus.Loaded || status == ETrayStatus.Unloaded)
|
|
|
|
|
return ESiloStatus.Standby;
|
|
|
|
|
return ESiloStatus.Stopped;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 请求切盘
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void RequestSwitchTray(string json)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
SchedulingSilo inquireSilo = JsonConvert.DeserializeObject<SchedulingSilo>(json);
|
|
|
|
|
switch (inquireSilo.SiloType)
|
|
|
|
|
{
|
|
|
|
|
case SchedulingSiloBase.ESiloType.ToBeTested:
|
|
|
|
|
StockManager.Instance.UnLoad(EStockType.Input);
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.Passed:
|
|
|
|
|
StockManager.Instance.UnLoad(EStockType.Ok);
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.Failed:
|
|
|
|
|
StockManager.Instance.UnLoad(EStockType.Ng);
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.Multifunction:
|
|
|
|
|
StockManager.Instance.UnLoad(EStockType.Multi);
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.EmptyInput:
|
|
|
|
|
break;
|
|
|
|
|
case SchedulingSiloBase.ESiloType.EmptyOutput:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -353,5 +398,40 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
string content = JsonConvert.SerializeObject(msgBox, new StringEnumConverter());
|
|
|
|
|
client.Send(content,Encoding.UTF8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SwitchTray(EStockType stockType,int floor)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert($"{stockType} 切盘中");
|
|
|
|
|
SchedulingSilo tray = new SchedulingSilo();
|
|
|
|
|
tray.Instruction = EInstruction.BeginSwitchTray;
|
|
|
|
|
tray.SiloFloor = floor;
|
|
|
|
|
tray.TurnoverID = 0;
|
|
|
|
|
tray.GroupID = 0;
|
|
|
|
|
tray.SiloStatus = ESiloStatus.Switching;
|
|
|
|
|
switch (stockType)
|
|
|
|
|
{
|
|
|
|
|
case EStockType.Empty1:
|
|
|
|
|
tray.SiloType = SchedulingSiloBase.ESiloType.EmptyInput;
|
|
|
|
|
break;
|
|
|
|
|
case EStockType.Input:
|
|
|
|
|
tray.SiloType = SchedulingSiloBase.ESiloType.ToBeTested;
|
|
|
|
|
break;
|
|
|
|
|
case EStockType.Ok:
|
|
|
|
|
tray.SiloType = SchedulingSiloBase.ESiloType.Passed;
|
|
|
|
|
break;
|
|
|
|
|
case EStockType.Ng:
|
|
|
|
|
tray.SiloType = SchedulingSiloBase.ESiloType.Failed;
|
|
|
|
|
break;
|
|
|
|
|
case EStockType.Multi:
|
|
|
|
|
tray.SiloType = SchedulingSiloBase.ESiloType.Multifunction;
|
|
|
|
|
break;
|
|
|
|
|
case EStockType.Empty2:
|
|
|
|
|
tray.SiloType = SchedulingSiloBase.ESiloType.EmptyOutput;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Send(tray);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|