FeedingEquip_OutStore.cs 12.2 KB
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 InOutParam lastOutParam = null;
        public override bool StartOutStoreMove(InOutParam param)
        {
            runStatus = LineRunStatus.Busy;
            lineStatus = LineStatus.OutStoreExecute;
            MoveInfo.NewMove(LineMoveType.OutStore);
            MoveInfo.MoveParam = new InOutParam();
            MoveInfo.NextMoveStep(LineMoveStep.FO_01_TrayLocation_After);
            TrayLCylinderAfter(MoveInfo);
            OutLog("检测到料架, FO_01_TrayLocation_After  :升降盘定位气缸后退");
            return true;
        }
        private void LineOutStoreProcess()
        {
            IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW);

            //判断是哪个工位有料架
            if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
            {
                //定位工位有料架,直接开始入料
                MoveInfo.NextMoveStep(LineMoveStep.FO_07_LocationCylinder_Up);
                OutLog("定位工位检测到料架" + MoveInfo.MoveStep + ":缓冲阻挡上升, 定位气缸上升");
                IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡下降 
                CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
            }
            //阻挡工位有料架,流水线转动一个工位
            else if (IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_03_LineStart);
                IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.LOW);//进料阻挡上升
                IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.HIGH);//缓冲阻挡下降
                IOMove(IO_Type.SL_Line_Run, IO_VALUE.HIGH);
                //等待指定时间
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
                OutLog("出料检测" + MoveInfo.SLog + ":阻挡工位有料架,进料阻挡上升,缓冲阻挡下降,流水线转动2000");
            }
            else if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_03_LineStart);
                IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.HIGH);//进料阻挡下降
                IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡上升
                IOMove(IO_Type.SL_Line_Run, IO_VALUE.HIGH);
                //等待指定时间
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
                OutLog("出料检测" + MoveInfo.SLog + ":入料工位有料架,进料阻挡下降,缓冲阻挡上升,流水线转动2000");
            }
            else
            {
                MoveInfo.EndMove();
                runStatus = LineRunStatus.Runing;
                LogUtil.info(" 未检测到料架,出料结束");
            }
        }
        protected override void OutStoreProcess()
        {
            if (MoveInfo.IsInWait)
            {
                CheckWait(MoveInfo);
            }
            if (MoveInfo.IsInWait)
            {
                return;
            }
            if (MoveInfo.MoveStep.Equals(LineMoveStep.Wait))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_01_TrayLocation_After);
                TrayLCylinderAfter(MoveInfo);
                OutLog("出料检测" + MoveInfo.SLog + ":升降盘定位气缸后退");
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_01_TrayLocation_After))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_02_LocationCylinder_Down);
                OutLog("出库:  " + MoveInfo.SLog + " 开始:定位气缸下降,提升轴移动到P1");
                CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down);
                BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_02_LocationCylinder_Down))
            {
                LineOutStoreProcess();
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_03_LineStart))
            {
                LineOutStoreProcess();
            }

            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_07_LocationCylinder_Up))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_08_BatchAxisToP2);
                OutLog("出库移栽 " + MoveInfo.SLog + " :提升轴下降到位P2");
                IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW);
                BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_08_BatchAxisToP2))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_09_TrayLocation_Before);
                OutLog("出库移栽 " + MoveInfo.SLog + " :升降盘定位气缸前进");
                TrayLCylinderBefore(MoveInfo);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_09_TrayLocation_Before))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_10_AxisUpMove);
                OutLog("出库移栽 " + MoveInfo.SLog + " :上料轴开始慢速上升到P3点");
                BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP3, Config.BatchAxis_TargetSpeed);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_10_AxisUpMove))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_11_AxisDownMove);
                OutLog("出库移栽 " + MoveInfo.SLog + " :提升伺服下降指定的高度");
                int targetPosition = Config.BatchAxisP3 + lastOutParam.PlateH * Config.Height_ChangeValue;
                BatchAxis.AbsMove(MoveInfo, targetPosition, Config.BatchAxis_TargetSpeed);

            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_11_AxisDownMove))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_12_MoveCylinder_Down);
                OutLog("出库移栽 " + MoveInfo.SLog + ":出料横移机构下降");
                CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Up, IO_Type.SL_MoveCylinder_Down);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_12_MoveCylinder_Down))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_13_MoveCylinder_Slack);
                OutLog("出库移栽 " + MoveInfo.SLog + ":出料横移机构放松");
                CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Tighten, IO_Type.SL_MoveCylinder_Slack);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_13_MoveCylinder_Slack))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_14_MoveCylinder_Up);
                OutLog("出库移栽 " + MoveInfo.SLog + ":上料横移机构上升");
                CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_14_MoveCylinder_Up))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_31_BatchAxisToP2);
                OutLog("出库移栽 " + MoveInfo.SLog + ":未检测到料盘,提升伺服到P2点");
                BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_31_BatchAxisToP2))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_32_TrayLocationCylinder_After);
                OutLog("出料完成 " + MoveInfo.SLog + ": 升降盘定位气缸后退");
                TrayLCylinderAfter(MoveInfo);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_32_TrayLocationCylinder_After))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_33_BatchAxisToP1);
                OutLog("出料完成 " + MoveInfo.SLog + ":提升伺服到P1点,定位气缸下降");
                BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
                CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_33_BatchAxisToP1))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_34_OutTopCylinder_Up);
                OutLog("出料完成 " + MoveInfo.SLog + ",出口顶升气缸上升,出料缓冲阻挡上升");
                CylinderMove(MoveInfo, IO_Type.SL_OutTopCylinder_Down, IO_Type.SL_OutTopCylinder_Up);
                IOMove(IO_Type.SL_Out_StopDown, IO_VALUE.LOW);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_34_OutTopCylinder_Up))
            {
                //TODO 
                MoveInfo.NextMoveStep(LineMoveStep.FO_36_SideWayLineRun);
                OutLog("出料完成 " + MoveInfo.SLog + ", 线体横移电机运转,等待料架离开定位工位");
                IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.HIGH);
                IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.HIGH);
                MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Location_Check, IO_VALUE.LOW));
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_35_WaitLocationNoShelf))
            {
                //TODO 
                MoveInfo.NextMoveStep(LineMoveStep.FO_36_SideWayLineRun);
                OutLog("出料完成 " + MoveInfo.SLog + ", 线体横移电机运转,等待料架到达出口");
                IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.HIGH);
                IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.HIGH);
                MoveInfo.OneWaitCanEndStep = true;
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
                MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Out_Check, IO_VALUE.HIGH));
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_36_SideWayLineRun))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_37_LineStop);

                OutLog("出料完成 " + MoveInfo.SLog + ", 料架到达出口,线体横移电机停止 ");
                IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.LOW);
                IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.LOW);
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_37_LineStop))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_38_TopCylinderDown);
                OutLog("出料完成 " + MoveInfo.SLog + ", 料架到达出口,出口顶升下降,定位气缸下降, ");
                CylinderMove(MoveInfo, IO_Type.SL_OutTopCylinder_Up, IO_Type.SL_OutTopCylinder_Down);
                CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down);
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_38_TopCylinderDown))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_39_OutLineRun);
                OutLog("出料完成 " + MoveInfo.SLog + ", 出口线体运转,料架到达出口处, 通知AGV取空料架, ");
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_40_OutLineRun))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_40_OutLineRun);
                OutLog("出料完成 " + MoveInfo.SLog + ", AGV到达,继续转动出口线体,送走出料料架,  ");
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_40_OutLineRun))
            {
                MoveInfo.NextMoveStep(LineMoveStep.FO_41_OutLineRun);
                OutLog("上料完成 " + MoveInfo.SLog + ", 料架送出, ");
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_41_OutLineRun))
            {
                MoveInfo.EndMove();
                runStatus = LineRunStatus.Runing;
                lastOutParam = null;
                LogUtil.info("空料架已送出,出料结束");
            }
        }
        #endregion
    }
}