Ejemplo n.º 1
0
        private void LoadProductFile(string strFile)
        {
            if (InvokeRequired)
            {
                this.BeginInvoke(new Action(() => LoadProductFile(strFile)));
            }
            else
            {
                label_CurrentFile.Text = "当前产品:" + strFile;
                //读取工站位置坐标
                ConfigToolMgr.GetInstance().UpdatePointFilePath();
                Dictionary <string, PointInfo> dicPonit = new Dictionary <string, PointInfo>();
                foreach (var tem in StationMgr.GetInstance().GetAllStationName())
                {
                    ConfigToolMgr.GetInstance().ReadPoint(tem, out dicPonit);
                    StationMgr.GetInstance().GetStation(tem).SetStationPointDic(dicPonit);
                }
                ConfigToolMgr.GetInstance().UpdataMoveparamconfigPath();

                ConfigToolMgr.GetInstance().ReadMoveParamConfig();
                ConfigToolMgr.GetInstance().ReadHomeParamConfig();

                VisionMgr.GetInstance().CurrentVisionProcessDir = ParamSetMgr.GetInstance().CurrentWorkDir + "\\" + ParamSetMgr.GetInstance().CurrentProductFile + "\\" + @"Config\Vision\";
                VisionMgr.GetInstance().Read();

                ParamSetMgr.GetInstance().m_eventLoadProductFileUpadata?.Invoke();

                //VisionMgr.GetInstance().PrItemChangedEvent
                GC.Collect();
            }
        }
 public static void UpdataTrayData(string strStationName, string posName)
 {
     if (("取料站" == strStationName || "Barrel站" == strStationName) && posName.Contains("料盘"))
     {
         if (StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic().ContainsKey(posName))
         {
             int    indexofstring = posName.IndexOf("_");
             string sub           = posName.Substring(indexofstring + 1);
             indexofstring = sub.IndexOf("_");
             sub           = sub.Substring(0, indexofstring);
             int index = sub.ToInt();
             if (posName.Contains($"_M_SP"))
             {
                 TrayMgr.GetInstance().trayDataLoadArr[index - 1].PlaceLeftTopcoordinate =
                     TrayMgr.GetInstance().trayDataLoadArr[index - 1].PickLeftTopcoordinate =
                         new Coordinate()
                 {
                     X = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointX,
                     Y = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointY,
                     Z = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointZ,
                 };
                 TrayMgr.GetInstance().trayDataLoadArr[index - 1].Init();
             }
             if (posName.Contains($"_M_EP"))
             {
                 TrayMgr.GetInstance().trayDataLoadArr[index - 1].PlaceRightBottomcoordinate =
                     TrayMgr.GetInstance().trayDataLoadArr[index - 1].PickRightBottomcoordinate =
                         new Coordinate()
                 {
                     X = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointX,
                     Y = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointY,
                     Z = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointZ,
                 };
                 TrayMgr.GetInstance().trayDataLoadArr[index - 1].Init();
             }
             if (posName.Contains($"_V_SP"))
             {
                 TrayMgr.GetInstance().trayDataLoadArr[index - 1].SnapLeftTopcoordinate =
                     new Coordinate()
                 {
                     X = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointX,
                     Y = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointY,
                     Z = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointZ,
                 };
                 TrayMgr.GetInstance().trayDataLoadArr[index - 1].Init();
             }
             if (posName.Contains($"_V_EP"))
             {
                 TrayMgr.GetInstance().trayDataLoadArr[index - 1].SnapRightBottomcoordinate =
                     new Coordinate()
                 {
                     X = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointX,
                     Y = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointY,
                     Z = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointZ,
                 };
                 TrayMgr.GetInstance().trayDataLoadArr[index - 1].Init();
             }
         }
     }
 }
Ejemplo n.º 3
0
 public static void AddStation()
 {
     //添加工站
     StationMgr.GetInstance().AddStation(new StationForm(), "AA站", new StationAA(StationMgr.GetInstance().GetStation("AA站")));
     StationMgr.GetInstance().AddStation(new StationForm(), "转盘站", new StationTable(StationMgr.GetInstance().GetStation("转盘站")));
     StationMgr.GetInstance().AddStation(new StationForm(), "点胶站", new StationDisp(StationMgr.GetInstance().GetStation("点胶站")));
     Dictionary <Form, Stationbase> keyValuePairs = StationMgr.GetInstance().GetDicStaion();
 }
Ejemplo n.º 4
0
        public bool IsCanLeave(bool bmanual)
        {
            if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) > AxisState.NormalStop)
            {
                AlarmMgr.GetIntance().WarnWithDlg($"流水线{lb.LineName}  在出料前,轴{MotionMgr.GetInstace().GetAxisName(nAxisNo)} ,报警{MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo).ToString()},程序停止", null, CommonDlg.DlgWaranType.WaranOK, null, bmanual);
                StationMgr.GetInstance().Stop();
            }
            bool bIsAxisStop = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop;

            return(lb.CheckJackUpCliyderStateInPos(false) && bIsAxisStop);
        }
Ejemplo n.º 5
0
        public override bool IsCanLeave(bool bmanual)
        {
            if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) > AxisState.NormalStop)
            {
                AlarmMgr.GetIntance().WarnWithDlg($"流水线{LineName}  在出料前,轴{MotionMgr.GetInstace().GetAxisName(nAxisNo)} ,报警{MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo).ToString()},程序停止", null, CommonDlg.DlgWaranType.WaranOK, null, bmanual);
                StationMgr.GetInstance().Stop();
            }
            bool bIsAxisStop          = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop;
            bool bIsAxisInPosOnOutPos = Math.Abs(MotionMgr.GetInstace().GetAxisActPos(nAxisNo) - dDischargePos) < 0.3;

            return(CheckJackUpCliyderStateInPos(false) && bIsAxisStop && bIsAxisInPosOnOutPos);
        }
Ejemplo n.º 6
0
 private APP()
 {
     MotionMgr      = MotionMgr.GetInstace();
     IOMgr          = IOMgr.GetInstace();
     AlarmMgr       = AlarmMgr.GetIntance();
     ConfigToolMgr  = ConfigToolMgr.GetInstance();
     StationMgr     = StationMgr.GetInstance();
     ParamSetMgr    = ParamSetMgr.GetInstance();
     ComMgr         = ComMgr.GetInstance();
     TcpMgr         = TcpMgr.GetInstance();
     SocketSeverMgr = SocketSeverMgr.GetInstace();
 }
Ejemplo n.º 7
0
        private void button_start_Click(object sender, EventArgs e)
        {
            UserTest.RunLog.Write($"【点击启动】", LogType.Info, PathHelper.LogPathManual);
            //ProcessSysIo("启动", true);
            if (GlobalVariable.g_StationState == StationState.StationStateStop)
            {
                if (!IsSafeDoorAndGrating())
                {
                    return;
                }

                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                {
                    IOMgr.GetInstace().WriteIoBit("绿灯", false);
                }
                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                {
                    IOMgr.GetInstace().WriteIoBit("红灯", false);
                }
                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                {
                    IOMgr.GetInstace().WriteIoBit("黄灯", true);
                }
                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                {
                    IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                }
                StationMgr.GetInstance().Run();
                // sys.g_StationState = StationState.StationStateRun;
            }
            else if (GlobalVariable.g_StationState == StationState.StationStateRun)
            {
                // sys.g_StationState = StationState.StationStatePause;
                //暂停
                StationMgr.GetInstance().Pause();
            }
            else if (GlobalVariable.g_StationState == StationState.StationStatePause)
            {
                if (!IsSafeDoorAndGrating())
                {
                    return;
                }
                IOMgr.GetInstace().WriteIoBit("绿灯", false);
                IOMgr.GetInstace().WriteIoBit("红灯", false);
                IOMgr.GetInstace().WriteIoBit("黄灯", true);
                IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                StationMgr.GetInstance().Resume();
            }
            else if (GlobalVariable.g_StationState == StationState.StationStateEmg)
            {
                MessageBox.Show("发生错误,请先复位", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
            }
        }
Ejemplo n.º 8
0
        private void button_start_Click(object sender, EventArgs e)
        {
            // ProcessSysIo("启动", true);
            if (GlobalVariable.g_StationState == StationState.StationStateStop)
            {
                if (!IsSafeDoorAndGrating())
                {
                    return;
                }

                ParamSetMgr.GetInstance().SetBoolParam("启动清料", false);
                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                {
                    IOMgr.GetInstace().WriteIoBit("绿灯", false);
                }
                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                {
                    IOMgr.GetInstace().WriteIoBit("红灯", false);
                }
                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                {
                    IOMgr.GetInstace().WriteIoBit("黄灯", true);
                }
                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                {
                    IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                }
                StationMgr.GetInstance().Run();
                // sys.g_StationState = StationState.StationStateRun;
            }
            else if (GlobalVariable.g_StationState == StationState.StationStateRun)
            {
                // sys.g_StationState = StationState.StationStatePause;
                //暂停
                StationMgr.GetInstance().Pause();
            }
            else if (GlobalVariable.g_StationState == StationState.StationStatePause)
            {
                if (!IsSafeDoorAndGrating())
                {
                    return;
                }
                IOMgr.GetInstace().WriteIoBit("绿灯", false);
                IOMgr.GetInstace().WriteIoBit("红灯", false);
                IOMgr.GetInstace().WriteIoBit("黄灯", true);
                IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                StationMgr.GetInstance().Resume();
            }
            else if (GlobalVariable.g_StationState == StationState.StationStateEmg)
            {
                MessageBox.Show("发生错误,请先复位", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 9
0
        public override bool IsOutFinishDealOK(bool bmaual)
        {
            if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) > AxisState.NormalStop)
            {
                AlarmMgr.GetIntance().WarnWithDlg($"流水线{LineName}  在出料前,轴{MotionMgr.GetInstace().GetAxisName(nAxisNo)} ,报警{MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo).ToString()},程序停止", null, CommonDlg.DlgWaranType.WaranOK, null, bmaual);
                StationMgr.GetInstance().Stop();
            }
            bool   bIsAxisStop           = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop;
            double pos                   = MotionMgr.GetInstace().GetAxisActPos(nAxisNo);
            bool   bIsAxisInPosOnFeedPos = Math.Abs(MotionMgr.GetInstace().GetAxisActPos(nAxisNo) - dFeedPos) < 0.3;

            return(bIsAxisStop & bIsAxisInPosOnFeedPos);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 初始化产品数据参数
        /// </summary>
        public static void InitProductNum()
        {
            NozzleMgr.GetInstance().Read();
            try
            {
                StationTable stationTable = (StationTable)StationMgr.GetInstance().GetStation("转盘站");

                TableData.GetInstance().Add(stationTable.GetStationPointDic()["A工位AA位"].pointU, 2);
                TableData.GetInstance().Add(stationTable.GetStationPointDic()["A工位夹取位"].pointU, 2);
                TableData.GetInstance().Add(stationTable.GetStationPointDic()["B工位AA位"].pointU, 1);
                TableData.GetInstance().Add(stationTable.GetStationPointDic()["B工位夹取位"].pointU, 1);

                TableData.GetInstance().AddPosStationName(stationTable.GetStationPointDic()["A工位AA位"].pointU, "A_AA");
                TableData.GetInstance().AddPosStationName(stationTable.GetStationPointDic()["A工位夹取位"].pointU, "A_Pick");
                TableData.GetInstance().AddPosStationName(stationTable.GetStationPointDic()["B工位AA位"].pointU, "B_AA");
                TableData.GetInstance().AddPosStationName(stationTable.GetStationPointDic()["B工位夹取位"].pointU, "B_Pick");

                TableData.GetInstance().AddStationResult("A_AA", false);
                TableData.GetInstance().AddStationResult("A_Pick", false);
                TableData.GetInstance().AddStationResult("B_AA", false);
                TableData.GetInstance().AddStationResult("B_Pick", false);
                TableData.GetInstance().AddStationResult("A_UnLoadLoad", false);
                TableData.GetInstance().AddStationResult("B_UnLoadLoad", false);

                TableData.GetInstance().dicTableCmdStart.Add("A_AA", false);
                TableData.GetInstance().dicTableCmdStart.Add("B_AA", false);
                TableData.GetInstance().dicTableCmdStart.Add("A_Pick", false);
                TableData.GetInstance().dicTableCmdStart.Add("B_Pick", false);
                TableData.GetInstance().dicTableCmdStart.Add("A_UnLoadLoad", false);
                TableData.GetInstance().dicTableCmdStart.Add("B_UnLoadLoad", false);


                TableData.GetInstance().AxisNo = stationTable.AxisU;
                TableData.GetInstance().listPoss.Clear();
                TableData.GetInstance().listPoss.Add(stationTable.GetStationPointDic()["A工位夹取位"].pointU);
                TableData.GetInstance().listPoss.Add(stationTable.GetStationPointDic()["A工位AA位"].pointU);
                TableData.GetInstance().listPoss.Add(stationTable.GetStationPointDic()["B工位夹取位"].pointU);
                TableData.GetInstance().listPoss.Add(stationTable.GetStationPointDic()["B工位AA位"].pointU);
            }
            catch (Exception e)
            {
            }


            //
        }
Ejemplo n.º 11
0
 private void button_stop_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("是否确定停止", "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
     {
         return;
     }
     _logger.Info("stop:开始");
     if (GlobalVariable.g_StationState == StationState.StationStateRun || GlobalVariable.g_StationState == StationState.StationStatePause)
     {
         StationMgr.GetInstance().Stop();
     }
     else
     {
         DoWhile.StopCirculate();
     }
     _logger.Info("stop:结束");
     AlarmMgr.GetIntance().StopAlarmBeet();
 }
Ejemplo n.º 12
0
        private bool checkSafe()
        {
            StationAA   stationAA      = (StationAA)StationMgr.GetInstance().GetStation("AA站");
            StationDisp stationDisp    = (StationDisp)StationMgr.GetInstance().GetStation("点胶站");
            double      SafeHeightAA   = stationAA.GetStationPointDic()["安全位置"].pointZ;
            double      SafeHeightDisp = stationDisp.GetStationPointDic()["安全位置"].pointZ;
            double      getAAPos       = MotionMgr.GetInstace().GetAxisPos(stationAA.AxisZ);
            double      getDispPos     = MotionMgr.GetInstace().GetAxisPos(stationDisp.AxisZ);

            if (MotionMgr.GetInstace().GetHomeFinishFlag(stationAA.AxisZ) != AxisHomeFinishFlag.Homed || getAAPos < SafeHeightAA - 0.5)
            {
                if (GlobalVariable.g_StationState != StationState.StationStateRun)
                {
                    MessageBox.Show("转盘运动前,检查AA站Z轴没有回原点或者低于安全高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                }
                return(false);
            }

            if (MotionMgr.GetInstace().GetHomeFinishFlag(stationDisp.AxisZ) != AxisHomeFinishFlag.Homed || getDispPos < SafeHeightDisp - 0.5)
            {
                if (GlobalVariable.g_StationState != StationState.StationStateRun)
                {
                    MessageBox.Show("转盘运动前,检查点胶站Z轴没有回原点或者低于吐胶点高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                }
                return(false);
            }

            //if (!IOMgr.GetInstace().ReadIoInBit("A治具盖上检测"))
            if (!SysFunConfig.LodUnloadPatten.IsSafeWhenURun("A"))
            {
                MessageBox.Show("转盘运动前,检查A治具盖上检测失败!", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                return(false);
            }

            // if (!IOMgr.GetInstace().ReadIoInBit("B治具盖上检测"))
            if (!SysFunConfig.LodUnloadPatten.IsSafeWhenURun("B"))
            {
                MessageBox.Show("转盘运动前,检查B治具盖上检测失败!", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                return(false);
            }

            Info($"安全位置检查成功,disp:{MotionMgr.GetInstace().GetAxisPos(stationDisp.AxisZ)}aa:{ MotionMgr.GetInstace().GetAxisPos(stationAA.AxisZ)}.");
            return(true);
        }
Ejemplo n.º 13
0
        public static bool IsSafeWhenTableAxisMoveHandler(int nAxisNo, double currentpos, double dsstpos, MoveType moveType)
        {
            StationAA   stationAA      = (StationAA)StationMgr.GetInstance().GetStation("AA站");
            StationDisp stationDisp    = (StationDisp)StationMgr.GetInstance().GetStation("点胶站");
            double      SafeHeightAA   = stationAA.GetStationPointDic()["安全位置"].pointZ;
            double      SafeHeightDisp = stationDisp.GetStationPointDic()["安全位置"].pointZ;

            //  double SafeHeightDisp = stationDisp.GetStationPointDic()["安全位置"].pointZ;
            if (MotionMgr.GetInstace().GetAxisName(nAxisNo) == "U")
            {
                if (MotionMgr.GetInstace().GetHomeFinishFlag(stationAA.AxisZ) != AxisHomeFinishFlag.Homed || MotionMgr.GetInstace().GetAxisPos(stationAA.AxisZ) < SafeHeightAA - 0.5)
                {
                    if (GlobalVariable.g_StationState != StationState.StationStateRun)
                    {
                        MessageBox.Show("转盘运动前,检查AA站Z轴没有回原点或者低于安全高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    return(false);
                }

                if (MotionMgr.GetInstace().GetHomeFinishFlag(stationDisp.AxisZ) != AxisHomeFinishFlag.Homed || MotionMgr.GetInstace().GetAxisPos(stationDisp.AxisZ) < SafeHeightDisp - 1)
                {
                    if (GlobalVariable.g_StationState != StationState.StationStateRun)
                    {
                        MessageBox.Show("转盘运动前,检查点胶站Z轴没有回原点或者低于吐胶点高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    _logger.Error("转盘运动前,检查点胶站Z轴没有回原点或者低于吐胶点高度");
                    return(false);
                }

                if (ParamSetMgr.GetInstance().GetBoolParam("是否侧向UV") &&
                    (!IOMgr.GetInstace().ReadIoInBit("左侧UV原位") || !IOMgr.GetInstace().ReadIoInBit("左侧UV原位")))
                {
                    if (GlobalVariable.g_StationState != StationState.StationStateRun)
                    {
                        MessageBox.Show("转盘运动前,左右UV是否在原位", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    _logger.Error("转盘运动前,左右UV是否在原位");
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 14
0
 private void button_stop_Click(object sender, EventArgs e)
 {
     UserTest.RunLog.Write($"点击【停止】", LogType.Info, PathHelper.LogPathManual);
     if (MessageBox.Show("是否确定停止? 如果为回零状态会关闭软件!", "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
     {
         return;
     }
     if (!Form_Auto.IsHome)
     {
         IsShowCloseForm = true;
         Form_Auto.EvenStop();
         this.Close();
     }
     else
     {
         _logger.Info("stop:开始");
         StationMgr.GetInstance().Stop();
         _logger.Info("stop:结束");
         AlarmMgr.GetIntance().StopAlarmBeet();
     }
 }
Ejemplo n.º 15
0
        public static void bandStationAndVisionCtrl(string stationname, VisionControl visionControl, int index = 1)
        {
            Stationbase pb = StationMgr.GetInstance().GetStation(stationname);

            switch (index)
            {
            case 1:
                pb.VisionControl = visionControl;
                break;

            case 2:
                pb.VisionControl2 = visionControl;
                break;

            case 3:
                pb.VisionControl3 = visionControl;
                break;

            case 4:
                pb.VisionControl4 = visionControl;
                break;
            }
        }
        public bool Carray(bool bmanul = false)
        {
            Info("右剥料工站:搬运气缸开始搬运物料");
            WaranResult waranResult;

            // CheckAndUp(bmanul);
retry_carry_up:
            ParamSetMgr.GetInstance().SetBoolParam("右剥料完成", false);
            Info("右装料Z轴气缸电磁阀 上升");
            IOMgr.GetInstace().WriteIoBit("右装料Z轴气缸电磁阀", false);
            waranResult = CheckIobyName("右装料Z轴气缸原位", true, "右剥料工站:右装料Z轴气缸电磁阀 上升失败,请检查气缸和感应器 线路 ", bmanul);
            if (waranResult == WaranResult.Retry)
            {
                goto retry_carry_up;
            }
            StationRightPackage stationLeftPackage = (StationRightPackage)StationMgr.GetInstance().GetStation("右贴装站");
            int AxisYNooFPageBack = stationLeftPackage.AxisY;
            int AxiXYNooFPageBack = stationLeftPackage.AxisX;

retry_carryMoving:
            if (MotionMgr.GetInstace().GetHomeFinishFlag(AxisY) == AxisHomeFinishFlag.Homed && MotionMgr.GetInstace().GetAxisPos(AxisY) > GetStationPointDic()["剥料准备位"].pointY - 50 &&
                MotionMgr.GetInstace().GetHomeFinishFlag(AxisYNooFPageBack) == AxisHomeFinishFlag.Homed && MotionMgr.GetInstace().GetAxisPos(AxisYNooFPageBack) < stationLeftPackage.GetStationPointDic()["搬料安全位"].pointY - 50
                )
            {
#if false
                IOMgr.GetInstace().WriteIoBit("右剥料前推压紧气缸电磁阀", true);
                waranResult = CheckIobyName("右剥料前推压紧气缸到位", true, "右剥料工站:右剥料前推压紧气缸到位失败,请检查气缸和感应器 线路 ", bmanul);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_carryMoving;
                }

                IOMgr.GetInstace().WriteIoBit("右剥料压紧气缸电磁阀", true);
                waranResult = CheckIobyName("右剥料压紧气缸到位", true, "右剥料工站:右剥料压紧气缸到位失败,请检查气缸和感应器 线路 ", bmanul);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_carryMoving;
                }
#endif
                Info("右装料搬运气缸电磁阀 移动搬料");
                IOMgr.GetInstace().WriteIoBit("右装料搬运气缸电磁阀", true);
                waranResult = CheckIobyName("右装料搬运气缸到位", true, "右剥料工站:右装料搬运气缸到位失败,物料可能掉落,请检查气缸和感应器 线路 ", bmanul);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_carryMoving;
                }

                //  CheckBuzzerPlaneAndUp();

retry_carry_down:
                Info("右装料Z轴气缸电磁阀 下降");
                IOMgr.GetInstace().WriteIoBit("右装料Z轴气缸电磁阀", true);
                waranResult = CheckIobyName("右装料Z轴气缸到位", true, "右剥料工站:右装料Z轴气缸原下降失败,物料可能掉落,请检查气缸和感应器 线路 ", bmanul);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_carry_down;
                }

                Info("右装料真空吸电磁阀 关闭");
                Info("右装料破真空电磁阀 打开");
                Info("右剥料真空吸电磁阀 打开");
                IOMgr.GetInstace().WriteIoBit("右装料破真空电磁阀", true);
                IOMgr.GetInstace().WriteIoBit("右装料真空吸电磁阀", false);
                IOMgr.GetInstace().WriteIoBit("右剥料真空吸电磁阀", true);
                Thread.Sleep(ParamSetMgr.GetInstance().GetIntParam("吸真空延时"));

                IOMgr.GetInstace().WriteIoBit("右装料破真空电磁阀", false);
retry_carry_up2:
                Info("右装料Z轴气缸电磁阀 上升");
                IOMgr.GetInstace().WriteIoBit("右装料Z轴气缸电磁阀", false);
                waranResult = CheckIobyName("右装料Z轴气缸原位", true, "右剥料工站:右装料Z轴气缸电磁阀 上升 失败,请检查气缸和感应器 线路 ", bmanul);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_carry_up2;
                }

                waranResult = CheckIobyName("右剥料真空检测", true, "右剥料工站:Carray:蜂鸣器片 在剥料平台未吸紧", bmanul);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_carry_down;
                }

                Info("右装料真空吸电磁阀 复检 检查料是否脱落");
                IOMgr.GetInstace().WriteIoBit("右装料破真空电磁阀", false);
                IOMgr.GetInstace().WriteIoBit("右装料真空吸电磁阀", true);
                waranResult = CheckIobyName("右装料真空检测", false, "右剥料工站 :Carray:蜂鸣器片 在装料抓手上未脱离", bmanul);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_carry_down;
                }
                IOMgr.GetInstace().WriteIoBit("右装料真空吸电磁阀", false);


retry_carryMovingback:
                Info("右装料搬运气缸电磁阀 移动搬料");
                IOMgr.GetInstace().WriteIoBit("右装料搬运气缸电磁阀", false);
                waranResult = CheckIobyName("右装料搬运气缸原位", true, "右剥料工站:Carray:搬运气缸回到原位", bmanul);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_carryMovingback;
                }
                IOMgr.GetInstace().WriteIoBit("右装料真空吸电磁阀", false);
                IOMgr.GetInstace().WriteIoBit("右装料破真空电磁阀", false);
                IOMgr.GetInstace().WriteIoBit("右剥料真空吸电磁阀", false);
                IOMgr.GetInstace().WriteIoBit("右剥料后压紧气缸电磁阀", false);
                ParamSetMgr.GetInstance().SetIntParam("右剥料次数", 0);
                NozzleMgr.GetInstance().nozzleArr[(int)NozzleType.RightStripNozzle].nozzleState = NozzleState.None;
                PlaneMgr.GetInstance().PlaneArr[(int)PlaneType.rightStripPlane].planeState      = PlaneState.Have;
                return(true);
            }
            else
            {
                Info("Y轴 在剥料准备位前 不能移动 请挪开 或者 右剥料平台Y轴 没有回原点");
                return(false);

                WaranResult waranResult2 = AlarmMgr.GetIntance().WarnWithDlg("Y轴 在剥料准备位前 不能移动 请挪开 或者 右剥料平台Y轴 没有回原点", bmanul ? null : this, CommonDlg.DlgWaranType.WaranInorge_Stop_Pause_Retry);
                if (waranResult2 == WaranResult.Retry)
                {
                    goto retry_carryMoving;
                }
            }
        }
Ejemplo n.º 17
0
        private void Form1_Load(object sender, EventArgs e)
        {
            #region 变量定义
            run = DateTime.Now;

            #endregion

            #region 初始化参数配置
            EvenAddPara();
            //读工站配置
            ConfigToolMgr.GetInstance().ReadStationConfig();
            //读取用户设置
            ConfigToolMgr.GetInstance().ReadUserConfig();
            ConfigToolMgr.GetInstance().ReadUserParam();

            //读取产品文件
            ConfigToolMgr.GetInstance().ReadProductDir_Name();

            //添加工位
            UserConfig.AddStation();
            //读取工站位置坐标
            Dictionary <string, PointInfo> dicPonit = new Dictionary <string, PointInfo>();
            foreach (var tem in StationMgr.GetInstance().GetAllStationName())
            {
                ConfigToolMgr.GetInstance().ReadPoint(tem, out dicPonit);
                StationMgr.GetInstance().GetStation(tem).SetStationPointDic(dicPonit);
            }
            GlobalVariable.g_StationState = StationState.StationStateStop;
            UserTest.algType = ParamSetMgr.GetInstance().GetStringParam("算法类型");

            #endregion


            #region 初始化硬件
            EvenAddHardware();
            ConfigToolMgr.GetInstance().ReadEthConfig();
            ConfigToolMgr.GetInstance().ReadComConfig();
            //读硬件配置 并创建IO,Motion 卡类 对象 并以默认参数配置卡
            ConfigToolMgr.GetInstance().ReadMotionCardConfig();
            ConfigToolMgr.GetInstance().ReadIoCardConfig();
            ConfigToolMgr.GetInstance().ReadIoInputConfig();
            ConfigToolMgr.GetInstance().ReadIoOutputConfig();

            //读运动配置
            ConfigToolMgr.GetInstance().ReadMoveParamConfig();
            ConfigToolMgr.GetInstance().ReadHomeParamConfig();

            //初始化IO  Motion
            if (!IOMgr.GetInstace().initAllIoCard())
            {
                MessageBox.Show("初始化IO卡失败");
                return;
            }
            if (!MotionMgr.GetInstace().OpenAllCard())
            {
                MessageBox.Show("初始化控制卡失败");
                return;
            }

            #endregion
            #region 初始化界面加载
            Ver.Text = "软件版本:" + System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString("1.yyyy.MMdd.HHmm");
            //界面加载初始化
            this.WindowState = FormWindowState.Maximized;
            int BtnHeight = button_stop.Height + 10;
            panel_window.Location = new System.Drawing.Point(0, BtnHeight);
            panel_window.Size     = new Size(this.Width - 30, this.Height - BtnHeight - 1);
            Form_Auto autoform = new Form_Auto();
            m_dicAllWindows.Add(button_Home, autoform);
            m_dicAllWindows.Add(button_Set, new Form_Set());
            m_dicAllWindows.Add(button_vision, new Form_VisionDebug());
            m_dicAllWindows.Add(button_Param, new Form_ParamSet());
            m_dicAllWindows.Add(button_UserSMgr, new UserManger());
            m_currentForm     = autoform;
            autoform.TopLevel = false;
            autoform.Dock     = DockStyle.Fill;
            autoform.Parent   = this.panel_window;
            autoform.Show();
            //初始化登入权限
            User user  = new User();
            int  index = sys.g_listUser.FindIndex(t => t._userName == "admin");
            if (index == -1)
            {
                user = new User()
                {
                    _userName = "******", _userPassWord = "******", _userRight = UserRight.超级管理员
                };
                sys.g_listUser.Add(user);
            }
            index = sys.g_listUser.FindIndex(t => t._userName == "user");
            if (index == -1)
            {
                user = new User()
                {
                    _userName = "******", _userPassWord = "******", _userRight = UserRight.客户操作员
                };
                sys.g_listUser.Add(user);
            }
            index = sys.g_listUser.FindIndex(t => t._userName == "debug");
            if (index == -1)
            {
                user = new User()
                {
                    _userName = "******", _userPassWord = "******", _userRight = UserRight.调试工程师
                };
                sys.g_listUser.Add(user);
            }
            index = sys.g_listUser.FindIndex(t => t._userName == "engineer");
            if (index == -1)
            {
                user = new User()
                {
                    _userName = "******", _userPassWord = "******", _userRight = UserRight.软件工程师
                };
                sys.g_listUser.Add(user);
            }
            #endregion
        }
Ejemplo n.º 18
0
        public void ProcessSysIo(string strIoName, bool bCurrentState)
        {
            if (InvokeRequired)
            {
                this.BeginInvoke(new Action(() => ProcessSysIo(strIoName, bCurrentState)));
            }
            else
            {
                if (strIoName == "急停" && !bCurrentState && !bAlreadyEmg)
                {
                    bAlreadyEmg = true;
                    if (GlobalVariable.g_StationState == StationState.StationStateRun || GlobalVariable.g_StationState == StationState.StationStatePause)
                    {
                        MotionMgr.GetInstace().StopEmg();
                        StationMgr.GetInstance().Stop();
                        MotionMgr.GetInstace().StopEmg();
                    }
                    GlobalVariable.g_StationState = StationState.StationStateEmg;
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("绿灯", false);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("红灯", false);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("黄灯", false);
                    }
                    //IOMgr.GetInstace().WriteIoBit("蜂鸣", true);

                    alarmtimer.Interval = 500;

                    alarmtimer.Start();

                    AlarmMgr.GetIntance().Warn("急停被按下,点击后关闭软件!", AlarmType.AlarmType_Emg);
                    AlarmMgr.GetIntance().StopAlarmBeet();
                    this.Close();
                }
                if (strIoName == "安全门" && !bCurrentState)
                {
                    if (ParamSetMgr.GetInstance().GetBoolParam("启用安全门"))
                    {
                        if (GlobalVariable.g_StationState == StationState.StationStateRun)
                        {
                            StationMgr.GetInstance().Pause();
                            IOMgr.GetInstace().WriteIoBit("绿灯", false);
                            if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                            {
                                IOMgr.GetInstace().WriteIoBit("红灯", false);
                            }
                            if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                            {
                                IOMgr.GetInstace().WriteIoBit("黄灯", true);
                            }
                            if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                            {
                                IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                            }
                            //AlarmMgr.GetIntance().Warn("安全门打开");
                            MessageBox.Show("安全门打开", "Waran", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            //  WaranResult waranResult = AlarmMgr.GetIntance().WarnWithDlg("安全门打开", null, DlgWaranType.WaranOK);
                        }
                    }
                }
                if (strIoName == "暂停" && bCurrentState)
                {
                    if (GlobalVariable.g_StationState == StationState.StationStateRun)
                    {
                        StationMgr.GetInstance().Pause();
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("绿灯", false);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("红灯", false);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("黄灯", true);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                        {
                            IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                        }
                        //AlarmMgr.GetIntance().Warn("安全门打开");
                        // WaranResult waranResult = AlarmMgr.GetIntance().WarnWithDlg("安全门打开", null, DlgWaranType.WaranOK);
                    }
                }
                if (strIoName == "安全光栅" && !bCurrentState)
                {
                    if (ParamSetMgr.GetInstance().GetBoolParam("启用安全光栅"))
                    {
                        if (ParamSetMgr.GetInstance().GetBoolParam("启用安全光栅"))
                        {
                            if (GlobalVariable.g_StationState == StationState.StationStateRun)
                            {
                                StationMgr.GetInstance().Pause();
                                IOMgr.GetInstace().WriteIoBit("绿灯", false);
                                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                                {
                                    IOMgr.GetInstace().WriteIoBit("红灯", false);
                                }
                                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                                {
                                    IOMgr.GetInstace().WriteIoBit("黄灯", true);
                                }
                                if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                                {
                                    IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                                }
                                //  AlarmMgr.GetIntance().Warn("安全光栅打开");
                                //WaranResult waranResult = AlarmMgr.GetIntance().WarnWithDlg("安全光栅打开", null, DlgWaranType.WaranOK);
                                MessageBox.Show("安全光栅打开", "Waran", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }
                }
                if (strIoName == "启动" && bCurrentState)
                {
                    if (GlobalVariable.g_StationState == StationState.StationStateStop)
                    {
                        if (!IsSafeDoorAndGrating())
                        {
                            return;
                        }
                        Thread.Sleep(500);
                        StationMgr.GetInstance().Run();
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("绿灯", true);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("红灯", false);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("黄灯", false);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                        {
                            IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                        }
                    }
                    else if (GlobalVariable.g_StationState == StationState.StationStatePause)
                    {
                        if (!IsSafeDoorAndGrating())
                        {
                            return;
                        }
                        StationMgr.GetInstance().Resume();
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("绿灯", true);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("红灯", false);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("黄灯", false);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                        {
                            IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                        }
                    }
                    else
                    {
                        MessageBox.Show("发生错误,请先复位", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                if (strIoName == "复位" && bCurrentState)
                {
                    if (GlobalVariable.g_StationState == StationState.StationStateEmg)
                    {
                        alarmtimer.Stop();
                        GlobalVariable.g_StationState = StationState.StationStateStop;
                        MotionMgr.GetInstace().ResetAxis();
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("绿灯", true);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("红灯", false);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                        {
                            IOMgr.GetInstace().WriteIoBit("黄灯", true);
                        }
                        if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                        {
                            IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                        }

                        bStartAlarmTimer = false;
                        bAlreadyEmg      = false;
                    }
                }
            }
        }
Ejemplo n.º 19
0
 private void button_pause_Click(object sender, EventArgs e)
 {
     StationMgr.GetInstance().Pause();
 }
Ejemplo n.º 20
0
        private void Form_Set_Load(object sender, EventArgs e)
        {
            rightTab1.TabPages.Clear();
            List <string> StationNameList = StationMgr.GetInstance().GetAllStationName();
            int           index           = 0;
            Form_Manual   ManualForm      = new Form_Manual();

            ManualForm.TopLevel = false;
            ManualForm.Size     = rightTab1.ClientSize;
            ManualForm.Dock     = DockStyle.Fill;

            TabPage tabManual = new TabPage();

            tabManual.Name = "ManualOpreate";
            tabManual.Text = "手动操作";
            tabManual.Controls.Add(ManualForm);
            rightTab1.TabPages.Add(tabManual);


            Form_AllIO form_AllIO = new Form_AllIO();

            form_AllIO.TopLevel = false;
            form_AllIO.Size     = rightTab1.ClientSize;
            form_AllIO.Dock     = DockStyle.Fill;


            TabPage tabIo = new TabPage();

            tabIo.Name = "AllIo";
            tabIo.Text = "Io操作";
            tabIo.Controls.Add(form_AllIO);
            rightTab1.TabPages.Add(tabIo);

            Form_AxisTest form_AxisTest = new Form_AxisTest();

            form_AxisTest.TopLevel = false;
            form_AxisTest.Dock     = DockStyle.Fill;
            TabPage tabAxisTest = new TabPage();

            tabAxisTest.Name = "MotionParam";
            tabAxisTest.Text = "电机设置";
            tabAxisTest.Controls.Add(form_AxisTest);
            rightTab1.TabPages.Add(tabAxisTest);
            tabAxisTest.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left;


            string strStationName = "";

            foreach (var st in StationMgr.GetInstance().GetDicStaion())
            {
                Form temp = (Form)st.Key;
                temp.Name      = st.Value.Name;
                strStationName = st.Value.Name;
                m_dicFromStation.TryAdd(temp, StationMgr.GetInstance().GetStation(strStationName));

                temp.TopLevel = false;
                temp.Dock     = DockStyle.Fill;

                TabPage tab = new TabPage();
                tab.Name = strStationName;
                tab.Text = strStationName;
                tab.Controls.Add(temp);
                rightTab1.TabPages.Add(tab);
                temp.Name = strStationName;
            }
            int stationIndexStart = 3;

            if (rightTab1.TabPages.Count > 3)
            {
                stationIndexStart = 3;
            }
            else
            {
                stationIndexStart = 0;
            }
            rightTab1.SelectedIndex = stationIndexStart;
            rightTab1.TabPages[stationIndexStart].Controls[0].Show();
            m_currentForm = (Form)rightTab1.TabPages[stationIndexStart].Controls[0];
        }
Ejemplo n.º 21
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //读取网口串口配置
            ParamSetMgr.GetInstance().SetBoolParam("启用安全门", true);
            ParamSetMgr.GetInstance().SetBoolParam("启用安全光栅", true);

            ConfigToolMgr.GetInstance().ReadEthConfig();
            ConfigToolMgr.GetInstance().ReadComConfig();
            //读硬件配置 并创建IO,Motion 卡类 对象 并以默认参数配置卡
            ConfigToolMgr.GetInstance().ReadMotionCardConfig();
            ConfigToolMgr.GetInstance().ReadIoCardConfig();
            ConfigToolMgr.GetInstance().ReadIoInputConfig();
            ConfigToolMgr.GetInstance().ReadIoOutputConfig();

            //读工站配置
            ConfigToolMgr.GetInstance().ReadStationConfig();

            //读取用户设置
            ConfigToolMgr.GetInstance().ReadUserConfig();
            //读取产品文件
            ConfigToolMgr.GetInstance().ReadProductDir_Name();
            //读运动配置
            ConfigToolMgr.GetInstance().ReadMoveParamConfig();
            ConfigToolMgr.GetInstance().ReadHomeParamConfig();
            ConfigToolMgr.GetInstance().ReadUserParam();

            //视觉x文件路径初始化
            VisionMgr.GetInstance().CurrentVisionProcessDir = ParamSetMgr.GetInstance().CurrentWorkDir + "\\" + ParamSetMgr.GetInstance().CurrentProductFile + "\\" + @"Config\Vision\";
            string str = VisionMgr.GetInstance().CurrentVisionProcessDir;

            //初始化 Motion IO
            MotionMgr.GetInstace().OpenAllCard();
            IOMgr.GetInstace().initAllIoCard();

            //AA参数加载

            UserConfig.BandEventOnForm1(this);

            this.WindowState = FormWindowState.Maximized;
            int BtnHeight = button_stop.Height + 10;

            panel_window.Location = new System.Drawing.Point(0, BtnHeight);

            panel_window.Size = new Size(this.Width - 30, this.Height - BtnHeight - 1);
            Form_Auto autoform = new Form_Auto();

            m_dicAllWindows.Add(button_Home, autoform);
            m_dicAllWindows.Add(button_Set, new Form_Set());
            m_dicAllWindows.Add(button_vision, new Form_VisionDebug());
            m_dicAllWindows.Add(button_Param, new Form_ParamSet());
            m_dicAllWindows.Add(button_UserSMgr, new UserManger());
            m_currentForm = autoform;

            UserConfig.AddStation();
            //读取工站位置坐标
            Dictionary <string, PointInfo> dicPonit = new Dictionary <string, PointInfo>();

            foreach (var tem in StationMgr.GetInstance().GetAllStationName())
            {
                ConfigToolMgr.GetInstance().ReadPoint(tem, out dicPonit);
                StationMgr.GetInstance().GetStation(tem).SetStationPointDic(dicPonit);
            }
            // 注册安全函数
            UserConfig.AddIoSafeOperate();
            UserConfig.AddAxisSafeOperate();

            //初始化 工站状态
            GlobalVariable.g_StationState = StationState.StationStateStop;
            IOMgr.GetInstace().m_deltgateSystemSingl += ProcessSysIo;
            MotionMgr.GetInstace().m_eventAxisSingl  += ProcessSysIo;
            autoform.TopLevel = false;
            autoform.Dock     = DockStyle.Fill;
            autoform.Parent   = this.panel_window;
            autoform.Show();

            //初始化权限
            sys.g_eventRightChanged += ChangedUserRight;
            User user  = new User();
            int  index = sys.g_listUser.FindIndex(t => t._userName == "admin");

            if (index == -1)
            {
                user = new User()
                {
                    _userName = "******", _userPassWord = "******", _userRight = UserRight.超级管理员
                };
                sys.g_listUser.Add(user);
            }
            index = sys.g_listUser.FindIndex(t => t._userName == "user");
            if (index == -1)
            {
                user = new User()
                {
                    _userName = "******", _userPassWord = "******", _userRight = UserRight.客户操作员
                };
                sys.g_listUser.Add(user);
            }
            index = sys.g_listUser.FindIndex(t => t._userName == "debug");
            if (index == -1)
            {
                user = new User()
                {
                    _userName = "******", _userPassWord = "******", _userRight = UserRight.调试工程师
                };
                sys.g_listUser.Add(user);
            }
            index = sys.g_listUser.FindIndex(t => t._userName == "engineer");
            if (index == -1)
            {
                user = new User()
                {
                    _userName = "******", _userPassWord = "******", _userRight = UserRight.软件工程师
                };
                sys.g_listUser.Add(user);
            }
            GlobalVariable.g_eventStationStateChanged += StationStateChangedHandler;
        }
 /// <summary>
 /// 添加工站
 /// </summary>
 public static void AddStation()
 {
     //添加工站
     StationMgr.GetInstance().AddStation(new StationForm(), "流水线", new LineStation(StationMgr.GetInstance().GetStation("流水线")));
     StationMgr.GetInstance().AddStation(new StationFormRobot(), "机械手", new LineStation(StationMgr.GetInstance().GetStation("机械手")));
 }
Ejemplo n.º 23
0
        private void Form_Auto_Load(object sender, EventArgs e)
        {
            GlobalVariable.g_eventStationStateChanged += StationStateChangedHandler;
            tabControl_Log.Controls.Clear();
            ParamSetMgr.GetInstance().m_eventChangedBoolSysVal   += Form_Auto_m_eventChangedBoolSysVal;
            ParamSetMgr.GetInstance().m_eventChangedDoubleSysVal += Form_Auto_m_eventChangedDoubleSysVal;
            ParamSetMgr.GetInstance().m_eventLoadProductFile     += LoadProductFile;
            label_CurrentFile.Text = "当前产品:" + ParamSetMgr.GetInstance().CurrentProductFile;
            foreach (var tem in StationMgr.GetInstance().GetAllStationName())
            {
                RichTxtBoxLog richTextBox = new RichTxtBoxLog();
                Control       control     = null;
                //ListLog listLog = new ListLog();
                //listLog.ItemHeight = 25;
                //listLog.HorizontalScrollbar = true;
                //listLog.ScrollAlwaysVisible = true;
                //listLog.Size = new Size(tabControl_Log.Size.Width - 20, tabControl_Log.Size.Height - 20);
                //control= (Control)listLog;

                richTextBox.Size       = new Size(tabControl_Log.Size.Width - 30, tabControl_Log.Size.Height - 30);
                richTextBox.ScrollBars = RichTextBoxScrollBars.Both;

                richTextBox.Dock          = System.Windows.Forms.DockStyle.Fill;
                richTextBox.HideSelection = false;
                richTextBox.Location      = new System.Drawing.Point(0, 0);
                richTextBox.Name          = "richTextBox1";
                richTextBox.Size          = new System.Drawing.Size(150, 150);
                richTextBox.TabIndex      = 0;
                richTextBox.Text          = "";
                richTextBox.WordWrap      = false;
                control = richTextBox;
                TabPage tabStaion = new TabPage();
                tabStaion.Name = tem;
                tabStaion.Text = tem;

                tabStaion.Controls.Add((Control)control);
                tabControl_Log.TabPages.Add(tabStaion);

                // StationMgr.GetInstance().GetStation(tem).SetShowListBox(listLog);
                // StationMgr.GetInstance().GetStation(tem).m_eventListBoxShow += ShowStationMsg;
                richTextBox.Multiline = true;

                StationMgr.GetInstance().GetStation(tem).SetShowRichTextBox(richTextBox);
                StationMgr.GetInstance().GetStation(tem).m_eventRichBoxShow += ShowStationMsgOnRichTxtBox;
                ;

                StationMgr.GetInstance().GetStation(tem).Info(tem + $" sd加载成功");
                //for (int i = 0; i < 300; i++)
                //{
                //    StationMgr.GetInstance().GetStation(tem).Info(tem + $"加载成功{i}");
                //    StationMgr.GetInstance().GetStation(tem).Err(tem + $"加载成功err{i}");
                //}
            }

            MachineStateEmg.Name   = "急停";
            MachineStateStop.Name  = "停止";
            MachineStateAuto.Name  = "自动";
            MachineStatePause.Name = "暂停";
            //添加 ------- 标志--------///
            userPanel_Flag.Visible = false;
            UserConfig.AddFlag(this);
            if (m_listFlag.Count > 0)
            {
                userPanel_Flag.Visible = true;
            }
            userPanel_Flag.Update();

            //添加 ------- 标志--------///
            //添加 ------- double param--------///
            AddDoubleRtn("产品计数", 0);
            ParamSetMgr.GetInstance().SetDoubleParam("产品计数", 0);

            AddDoubleRtn("CT", 0);
            ParamSetMgr.GetInstance().SetDoubleParam("CT", 0);

            AddDoubleRtn("UPH", 0);
            ParamSetMgr.GetInstance().SetDoubleParam("UPH", 0);

            UserConfig.InitHalconWindow(this);
            UserConfig.BandStationWithVisionCtr(this);
            UserConfig.InitCam(this);

            //默认用户登陆
            sys.g_User = sys.g_listUser.Find(t => t._userName == "admin");

            UserConfig.InitEpson4Robot();
            UserConfig.InitHardWare();
            UserConfig.CalibDataRead();
            UserConfig.ReadVisionData();
            UserConfig.UpdataTrayData();
            UserConfig.ReadAndUpdatStatisticaldata(this);
        }