示例#1
0
        /// <summary>
        /// 模块加载
        /// </summary>
        private void ModuleAttach()
        {
            logView = new LogView("日志");
            logView.SetParent(this);



            logView.RegisterMenus(this.menuStrip1, "日志查询");
            logView.SetLogDispInterface(this);

            recordView = new RecordView();
            recordView.SetParent(this);
            recordView.RegisterMenus(this.menuStrip1, "记录查询与管理");
            recordView.SetLoginterface(logView.GetLogrecorder());

            storageView = new StorageMainView();
            storageView.SetParent(this);
            storageView.RegisterMenus(this.menuStrip1, "库存管理");
            storageView.SetLoginterface(logView.GetLogrecorder());

            AsrsInterface.IAsrsManageToCtl asrsResManage = null;
            // AsrsInterface.IAsrsCtlToManage asrsCtl = asrsCtlView.GetPresenter();
            string reStr = "";

            if (!storageView.Init(asrsCtlSvc, ref asrsResManage, ref reStr))
            {
                logView.GetLogrecorder().AddLog(new LogModel("主模块", "立库管理层模块初始化错误," + reStr, EnumLoglevel.错误));
            }
            // asrsCtlView.SetAsrsResManage(asrsResManage);
            List <string> logSrcList = new List <string>();
            //List<string> logSrcs = asrsCtlView.GetLogsrcList();
            //if(logSrcs != null)
            //{
            //    logSrcList.AddRange(logSrcs);
            //}
            List <string> logSrcs = storageView.GetLogsrcList();

            if (logSrcs != null)
            {
                logSrcList.AddRange(logSrcs);
            }
            logView.SetLogsrcList(logSrcList);
            Form frontForm = storageView.GetViewByCaptionTxt("货位看板");

            if (frontForm != null)
            {
                AttachModuleView(frontForm);
            }
        }
示例#2
0
        private bool InitWESMonitor()
        {
            try
            {
                string svcAddr = ConfigurationManager.AppSettings["MonitorSvcAddr"];
                CtlMonitorInterface.IWESMonitorSvc wesMonitorSvc = ChannelFactory <CtlMonitorInterface.IWESMonitorSvc> .CreateChannel(new BasicHttpBinding(), new EndpointAddress(svcAddr));

                if (wesMonitorSvc == null)
                {
                    Console.WriteLine("WCS服务未启动");
                    return(false);
                }
                Console.WriteLine(wesMonitorSvc.hello());
                this.nodeMonitorView.NodeMonitor = wesMonitorSvc;
                this.nodeMonitorView.AsrsMonitor = wesMonitorSvc;
                nodeMonitorView.Init();
                this.nodeMonitorView.InitDevDic(wesMonitorSvc.GetPLCConnStatDic());
                this.nodeMonitorView.DevMonitorView.devCommMonitor = wesMonitorSvc;
                asrsMonitorView.SetAsrsMonitor(wesMonitorSvc);
                asrsMonitorView.Init();
                nodeMonitorView.SetAsrsMonitors(asrsMonitorView.AsrsMonitors);

                List <string> logSrcs = new List <string>();
                logSrcs.AddRange(wesMonitorSvc.GetLogSrcList());
                List <string> storLogSrcs = storageView.GetLogsrcList();
                if (storLogSrcs != null)
                {
                    logSrcs.AddRange(logSrcs);
                }
                logView.SetLogsrcList(logSrcs);
                logView.AddLogsrcList(ExtLogSrc);
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(false);
            }
        }
示例#3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                this.WindowState       = FormWindowState.Maximized;
                this.btnPause.Enabled  = false;
                this.labelVersion.Text = this.version;
                #region 数据库配置
                string dbSrc = ConfigurationManager.AppSettings["DBSource"];
                //CtlDBAccess.DBUtility.PubConstant.ConnectionString = string.Format(@"{0}Initial Catalog=ACEcams;User ID=sa;Password=123456;", dbSrc);
                string dbConn1 = string.Format(@"{0}Initial Catalog=AoyouEcams;User ID=sa;Password=123456;", dbSrc);
                CtlDBAccess.DBUtility.DbHelperSQL.SetConnstr(dbConn1);
                string dbConn2 = string.Format(@"{0}Initial Catalog=AoyouLocalMes;User ID=sa;Password=123456;", dbSrc);
                MesDBAccess.DBUtility.DbHelperSQL.SetConnstr(dbConn2);
                AsrsStorDBAcc.DbHelperSQL.SetConnstr(string.Format(@"{0}Initial Catalog=AoyouWMSDB;User ID=sa;Password=123456;", dbSrc));
                #endregion
                string mesAddr = ConfigurationManager.AppSettings["MesSvcAddr"];
                PrcsCtlModelsAoyou.WShelper.url = mesAddr;
                presenter  = new MainPresenter(this);
                childList  = new List <string>();
                childViews = new List <BaseChildView>();

                Console.SetOut(new TextBoxWriter(this.richTextBoxLog));

                // corePresenter = new CtlcorePresenter();

                this.labelUser.Text            = "当前用户:" + this.userName;
                this.MainTabControl.DrawMode   = TabDrawMode.OwnerDrawFixed;
                this.MainTabControl.Padding    = new System.Drawing.Point(CLOSE_SIZE, CLOSE_SIZE);
                this.MainTabControl.DrawItem  += new DrawItemEventHandler(this.tabControlMain_DrawItem);
                this.MainTabControl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControlMain_MouseDown);
                if (!presenter.SysCtlInit())
                {
                    return;
                }

                if (!LoadModules())//加载子模块
                {
                    MessageBox.Show("子模块加载错误");

                    return;
                }
                this.configView.BatteryCfgView.dlgtSndPalletCfg = presenter.SendDevlinePalletCfg;
                this.configView.BatteryCfgView.dlgtGetPalletCfg = presenter.ReadPalletCfgFromPlc;
                List <string> logSrcs = new List <string>();
                logSrcs.AddRange(presenter.GetLogSrcList());
                List <string> storLogSrcs = storageView.GetLogsrcList();
                if (storLogSrcs != null)
                {
                    logSrcs.AddRange(storLogSrcs);
                }
                logView.SetLogsrcList(logSrcs);

                presenter.SetLogRecorder(logView.GetLogrecorder());
                AllocateModuleInface();
                nodeMonitorView.Init();
                this.nodeMonitorView.InitDevDic(presenter.DevCommManager.GetPLCConnStatDic());
                this.nodeMonitorView.DevMonitorView.devCommMonitor = presenter.DevCommManager;
                string[] taskNodeIDS = new string[] { "1001", "1002", "1003", "1004", "1005", "1006", "6001", "6002", "6003" };
                IDictionary <string, string> taskNodeMap = new Dictionary <string, string>();
                foreach (string nodeID in taskNodeIDS)
                {
                    FlowCtlBaseModel.CtlNodeBaseModel node = presenter.CtlNodeManager.GetNodeByID(nodeID);
                    if (node != null)
                    {
                        taskNodeMap[nodeID] = node.NodeName;
                    }
                }
                asrsCtlView.SetTaskNodeNames(taskNodeMap);


                string licenseFile = AppDomain.CurrentDomain.BaseDirectory + @"\NBSSLicense.lic";
                this.licenseMonitor = new LicenseMonitor(this, 60000, licenseFile, "zzkeyFT1");
                if (!this.licenseMonitor.StartMonitor())
                {
                    throw new Exception("license 监控失败");
                }
                string reStr = "";
                if (!this.licenseMonitor.IslicenseValid(ref reStr))
                {
                    MessageBox.Show(reStr);
                    return;
                }
                presenter.LoadAsrsExtSvc();

                //宿主状态监控服务
                PublicMonitorSvc();
                Console.WriteLine("系统初始化完成!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
示例#4
0
        /// <summary>
        /// 模块加载
        /// </summary>
        private void ModuleAttach()
        {
            logView = new LogView("日志");
            childViews.Add(logView);
            logView.SetParent(this);

            asrsCtlView = new AsrsCtlView("立库控制");
            childViews.Add(asrsCtlView);
            asrsCtlView.SetParent(this);
            asrsCtlView.RegisterMenus(this.menuStrip1, "立库控制");
            asrsCtlView.SetLoginterface(logView.GetLogrecorder());
            asrsCtlView.Init();

            nodeMonitorView = new ProcessMonitorView("流程监控");
            childViews.Add(nodeMonitorView);
            nodeMonitorView.SetParent(this);
            nodeMonitorView.RegisterMenus(this.menuStrip1, "流程监控");
            nodeMonitorView.SetLoginterface(logView.GetLogrecorder());
            nodeMonitorView.SetAsrsPresener(asrsCtlView.GetPresenter());
            if (!nodeMonitorView.Init())
            {
                MessageBox.Show("控制模块初始化失败");
                return;
            }
            nodeMonitorView.SetAsrsMonitors(asrsCtlView.AsrsMonitors);
            //  nodeMonitorView.SetAsrsBatchSetCtl(asrsCtlView.AsrsBatchSettingCtl);

            logView.RegisterMenus(this.menuStrip1, "日志查询");
            logView.SetLogDispInterface(this);

            recordView = new RecordView();
            recordView.SetParent(this);
            recordView.RegisterMenus(this.menuStrip1, "记录查询与管理");
            recordView.SetLoginterface(logView.GetLogrecorder());
            //recordView.SetHKAccessObj(nodeMonitorView.Presenter.HkAccessList[1]);
            //recordView.SetOcvAccessObj(nodeMonitorView.Presenter.OcvAccessObj);

            storageView = new StorageMainView();
            childViews.Add(storageView);
            storageView.SetParent(this);
            storageView.RegisterMenus(this.menuStrip1, "库存管理");
            storageView.SetLoginterface(logView.GetLogrecorder());
            nodeMonitorView.SetAsrsBatchSetCtl(storageView.BatchSetControl);


            AsrsInterface.IAsrsManageToCtl asrsResManage = null;
            AsrsInterface.IAsrsCtlToManage asrsCtl       = asrsCtlView.GetPresenter();
            string reStr = "";

            if (!storageView.Init(asrsCtl, ref asrsResManage, ref reStr))
            {
                logView.GetLogrecorder().AddLog(new LogModel("主模块", "立库管理层模块初始化错误," + reStr, EnumLoglevel.错误));
            }

            asrsCtlView.SetAsrsResManage(asrsResManage);
            nodeMonitorView.SetAsrsResManage(asrsResManage);

            configView = new ConfiManageView();
            childViews.Add(configView);
            configView.SetParent(this);
            configView.RegisterMenus(this.menuStrip1, "配置管理");
            configView.SetLoginterface(logView.GetLogrecorder());
            List <string> logSrcList = new List <string>();
            //List<string> logSrcs = asrsCtlView.GetLogsrcList();
            //if(logSrcs != null)
            //{
            //    logSrcList.AddRange(logSrcs);
            //}

            List <string> logSrcs = nodeMonitorView.GetLogsrcList();

            if (logSrcs != null)
            {
                logSrcList.AddRange(logSrcs);
            }
            logSrcs = storageView.GetLogsrcList();
            if (logSrcs != null)
            {
                logSrcList.AddRange(logSrcs);
            }
            logView.SetLogsrcList(logSrcList);
            AttachModuleView(nodeMonitorView);
            foreach (BaseChildView childView in childViews)
            {
                childView.ChangeRoleID(this.roleID);
            }
        }
示例#5
0
        private bool LoadModules()
        {
            logView = new LogView("日志");
            childViews.Add(logView);
            logView.SetParent(this);
            logView.RegisterMenus(this.menuStrip1, "日志查询");
            logView.SetLogDispInterface(this);

            configView = new ConfiManageView();
            childViews.Add(configView);
            configView.SetParent(this);
            configView.RegisterMenus(this.menuStrip1, "配置管理");
            configView.SetLoginterface(logView.GetLogrecorder());

            asrsCtlView = new AsrsCtlView("立库控制");
            childViews.Add(asrsCtlView);
            asrsCtlView.SetParent(this);
            asrsCtlView.RegisterMenus(this.menuStrip1, "立库控制");
            asrsCtlView.SetLoginterface(logView.GetLogrecorder());
            asrsCtlView.SetAsrsPresenter(presenter.AsrsPresenter);
            asrsCtlView.Init();

            nodeMonitorView = new CtlNodeMonitorView("流程监控");
            childViews.Add(nodeMonitorView);
            nodeMonitorView.SetParent(this);
            nodeMonitorView.RegisterMenus(this.menuStrip1, "流程监控");
            nodeMonitorView.SetLoginterface(logView.GetLogrecorder());

            storageView = new StorageMainView();
            childViews.Add(storageView);
            storageView.SetParent(this);
            storageView.RegisterMenus(this.menuStrip1, "库存管理");
            storageView.SetLoginterface(logView.GetLogrecorder());
            nodeMonitorView.SetAsrsBatchSetCtl(storageView.BatchSetControl);
            nodeMonitorView.SetAsrsMonitors(asrsCtlView.AsrsMonitors);

            List <string> logSrcs     = presenter.GetLogsrcList();
            List <string> storLogSrcs = storageView.GetLogsrcList();

            if (storLogSrcs != null)
            {
                logSrcs.AddRange(storLogSrcs);
            }

            logView.SetLogsrcList(logSrcs);

            AsrsInterface.IAsrsManageToCtl asrsResManage = null;
            AsrsInterface.IAsrsCtlToManage asrsCtl       = presenter.GetAsrsCtlInterfaceObj();
            string reStr = "";

            if (!storageView.Init(asrsCtl, ref asrsResManage, ref reStr))
            {
                // logView.GetLogrecorder().AddLog(new LogModel("主模块", "立库管理层模块初始化错误," + reStr, EnumLoglevel.错误));
                Console.WriteLine("立库管理层模块初始化错误," + reStr);
                return(false);
            }
            asrsCtlView.SetAsrsResManage(asrsResManage);
            AttachModuleView(nodeMonitorView);
            foreach (BaseChildView childView in childViews)
            {
                childView.ChangeRoleID(this.roleID);
            }
            presenter.SetAsrsResManage(asrsResManage);
            return(true);
        }