Ejemplo n.º 1
0
        public MainForm() : base("CDI检测机系统", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString())
        {
            InitializeComponent();
            //Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            ClassCommonSetting.ProgramLog(LogFile.Level.Info, "Main", "Run version: " + Version);
            //初始化硬件
            SplashProcessInfo = "初始化硬件...";
            HardwarePool.SystemHardware.instance.Init();
            HardwarePool.SystemHardware.instance.Open();
            SerialProtocalCollection.instance.ConnectProtocol();
            SplashProcessInfo = "加载参数,打开CDIVision...";
            ClassCommonSetting.CommonInit();
            this.LogOutTime = GetLogOutTime(ClassCommonSetting.SysParam.LogOutTime);

            //初始化工作区域
            SplashProcessInfo = "初始化工作区域...";
            zones             = ClassWorkZones.Instance;
            zones.AllZoneInit();
            SplashProcessInfo = "初始化工作流程...";
            workflow          = ClassWorkFlow.Instance;
            workflow.WorkFlowInit();
            //初始化主界面
            SplashProcessInfo = "初始化界面...";
            auto        = AutoPanel.Instance;
            setting     = new ConfigurationPanel();
            manual      = new ManualOperationPanel();
            product     = new ProductPanel();
            calibration = new CalibrationPanel();
            monitor     = new MonitorPanel();
            AddInterface(PanelType.AutoFace, auto);
            AddInterface(PanelType.SettingFace, setting);
            AddInterface(PanelType.ManualFace, manual);
            AddInterface(PanelType.ProductFace, product);
            AddInterface(PanelType.DebugFace, calibration);
            AddInterface(PanelType.MonitorFace, monitor);
            ClassCommonSetting.SysParam.AddParaInterface(product);
            ClassCommonSetting.SysParam.CurrentProductParam.SetDataToInterface(product);
            ClassCommonSetting.SysParam.CurrentProductParam.AddParaInterface(calibration);

            zones.SPC.AddGUI(auto);
            zones.SPC.AddGUI(monitor);

            //事件挂钩
            CommonFunction.SysPublisher.subscribeMeToSystemEvents(zones);
            CommonFunction.SysPublisher.subscribeMeToSystemEvents(workflow);
            zones.WorkZone外框架.HookErrorEvent();
            auto.HookErrorEvent();
            workflow.TimeUsage.AddTimeUsageGUI(auto);
            zones.AddTimeUsage(auto);
            ClassCommonSetting.SocketToAOI.subscribeMeToResponseEvents(zones.WorkZone尺寸测量);
            HookErrorEvent();
            CommonFunction.SysPublisher.subscribeMeToSystemEvents(this);
            this.UserLoggedIn     += MainForm_UserLoggedIn1;
            this.UserLoggedOut    += MainForm_UserLoggedOut1;
            product.SaveParaEvent += Product_SaveParaEvent;
            //发送事件
            CommonFunction.SysPublisher.notifyProductChangeEventSubscribers(null, new StateEventArgs(ClassCommonSetting.SysParam.CurrentProduct, ""));
        }
Ejemplo n.º 2
0
 public void WorkFlowInit()
 {
     workzones         = ClassWorkZones.Instance;
     _CDIMainSM        = new CDIMainStateMachine(this);
     _LoadPNPLoadSM    = new LoadPNPLoadStateMachine(this);
     _SortingPNPWorkSM = new SortingPNPWorkStateMachine(this);
     _TransPNPWorkSM   = new TransPNPWorkStateMachine(this);
     _UnloadPNPWorkSM  = new UnloadPNPWorkStateMachine(this);
     foreach (ClassBaseWorkZone zone in workzones.ToArray())
     {
         zone.SubscribeMeToResponseEvent(this);
     }
 }
Ejemplo n.º 3
0
        public AutoPanel()
        {
            InitializeComponent();
            switch (ClassWorkFlow.Instance.WorkMode)
            {
            case EnumWorkMode.正常: optionBoxWorkModeNormal.Text = EnumWorkMode.正常.ToString(); optionBoxWorkModeNormal.Checked = true; break;

            case EnumWorkMode.空跑: optionBoxWorkModeDry.Text = EnumWorkMode.空跑.ToString(); optionBoxWorkModeDry.Checked = true; break;
            }
            switch (ClassWorkFlow.Instance.UnloadMode)
            {
            case EnumUnloadMode.全NG: optionBoxUnloadAllNG.Text = EnumUnloadMode.全NG.ToString(); optionBoxUnloadAllNG.Checked = true; break;

            case EnumUnloadMode.全OK: optionBoxUnloadAllOK.Text = EnumUnloadMode.全OK.ToString(); optionBoxUnloadAllOK.Checked = true; break;

            case EnumUnloadMode.正常: optionBoxUnloadNormal.Text = EnumUnloadMode.正常.ToString(); optionBoxUnloadNormal.Checked = true; break;
            }
            switch (ClassWorkFlow.Instance.LoadMode)
            {
            case EnumLoadMode.手动: optionBoxLoadManual.Text = EnumLoadMode.手动.ToString(); optionBoxLoadManual.Checked = true; break;

            case EnumLoadMode.自动: optionBoxLoadAuto.Text = EnumLoadMode.自动.ToString(); optionBoxLoadAuto.Checked = true; break;
            }
            ClassErrorHandle.AddErrorDispPanel(errorListUserControl1);
            zones = ClassWorkZones.Instance;
            zones.AddStatusGUI(this);
            zones.CellDTViewer       = dataGridViewAuto;
            zones.CellDT.RowChanged += DataRowChangeEventHandler;
            //LogLevel = LogFile.Level.Info;
            //ClassCommonSetting.Log.AddLogControl(this);
            AddDisp();
            CommonFunction.SysPublisher.subscribeMeToSystemEvents(this);
            ClassCommonSetting.SysParam.CurrentProductParam.AddParaInterface(this);
            ClassWorkZones.Instance.WorkZoneNG挑选机械手.UpdateNGBoxEvent += UpdateSortingNGBox;
            ClassWorkZones.Instance.WorkZone上料机械手.UpdateNGBoxEvent   += UpdateLoadNGBox;
            ClassWorkZones.Instance.WorkZone外框架.SafetyStatusChange   += WorkZone外框架_SafetyStatusChange;
            WorkZone外框架_SafetyStatusChange(ClassWorkZones.Instance.WorkZone外框架.ThisInport(ClassZone外框架.EnumInportName.FrameDoorOpen));
            timer.ThreadTimerTickEvent += timer1_Tick;
            textBoxWorkFlowStatus.Text  = Statistic.WFStatus.ToString();
            BaseForm.SetHelpTip(pictureBoxDebugSwitch, "鼠标点击进行切换。手动模式下流程暂停,切换回自动模式下才能进行恢复流程操作。");
        }
Ejemplo n.º 4
0
 public MotorSafetyCheck(ClassWorkZones WorkZones)
 {
     zones = WorkZones;
 }