예제 #1
0
        public ErrorInfoWithPause ActionStartUnload(CallBackCommonFunc AfterUnloadOut)
        {
            ErrorInfoWithPause res = null;

            IsWorkFree = false;
            AxisUnloadOutConveyor.SetZero();
            while (!AxisUnloadOutConveyor.MoveTo(EnumPoint.Step))
            //return DispMotionError(AxisUnloadOutConveyor, "向外移料");
            {
                res = DispMotionError(AxisUnloadOutConveyor, "向外移料");
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterUnloadOut != null)
            {
                AfterUnloadOut();
            }
            //if (ThisInport(EnumInportName.UnloadOutUnload).status != (UnloadOutDatas[0] != null))
            //{
            //    ClassErrorInfo.ShowError(this.Name, "下料处电芯有无和数据不相符。", ErrorLevel.Error);
            //    return "下料处电芯有无和数据不相符。";
            //}
            //else if (ThisInport(EnumInportName.UnloadOutUnload).status)
            //    break;
            IsWorkFree = true;
            return(null);
        }
예제 #2
0
 public ClassBaseWorkZone(string ZoneName)
 {
     Name           = ZoneName;
     asyncReset     = DoReset;
     asyncMotorMove = ActionMotorMove;
     //GetProdParameter();
     CommonFunction.SysPublisher.subscribeMeToSystemEvents(this);
 }
예제 #3
0
        public ErrorInfoWithPause ActionLoadPNPStartPlace(CallBackCommonFunc ActionPlace, CallBackCommonFunc AfterActionPlace)
        {
            ErrorInfoWithPause res;

            //Check vacuum
            res = CheckVacuumStatus();
            if (res != null)
            {
                return(res);
            }
            //PNP Z down
            while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Place, true, ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean + 1))
            //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Place);
            {
                res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Place);
                if (res != null)
                {
                    return(res);
                }
            }
            //Start placing
            if (ActionPlace != null)
            {
                ActionPlace();
            }
            //PNP Z up
            while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Idle))
            //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle);
            {
                res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle);
                if (res != null)
                {
                    return(res);
                }
            }
            //if (!ClassCommonSetting.CheckTimeOut(() => MotorSafetyCheck.GreaterThanPosition(AxisLoadPNPZ, EnumPointZ.Idle, -5)))
            //    return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle);
            //Close air
            AirControl((LoadPNPDataStations[EnumCellIndex.左电芯].CellData != null && LoadPNPDataStations[EnumCellIndex.左电芯].CellData.LoadNG) ? EnumAirControl.Vacuum : EnumAirControl.Close,
                       (LoadPNPDataStations[EnumCellIndex.中电芯].CellData != null && LoadPNPDataStations[EnumCellIndex.中电芯].CellData.LoadNG) ? EnumAirControl.Vacuum : EnumAirControl.Close,
                       (LoadPNPDataStations[EnumCellIndex.右电芯].CellData != null && LoadPNPDataStations[EnumCellIndex.右电芯].CellData.LoadNG) ? EnumAirControl.Vacuum : EnumAirControl.Close);
            //PNP Y move away
            while (!AxisLoadPNPY.MoveTo(EnumPointY.Pick, false))
            //return DispMotionError(AxisLoadPNPY, EnumPointY.Pick);
            {
                res = DispMotionError(AxisLoadPNPY, EnumPointY.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionPlace != null)
            {
                AfterActionPlace();
            }
            return(null);
        }
예제 #4
0
        public ErrorInfoWithPause ActionStartLoad(out bool AllPick, CallBackCommonFunc ActionTransLoad, CallBackCommonFunc AfterActionTransLoad)
        {
            ErrorInfoWithPause res = ActionMove(EnumPointPNPX.Load);

            if (res != null)
            {
                AllPick = false;
                return(res);
            }
            //Cylinder down
            while (!PNPCylinder.SetCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
            {
                //res = new ErrorInfoWithPause("传送机械手气缸下移超时错。", ErrorLevel.Error);
                res = WaitAlarmPause("传送PNP取料", "传送机械手气缸下移超时错");
                if (res != null)
                {
                    AllPick = false;
                    return(res);
                }
            }
            if (ActionTransLoad != null)
            {
                ActionTransLoad();
            }
            //Cylinder up
            while (!PNPCylinder.SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
            {
                //res = new ErrorInfoWithPause("传送机械手气缸上移超时错。", ErrorLevel.Error);
                //AllPick = false;
                //return res;
                res = WaitAlarmPause("传送PNP取料", "传送机械手气缸上移超时错");
                if (res != null)
                {
                    AllPick = false;
                    return(res);
                }
            }
            if (AfterActionTransLoad != null)
            {
                AfterActionTransLoad();
            }
            //Check vacuum
            string vac = CheckVacuumStatus();

            AllPick = vac.Trim() == "";
            if (!AllPick)
            {
                return(new ErrorInfoWithPause(vac.Trim(), ErrorLevel.Alarm, true));
            }
            return(null);
        }
예제 #5
0
        public static void CallBackCommonAsyncReturn(IAsyncResult result, string Handle)
        {
            CallBackCommonFunc handler = (CallBackCommonFunc)result.AsyncState;

            try
            {
                handler.EndInvoke(result);
                result.AsyncWaitHandle.Close();
            }
            catch (Exception e)
            {
                ClassCommonSetting.ThrowException(handler, Handle, e);
            }
        }
예제 #6
0
        public ErrorInfoWithPause ActionStartShift(CallBackCommonFunc AfterUnloadOutShift)
        {
            ErrorInfoWithPause res = null;

            AxisUnloadOutConveyor.SetZero();
            while (!AxisUnloadOutConveyor.MoveTo(EnumPoint.Shift))
            //return DispMotionError(AxisUnloadOutConveyor, "移到NG取料位");
            {
                res = DispMotionError(AxisUnloadOutConveyor, "移到NG取料位");
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterUnloadOutShift != null)
            {
                AfterUnloadOutShift();
            }
            CheckNGSensor();
            return(null);
        }
예제 #7
0
        public ErrorInfoWithPause ActionUnloadPNPStartPlace(CallBackCommonFunc ActionLoadOutPlace, CallBackCommonFunc AfterActionLoadOutPlace)
        {
            ErrorInfoWithPause res;

            //Check vacuum
            res = CheckVacuumStatus();
            if (res != null)
            {
                return(res);
            }
            //Cylinder down
            while (!PNPCylinder.SetCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
            //return new ErrorInfoWithPause("下料PNP气缸下移错误。", ErrorLevel.Error);
            {
                res = WaitAlarmPause("下料PNP放料", "下料PNP气缸下移错误");
                if (res != null)
                {
                    return(res);
                }
            }
            if (ActionLoadOutPlace != null)
            {
                ActionLoadOutPlace();
            }
            //Cylinder up
            while (!PNPCylinder.SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
            //return new ErrorInfoWithPause("下料PNP气缸上移错误。", ErrorLevel.Error);
            {
                res = WaitAlarmPause("下料PNP放料", "下料PNP气缸上移错误");
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionLoadOutPlace != null)
            {
                AfterActionLoadOutPlace();
            }
            return(null);
        }
예제 #8
0
        public ErrorInfoWithPause ActionLoadPNPStartPick(CallBackCommonFunc ActionPick, CallBackCommonFunc AfterActionPick)
        {
            ErrorInfoWithPause res = null;

            //PNP Z down
            while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Pick, true, ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean - 1))
            //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Pick);
            {
                res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            //Start picking
            if (ActionPick != null)
            {
                ActionPick();
            }
            //PNP Z up
            while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Idle))
            //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle);
            {
                res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle);
                if (res != null)
                {
                    return(res);
                }
            }
            //TimeClass.Delay(500);
            if (AfterActionPick != null)
            {
                AfterActionPick();
            }
            //Check vacuum
            res = CheckVacuumStatus();
            return(res);
        }
예제 #9
0
        public ErrorInfoWithPause ActionUnloadPNPStartPick(CallBackCommonFunc ActionLoadOutPick, CallBackCommonFunc AfterActionLoadOutPick)
        {
            ErrorInfoWithPause res;

            //Cylinder down
            while (!PNPCylinder.SetCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
            //return new ErrorInfoWithPause("下料PNP气缸下移超时错。", ErrorLevel.Error);
            {
                res = WaitAlarmPause("下料PNP取料", "下料PNP气缸下移超时错");
                if (res != null)
                {
                    return(res);
                }
            }
            //Start picking
            if (ActionLoadOutPick != null)
            {
                ActionLoadOutPick();
            }
            //Cylinder up
            while (!PNPCylinder.SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
            //return new ErrorInfoWithPause("下料PNP气缸上移超时错。", ErrorLevel.Error);
            {
                res = WaitAlarmPause("下料PNP取料", "下料PNP气缸上移超时错");
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionLoadOutPick != null)
            {
                AfterActionLoadOutPick();
            }
            //Check vacuum
            ErrorInfoWithPause temp = CheckVacuumStatus();

            return(temp);
        }
예제 #10
0
        public ErrorInfoWithPause ActionSortPNPStartPick(CallBackCommonFunc ActionSortPNPPick, CallBackCommonFunc AfterActionSortPNPPick)
        {
            ErrorInfoWithPause res = null;

            //PNP Z down
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Pick, true, ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean - 1))
            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Pick);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            //Start picking
            if (ActionSortPNPPick != null)
            {
                ActionSortPNPPick();
            }
            //PNP Z up
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Up)) //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionSortPNPPick != null)
            {
                AfterActionSortPNPPick();
            }
            //Check vacuum
            System.Threading.Thread.Sleep(100);
            res = CheckVacuumStatus();
            return(res);
        }
예제 #11
0
        public ErrorInfoWithPause ActionSortPNPStartPlaceNG(CallBackCommonFunc AfterActionSortPNPPlaceNG)
        {
            ErrorInfoWithPause res = null;

            //Check vacuum
            res = CheckVacuumStatus();
            if (res != null)
            {
                return(res);
            }
            bool NeedCylinderDown;

            //res = UpdateRow();
            //if (res != null) return res;
            if (ClassWorkFlow.Instance.UnloadMode != EnumUnloadMode.全NG)
            {
                for (int i = 0; i < CELLCOUNT; i++)
                {
                    if (CheckCellIsNG(SortNGDataStations[i].CellData))
                    {
                        if (IsUseBackNGBox)
                        {
                            if (SortNGDataStations[i].CellData.ThicknessNG)
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox1;
                            }
                            else
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox2;
                            }
                        }
                        else
                        {
                            if (SortNGDataStations[i].CellData.ThicknessNG)
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox3;
                            }
                            else
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox4;
                            }
                        }
                        NGBoxCellCount[CurrentNGBoxRow, i]++;
                        string NGData = SortNGDataStations[i].CellData.NGDataInfoString;
                        if (NGData != "")
                        {
                            NGBoxDataInfoString[CurrentNGBoxRow, i] += NGData + Environment.NewLine;
                        }
                        NeedCylinderDown = CheckIfNeedCylinder(NGBoxCellCount[CurrentNGBoxRow, i]);

                        //PNP Y move away
                        res = ActionMove((EnumPointPNPY)CurrentNGBoxRow);
                        if (res != null)
                        {
                            return(res);
                        }
                        if (NeedCylinderDown)
                        {
                            //PNP Z down
                            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, 1 + NGBoxCellCount[CurrentNGBoxRow, i] * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                            {
                                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                            //Cylinder down
                            while (!PNPCylinder[i].SetCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
                            //return new ErrorInfoWithPause("NG挑选PNP气缸下移超时错。", ErrorLevel.Error);
                            {
                                res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸下移超时错");
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                        }
                        else
                        {
                            //PNP Z down
                            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                            {
                                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                        }
                        //Open blow
                        AirControl((EnumCellIndex)i, EnumAirControl.Blow);
                        //AirControl((EnumCellIndex)i, EnumAirControl.Close);
                        //Delay
                        TimeClass.Delay(400);
                        //Cylinder up
                        while (!PNPCylinder[i].SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                        //return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错。", ErrorLevel.Error);
                        {
                            res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸上移超时错");
                            if (res != null)
                            {
                                return(res);
                            }
                        }
                        //Close blow
                        AirControl((EnumCellIndex)i, EnumAirControl.Close);
                    }
                }
            }
            else
            {
                for (int i = 0; i < CELLCOUNT; i++)
                {
                    if (CheckCellIsNG(SortNGDataStations[i].CellData))
                    {
                        NGBoxCellCount[CurrentNGBoxRow, i]++;
                    }
                }
                NeedCylinderDown = CheckIfNeedCylinder(GetMaxCount());

                //PNP Y move away
                res = ActionMove((EnumPointPNPY)CurrentNGBoxRow);
                if (res != null)
                {
                    return(res);
                }
                if (NeedCylinderDown)
                {
                    //PNP Z down
                    while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                    //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                    {
                        res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                    //Cylinder down
                    PNPCylinder[0].SetCylinderState(CYLIND_DOWN, 0, false);
                    PNPCylinder[1].SetCylinderState(CYLIND_DOWN, 0, false);
                    PNPCylinder[2].SetCylinderState(CYLIND_DOWN, 0, false);
                    while (!PNPCylinder[0].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT) || !PNPCylinder[1].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT) || !PNPCylinder[2].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
                    //return new ErrorInfoWithPause("NG挑选PNP气缸下移超时错。", ErrorLevel.Error);
                    {
                        res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸下移超时错");
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                }
                else
                {
                    //PNP Z down
                    while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                    //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                    {
                        res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                }
                //Open blow
                AirControl(EnumAirControl.Blow, EnumAirControl.Blow, EnumAirControl.Blow);
                //AirControl(EnumAirControl.Close, EnumAirControl.Close, EnumAirControl.Close);
                //Delay
                TimeClass.Delay(400);
                //Cylinder up
                PNPCylinder[0].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[1].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[2].SetCylinderState(CYLIND_UP, 0, false);
                while (!PNPCylinder[0].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT) || !PNPCylinder[1].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT) || !PNPCylinder[2].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                //return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错。", ErrorLevel.Error);
                {
                    res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸上移超时错");
                    if (res != null)
                    {
                        return(res);
                    }
                }
                //Close blow
                AirControl(EnumAirControl.Close, EnumAirControl.Close, EnumAirControl.Close);
            }

            //PNP Z up
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Up)) //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
                if (res != null)
                {
                    return(res);
                }
            }
            DoUpdateNGBox();
            //PNP Y move away
            while (!AxisSortingPNPY.MoveTo(EnumPointPNPY.Pick)) //return DispMotionError(AxisSortingPNPY, EnumPointPNPY.Pick);
            {
                res = DispMotionError(AxisSortingPNPY, EnumPointPNPZ.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionSortPNPPlaceNG != null)
            {
                AfterActionSortPNPPlaceNG();
            }
            NGBoxFullErrorHandler(this.Name, "", ErrorDialogResult.OK);
            return(null);
        }
예제 #12
0
        public ErrorInfoWithPause ActionLoadPNPStartPlaceNG(CallBackCommonFunc AfterActionPlaceNG)
        {
            ErrorInfoWithPause res;
            bool NeedCylinderDown;

            for (int i = 0; i < CELLCOUNT; i++)
            {
                if (LoadPNPDataStations[i].CellData != null && LoadPNPDataStations[i].CellData.LoadNG)
                {
                    NGBoxCellCount[i]++;
                    NeedCylinderDown = CheckIfNeedCylinder(NGBoxCellCount[i]);
                    if (NeedCylinderDown)
                    {
                        //PNP Z down
                        while (!AxisLoadPNPZ.MoveTo(EnumPointZ.PlaceNG, true, 1 + NGBoxCellCount[i] * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                        //return DispMotionError(AxisLoadPNPZ, EnumPointZ.PlaceNG);
                        {
                            res = DispMotionError(AxisLoadPNPZ, EnumPointZ.PlaceNG);
                            if (res != null)
                            {
                                return(res);
                            }
                        }
                        //Cylinder down
                        if (!PNPCylinder[i].SetCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
                        {
                            return(new ErrorInfoWithPause("上料PNP气缸下移超时错。", ErrorLevel.Error));
                        }
                    }
                    else
                    {
                        //PNP Z down
                        while (!AxisLoadPNPZ.MoveTo(EnumPointZ.PlaceNG, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                        //return DispMotionError(AxisLoadPNPZ, EnumPointZ.PlaceNG);
                        {
                            res = DispMotionError(AxisLoadPNPZ, EnumPointZ.PlaceNG);
                            if (res != null)
                            {
                                return(res);
                            }
                        }
                    }
                    //Open blow
                    AirControl((EnumCellIndex)i, EnumAirControl.Blow);
                    //Delay
                    System.Threading.Thread.Sleep(ClassCommonSetting.SysParam.VacuumDelayTime);
                    //Cylinder up
                    while (!PNPCylinder[i].SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                    //return new ErrorInfoWithPause("上料PNP气缸上移超时错。", ErrorLevel.Error);
                    {
                        res = WaitAlarmPause("上料PNP放NG料", "上料PNP气缸上移超时错");
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                    //Close blow
                    AirControl((EnumCellIndex)i, EnumAirControl.Close);
                }
            }
            //PNP Z up
            while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Idle))
            //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle);
            {
                res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle);
                if (res != null)
                {
                    return(res);
                }
            }
            DoUpdateNGBox();
            NGBoxFullErrorHandler("NGBox", "", ErrorDialogResult.OK);
            //PNP Y move away
            while (!AxisLoadPNPY.MoveTo(EnumPointY.Pick))
            //return DispMotionError(AxisLoadPNPY, EnumPointY.Pick);
            {
                res = DispMotionError(AxisLoadPNPY, EnumPointY.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionPlaceNG != null)
            {
                AfterActionPlaceNG();
            }
            return(null);
        }
예제 #13
0
        /// <summary>
        /// 开始传送准备。
        /// 开始的条件是SMEMA的ready信号为true,并且InPos传感器没有检测到物料。
        /// 传送带运行,
        /// SMEMA avaliable为false。
        /// </summary>
        /// <returns>返回执行结果。成功返回空字符。</returns>
        public ErrorInfoWithPause ActionStartLoad(CallBackCommonFunc AfterActionLoadNew)
        {
            ErrorInfoWithPause res = null;
            string             barcodeReadRes;

            ////Go back to align the new cell.
            AxisLoadInConveyor.SetZero();
            bool   havenewpart = ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑;// && ThisInport(EnumInportName.LoadInConvLoad).status;
            double offsetTemp  = 0;

            if (ClassWorkFlow.Instance.LoadMode == EnumLoadMode.自动)
            {
                offsetTemp  = ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellWidth.Mean - ClassCommonSetting.SysParam.Products[CALIBPROD].CellDataSpec.CellWidth.Mean;
                offsetTemp /= 2;
                offsetTemp += ThisAxis(EnumAxisName.LoadInConveyor).PointList[EnumPointConveyor.BackDistance].Position;
                while (!ThisAxis(EnumAxisName.LoadInConveyor).MoveTo(offsetTemp))
                //return DispMotionError(AxisLoadInConveyor, "回移");
                {
                    res = DispMotionError(AxisLoadInConveyor, "回移");
                    if (res != null)
                    {
                        return(res);
                    }
                }
            }
            if ((havenewpart || ClassWorkFlow.Instance.WorkMode == EnumWorkMode.空跑) && ClassWorkFlow.Instance.FeedNewPart)
            {
                LoadInDataStations[LoadInDataStations.Length - 1].CellData = ClassDataInfo.NewCellData(++ClassWorkFlow.Instance.GetCell);
            }
            else
            {
                LoadInDataStations[LoadInDataStations.Length - 1].CellData = null;
            }
            //Go to next pitch position and start scan barcode
            AxisLoadInConveyor.SetZero();
            while (!AxisLoadInConveyor.MoveTo(EnumPointConveyor.CellPitch, true, -offsetTemp))
            //return DispMotionError(AxisLoadInConveyor, "进料移动");
            {
                res = DispMotionError(AxisLoadInConveyor, "进料移动");
                if (res != null)
                {
                    return(res);
                }
            }
            ////If PNP can pick
            //if (ThisInport(EnumInportName.LoadInConvInPos).status)
            //{
            //    NotifyDoneEvent(EnumEventName.NewCellLoad);
            //}
            if (LoadInDataStations[LoadInDataStations.Length - 1].CellData != null)
            {
                havenewpart &= BarcodeEnabled;
                if (ClassWorkFlow.Instance.LoadMode == EnumLoadMode.自动)
                {
                    barcodeReadRes = StartBarcodeScan(havenewpart);
                }
                else
                {
                    do
                    {
                        barcodeReadRes = StartBarcodeScan(havenewpart);
                        if (barcodeReadRes != "")
                        {
                            BaseForm.DoInvokeRequired(MainForm.instance,
                                                      () =>
                            {
                                while (MessageBox.Show(MainForm.instance, $"条码枪扫码出错: {barcodeReadRes}。{Environment.NewLine}请检查电芯位置是否正确或者是否有电芯。{Environment.NewLine}" +
                                                       "点“重试”重新扫条码。如果无电芯或需要移除电芯,则点“取消”放弃扫码。",
                                                       "条码枪扫码", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information) == DialogResult.Cancel)
                                {
                                    if (MessageBox.Show(MainForm.instance, "确定要取消并移除电芯?", "取消电芯", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                    {
                                        LoadInDataStations[LoadInDataStations.Length - 1].CellData = null;
                                        break;
                                    }
                                }
                            });
                        }
                    } while (LoadInDataStations[LoadInDataStations.Length - 1].CellData != null && barcodeReadRes != "");
                }
                if (LoadInDataStations[LoadInDataStations.Length - 1].CellData != null)
                {
                    ClassCommonSetting.ProgramLog(LogFile.Level.Notice, this.Name, "加载新物料,索引号" + ClassWorkFlow.Instance.GetCell.ToString() + " NG结果为" + (LoadInDataStations[LoadInDataStations.Length - 1].CellData.LoadNG ? "NG" : "OK"));
                }
            }
            if (AfterActionLoadNew != null)
            {
                AfterActionLoadNew();
            }
            return(null);
        }