Beispiel #1
0
        //process.Initialize(context);初始化的时候执行
        public override void Initialize(Context context)
        {
            try
            {
                base.Initialize(context);
                //堆垛机收发报文的错误信息代码
                CraneErrMessageDal errDal = new CraneErrMessageDal();
                dtErrMesage = errDal.GetErrMessageList();
                NCK001 = 100;

                for (int i = 1; i <= 6; i++)
                {
                    string CraneNo = i.ToString().PadLeft(2, '0');
                    if (!dCraneWait.ContainsKey(CraneNo))
                    {
                        dCraneWait.Add(CraneNo, null);
                    }
                }

                THOK.MCP.Config.Configuration conf = new MCP.Config.Configuration();
                conf.Load("Config.xml");
                blnOutOrder = conf.Attributes["IsOutOrder"] == "1" ? true : false;
            }
            catch (Exception ex)
            {
                Logger.Error("THOK.XC.Process.Process_Crane.CraneProcess堆垛机初始化出错,原因:" + ex.Message);
            }
        }
Beispiel #2
0
        //process.Initialize(context);初始化的时候执行
        public override void Initialize(Context context)
        {
            try
            {
                base.Initialize(context);
                //堆垛机收发报文的错误信息代码
                CraneErrMessageDal errDal = new CraneErrMessageDal();
                dtErrMesage = errDal.GetErrMessageList();
                NCK001 = 100;

                for (int i = 1; i <= 6; i++)
                {
                    string CraneNo = i.ToString().PadLeft(2, '0');
                    if (!dCraneWait.ContainsKey(CraneNo))
                    {
                        dCraneWait.Add(CraneNo, null);
                    }
                }

            }
            catch (Exception ex)
            {
                Logger.Error("THOK.XC.Process.Process_Crane.CraneProcess堆垛机初始化出错,原因:" + ex.Message);
            }
        }
Beispiel #3
0
        public override void Initialize(Context context)
        {
            OrderIndex = 0;
            if (dtCarAddress == null)
            {
                SysCarAddressDal cad = new SysCarAddressDal();
                dtCarAddress = cad.CarAddress();
            }
            if (dtCarOrder == null)
            {
                dtCarOrder = new DataTable();
                DataColumn dc1 = new DataColumn("CAR_NO", Type.GetType("System.String"));
                DataColumn dc2 = new DataColumn("State", Type.GetType("System.String"));
                DataColumn dc3 = new DataColumn("CurStation", Type.GetType("System.Int32"));
                DataColumn dc4 = new DataColumn("OrderNo", Type.GetType("System.Int32"));
                DataColumn dc5 = new DataColumn("ToStation", Type.GetType("System.Int32"));

                DataColumn dc6 = new DataColumn("WriteItem", Type.GetType("System.String"));
                DataColumn dc7 = new DataColumn("ToStationOrder", Type.GetType("System.Int32"));

                dtCarOrder.Columns.Add(dc1);
                dtCarOrder.Columns.Add(dc2);
                dtCarOrder.Columns.Add(dc3);
                dtCarOrder.Columns.Add(dc4);
                dtCarOrder.Columns.Add(dc5);
                dtCarOrder.Columns.Add(dc6);
                dtCarOrder.Columns.Add(dc7);
            }
            THOK.MCP.Config.Configuration conf = new MCP.Config.Configuration();
            conf.Load("Config.xml");
            blnOutOrder = conf.Attributes["IsOutOrder"] == "1" ? true : false;

            base.Initialize(context);
        }
Beispiel #4
0
 public Dispatcher(Context context)
 {
     this.context = context;
     thread = new Thread(new ThreadStart(Run));
     thread.IsBackground = true;
     isRun = true;
     thread.Start();
 }
        private void InitializeResourceManager(Context context)
        {
            try
            {
                ResourceConfiguration configuration = new ResourceConfiguration();
                configuration.Load("Monitor.xml");
                DeviceManager deviceManager = new DeviceManager();

                foreach (string key in configuration.Resources.Keys)
                {
                    foreach (ResourceConfig resourceConfig in configuration.Resources[key])
                    {
                        Resource resource = new Resource();
                        resource.DeviceClass = key;
                        resource.StateCode = resourceConfig.StateCode;
                        resource.StateDesc = resourceConfig.StateDesc;
                        System.Drawing.Image image = null;
                        try
                        {
                            if (resourceConfig.ImageFile != null && resourceConfig.ImageFile.Trim().Length != 0)
                                image = System.Drawing.Bitmap.FromFile(resourceConfig.ImageFile);
                        }
                        catch (Exception e)
                        {
                            Logger.Error("ContextInitialize�����ԭ��" + e.Message);
                        }
                        resource.Image = image;

                        deviceManager.AddResource(resource);
                    }
                }

                foreach (string key in configuration.Devices.Keys)
                {
                    foreach (DeviceConfig deviceConfig in configuration.Devices[key])
                    {
                        Device device = new Device();
                        device.DeviceClass = key;
                        device.DeviceNo = deviceConfig.DeviceNo;
                        device.X = deviceConfig.X;
                        device.Y = deviceConfig.Y;
                        device.Width = deviceConfig.Width;
                        device.Height = deviceConfig.Height;
                        deviceManager.AddDevice(device);
                    }
                }

                context.DeviceManager = deviceManager;
                configuration.Release();
            }
            catch (Exception e)
            {
                Logger.Error("ContextInitialize�����ԭ��" + e.Message);
            }
        }
        public void InitializeContext(Context context)
        {
            configuration.Load("Config.xml");

            Logger.LogLevel = (LogLevel)Enum.Parse(typeof(LogLevel), configuration.LogLevel);
            context.ViewProcess = configuration.ViewProcess;

            InitializeAttributes(context);
            InitializeProcess(context);
            InitializeService(context);
            configuration.Release();

            //InitializeResourceManager(context);

            context.CompleteInitialize();
        }
        private void InitializeProcess(Context context)
        {
            foreach (ProcessConfig processConfig in configuration.Processes)
            {
                IProcess process = (IProcess)Create(processConfig.Assembly, processConfig.ClassName);
                process.Name = processConfig.Name;
                process.Initialize(context);

                if (processConfig.Items.Count != 0)
                    foreach (ProcessItemConfig itemConfig in processConfig.Items)
                        context.RegisterRelation(itemConfig.ServiceName, itemConfig.ItemName, process);
                else
                    context.RegisterProcess(process);

                process.Start();

                //�����ʼ��Ҫ��Ϊ���������ǰProcess
                if (processConfig.Suspend)
                    process.Suspend();
            }
        }
 private void InitializeAttributes(Context context)
 {
     foreach (string key in configuration.Attributes.Keys)
         context.Attributes.Add(key, configuration.Attributes[key]);
 }
 private void InitializeService(Context context)
 {
     foreach (ServiceConfig serviceConfig in configuration.Services)
     {
         IService service = (IService)Create(serviceConfig.Assembly, serviceConfig.ClassName);
         service.Name = serviceConfig.Name;
         service.Initialize(serviceConfig.FileName);
         context.RegisterService(service);
         service.Start();
     }
 }
Beispiel #10
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            try
            {
                Logger.OnLog += new LogEventHandler(Logger_OnLog);

                FormDialog.OnDialog += new DialogEventHandler(FormDialog_OnDialog);
                context = new Context();

                ContextInitialize initialize = new ContextInitialize();
                context.RegisterProcessControl(buttonArea);
                initialize.InitializeContext(context);
                context.RegisterProcessControl(monitorView);

                //context.Processes["DynamicShowProcess"].Resume();
            }
            catch (Exception ee)
            {
                Logger.Error("��ʼ������ʧ���������ã�ԭ��" + ee.Message);
            }
        }
Beispiel #11
0
 public virtual void Initialize(Context context)
 {
     this.context = context;
     state = ProcessState.Initialized;
 }