Commit e0d5952c LN

预扫码增加超时判断

1 个父辈 8a38b111
此文件类型无法预览

using Asa;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class AgvClient
{
public static bool CurrCancelState = true ;
private static string ServerIp = ConfigAppSettings.GetValue(Setting_Init.AgvServerIp);
private static Asa.AgvClient agvClient;
public static Dictionary<string, Asa.ClientAction> actionMap = new Dictionary<string, Asa.ClientAction>();
public static List<string> NodeList = new List<string>();
private static bool isInit = false;
public static void Init()
{
try
{
LogUtil.info("开始 Init agvclient");
if (!isInit)
{
isInit = true;
agvClient = new Asa.AgvClient(ServerIp);
agvClient.CancelState = true;
agvClient.Log += AgvClient_Log;
agvClient.Arrive += AgvClient_Arrive;
agvClient.Ready += AgvClient_Ready;
agvClient.CloseDoor += AgvClient_CloseDoor;
}
actionMap = new Dictionary<string, Asa.ClientAction>();
LogUtil.info(" 开始 agvClient.Connect");
agvClient.Connect();
foreach (string str in NodeList)
{
SetStatus(str);
}
}
catch (Exception ex)
{
LogUtil.error("初始化agvClient " + ServerIp + " 出错:", ex);
}
}
public static void SetCancelState(bool isCancel)
{
if (agvClient == null)
{
return;
}
CurrCancelState = isCancel;
agvClient.CancelState = isCancel;
}
public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low,bool isMust=false)
{
if (!isMust && level.Equals(ClientLevel.Low))
{
if (actionMap.ContainsKey(id))
{
ClientAction currA = actionMap[id]; //相同状态就设置一次
if (currA.Equals(action))
{
return;
}
}
}
string mark = "";
if (shelfId != "")
{
int index = shelfId.IndexOf(',');
if (index > 0)
{
//紧急出料模块,料架离开时,mark=紧急料或者分配料,rfid=料架号
mark = shelfId.Substring(index + 1, shelfId.Length - index - 1);
shelfId = shelfId.Substring(0, index);
}
}
agvClient.SetStatus(id,mark, shelfId, action, level);
UpdateAction(id, action);
}
private static void AgvClient_CloseDoor(string id, string rfid)
{
LogUtil.info("收到 AgvClient_CloseDoor [" + id + "] [" + rfid + "] 更新状态 ");
UpdateAction(id, ClientAction.CloseDoor);
Task.Factory.StartNew(delegate
{
Thread.Sleep(5000);
if (GetAction(id).Equals(ClientAction.CloseDoor))
{
SetStatus(id);
LogUtil.error("收到 AgvClient_CloseDoor [" + id + "] [" + rfid + "] 5秒后,更新状态为None ");
}
});
}
private static void AgvClient_Ready(string id, string rfid)
{
UpdateAction(id, ClientAction.Ready);
// RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + rfid + "] ");
FeedingEquip equip = getFeedEquip(id);
if (equip == null)
{
LogUtil.error("收到 AgvClient_Ready [" + id + "] [" + rfid + "] 未找到对应的设备 ,暂不处理");
return;
}
equip.AgvReady(id, rfid);
}
private static void AgvClient_Arrive(string id, string rfid)
{
UpdateAction(id, ClientAction.Arrive);
// RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] ");
FeedingEquip equip = getFeedEquip(id);
if (equip == null)
{
LogUtil.error("收到 AgvClient_Ready [" + id + "] [" + rfid + "] 未找到对应的设备 ,暂不处理 ");
return;
}
equip.AgvArrive(id, rfid);
}
private static FeedingEquip getFeedEquip(string nodeId)
{
foreach (FeedingEquip feed in LineManager.Line.FeedingEquipMap.Values)
{
if (feed.Config.AgvInName.Equals(nodeId) || feed.Config.AgvOutName.Equals(nodeId))
{
return feed;
}
}
return null;
}
internal static bool ISConnected()
{
if (agvClient == null)
{
return false;
}
return agvClient.IsConn;
}
public static bool SetToNone(string id, string shelfId = "")
{
ClientAction currA = GetAction(id);
if (currA.Equals(ClientAction.None) || currA.Equals(ClientAction.NeedLeave) || currA.Equals(ClientAction.NeedEnter))
{
SetStatus(id, shelfId, ClientAction.None);
return true;
}
return false;
}
public static bool NeedEnter(string id, string shelfId="", ClientLevel level = ClientLevel.Low)
{
ClientAction currA = GetAction(id);
if (currA.Equals(ClientAction.None) || currA.Equals(ClientAction.NeedLeave) || currA.Equals(ClientAction.NeedEnter))
{
SetStatus(id, shelfId, ClientAction.NeedEnter, level);
return true;
}
return false;
}
public static bool NeedLeave(string id, string shelfId="",ClientLevel level=ClientLevel.Low)
{
ClientAction currA = GetAction(id);
if (currA.Equals(ClientAction.None) || currA.Equals(ClientAction.NeedLeave) || currA.Equals(ClientAction.NeedEnter))
{
SetStatus(id, shelfId, ClientAction.NeedLeave, level);
return true;
}
return false;
}
private static bool isLog = ConfigAppSettings.GetIntValue(Setting_Init.Agv_Log_Open).Equals(1);
private static void AgvClient_Log(string s)
{
try
{
if (isLog)
{
LogUtil.info(" AGV " + ServerIp + " Log : " + s);
}
}
catch (Exception ex)
{
LogUtil.error("AgvClient_Log 出错:" + ex.ToString());
}
}
public static Asa.ClientAction GetAction(string NodeName)
{
if (actionMap.ContainsKey(NodeName))
{
return actionMap[NodeName];
}
return Asa.ClientAction.None;
}
public static void UpdateAction(string name, Asa.ClientAction action)
{
if (actionMap.ContainsKey(name))
{
actionMap[name] = action;
}
else
{
actionMap.Add(name, action);
}
}
public static void Dispose()
{
try
{
if (agvClient != null)
{
agvClient.Close();
}
}
catch (Exception ex)
{
LogUtil.error("释放 agvClient " + ServerIp + " 出错:", ex);
}
}
}
//public class AGVAction
//{
// public static string None = "None";
// public static string Arrive = "Arrive";
// public static string CanEnter = "CanEnter";
// public static string GetRFID = "GetRFID";
// public static string Ready = "Ready";
//}
}
...@@ -879,10 +879,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -879,10 +879,11 @@ namespace OnlineStore.DeviceLibrary
InLog("料盘移栽" + MoveInfo.SLog + ":提升轴下降到料盘不溢出(" + (currPositon - Config.Height_ChangeValue * 30) + "):" + targetPosition+",速度"+Config.BatchAxis_P4Speed); InLog("料盘移栽" + MoveInfo.SLog + ":提升轴下降到料盘不溢出(" + (currPositon - Config.Height_ChangeValue * 30) + "):" + targetPosition+",速度"+Config.BatchAxis_P4Speed);
BatchAxis.AbsMove(MoveInfo, targetPosition, Config.BatchAxis_P4Speed); BatchAxis.AbsMove(MoveInfo, targetPosition, Config.BatchAxis_P4Speed);
} }
private Task YuScanTask = null;
private void YuScanCode() private void YuScanCode()
{ {
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1); bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1);
YuScanTask = null;
//TODO 此处需要等待空托盘 //TODO 此处需要等待空托盘
if (MoveInfo.ShelfNoTray.Equals(false) && isScan) if (MoveInfo.ShelfNoTray.Equals(false) && isScan)
{ {
...@@ -892,7 +893,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -892,7 +893,7 @@ namespace OnlineStore.DeviceLibrary
List<string> bijiaoList = new List<string>(LastCodeList); List<string> bijiaoList = new List<string>(LastCodeList);
try try
{ {
Task<List<string>> scanTask = Task.Factory.StartNew(delegate YuScanTask = Task.Factory.StartNew(delegate
{ {
Thread.Sleep(100); Thread.Sleep(100);
NextCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name.Trim()+"预扫码"); NextCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name.Trim()+"预扫码");
...@@ -949,56 +950,64 @@ namespace OnlineStore.DeviceLibrary ...@@ -949,56 +950,64 @@ namespace OnlineStore.DeviceLibrary
{ {
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Give)) if (CylinderIsOk(IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Give))
{ {
MoveInfo.NextMoveStep(LineMoveStep.FI_18_ScanCode); if (YuScanTask == null || YuScanTask.IsCompleted)
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1); {
ClearTimeoutAlarm("预扫码结束超时");
MoveInfo.NextMoveStep(LineMoveStep.FI_18_ScanCode);
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1);
LastCodeList = new List<string>(); LastCodeList = new List<string>();
ScanCodeTask = null; ScanCodeTask = null;
if (NextCodeList.Count > 0) if (NextCodeList.Count > 0)
{ {
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码:使用预扫码"); InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码:使用预扫码");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastCodeList = new List<string>(NextCodeList); LastCodeList = new List<string>(NextCodeList);
NextCodeList = new List<string>(); NextCodeList = new List<string>();
MoveInfo.NextMoveStep(LineMoveStep.FI_20_CylinderTake); MoveInfo.NextMoveStep(LineMoveStep.FI_20_CylinderTake);
lastcode = CodeManager.ProcessCode(LastCodeList); lastcode = CodeManager.ProcessCode(LastCodeList);
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端"); InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take); CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
} }
else if (isScan) else if (isScan)
{
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000));
try
{ {
ScanCodeTask = Task.Factory.StartNew(delegate InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000));
try
{ {
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name); ScanCodeTask = Task.Factory.StartNew(delegate
bool hasRightCode = CodeManager.HasRightCode(LastCodeList.ToArray());
if (!hasRightCode)
{ {
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name, false, 3000); LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name);
} bool hasRightCode = CodeManager.HasRightCode(LastCodeList.ToArray());
lastcode = CodeManager.ProcessCode(LastCodeList); if (!hasRightCode)
return LastCodeList; {
}); LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name, false, 3000);
}
lastcode = CodeManager.ProcessCode(LastCodeList);
return LastCodeList;
});
}
catch (Exception ex)
{
LogUtil.error("" + MoveInfo.SLog + ":扫码出错:", ex);
}
//finally
//{
// MoveInfo.EndStepWait();
//}
} }
catch (Exception ex) else
{ {
LogUtil.error("" + MoveInfo.SLog + ":扫码出错:", ex); InLog("料盘移栽" + MoveInfo.SLog + ":不需要扫码");
} }
//finally
//{
// MoveInfo.EndStepWait();
//}
} }
else else if (MoveInfo.IsTimeOut(60))
{ {
InLog("料盘移栽" + MoveInfo.SLog + ":不需要扫码"); MoveTimeOut(MoveInfo, "预扫码结束超时");
} }
} }
else else
......
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
partial class FeedingEquip
{
#region 出料流程
private int OutStoreHeight = -1;
private int OutStoreCount = -1;
private TaskData taskData = null;
private InOutParam LastOutParam = new InOutParam();
private bool NeedCheckShelf = true;
public bool StartTrayOut(InOutParam outParam)
{
if (outParam == null || outParam.PosId == null || outParam.PosId.Equals(""))
{
LogUtil.error(Name + "出库失败,参数不完整,托盘先离开");
TrayMoveOk();
LogUtil.error(outParam.ToStr());
return false;
}
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.LOW) || OutStoreHeight < 0)
{
LogUtil.error(Name + "出库" + outParam.ToStr() + "失败,未准备好料架,托盘先离开");
TrayMoveOk();
return false;
}
//如果已经开始送出料架,暂不处理
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) && MoveInfo.MoveStep >= LineMoveStep.FO_51_BatchAxisToP2)
{
LogUtil.error(Name + "出库" + outParam.ToStr() + "失败,正在送出料架,托盘先离开");
TrayMoveOk();
return false;
}
if (!MoveInfo.MoveType.Equals(LineMoveType.None))
{
return false;
}
runStatus = LineRunStatus.Busy;
string lastXuniRfid = LastOutParam.rfid;
if (lastXuniRfid.Equals("") || lastXuniRfid.Equals(outParam.rfid))
{
//如果虚拟料架号为空,或者虚拟料架号与当前一致才可以出库
}
else
{
//料架号不一致时,直接送出料架
//如果流水线还有次料架的任务,暂不送出
int count = TrayManager.GetOutTaskByRfid(lastXuniRfid);
if (count <= 0)
{
LogUtil.info(Name + "出库" + outParam.ToStr() + "失败,料架号不一致[" + lastXuniRfid + "][" + outParam.rfid + "],当前料架暂时无任务,送出料架,托盘先离开");
TrayMoveOk();
MoveInfo.NewMove(LineMoveType.OutStore, LastOutParam);
SendOutShelfOut("料架号[" + lastXuniRfid + "][" + outParam.rfid + "]不一致");
return false;
}
else
{
LogUtil.info(Name + "出库" + outParam.ToStr() + "失败,料架号不一致[" + lastXuniRfid + "][" + outParam.rfid + "],当前料架还有【" + count + "】个任务,托盘先离开");
TrayMoveOk();
return false;
}
}
MoveInfo.NewMove(LineMoveType.OutStore, outParam);
LastOutParam = outParam;
//可以开始出库啦
MoveInfo.NextMoveStep(LineMoveStep.FO_21_AxisDownMove);
// CylinderMove(MoveInfo, IO_Type.SW_LocationCylinder_Down, IO_Type.SW_LocationCylinder_Up);
int height = outParam.PlateH + 4;
int targetPosition = BatchAxis.GetAclPosition() - height * Config.Height_ChangeValue;
if (targetPosition < Config.BatchAxisP2)
{
targetPosition = Config.BatchAxisP2;
}
OutLog("出库移栽 " + MoveInfo.SLog + " :提升伺服下降" + height + "mm,目标:" + targetPosition);
if (UpdownIsInP1() )
{
//已经在取料端
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take))
{
int targetP = Config.GetUpdownP2Detial(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW);
UpdownAxis.AbsMove(MoveInfo, targetP, Config.UpdownAxis_P2Speed);
}
else if (UpdownIsInP1())
{
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
}
else
{
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
BatchAxis.AbsMove(MoveInfo, targetPosition, Config.BatchAxis_P2Speed);
return true;
}
public void StartOutStoreP()
{
if (OutStoreHeight >= 0)
{
//判断是否需要送出料架
if (CurrShelfId != "" && CurrShelfId != "00" && LastOutParam.rfid != "")
{
//重新获取剩余任务
string msg = SServerManager.afterPutCut(Name, CurrShelfId, "", "", 0, out taskData);
if (String.IsNullOrEmpty(msg).Equals(false) || taskData == null)
{
LogUtil.error(Name + "定时获取 " + LastOutParam.ToShortStr() + " 剩余任务出错:" + msg);
}
else if (LastOutParam.cutReel && taskData.cutTask <= 0)
{
MoveInfo.NewMove(LineMoveType.OutStore, LastOutParam);
LogUtil.info(Name + "定时获取到 " + LastOutParam.ToShortStr() + " 已无剩余任务:" + taskData.ToStr());
SendOutShelfOut("分盘料,cutTask=" + taskData.cutTask + ",需要送出料架");
}
else if (LastOutParam.urgentReel && taskData.urgentTask <= 0)
{
MoveInfo.NewMove(LineMoveType.OutStore, LastOutParam);
LogUtil.info(Name + "定时获取到 " + LastOutParam.ToShortStr() + " 已无剩余任务:" + taskData.ToStr());
SendOutShelfOut("紧急料,urgentTask=" + taskData.urgentTask + ",需要送出料架");
}
}
return;
}
//若定位工位,阻挡工位,有 料架,直接进入定位工位,并上升好位置,若需要出库,直接下降高度即可
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
StartOutStoreMove(null);
}
else if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
//小车到达处理
}
else if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH))
{
//线体出口检测到料架,需要通知AGV小车
// AgvClient.NeedLeave(Config.AgvOutName);
}
}
public override bool StartOutStoreMove(InOutParam param)
{
runStatus = LineRunStatus.Busy;
MoveInfo.NewMove(LineMoveType.OutStore);
MoveInfo.MoveParam = new InOutParam();
taskData = null;
RFIDData data = RFIDManager.GetShelfId(DeviceID);
//判断是哪个工位有料架
if (data.Num > 0 && IsTrayLCylinderAfter())
{
OutLog("定位工位读取到料串 " + data.NumStr() + " , 等待定位工位检测信号亮");
FO_06_WaitTime(true);
}
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH) && IsTrayLCylinderAfter())
{
FO_06_WaitTime();
}
else
{
//如果升降盘在锁紧状态,需要返回P2
if (IsTrayLCylinderAfter())
{
MoveInfo.NextMoveStep(LineMoveStep.FO_02_TrayLocation_After);
OutLog("准备出库料架, " + MoveInfo.SLog + " :升降盘定位气缸后退");
TrayLCylinderAfter(MoveInfo);
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.FO_01_BatchAxisToP2);
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
OutLog("准备出库料架,升降盘不在后退端 " + MoveInfo.SLog + " :提升伺服先回到P2 ["+ Config.BatchAxisP2 + "]");
}
}
return true;
}
private void FO_06_WaitTime(bool needWaitCheck = false)
{
//定位工位有料架,等待1秒后再次检测
MoveInfo.NextMoveStep(LineMoveStep.FO_06_WaitTime);
if (needWaitCheck)
{
OutLog("定位工位读取到料串: " + MoveInfo.SLog + ",进料阻挡上升,缓冲阻挡上升, 等待定位工位信号");
}
else
{
OutLog("准备出库料架 " + MoveInfo.SLog + "定位工位检测到料架:进料阻挡上升, 等待3秒再次检测");
}
IOMove(IO_Type.SL_Line_Run, IO_VALUE.HIGH);
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.LOW);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
if (needWaitCheck)
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Location_Check, IO_VALUE.HIGH));
}
}
private void LineOutStoreProcess()
{
//判断是哪个工位有料架
RFIDData data = RFIDManager.GetShelfId(DeviceID);
if (data.Num > 0)
{
OutLog("定位工位读取到料串 " + data.NumStr() + " , 等待定位工位检测信号亮");
FO_06_WaitTime(true);
}
else if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
FO_06_WaitTime();
}
//阻挡工位有料架,流水线转动一个工位
else if (IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_05_LineStart);
OutLog("准备出库料架: " + MoveInfo.SLog + " 阻挡工位有新料架,清理缓存料架RFID,进料阻挡下降500ms,缓冲阻挡前进1000,流水线转动 5000");
UpdateLastShelfID();
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.HIGH, 500);
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.HIGH, 1000);//缓冲阻挡前进1000
IOMove(IO_Type.SL_Line_Run, IO_VALUE.HIGH);
//等待指定时间
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Location_Check, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Line_Run, IO_VALUE.HIGH));
}
else if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_05_LineStart);
OutLog("准备出库料架: " + MoveInfo.SLog + " 进料口有新料架,进料阻挡上升,缓冲阻挡前进1000,流水线转动 1000");
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.LOW);//进料阻挡上升
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.HIGH, 1000);//缓冲阻挡前进1000
IOMove(IO_Type.SL_Line_Run, IO_VALUE.HIGH);
//等待指定时间
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Stop_Check, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Line_Run, IO_VALUE.HIGH));
}
else
{
if (!ProcessShelfEnter)
{
IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW);
}
MoveEndS();
OutLog(" 未检测到料架, 准备出库料架结束");
}
}
protected override void OutStoreProcess()
{
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (MoveInfo.IsInWait)
{
return;
}
if (MoveInfo.IsStep(LineMoveStep.FO_01_BatchAxisToP2))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_02_TrayLocation_After);
TrayLCylinderAfter(MoveInfo);
OutLog("准备出库料架, " + MoveInfo.SLog + " :升降盘定位气缸后退");
}
else if (MoveInfo.IsStep(LineMoveStep.FO_02_TrayLocation_After))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_03_FixedUp);
OutLog("出库: " + MoveInfo.SLog + " 开始:固定气缸上升");
FixedCylinderUp(MoveInfo);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_03_FixedUp))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_04_LocationDown);
OutLog("出库: " + MoveInfo.SLog + " 开始:定位气缸下降,提升轴移动到P1");
LocationCylinderDown(MoveInfo);
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_04_LocationDown))
{
LineOutStoreProcess();
}
else if (MoveInfo.IsStep(LineMoveStep.FO_05_LineStart))
{
LineOutStoreProcess();
}
else if (MoveInfo.IsStep(LineMoveStep.FO_06_WaitTime))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_06_WaitTime);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(20000));
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
ReadShelfId();
if (CurrShelfId.EndsWith("00"))
{
SendOutShelfOut("料架号【" + CurrShelfId + "】无效");
return;
}
//判断是否是第一次获取料架,需要从服务器获取此料架的虚拟料架号,若无虚拟料架号,料架可以用
//有虚拟料架号,从服务器获取此料架剩余任务,若无任务,需要送出料架
if (LastOutParam.rfid.Equals("") && NeedCheckShelf)
{
//只有启动后第一个料架才需要验证
NeedCheckShelf = false;
string tempRfid = "";
string msg = SServerManager.findTempRfid(Name, CurrShelfId, out tempRfid);
if (!String.IsNullOrEmpty(msg))
{
LogUtil.error(Name + "findTempRfid 【" + CurrShelfId + "】【" + tempRfid + "】结果:" + msg);
}
if (!String.IsNullOrEmpty(tempRfid))
{
//如果虚拟料架号存在,直接送出料架
SendOutShelfOut("料架【" + CurrShelfId + "】【" + tempRfid + "】已绑定,不再使用");
return;
}
}
//定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FO_07_LocationUp);
OutLog("定位工位检测到料架: " + MoveInfo.SLog + " 定位气缸上升,读取并缓存料架RFID");
UpdateLastShelfID(CurrShelfId);
LocationCylinderUp(MoveInfo);
}
else
{
MoveEndS();
OutLog(" 未检测到料架,料架处理结束");
}
}
else if (MoveInfo.IsStep(LineMoveStep.FO_07_LocationUp))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_08_FixedDown);
OutLog("准备出库料架: " + MoveInfo.SLog + " 固定气缸下降");
FixedCylinderDown(MoveInfo);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_08_FixedDown))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_11_BatchAxisToP2);
OutLog("准备出库料架 " + MoveInfo.SLog + " :提升轴下降到位P2[" + Config.BatchAxisP2 + "]");
if (!ProcessShelfEnter)
{
IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW);
}
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_11_BatchAxisToP2))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_12_TrayLocation_Before);
OutLog("准备出库料架 " + MoveInfo.SLog + " :升降盘定位气缸第一次前进 2秒");
TrayLCylinderBefore(null);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
}
else if (MoveInfo.IsStep(LineMoveStep.FO_12_TrayLocation_Before))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_13_TrayLocation_Back);
OutLog("准备出库料架 " + MoveInfo.SLog + " :升降盘定位气缸后退,等待再次前进");
TrayLCylinderAfter(MoveInfo);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_13_TrayLocation_Back))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_14_TrayLocation_Before);
OutLog("准备出库料架 " + MoveInfo.SLog + " :升降盘定位气缸前进");
TrayLCylinderBefore(MoveInfo);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_14_TrayLocation_Before))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_15_AxisUpMove);
OutLog("准备出库料架 " + MoveInfo.SLog + " :上料轴开始慢速上升到P3点,等待检测到料盘");
BatchAxisToP3();
}
else if (MoveInfo.IsStep(LineMoveStep.FO_15_AxisUpMove))
{
//判断信号是否亮
if (IOValue(IO_Type.SL_AxisLocationCheck).Equals(IO_VALUE.LOW))
{
OutStoreHeight = 0;
OutStoreCount = 0;
//如果再出库中直接出库
MoveInfo.EndMove();
runStatus = LineRunStatus.Runing;
OutLog("准备出库料架完成");
}
else
{
//检测到料盘,需要下降指定高度,此处默认下降2cm
int tp = BatchAxis.GetAclPosition() - Config.Height_ChangeValue * 20;
if (tp < Config.BatchAxisP2)
{
OutLog("准备出库料架 " + MoveInfo.SLog + " :检测到料盘,下降的目标高度为【" + tp + "】<【" + Config.BatchAxisP2 + "】,料架已满,直接送出料架");
MoveInfo.NextMoveStep(LineMoveStep.FO_51_BatchAxisToP2);
OutLog("出库移栽 " + MoveInfo.SLog + ":提升伺服到P2点 [" + Config.BatchAxisP2 + "]");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.FO_15_AxisUpMove);
OutLog("准备出库料架 " + MoveInfo.SLog + " :检测到料盘,需要下降指定高度,目标位置:" + tp + ",等待检测不到料盘");
MoveInfo.TimeOutSeconds = 200;
MoveInfo.CanWhileCount = 0;
MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(Config.Batch_Axis, tp, Config.BatchAxis_P3Speed));
Config.Batch_Axis.TargetPosition = tp;
BatchAxis.AbsMove(null, tp, Config.BatchAxis_P3Speed);
//开始检测信号
BatchAxisStartCheck(IO_Type.SL_AxisLocationCheck, IO_VALUE.LOW);
}
}
}
else if (MoveInfo.IsStep(LineMoveStep.FO_51_BatchAxisToP2))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_52_TrayLocation_After);
OutLog("送出料串: " + MoveInfo.SLog + ": 升降盘定位气缸后退,重置 OutEndSendShelfOut=fasle ,OutStoreCount = 0");
OutEndSendShelfOut = false;
OutStoreHeight = -1;
OutStoreCount = 0;
TrayLCylinderAfter(MoveInfo);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_52_TrayLocation_After))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_53_BatchAxisToP1);
OutLog("送出料串: " + MoveInfo.SLog + ":提升伺服到P1点");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_53_BatchAxisToP1))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_54_FixedUp);
OutLog("送出料串: " + MoveInfo.SLog + ":固定气缸上升,定位气缸下降");
FixedCylinderUp(MoveInfo);
LocationCylinderDown(MoveInfo);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_54_FixedUp))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_55_OutCheck);
OutLog("送出料串: " + MoveInfo.SLog + ",等待出料线体无料架");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Out_Check, IO_VALUE.LOW));
}
else if (MoveInfo.IsStep(LineMoveStep.FO_55_OutCheck))
{
if (!ProcessShelfOut)
{
if (IsFixedCylinderUp())
{
MoveInfo.NextMoveStep(LineMoveStep.FO_56_TopUp);
OutLog("送出料串: " + MoveInfo.SLog + ",顶升气缸上升,出料缓冲阻挡上升");
TopCylinderUp(MoveInfo);
IOMove(IO_Type.SL_Out_StopDown, IO_VALUE.LOW);
}
else
{
OutLog("送出料串: " + MoveInfo.SLog + ",顶升气缸上升时发现固定气缸不在上升端,重新上升固定气缸");
MoveInfo.NextMoveStep(LineMoveStep.FO_54_FixedUp);
OutLog("送出料串: " + MoveInfo.SLog + ":固定气缸上升,定位气缸下降");
FixedCylinderUp(MoveInfo);
LocationCylinderDown(MoveInfo);
}
}
}
else if (MoveInfo.IsStep(LineMoveStep.FO_56_TopUp))
{
//TODO
MoveInfo.NextMoveStep(LineMoveStep.FO_57_SideWayLineRun);
OutLog("送出料串: " + MoveInfo.SLog + ", 线体横移电机运转,等待料架离开定位工位");
IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.HIGH);
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.HIGH);
//IOMove(IO_Type.SL_RollerLine_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Location_Check, IO_VALUE.LOW));
}
else if (MoveInfo.IsStep(LineMoveStep.FO_57_SideWayLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_58_WaitShelfGo);
OutLog("送出料串:" + MoveInfo.SLog + ", 线体横移电机运转,等待料架到达出口");
IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.HIGH);
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.HIGH);
//IOMove(IO_Type.SL_RollerLine_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Out_Check, IO_VALUE.HIGH));
}
else if (MoveInfo.IsStep(LineMoveStep.FO_58_WaitShelfGo))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_59_WaitTime);
OutLog("送出料串:" + MoveInfo.SLog + ", 横移电机再转动3秒,等待料架到达出口");
IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.HIGH);
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.HIGH);
//IOMove(IO_Type.SL_RollerLine_Run, IO_VALUE.HIGH);
int time = 200;
if (HasOutLine)
{
time = 3000;
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(time));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Out_Check, IO_VALUE.HIGH));
}
else if (MoveInfo.IsStep(LineMoveStep.FO_59_WaitTime))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_60_LineStop);
OutLog("送出料串: " + MoveInfo.SLog + ", 料架到达出口,线体横移电机停止 ");
IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.LOW);
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.LOW);
//IOMove(IO_Type.SL_RollerLine_Run, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}
else if (MoveInfo.IsStep(LineMoveStep.FO_60_LineStop))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_61_TopDown);
OutLog("送出料串: " + MoveInfo.SLog + ", 料架到达出口,顶升气缸下降 ,清空LastOutParam,清理料架号,清理RFID缓存 ");
UpdateLastShelfID();
TopCylinderDown(MoveInfo);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastOutParam = new InOutParam();
//清理RFID
RFIDManager.ClearTrayNum(DeviceID);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_61_TopDown))
{
if (HasOutLine)
{
MoveInfo.NextMoveStep(LineMoveStep.FO_62_OutLineRun);
OutLog("送出料串: " + MoveInfo.SLog + ", 出料线阻挡上升,出料线体转动5秒钟 或等待出料口信号亮");
IOMove(IO_Type.SL_Out_StopDown, IO_VALUE.LOW);
//IOMove(IO_Type.SL_OutLine_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
//if (IOValue(IO_Type.SL_OutLine_Check).Equals(IO_VALUE.LOW))
//{
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_OutLine_Check, IO_VALUE.HIGH));
//}
}
else
{
MoveEndS();
OutLog("送出料串: " + MoveInfo.SLog + ", 料架到达出口处, 通知AGV取空料架, 出料结束");
AgvClient.NeedLeave(Config.AgvOutName, LastOutShelfId, Asa.ClientLevel.High);
}
}
else if (MoveInfo.IsStep(LineMoveStep.FO_62_OutLineRun))
{
MoveEndS();
OutLog("送出料串: " + MoveInfo.SLog + ", 出料线体停止,料架到达出口处, 通知AGV取空料架, 出料结束");
IOMove(IO_Type.SL_Out_StopDown, IO_VALUE.LOW);
//IOMove(IO_Type.SL_OutLine_Run, IO_VALUE.LOW);
AgvClient.NeedLeave(Config.AgvOutName, LastOutShelfId, Asa.ClientLevel.High);
}
else if (MoveInfo.MoveStep >= LineMoveStep.FO_21_AxisDownMove && MoveInfo.MoveStep < LineMoveStep.FO_51_BatchAxisToP2)
{
TrayOutProcess();
}
else
{
LogUtil.error(Name + " " + MoveInfo.MoveType + MoveInfo.SLog + "未找到相关处理", 19);
}
}
private void TrayOutProcess()
{
string outType = "紧急出料 ";
if (MoveInfo.MoveParam != null && MoveInfo.MoveParam.cutReel)
{
outType = "分盘料 ";
}
if (MoveInfo.IsStep(LineMoveStep.FO_21_AxisDownMove))
{
//判断伺服检测信号是否亮
//if (IOValue(IO_Type.SL_AxisLocationCheck).Equals(IO_VALUE.LOW) || BatchAxis.IsInPosition(Config.BatchAxisP2))
if (IOValue(IO_Type.SL_AxisLocationCheck).Equals(IO_VALUE.HIGH) && BatchAxis.IsInPosition(Config.BatchAxisP2).Equals(false))
{
//可以开始出库啦
MoveInfo.NextMoveStep(LineMoveStep.FO_21_AxisDownMove);
int height = MoveInfo.MoveParam.PlateH + 4;
int targetPosition = BatchAxis.GetAclPosition() - height * Config.Height_ChangeValue;
if (targetPosition < Config.BatchAxisP2)
{
targetPosition = Config.BatchAxisP2;
}
OutLog("出库移栽 " + MoveInfo.SLog + " :TrayOutProcess 伺服检测信号亮并且不再P2点,再次下降" + height + "mm,目标:" + targetPosition);
BatchAxis.AbsMove(MoveInfo, targetPosition, Config.BatchAxis_P2Speed);
}
else
{
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take))
{
int targetP = Config.GetUpdownP2Detial(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW);
if (UpdownAxis.IsInPosition(targetP))
{
FO_25_CylinderTighten(outType);
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.FO_23_UpdownAxisToP2);
OutLog(outType + MoveInfo.SLog + ":升降伺服下降到P2:" + targetP);
UpdownAxis.AbsMove(MoveInfo, targetP, Config.UpdownAxis_P2Speed);
}
}
else
{
if (UpdownIsInP1())
{
MoveInfo.NextMoveStep(LineMoveStep.FO_22_CylinderTake);
OutLog(outType + MoveInfo.SLog + ":上料横移机构取料端,等待夹爪无料");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_ClampCylinder_Check, IO_VALUE.LOW));
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.FO_21_AxisDownMove);
OutLog(outType + MoveInfo.SLog + ":上料横移机构取料端 前升降轴先到P1 [" + Config.UpDownAxisP1 + "]");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
}
}
}
else if (MoveInfo.IsStep(LineMoveStep.FO_22_CylinderTake))
{
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_23_UpdownAxisToP2);
int targetP = Config.GetUpdownP2Detial(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW);
OutLog(outType + MoveInfo.SLog + ":升降伺服下降到P2:" + targetP);
UpdownAxis.AbsMove(MoveInfo, targetP, Config.UpdownAxis_P2Speed);
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.FO_22_CylinderTake);
OutLog(outType + MoveInfo.SLog + ":上料横移机构取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
}
else if (MoveInfo.IsStep(LineMoveStep.FO_23_UpdownAxisToP2))
{
FO_25_CylinderTighten(outType);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_24_CylinderDown))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_25_CylinderTighten);
OutLog(outType + MoveInfo.SLog + ":上料气缸夹紧");
//CylinderMove(MoveInfo, IO_Type.SL_ClampCylinder_Relax, IO_Type.SL_ClampCylinder_Work);
ClampJwa.Push(MoveInfo);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_25_CylinderTighten))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_26_UpdownAxisToP1);
OutLog(outType + MoveInfo.SLog + ":升降伺服到P1");
if (!UpdownAxis.IsInPosition(Config.UpDownAxisP1))
{
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
}
else if (MoveInfo.IsStep(LineMoveStep.FO_26_UpdownAxisToP1))
{
if (UpdownIsInP1())
{
//if (IOValue(IO_Type.SL_ClampCylinder_Check).Equals(IO_VALUE.LOW))
//{
// MoveInfo.NextMoveStep(LineMoveStep.FO_27_ClampCheck);
// OutLog(outType + MoveInfo.SLog + ":检测夹爪料盘检测=HIGH");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_ClampCylinder_Check, IO_VALUE.HIGH));
//}
//else
{
FO_28_CylinderGive(outType);
}
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.FO_26_UpdownAxisToP1);
OutLog(outType + MoveInfo.SLog + ":上料横移机构到放料端前,先升降轴先到P1 [" + Config.UpDownAxisP1 + "]");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
}
else if (MoveInfo.IsStep(LineMoveStep.FO_27_ClampCheck))
{
FO_28_CylinderGive(outType);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_28_CylinderGive))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_29_UpdownAxisToP3);
OutLog(outType + MoveInfo.SLog + ":移栽伺服到P3 [" + Config.UpDownAxisP3 + "]");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP3, Config.UpdownAxis_P3Speed);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_29_UpdownAxisToP3))
{
OutStoreHeight += MoveInfo.MoveParam.PlateH;
OutStoreCount++;
MoveInfo.NextMoveStep(LineMoveStep.FO_30_CylinderSlack);
OutLog(outType + MoveInfo.SLog + ":出料横移机构放松,累积出库【" + OutStoreCount + "】盘【" + OutStoreHeight + "】mm");
//CylinderMove(MoveInfo, IO_Type.SL_ClampCylinder_Work, IO_Type.SL_ClampCylinder_Relax);
ClampJwa.Relax(MoveInfo);
}
else if (MoveInfo.IsStep(LineMoveStep.FO_30_CylinderSlack))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_31_UpdownAxisToP1);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
OutLog(outType + MoveInfo.SLog + ":移栽伺服上升到待机点P1,通知服务器 afterPutCut");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
afterPutOk = false;
string msg = SServerManager.afterPutCut(Name, CurrShelfId, MoveInfo.MoveParam.WareCode, "", OutStoreCount, out taskData);
if (String.IsNullOrEmpty(msg).Equals(false))
{
LogUtil.error(Name + "【" + MoveInfo.MoveParam.WareCode + "】【" + CurrShelfId + "】【" + OutStoreCount.ToString() + "】afterPutCut 结果:" + msg);
taskData = null;
}
afterPutOk = true;
}
else if (MoveInfo.IsStep(LineMoveStep.FO_31_UpdownAxisToP1))
{
// MoveInfo.NextMoveStep(LineMoveStep.FO_32_ClampCheck);
// OutLog(outType + MoveInfo.SLog + ":检测夹爪料盘检测=LOW");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_ClampCylinder_Check, IO_VALUE.LOW));
//}
//else if (MoveInfo.IsStep(LineMoveStep.FO_32_ClampCheck))
//{
if (UpdownIsInP1())
{
MoveInfo.NextMoveStep(LineMoveStep.FO_33_CylinderTake);
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
//只有提升轴位置过低时才需要到P3
int currPosition = BatchAxis.GetAclPosition();
if (currPosition <= (Config.BatchAxisP2 + Config.Height_ChangeValue * 40))
{
OutLog(outType + MoveInfo.SLog + ":上料横移机构回到取料端,提升轴[" + currPosition + "]需要到P3");
BatchAxisToP3();
}
else
{
OutLog(outType + MoveInfo.SLog + ":上料横移机构回到取料端,提升轴[" + currPosition + "]不需要到P3");
}
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.FO_31_UpdownAxisToP1);
OutLog(outType + MoveInfo.SLog + ":上料横移机构取料端 前升降轴先到P1");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
}
else if (MoveInfo.IsStep(LineMoveStep.FO_33_CylinderTake))
{
if (afterPutOk)
{
//出库结束 TODO
// bool isNeedSendShelf = false;
//判断料架是否满了
int currPositon = BatchAxis.GetAclPosition();
int tp = currPositon - Config.Height_ChangeValue * 40;
if (tp <= Config.BatchAxisP2)
{
SendOutShelfOut("当前提升轴位置:" + currPositon + ",料架已满,需要送出料架");
}
else if (OutEndSendShelfOut)
{
SendOutShelfOut("当前提升轴位置:" + currPositon + ",OutEndSendShelfOut,需要送出料架");
}
else
{
//判断是否需要送出料架'
if (taskData == null)
{
SendOutShelfOut("出料结束,taskData=null,需要送出料架");
}
else if (MoveInfo.MoveParam.cutReel && taskData.cutTask <= 0)
{
SendOutShelfOut("分盘料,cutTask=" + taskData.cutTask + ",需要送出料架");
}
else if (MoveInfo.MoveParam.urgentReel && taskData.urgentTask <= 0)
{
SendOutShelfOut("紧急料,urgentTask=" + taskData.urgentTask + ",需要送出料架");
}
else
{
OutLog("出料完成,出料结束");
MoveEndS();
}
}
ClearTimeoutAlarm("等待给服务器发送afterPut完成超时");
}
else if (MoveInfo.IsTimeOut(60))
{
MoveTimeOut(MoveInfo, "等待给服务器发送afterPut完成超时");
}
}
}
private void FO_28_CylinderGive(string outType)
{
int trayNum = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.TrayNumber : currTrayNum;
TrayManager.UpdateTrayInfo(trayNum, false);
TrayMoveOk();
MoveInfo.NextMoveStep(LineMoveStep.FO_28_CylinderGive);
OutLog(outType + MoveInfo.SLog + ":更新托盘【"+ trayNum + "】为空,托盘可离开,上料横移机构到放料端 ");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Give);
}
private bool afterPutOk = false;
private void FO_25_CylinderTighten(string outType)
{
MoveInfo.NextMoveStep(LineMoveStep.FO_25_CylinderTighten);
OutLog(outType + MoveInfo.SLog + ":上料气缸夹紧");
//CylinderMove(MoveInfo, IO_Type.SL_ClampCylinder_Relax, IO_Type.SL_ClampCylinder_Work);
ClampJwa.Push(MoveInfo);
}
private void SendOutShelfOut(string msg = "")
{
MoveInfo.NextMoveStep(LineMoveStep.FO_51_BatchAxisToP2);
OutStoreHeight = -1;
//包装料会发往分盘区, 紧急料区, 包装线区
// urgentReel 这个为true是紧急料 出到紧急料区
// cutReel 为true是分盘料,AGV会拉到到分盘区
//料串会发到分盘区和紧急料区
//两个都为false 包装料默认拉到包装线体, 料串默认拉到紧急料区
if (CurrShelfId.Equals("00"))
{
//料架号无效送出的,不发mark
LastOutShelfId = CurrShelfId + "";
}
else
{
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
if (MoveInfo.MoveParam.urgentReel)
{
//紧急料,需要到紧急料区
LastOutShelfId = CurrShelfId + ",urgent";
}
else if (MoveInfo.MoveParam.cutReel)
{
//cutReel 为true是分盘料,AGV会拉到到分盘区
LastOutShelfId = CurrShelfId + ",cut";
}
else
{
LastOutShelfId = CurrShelfId + ",urgent";
}
}
OutLog("紧急出料完成, " + MoveInfo.SLog + ":" + msg + ",送出料串,提升伺服到P2点,重置OutStoreHeight=-1,更新LastOutShelfId=" + LastOutShelfId);
}
#endregion
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!