Commit e5f96595 刘韬

1

1 个父辈 6f4bfe8d
......@@ -92,6 +92,7 @@
<Compile Include="theMachine\Common.cs" />
<Compile Include="theMachine\JobList.cs" />
<Compile Include="theMachine\LabelParam.cs" />
<Compile Include="theMachine\DeviceRunControl.cs" />
<Compile Include="theMachine\MainMachine _BtnProcess.cs" />
<Compile Include="theMachine\DeviceBase.cs" />
<Compile Include="theMachine\MainMachine _IOMonitor.cs" />
......@@ -114,6 +115,7 @@
<Compile Include="theMachine\sub\TrayStop.cs" />
<Compile Include="theMachine\sub\TransplantMove.cs" />
<Compile Include="theMachine\sub\SideMove.cs" />
<Compile Include="theMachine\TrayManager.cs" />
<Compile Include="userControl\AxisMoveControl.cs">
<SubType>UserControl</SubType>
</Compile>
......
......@@ -12,12 +12,14 @@ namespace DeviceLibrary
{
string High;
string Low;
string DeviceGroup;
string Name;
IO_VALUE currentIOvalue = IO_VALUE.None;
public CylinderManger(string name,string high,string low) {
public CylinderManger(string name,string devicegroup,string high,string low) {
High = high;
Low = low;
Name = name;
DeviceGroup = devicegroup;
SafetyDevice.AddDevice(this);
}
public void ToHigh(MoveInfo moveInfo) {
......@@ -59,16 +61,16 @@ namespace DeviceLibrary
return;
}
IOManager.IOMove(Low, IO_VALUE.LOW);
IOManager.IOMove(High, IO_VALUE.LOW);
IOManager.IOMove(Low, IO_VALUE.LOW, DeviceGroup);
IOManager.IOMove(High, IO_VALUE.LOW, DeviceGroup);
}
public void Resume()
{
if (currentIOvalue == IO_VALUE.None)
return;
IOManager.IOMove(Low, currentIOvalue == IO_VALUE.LOW ? IO_VALUE.HIGH : IO_VALUE.LOW);
IOManager.IOMove(High, currentIOvalue == IO_VALUE.HIGH ? IO_VALUE.HIGH : IO_VALUE.LOW);
IOManager.IOMove(Low, currentIOvalue == IO_VALUE.LOW ? IO_VALUE.HIGH : IO_VALUE.LOW, DeviceGroup);
IOManager.IOMove(High, currentIOvalue == IO_VALUE.HIGH ? IO_VALUE.HIGH : IO_VALUE.LOW, DeviceGroup);
LogUtil.info($"{Name},恢复运行");
}
......
......@@ -328,7 +328,7 @@ namespace DeviceLibrary
Dictionary<string, List<Msg>> l = new Dictionary<string, List<Msg>>();
foreach (var k in MSList.Keys)
{
l.Add(k, MsgService.MSList[k].get()[k]);
l.Add(k, MsgService.MSList[k].get());
}
return l;
}
......@@ -339,7 +339,7 @@ namespace DeviceLibrary
MSList.Add(Device, this);
}
public List<Msg> msg = new List<Msg>();
public Dictionary<string, List<Msg>> get()
public List<Msg> get()
{
if (_setlogones)
{
......@@ -347,9 +347,9 @@ namespace DeviceLibrary
foreach (var m in msg)
LogUtil.info(m.msgtxt);
}
Dictionary<string, List<Msg>> l = new Dictionary<string, List<Msg>>();
l.Add(Device, new List<Msg>(msg));
return l;
//Dictionary<string, List<Msg>> l = new Dictionary<string, List<Msg>>();
//l.Add(Device, new List<Msg>(msg));
return new List<Msg>(msg);
}
public void add(string m, MsgLevel ml, ErrInfo errInfo = ErrInfo.Empty)
{
......
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
public class DeviceRunControl
{
public static List<ManualResetEvent> manualResets = new List<ManualResetEvent>();
List<IDevice> DevicesList;
string DeviceListName;
public delegate void ProcessMsg(List<Msg> msg);
public event ProcessMsg ProcessMsgEvent;
ManualResetEvent resetEvent = new ManualResetEvent(false);
public DeviceRunControl(string name, List<IDevice> device) {
DevicesList = device;
DeviceListName = name;
manualResets.Add(resetEvent);
}
Thread thread;
public void Start() {
thread = new Thread(new ThreadStart(Run));
thread.Start();
resetEvent.Reset();
}
void Run() {
LogUtil.info($"{DeviceListName}设备线程启动");
while (RobotManage.mainMachine.mstart)
{
Thread.Sleep(200);
ManualResetEvent.WaitAll(new ManualResetEvent[] { RobotManage.mainMachine.ResetEvent });
if (!RobotManage.mainMachine.canRunning || !RobotManage.mainMachine.mstart)
continue;
DevicesList.ForEach(x =>
{
try
{
x.Process();
}
catch (Exception ex)
{
MsgService.MSList[x.GroupName].add(ex.ToString(), MsgLevel.warning);
MsgService.MSList[x.GroupName].setlogones();
}
finally
{
var m = MsgService.MSList[x.GroupName].get();
ProcessMsgEvent?.Invoke(m);
}
});
//ProcessMoveinfoEvent?.Invoke(MoveInfo.List);
if (!RobotManage.mainMachine.UserPause)
{
DevicesList.ForEach(x =>
{
MsgService.MSList[x.GroupName].clear();
});
}
resetEvent.Set();
}
LogUtil.info($"{DeviceListName}设备线程已退出.");
}
}
}
\ No newline at end of file
......@@ -29,7 +29,7 @@ namespace DeviceLibrary
}
LogUtil.info("按下复位按钮");
ProcessMsgEvent?.Invoke(Msg.get()[Msg.Device]);
ProcessMsgEvent?.Invoke(Msg.get());
//暂停时按下reaet按钮
if (RobotManage.isRunning && RobotManage.mainMachine.UserPause)
......@@ -50,7 +50,7 @@ namespace DeviceLibrary
Msg.add(crc.GetString("Res0165","急停中,按下启动按钮,无法启动."), MsgLevel.warning);
}
LogUtil.info("按下启动按钮");
ProcessMsgEvent?.Invoke(Msg.get()[Msg.Device]);
ProcessMsgEvent?.Invoke(Msg.get());
}
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ namespace DeviceLibrary
public partial class MainMachine : DeviceBase, IRobot
{
new public string Name { get; set; } = "Cycle Line";
private bool _canRunning = true;
private volatile bool _canRunning = true;
public bool canRunning
{
get { return _canRunning; }
......@@ -38,6 +38,8 @@ namespace DeviceLibrary
ServerCommunication ServerCM = new ServerCommunication();
public ManualResetEvent ResetEvent = new ManualResetEvent(true);
/// <summary>
/// 是否在急停中
/// </summary>
......@@ -80,7 +82,7 @@ namespace DeviceLibrary
/// <summary>
/// 整机启动变量,设置为false后将退出线程,只在停止时调用
/// </summary>
bool mstart=true;
public volatile bool mstart=true;
public void Run() {
mstart = true;
while (mstart) {
......@@ -89,6 +91,7 @@ namespace DeviceLibrary
canRunning = DeviceCheck();
if (canRunning)
{
ResetEvent.Set();
BtnProcess();
canRunning = SafeCheck();
}
......@@ -101,6 +104,7 @@ namespace DeviceLibrary
}
else if (runStatus == RunStatus.HomeReset)
{
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
runStatus = RunStatus.Running;
}
}
......@@ -110,7 +114,7 @@ namespace DeviceLibrary
Msg.setlogones();
}
finally {
var m = Msg.get()[Msg.Device];
var m = Msg.get();
ProcessMsgEvent?.Invoke(m);
ServerCM.ProcessMsg(m);
StoreStatus currnetstoreStatus= StoreStatus.None;
......@@ -148,6 +152,7 @@ namespace DeviceLibrary
}
public void Stop() {
mstart = false;
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
Alarm(AlarmType.None);
StopMove(true);
LedProcess(null);
......@@ -161,7 +166,8 @@ namespace DeviceLibrary
OpenAllServo();
Alarm(AlarmType.None);
runStatus = RunStatus.HomeReset;
SideMove.SideMoves.Values.ToList().ForEach(s => s.Start());
SideMove.DeviceList.Values.ToList().ForEach(s => s.Start());
}
......@@ -176,11 +182,17 @@ namespace DeviceLibrary
return ok;
}
void DeviceSuddenStop() {
void DeviceSuddenStop() {
if (lastSafeCheckStatus)
{
LogUtil.info("开始急停");
ResetEvent.Reset();
LogUtil.info("复位线程锁,等待其他线程完成");
ManualResetEvent.WaitAll(DeviceRunControl.manualResets.ToArray(),500);
LogUtil.info("其他线程已完成");
AxisBean.StopMultiAxis(AxisBean.List[GroupName]);
MoveInfo.List.ForEach((m) => { m.CanWhileCount = 5; });
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
SafetyDevice.PauseAll();
}
}
......
......@@ -47,6 +47,46 @@ namespace DeviceLibrary
SideMove_16,
SideMove_17,
SideMove_18,
TrayStop_01,
TrayStop_02,
TrayStop_03,
TrayStop_04,
TrayStop_05,
TrayStop_06,
TrayStop_07,
TrayStop_WaitLoadLeave,
TrayStop_LoadLeaved,
TransplantMove_01,
TransplantMove_02,
TransplantMove_03,
TransplantMove_04,
TransplantMove_05,
TransplantMove_06,
TransplantMove_07,
TransplantMove_08,
TransplantMove_09,
TransplantMove_10,
TransplantMove_11,
TransplantMove_12,
TransplantMove_13,
TransplantMove_14,
TransplantMove_15,
TransplantMove_16,
TransplantMove_17,
TransplantMove_18,
TransplantMove_19,
TransplantMove_30,
TransplantMove_31,
TransplantMove_32,
TransplantMove_33,
TransplantMove_34,
TransplantMove_35,
TransplantMove_36,
TransplantMove_37,
TransplantMove_38,
TransplantMove_39,
}
......
......@@ -83,7 +83,13 @@ namespace DeviceLibrary
}
mainThread = new Thread(new ThreadStart(mainMachine.Start));
mainThread.Start();
Thread.Sleep(50);
var d1 = new DeviceRunControl("SideMove", SideMove.DeviceList.Values.ToList<IDevice>());
var d2 = new DeviceRunControl("TransplantMove", TransplantMove.DeviceList.Values.ToList<IDevice>());
var d3 = new DeviceRunControl("TrayStop", TrayStop.DeviceList.Values.ToList<IDevice>());
d1.Start();
d2.Start();
d3.Start();
isRunning = true;
GC.KeepAlive(mainThread);
Task.Run(()=> {
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public partial class TrayManager
{
public static Dictionary<string,TrayInfo> Traylist = new Dictionary<string,TrayInfo>();
/// <summary>
/// 处理更新托盘信息
/// </summary>
/// <param name="rfid"></param>
/// <param name="addr"></param>
/// <param name="trayInfo"></param>
/// <returns>是否放行</returns>
public static bool Process(string rfid, int addr, out TrayInfo trayInfo) {
if (!Traylist.ContainsKey(rfid)) {
Traylist.Add(rfid, new TrayInfo());
Traylist[rfid].RFID = rfid;
}
Traylist[rfid].LastUpdateTime = DateTime.Now;
trayInfo = Traylist[rfid];
return true;
}
}
public class TrayInfo {
string _rfid;
public string RFID { get => _rfid; set {
try
{
var ss = Enum.GetNames(typeof(TrayTypeE));
TrayType = (TrayTypeE)Enum.Parse(typeof(TrayTypeE), ss.ToList().Find(s => value.StartsWith(s)));
_rfid = value;
}
catch (Exception ex) {
LogUtil.error($"获取RFID的类型时出错:{value}");
}
}
}
public string Destination;
public int DestinationAddr;
public bool HasLoad;
public LoadTypeE LoadType;
public TrayTypeE TrayType;
public DateTime LastUpdateTime;
public ReelParam ReelParam;
}
public enum LoadTypeE {
MTP2, //流水线治具托盘
MTP1, //流水线料盘托盘
S007, //料串
M03, //Tray料格
M02, //PCB料格
M01, //PizzaBOX料格
M04, //ShoeBOX料格
}
public enum TrayTypeE
{
C01, //PCB治具
C02, //Pizza治具
C03, //Tray治具
C04, //ShoeBOX治具
}
public partial class TrayManager
{
public static Dictionary<LoadTypeE, string> LoadTypeDesc = new Dictionary<LoadTypeE, string>();
public static Dictionary<TrayTypeE, string> TrayTypeDesc = new Dictionary<TrayTypeE, string>();
static TrayManager() {
LoadTypeDesc.Add(LoadTypeE.MTP2, "流水线治具托盘");
LoadTypeDesc.Add(LoadTypeE.MTP1, "流水线料盘托盘");
LoadTypeDesc.Add(LoadTypeE.S007, "料串");
LoadTypeDesc.Add(LoadTypeE.M03, "Tray料格");
LoadTypeDesc.Add(LoadTypeE.M02, "PCB料格");
LoadTypeDesc.Add(LoadTypeE.M01, "PizzaBOX料格");
LoadTypeDesc.Add(LoadTypeE.M04, "ShoeBOX料格");
TrayTypeDesc.Add(TrayTypeE.C01, "PCB治具");
TrayTypeDesc.Add(TrayTypeE.C02, "Pizza治具");
TrayTypeDesc.Add(TrayTypeE.C03, "Tray治具");
TrayTypeDesc.Add(TrayTypeE.C04, "ShoeBOX治具");
}
}
}
......@@ -8,9 +8,9 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
public class SideMove:DeviceBase, IDevice,ISafetyDevice
public class SideMove:DeviceBase, IDevice
{
public static Dictionary<string,SideMove> SideMoves = new Dictionary<string, SideMove>();
public static Dictionary<string,SideMove> DeviceList = new Dictionary<string, SideMove>();
public static void Init(Robot_Config config, Dictionary<string, DeviceGroup> devices,out string msg) {
msg = "";
......@@ -19,15 +19,16 @@ namespace DeviceLibrary
continue;
SideMove sideMove = new SideMove(devices[key],out string m);
SideMoves.Add(devices[key].GroupName, sideMove);
DeviceList.Add(devices[key].GroupName, sideMove);
msg += m;
}
}
DeviceGroup DeviceGroup;
MoveInfo LSAMoveInfo;
MoveInfo LSBMoveInfo;
PuYueRFID_C2S RFID_1 = null;
CylinderManger Location_A = null;
CylinderManger Location_B = null;
PuYueRFID_C2S RFID_1 = null;
PuYueRFID_C2S RFID_2 = null;
public LineRunMonitor Line;
LS_TypeE LS_Type = LS_TypeE.NoRfid;
......@@ -39,7 +40,10 @@ namespace DeviceLibrary
Msg = new MsgService(GroupName);
LSAMoveInfo = new MoveInfo(GroupName + "_A");
LSBMoveInfo = new MoveInfo(GroupName + "_B");
SafetyDevice.AddDevice(this);
Location_A = new CylinderManger($"A侧顶升", GroupName, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down);
Location_B = new CylinderManger($"B侧顶升", GroupName, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down);
if (!string.IsNullOrEmpty(DeviceGroup.RFID_1))
{
RFID_1 = new PuYueRFID_C2S(DeviceGroup.RFID_1);
......@@ -56,7 +60,7 @@ namespace DeviceLibrary
}
}
if (RobotManage.Config.DOList[device.GroupName].ContainsKey(IO_Type.Ls_A_LineRwd))
Line = new LineRunMonitor(GroupName, RobotManage.Config.DOList[GroupName][IO_Type.Ls_A_LineRwd].GetIOAddr(), RobotManage.Config.DOList[GroupName][IO_Type.Ls_A_LineRwd].GetIOAddr());
Line = new LineRunMonitor(GroupName, RobotManage.Config.DOList[GroupName][IO_Type.Ls_A_LineRun].GetIOAddr(), RobotManage.Config.DOList[GroupName][IO_Type.Ls_A_LineRwd].GetIOAddr());
else
Line = new LineRunMonitor(GroupName, RobotManage.Config.DOList[GroupName][IO_Type.Ls_A_LineRun].GetIOAddr());
if (RFID_1 == null && RFID_2 == null)
......@@ -70,11 +74,15 @@ namespace DeviceLibrary
public void Start()
{
DeviceState = DeviceStateE.HomeReset;
LSAMoveInfo.NewMove(MoveStep.H01_HomeReset);
LSAMoveInfo.log("开始回原");
}
public void Stop()
{
DeviceState = DeviceStateE.Stop;
Line.LineStop("n");
LSAMoveInfo.log("停止运行");
}
public void Process()
{
......@@ -101,14 +109,15 @@ namespace DeviceLibrary
switch (LSAMoveInfo.MoveStep)
{
case MoveStep.Wait:
LSAMoveInfo.NewMove(MoveStep.SideMove_01);
break;
case MoveStep.SideMove_01:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_01);
if (IOValue(IO_Type.Ls_A_Front_Check).Equals(IO_VALUE.HIGH))
{
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_02);
CylinderMove(LSAMoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.LOW);
CylinderMove(LSAMoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.LOW);
Location_A.ToLow(LSAMoveInfo);
Location_B.ToLow(LSAMoveInfo);
}
else
{
......@@ -128,12 +137,12 @@ namespace DeviceLibrary
break;
case MoveStep.SideMove_04:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_05);
CylinderMove(LSAMoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.HIGH);
CylinderMove(LSAMoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.HIGH);
Location_A.ToHigh(LSAMoveInfo);
Location_B.ToHigh(LSAMoveInfo);
break;
case MoveStep.SideMove_05:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_06);
IOMove(IO_Type.Ls_A_LineRun, IO_VALUE.HIGH);
Line.LineRun("n",false, 999);
break;
case MoveStep.SideMove_06:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_07);
......@@ -145,9 +154,9 @@ namespace DeviceLibrary
break;
case MoveStep.SideMove_08:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_09);
IOMove(IO_Type.Ls_A_LineRun, IO_VALUE.LOW);
CylinderMove(LSAMoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.LOW);
CylinderMove(LSAMoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.LOW);
Line.LineStop("n");
Location_A.ToLow(LSAMoveInfo);
Location_B.ToLow(LSAMoveInfo);
break;
case MoveStep.SideMove_09:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_10);
......@@ -190,6 +199,7 @@ namespace DeviceLibrary
switch (Minfo.MoveStep)
{
case MoveStep.Wait:
Minfo.NewMove(MoveStep.SideMove_01);
break;
case MoveStep.SideMove_01:
Minfo.NextMoveStep(MoveStep.SideMove_01);
......@@ -223,6 +233,7 @@ namespace DeviceLibrary
if (RFID.TryRead(out string rfid, out _) == 1)
{
TrayManager.Process(rfid, DeviceGroup.addr_1, out TrayInfo trayInfo);
if (rfid == "通过")
Minfo.NextMoveStep(MoveStep.SideMove_04);
else
......@@ -270,13 +281,13 @@ namespace DeviceLibrary
break;
case MoveStep.SideMove_11:
Minfo.NextMoveStep(MoveStep.SideMove_05);
CylinderMove(Minfo, Ls_A_Location_Up, Ls_A_Location_Down, IO_VALUE.HIGH);
CylinderMove(Minfo, Ls_B_Location_Up, Ls_B_Location_Down, IO_VALUE.HIGH);
Location_A.ToHigh(Minfo);
Location_B.ToHigh(Minfo);
IOMove(Ls_B_BufStop_Fwd, IO_VALUE.HIGH, StopBufDelayMS);
break;
case MoveStep.SideMove_12:
Minfo.NextMoveStep(MoveStep.SideMove_06);
IOMove(IO_Type.Ls_A_LineRun, IO_VALUE.HIGH);
Line.LineRun("n", false, 999);
Minfo.WaitList.Add(WaitResultInfo.WaitIO(Ls_B_Tray_Check, IO_VALUE.HIGH));
break;
case MoveStep.SideMove_13:
......@@ -285,9 +296,9 @@ namespace DeviceLibrary
break;
case MoveStep.SideMove_14:
Minfo.NextMoveStep(MoveStep.SideMove_08);
IOMove(IO_Type.Ls_A_LineRun, IO_VALUE.LOW);
CylinderMove(Minfo, Ls_A_Location_Up, Ls_A_Location_Down, IO_VALUE.LOW);
CylinderMove(Minfo, Ls_B_Location_Up, Ls_B_Location_Down, IO_VALUE.LOW);
Line.LineStop("n");
Location_A.ToLow(Minfo);
Location_B.ToLow(Minfo);
break;
case MoveStep.SideMove_15:
Minfo.NextMoveStep(MoveStep.SideMove_09);
......@@ -307,7 +318,7 @@ namespace DeviceLibrary
}
}
#endregion
public void ResetProcess()
void ResetProcess()
{
if (CheckWait(LSAMoveInfo))
return;
......@@ -318,43 +329,65 @@ namespace DeviceLibrary
break;
case MoveStep.H01_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
IOMove(IO_Type.Ls_A_LineRun, IO_VALUE.LOW);
CylinderMove(LSAMoveInfo, IO_Type.Ls_A_Location_Down, IO_Type.Ls_A_Location_Up, IO_VALUE.LOW);;
CylinderMove(LSAMoveInfo, IO_Type.Ls_B_Location_Down, IO_Type.Ls_B_Location_Up, IO_VALUE.LOW);
var loAdown = IOValue(IO_Type.Ls_A_Location_Down).Equals(IO_VALUE.HIGH);
var loBdown = IOValue(IO_Type.Ls_B_Location_Down).Equals(IO_VALUE.HIGH);
var trayAstate = IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH);
var trayBstate = IOValue(IO_Type.Ls_B_Tray_Check).Equals(IO_VALUE.HIGH);
LSAMoveInfo.log($"Ls_A_Location_Down:{loAdown},Ls_B_Location_Down:{loBdown},Ls_A_Tray_Check:{trayAstate},Ls_B_Tray_Check:{trayBstate}");
if (loAdown && loBdown)
{
if (!trayAstate && !trayBstate)
{
LSAMoveInfo.log("托盘上没有料盘回原结束");
DeviceState = DeviceStateE.Run;
LSAMoveInfo.EndMove();
}
else if (LS_Type == LS_TypeE.NoRfid)
{
}
else if (trayAstate)
{
LSAMoveInfo.log("有过路料直接放行");
DeviceState = DeviceStateE.Run;
LSAMoveInfo.NewMove(MoveStep.SideMove_04);
}
else if (trayBstate)
{
LSBMoveInfo.log("有过路料直接放行");
DeviceState = DeviceStateE.Run;
LSBMoveInfo.NewMove(MoveStep.SideMove_04);
}
}
break;
case MoveStep.H02_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.H03_HomeReset);
IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH);
IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH,500);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
Location_A.ToHigh(LSAMoveInfo);
Location_B.ToHigh(LSAMoveInfo);
IOMove(IO_Type.Ls_B_BufStop_Fwd, IO_VALUE.HIGH,StopBufDelayMS);
break;
case MoveStep.H03_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
IOMove(IO_Type.Ls_B_BufStop_Fwd, IO_VALUE.HIGH, 500);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Ls_A_Tray_Check, IO_VALUE.HIGH));
Line.LineRun("n", false, 10);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
case MoveStep.H04_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.H05_HomeReset);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
Location_A.ToLow(LSAMoveInfo);
Location_B.ToLow(LSAMoveInfo);
break;
case MoveStep.H05_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.H06_HomeReset);
CylinderMove(LSAMoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.HIGH);
CylinderMove(LSAMoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.HIGH);
IOMove(IO_Type.Ls_B_Stop, IO_VALUE.HIGH, StopDelayMS);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
case MoveStep.H06_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.H07_HomeReset);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Ls_B_Tray_Check, IO_VALUE.HIGH));
break;
case MoveStep.H07_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.H08_HomeReset);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.H08_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
CylinderMove(LSAMoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.LOW);
CylinderMove(LSAMoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.LOW);
break;
LSAMoveInfo.log("回原完成");
DeviceState = DeviceStateE.Run;
LSAMoveInfo.EndMove();
break;
case MoveStep.HEND_HomeReset:
LSAMoveInfo.NewMove(MoveStep.SideMove_01);
DeviceState = DeviceStateE.Run;
......@@ -362,21 +395,10 @@ namespace DeviceLibrary
}
}
public void Pause()
{
Line.Pause();
}
public void Resume()
{
Line.Resume();
}
enum LS_TypeE {
NoRfid,
OneWay,
TwoWay
}
}
}
\ No newline at end of file
......@@ -8,37 +8,40 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
public class TransplantMove : DeviceBase,IDevice,ISafetyDevice
public class TransplantMove : DeviceBase,IDevice
{
static List<TransplantMove> SideMoves = new List<TransplantMove>();
public static Dictionary<string, TransplantMove> DeviceList = new Dictionary<string, TransplantMove>();
public static void Init(Robot_Config config, Dictionary<string, DeviceGroup> devices,out string msg) {
msg = "";
foreach (var key in devices.Keys) {
if (!devices[key].DeviceType.StartsWith("SISO"))
continue;
TransplantMove sideMove = new TransplantMove(devices[key],out string m);
SideMoves.Add(sideMove);
TransplantMove sideMove = new TransplantMove(devices[key],config,out string m);
DeviceList.Add(devices[key].GroupName, sideMove);
msg += m;
}
}
Robot_Config Config;
DeviceGroup DeviceGroup;
MoveInfo MoveInfo;
MoveInfo MoveInfo2;
MsgService Msg;
PuYueRFID_C2S RFID_1 = null;
PuYueRFID_C2S RFID_2 = null;
AxisBean axis;
CylinderManger Location;
CylinderManger Transplant;
public DeviceStateE DeviceState { get ; set ; }
public DeviceStateE DeviceState { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public TransplantMove(DeviceGroup device,out string msg) {
public TransplantMove(DeviceGroup device, Robot_Config config, out string msg) {
msg = "";
Name = device.Name+"("+ device.GroupName + ")";
Config = config;
DeviceGroup = device;
GroupName = DeviceGroup.GroupName;
Msg = new MsgService(GroupName);
MoveInfo = new MoveInfo(GroupName);
SafetyDevice.AddDevice(this);
MoveInfo2 = new MoveInfo(GroupName,false);
if (!string.IsNullOrEmpty(DeviceGroup.RFID_1))
{
RFID_1 = new PuYueRFID_C2S(DeviceGroup.RFID_1);
......@@ -46,86 +49,195 @@ namespace DeviceLibrary
msg += DeviceGroup.GroupName + " RFID 1:" + DeviceGroup.RFID_1 +","+crc.GetString("Res0183","打开失败")+ "\r\n";
}
}
if (!string.IsNullOrEmpty(DeviceGroup.RFID_2))
{
RFID_2 = new PuYueRFID_C2S(DeviceGroup.RFID_2);
if (!RFID_2.Open())
{
msg += DeviceGroup.GroupName + " RFID 2:" + DeviceGroup.RFID_2 + "," + crc.GetString("Res0183","打开失败") + "\r\n";
}
}
Location = new CylinderManger($"托盘顶升", GroupName, IO_Type.AMH_Location_Up, IO_Type.AMH_Location_Down);
Transplant = new CylinderManger($"移栽", GroupName, IO_Type.AMH_Trans_Fwd, IO_Type.AMH_Trans_Bwd);
var axisc = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[GroupName].AxisID);
axis = new AxisBean(axisc, GroupName);
}
public void Start()
{
DeviceState = DeviceStateE.HomeReset;
MoveInfo.NewMove(MoveStep.H01_HomeReset);
MoveInfo.log("开始回原");
}
public void Stop()
{
DeviceState = DeviceStateE.Stop;
MoveInfo.log("停止运行");
}
public void Process()
{
if (DeviceState == DeviceStateE.HomeReset)
ResetProcess();
else if (DeviceState == DeviceStateE.Run)
{
OneWayProcess();
SecondProcess();
}
}
int StopBufDelayMS = 500;
int StopDelayMS = 1000;
public void OneWayProcess()
{
if (CheckWait(MoveInfo))
return;
switch (MoveInfo.MoveStep)
{
case MoveStep.Wait:
if (IOValue(IO_Type.Ls_B_Tray_Check).Equals(IO_VALUE.HIGH)) {
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
if (IOValue(IO_Type.AMH_Front_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.TransplantMove_01);
Location.ToLow(MoveInfo);
}
else
{
Msg.add(crc.GetString("Res0184", "空闲中"), MsgLevel.info);
}
else if(IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH))
break;
case MoveStep.TransplantMove_01:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_02);
IOMove(IO_Type.AMH_Front_Stop, IO_VALUE.HIGH, StopDelayMS);
MoveInfo.CanWhileCount = 3;
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.MI_In_Check, IO_VALUE.HIGH));
break;
case MoveStep.TransplantMove_02:
if (RFID_1.TryRead(out string rfid, out _) == 1)
{
if (rfid == "通过")
MoveInfo.NextMoveStep(MoveStep.TransplantMove_03);
else if (IOValue(IO_Type.AMH_Reel_Check).Equals(IO_VALUE.HIGH))
MoveInfo.NextMoveStep(MoveStep.TransplantMove_10);
else
MoveInfo.NextMoveStep(MoveStep.TransplantMove_30);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (IOValue(IO_Type.Ls_A_Front_Check).Equals(IO_VALUE.HIGH))
else if (MoveInfo.CanWhileCount > 0)
{
MoveInfo.NextMoveStep(MoveStep.SideMove_01);
CylinderMove(MoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.LOW);
IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH, 1000);
IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, 500);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Ls_A_Tray_Check,IO_VALUE.HIGH));
MoveInfo.CanWhileCount--;
MoveInfo.log($"RFid读取失败,重试第{3 - MoveInfo.CanWhileCount}次");
}
else {
Msg.add(crc.GetString("Res0184","空闲中"), MsgLevel.info);
else
{
MoveInfo.log("RFid读取失败,直接通过");
MoveInfo.NextMoveStep(MoveStep.TransplantMove_04);
}
break;
case MoveStep.SideMove_01:
MoveInfo.NextMoveStep(MoveStep.SideMove_02);
case MoveStep.TransplantMove_03:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_04);
IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.HIGH, StopDelayMS);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.MI_In_Check, IO_VALUE.LOW));
break;
case MoveStep.TransplantMove_04:
MoveInfo.NextMoveStep(MoveStep.Wait);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo.log("托盘已放行");
break;
case MoveStep.SideMove_02:
MoveInfo.NextMoveStep(MoveStep.SideMove_02);
CylinderMove(MoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.HIGH);
case MoveStep.TransplantMove_10:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_11);
Location.ToHigh(MoveInfo);
axis.AbsMove(MoveInfo, Config.AMH_TS_P1, Config.AMH_TS_P1_speed);
Transplant.ToLow(MoveInfo);
MoveInfo.log("顶升上升,取料轴到P1,移栽气缸回位");
break;
case MoveStep.SideMove_03:
MoveInfo.NextMoveStep(MoveStep.SideMove_04);
IOMove(IO_Type.Ls_A_LineRun, IO_VALUE.HIGH);
case MoveStep.TransplantMove_11:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_12);
axis.AbsMove(MoveInfo, Config.AMH_TS_P2, Config.AMH_TS_P1_speed);
IOMove(IO_Type.AMH_Sucker, IO_VALUE.HIGH);
break;
case MoveStep.TransplantMove_12:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_13);
break;
case MoveStep.TransplantMove_13:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_14);
axis.AbsMove(MoveInfo, Config.AMH_TS_P1, Config.AMH_TS_P1_speed);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.AMH_Reel_Check,IO_VALUE.LOW));
break;
case MoveStep.TransplantMove_14:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_15);
MoveInfo2.NewMove(MoveStep.TransplantMove_01);
Location.ToLow(MoveInfo);
break;
case MoveStep.TransplantMove_15:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_16);
IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.HIGH, StopDelayMS);
break;
case MoveStep.TransplantMove_16:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_17);
IOMove(IO_Type.AMH_Sucker, IO_VALUE.LOW);
break;
case MoveStep.TransplantMove_17:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_18);
axis.AbsMove(MoveInfo, Config.AMH_TS_P1, Config.AMH_TS_P1_speed);
break;
case MoveStep.TransplantMove_18:
MoveInfo.NewMove(MoveStep.Wait);
MoveInfo.log("从线体到料仓移栽结束");
break;
case MoveStep.TransplantMove_30:
MoveInfo.NextMoveStep(MoveStep.Wait);
Location.ToLow(MoveInfo);
MoveInfo.log("载荷离开, 顶升下降");
break;
}
}
public void Start()
public void SecondProcess()
{
throw new NotImplementedException();
}
if (CheckWait(MoveInfo2))
return;
public void Stop()
{
throw new NotImplementedException();
switch (MoveInfo2.MoveStep)
{
case MoveStep.Wait:
break;
case MoveStep.TransplantMove_01:
MoveInfo2.NextMoveStep(MoveStep.TransplantMove_02);
Transplant.ToHigh(MoveInfo);
break;
case MoveStep.TransplantMove_02:
MoveInfo2.NextMoveStep(MoveStep.TransplantMove_03);
axis.AbsMove(MoveInfo2, Config.AMH_TS_P2, Config.AMH_TS_P2_speed);
break;
case MoveStep.TransplantMove_03:
MoveInfo2.NextMoveStep(MoveStep.TransplantMove_04);
IOMove(IO_Type.AMH_Sucker, IO_VALUE.LOW);
break;
case MoveStep.TransplantMove_04:
MoveInfo2.NextMoveStep(MoveStep.TransplantMove_05);
axis.AbsMove(MoveInfo2, Config.AMH_TS_P1, Config.AMH_TS_P1_speed);
break;
case MoveStep.TransplantMove_05:
MoveInfo2.NewMove(MoveStep.Wait);
MoveInfo.log("从线体到料仓移栽结束");
break;
}
}
public void Pause()
public void ResetProcess()
{
throw new NotImplementedException();
}
public void Resume()
{
throw new NotImplementedException();
}
enum LS_TypeE {
NoRfid,
OneWay,
TwoWay
if (CheckWait(MoveInfo))
return;
switch (MoveInfo.MoveStep)
{
case MoveStep.Wait:
MoveInfo.NextMoveStep(MoveStep.SideMove_01);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
case MoveStep.SideMove_01:
MoveInfo.NextMoveStep(MoveStep.SideMove_02);
CylinderMove(MoveInfo, IO_Type.MI_Location_Down, IO_Type.MI_Location_Up, IO_VALUE.LOW);
break;
case MoveStep.SideMove_02:
MoveInfo.NextMoveStep(MoveStep.SideMove_03);
IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.HIGH, StopDelayMS);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
break;
case MoveStep.SideMove_03:
MoveInfo.EndMove();
DeviceState = DeviceStateE.Run;
break;
}
}
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ namespace DeviceLibrary
{
public class TrayStop : DeviceBase, IDevice
{
static List<TrayStop> SideMoves = new List<TrayStop>();
public static Dictionary<string, TrayStop> DeviceList = new Dictionary<string, TrayStop>();
public static void Init(Robot_Config config, Dictionary<string, DeviceGroup> devices,out string msg) {
msg = "";
......@@ -18,7 +18,7 @@ namespace DeviceLibrary
if (!devices[key].DeviceType.StartsWith("RT"))
continue;
TrayStop sideMove = new TrayStop(devices[key],out string m);
SideMoves.Add(sideMove);
DeviceList.Add(devices[key].GroupName, sideMove);
msg += m;
}
}
......@@ -26,13 +26,11 @@ namespace DeviceLibrary
MoveInfo MoveInfo;
MsgService Msg;
PuYueRFID_C2S RFID_1 = null;
PuYueRFID_C2S RFID_2 = null;
CylinderManger Location;
AxisBean axis;
AxisBean axis2;
public DeviceStateE DeviceState { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public TrayStop(DeviceGroup device,out string msg) {
msg = "";
Name = device.Name+"("+ device.GroupName + ")";
DeviceGroup = device;
......@@ -46,22 +44,40 @@ namespace DeviceLibrary
msg += DeviceGroup.GroupName + " RFID 1:" + DeviceGroup.RFID_1 +","+crc.GetString("Res0183","打开失败")+ "\r\n";
}
}
if (!string.IsNullOrEmpty(DeviceGroup.RFID_2))
Location = new CylinderManger($"托盘顶升", GroupName, IO_Type.MI_Location_Up, IO_Type.MI_Location_Down);
var axisc = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[GroupName].AxisID);
if (axisc != null)
axis = new AxisBean(axisc, GroupName);
axisc = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[GroupName].Axis2ID);
if (axisc != null)
axis2 = new AxisBean(axisc, GroupName);
}
public DeviceStateE DeviceState { get; set; }
public void Start()
{
DeviceState = DeviceStateE.HomeReset;
MoveInfo.NewMove(MoveStep.H01_HomeReset);
MoveInfo.log("开始回原");
}
public void Stop()
{
DeviceState = DeviceStateE.Stop;
MoveInfo.log("停止运行");
}
public void Process()
{
if (DeviceState == DeviceStateE.HomeReset)
ResetProcess();
else if (DeviceState == DeviceStateE.Run)
{
RFID_2 = new PuYueRFID_C2S(DeviceGroup.RFID_2);
if (!RFID_2.Open())
{
msg += DeviceGroup.GroupName + " RFID 2:" + DeviceGroup.RFID_2 + "," + crc.GetString("Res0183","打开失败") + "\r\n";
}
OneWayProcess();
}
var axisc = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[device.GroupName].AxisID);
if (axisc!=null)
axis = new AxisBean(axisc, device.GroupName);
var axisc2 = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[device.GroupName].Axis2ID);
if (axisc2 != null)
axis2 = new AxisBean(axisc2, device.GroupName);
}
public void Process()
int StopBufDelayMS = 500;
int StopDelayMS = 1000;
public void OneWayProcess()
{
if (CheckWait(MoveInfo))
return;
......@@ -69,38 +85,58 @@ namespace DeviceLibrary
switch (MoveInfo.MoveStep)
{
case MoveStep.Wait:
if (IOValue(IO_Type.Ls_B_Tray_Check).Equals(IO_VALUE.HIGH)) {
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if(IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (IOValue(IO_Type.Ls_A_Front_Check).Equals(IO_VALUE.HIGH))
if (IOValue(IO_Type.MI_Front_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.SideMove_01);
CylinderMove(MoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.LOW);
IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH, 1000);
IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, 500);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Ls_A_Tray_Check,IO_VALUE.HIGH));
Location.ToLow(MoveInfo);
}
else {
Msg.add(crc.GetString("Res0184","空闲中"), MsgLevel.info);
}
break;
case MoveStep.SideMove_01:
case MoveStep.TrayStop_01:
MoveInfo.NextMoveStep(MoveStep.SideMove_02);
IOMove(IO_Type.AMH_Front_Stop, IO_VALUE.HIGH, StopDelayMS);
MoveInfo.CanWhileCount = 3;
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.MI_In_Check, IO_VALUE.HIGH));
break;
case MoveStep.TrayStop_02:
if (RFID_1.TryRead(out string rfid, out _) == 1)
{
if (rfid == "通过")
MoveInfo.NextMoveStep(MoveStep.TrayStop_03);
else
MoveInfo.NextMoveStep(MoveStep.TrayStop_WaitLoadLeave);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (MoveInfo.CanWhileCount > 0)
{
MoveInfo.CanWhileCount--;
MoveInfo.log($"RFid读取失败,重试第{3 - MoveInfo.CanWhileCount}次");
}
else
{
MoveInfo.log("RFid读取失败,直接通过");
MoveInfo.NextMoveStep(MoveStep.SideMove_04);
}
break;
case MoveStep.TrayStop_03:
MoveInfo.NextMoveStep(MoveStep.TrayStop_04);
IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.HIGH, StopDelayMS);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.MI_In_Check, IO_VALUE.LOW));
break;
case MoveStep.TrayStop_04:
MoveInfo.NextMoveStep(MoveStep.Wait);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo.log("托盘已放行");
break;
case MoveStep.SideMove_02:
MoveInfo.NextMoveStep(MoveStep.SideMove_02);
CylinderMove(MoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.HIGH);
case MoveStep.TrayStop_WaitLoadLeave:
break;
case MoveStep.SideMove_03:
MoveInfo.NextMoveStep(MoveStep.SideMove_04);
IOMove(IO_Type.Ls_A_LineRun, IO_VALUE.HIGH);
case MoveStep.TrayStop_LoadLeaved:
MoveInfo.NextMoveStep(MoveStep.Wait);
Location.ToLow(MoveInfo);
MoveInfo.log("载荷离开, 顶升下降");
break;
}
}
......@@ -112,59 +148,23 @@ namespace DeviceLibrary
switch (MoveInfo.MoveStep)
{
case MoveStep.Wait:
if (IOValue(IO_Type.Ls_B_Tray_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (IOValue(IO_Type.Ls_A_Front_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.SideMove_01);
CylinderMove(MoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.LOW);
IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH, 1000);
IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, 500);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Ls_A_Tray_Check, IO_VALUE.HIGH));
}
else
{
Msg.add(crc.GetString("Res0184","空闲中"), MsgLevel.info);
}
MoveInfo.NextMoveStep(MoveStep.SideMove_01);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
case MoveStep.SideMove_01:
MoveInfo.NextMoveStep(MoveStep.SideMove_02);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
CylinderMove(MoveInfo, IO_Type.MI_Location_Down, IO_Type.MI_Location_Up, IO_VALUE.LOW);
break;
case MoveStep.SideMove_02:
MoveInfo.NextMoveStep(MoveStep.SideMove_02);
CylinderMove(MoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.HIGH);
MoveInfo.NextMoveStep(MoveStep.SideMove_03);
IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.HIGH, StopDelayMS);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
break;
case MoveStep.SideMove_03:
MoveInfo.NextMoveStep(MoveStep.SideMove_04);
IOMove(IO_Type.Ls_A_LineRun, IO_VALUE.HIGH);
MoveInfo.EndMove();
DeviceState = DeviceStateE.Run;
break;
}
}
public void Start()
{
throw new NotImplementedException();
}
public void Stop()
{
throw new NotImplementedException();
}
enum LS_TypeE {
NoRfid,
OneWay,
TwoWay
}
}
}
\ No newline at end of file
......@@ -14,6 +14,8 @@ PRO,50,IO信号超时时间(秒),IOSingle_TimerOut,5,,,,,,,,,,,,
PRO,0,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
PRO,10,AMH移栽设备每毫米脉冲,AMH_TS_PoToMM,1000,,,,,,,,,,,,
PRO,10,AMH移栽设备待机点P1,AMH_TS_P1,1000,,,10000,,,,,,,,,
PRO,10,AMH移栽设备取料P2-8mm,AMH_TS_P2,1000,,,10000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,14,机器人压紧轴每毫米脉冲,AMH_RoboComp_PoToMM,1000,,,,,,,,,,,,
PRO,14,机器人压紧轴待机点P1,AMH_RoboComp_P1,1000,,,10000,,,,,,,,,
PRO,15,托盘旋转轴每度脉冲,AMH_Route_PoToMM,1000,,,10000,,,,,,,,,
......
......@@ -132,7 +132,7 @@ namespace OnlineStore.LoadCSVLibrary
this.DIList[devicename].Add(con.ProName, io);
}
if (devicename == "root" && !ioTypeList.Contains(con.ProName))
if (!ioTypeList.Contains(con.ProName))
{
AddBuffer(con, builder);
}
......
......@@ -264,6 +264,18 @@ namespace OnlineStore.LoadCSVLibrary
/// DI,0,MI1-15寸物料检测,MI_w15_Check,57,AMH-MI1,X57,,,,,,,,,,
/// </summary>
public static string MI_w15_Check = "MI_w15_Check";
/// <summary>
/// DI,0,AMH-SBSH2托盘前阻挡检测,AMH_Front_Check,14,AMH-SBSH2,X14,,,,,,,,,,
/// </summary>
public static string AMH_Front_Check = "AMH_Front_Check";
/// <summary>
/// DI,0,AMH-SBSH2托盘到位检测,AMH_In_Check,15,AMH-SBSH2,X15,,,,,,,,,,
/// </summary>
public static string AMH_In_Check = "AMH_In_Check";
/// <summary>
/// DI,0,AMH-SBSH2托盘物料检测,AMH_Reel_Check,16,AMH-SBSH2,X16,,,,,,,,,,
/// </summary>
public static string AMH_Reel_Check = "AMH_Reel_Check";
}
public enum IO_VALUE
{
......
......@@ -94,13 +94,21 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[ConfigProAttribute("AMH_TS_P1")]
public int AMH_TS_P1 { get; set; }
/// <summary>
/// PRO,0,AMH移栽设备取料P2-8mm,AMH_TS_P2,1000,,,10000,,,,,,,,,
/// </summary>
[ConfigProAttribute("AMH_TS_P2")]
public int AMH_TS_P2 { get; set; }
/// <summary>
/// PRO,0,AMH移栽设备待机点P1,AMH_TS_P1,1000,,,10000,,,,,,,,,
/// </summary>
[ConfigProAttribute("AMH_TS_P1_speed")]
public int AMH_TS_P1_speed { get; set; }
/// <summary>
/// PRO,0,AMH移栽设备待机点P1,AMH_TS_P1,1000,,,10000,,,,,,,,,
/// </summary>
[ConfigProAttribute("AMH_TS_P2_speed")]
public int AMH_TS_P2_speed { get; set; }
/// <summary>
/// PRO,0,机器人压紧轴每毫米脉冲,AMH_RoboComp_PoToMM,1000,,,,,,,,,,,,
/// </summary>
......
......@@ -365,13 +365,13 @@ namespace TheMachine
if (RobotManage.mainMachine.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
RobotManage.mainMachine.Msg.add("急停中,无法启动", MsgLevel.warning);
MainMachine_ProcessMsgEvent(RobotManage.mainMachine.Msg.get().Values.First());
MainMachine_ProcessMsgEvent(RobotManage.mainMachine.Msg.get());
return;
}
if (RobotManage.mainMachine.IOValue(IO_Type.AutoRun_Single).Equals(IO_VALUE.LOW))
{
RobotManage.mainMachine.Msg.add("运行开关没有打开,无法启动", MsgLevel.warning);
MainMachine_ProcessMsgEvent(RobotManage.mainMachine.Msg.get().Values.First());
MainMachine_ProcessMsgEvent(RobotManage.mainMachine.Msg.get());
return;
}
RobotManage.Start();
......
......@@ -138,6 +138,12 @@
<Compile Include="SettingControl.Designer.cs">
<DependentUpon>SettingControl.cs</DependentUpon>
</Compile>
<Compile Include="TrayManagerControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="TrayManagerControl.Designer.cs">
<DependentUpon>TrayManagerControl.cs</DependentUpon>
</Compile>
<Compile Include="UC\CylinderButton.cs">
<SubType>Component</SubType>
</Compile>
......@@ -206,6 +212,9 @@
<EmbeddedResource Include="SettingControl.resx">
<DependentUpon>SettingControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="TrayManagerControl.resx">
<DependentUpon>TrayManagerControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UC\StorePosControl.resx">
<DependentUpon>StorePosControl.cs</DependentUpon>
</EmbeddedResource>
......

namespace TheMachine
{
partial class TrayManagerControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// TrayManagerControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "TrayManagerControl";
this.Size = new System.Drawing.Size(725, 462);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TheMachine
{
public partial class TrayManagerControl : UserControl
{
public TrayManagerControl()
{
InitializeComponent();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -45,22 +45,26 @@ namespace TheMachine
btn_linerev.Visible = false;
btn_linestop.Visible = false;
}
if (!RobotManage.Config.DOList[deviceGroup].ContainsKey(IO_Type.Ls_A_LineRwd))
{
btn_linerev.Visible = false;
}
crc.LanguageProcess(this);
}
string deviceGroup;
private void btn_linerun_Click(object sender, EventArgs e)
{
SideMove.SideMoves[deviceGroup].Line.LineRun("n", false, 999);
SideMove.DeviceList[deviceGroup].Line.LineRun("n", false, 999);
}
private void btn_linerev_Click(object sender, EventArgs e)
{
SideMove.SideMoves[deviceGroup].Line.LineRun("n", true, 999);
SideMove.DeviceList[deviceGroup].Line.LineRun("n", true, 999);
}
private void btn_linestop_Click(object sender, EventArgs e)
{
SideMove.SideMoves[deviceGroup].Line.LineStop("n");
SideMove.DeviceList[deviceGroup].Line.LineStop("n");
}
}
}
......@@ -128,7 +128,7 @@ namespace TheMachine
this.cylinderButton2.BackColor = System.Drawing.Color.White;
this.cylinderButton2.DeviceType = "root";
this.cylinderButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton2.IO_HIGH = "AMH_Sucker";
this.cylinderButton2.IO_HIGH = "AMH_Tray_Stop";
this.cylinderButton2.IO_LOW = "";
this.cylinderButton2.Location = new System.Drawing.Point(618, 404);
this.cylinderButton2.Name = "cylinderButton2";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!