Beispiel #1
0
        public LogisticScreen()
        {
            InitializeComponent();
            this.formSize = this.Size;
            this.lineId   = Convert.ToInt32(Properties.Settings.Default.LineId);

            this.myLineClient1 = new ServiceReference1.LogisticClient("NetTcpBinding_ILogistic1");
            this.myLineClient2 = new ServiceReference1.LogisticClient("NetTcpBinding_ILogistic2");
            ////this.myCollector = new ServiceReference1.LogisticCollectorClient("NetTcpBinding_ILogisticCollector");

            this.myFormTimer              = new FormTimer();
            this.myFormTimer.CounterTick += new myEventHandler(timerHandler);
            this.laProduct.Text           = ""; // tbd

            this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.BlackScreen_MouseDown);
            this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BlackScreen_MouseMove);
        }
Beispiel #2
0
        private void timerHandler()
        {
            this.laTime.Text = DateTime.Now.ToLongTimeString().ToString();
            try
            {
                if (!this.connected1)
                {
                    this.myLineClient1 = new ServiceReference1.LogisticClient("NetTcpBinding_ILogistic1");
                    this.connected1    = true;
                }

                if (!this.connected2)
                {
                    this.myLineClient2 = new ServiceReference1.LogisticClient("NetTcpBinding_ILogistic2");
                    this.connected2    = true;
                }

                ServiceReference1.StationRealtimeData[] stationData1 = new ServiceReference1.StationRealtimeData[0];
                ServiceReference1.StationRealtimeData[] stationData2 = new ServiceReference1.StationRealtimeData[0];

                try
                {
                    stationData1 = myLineClient1.ReadLogisticRealTimeData(1);
                }
                catch (Exception ex)
                {
                    this.myLog.LogAlert(AlertType.Error, this.GetType().ToString(), ex.Message.ToString());
                }

                try
                {
                    stationData2 = myLineClient2.ReadLogisticRealTimeData(1);
                }
                catch (Exception ex)
                {
                    this.myLog.LogAlert(AlertType.Error, this.GetType().ToString(), ex.Message.ToString());
                }


                int largeValue   = 999999;
                int taktCounter1 = (stationData1.FirstOrDefault(p => p.Key.Equals("T")) != null)
                    ? Convert.ToInt32(stationData1.FirstOrDefault(p => p.Key.Equals("T")).Value) : largeValue;
                int taktCounter2 = (stationData2.FirstOrDefault(p => p.Key.Equals("T")) != null)
                    ? Convert.ToInt32(stationData2.FirstOrDefault(p => p.Key.Equals("T")).Value) : largeValue;
                int taktCounter = Math.Min(taktCounter1, taktCounter2);

                this.laMem.Text = formatCounter(taktCounter);

                this.laFrame.Text = (stationData1.FirstOrDefault(p => p.Key.Equals("F")) != null)
                    ? (stationData1.FirstOrDefault(p => p.Key.Equals("F")).Value).ToString() : "";


                this.fillStationGrid();
                this.fillTailGrid();

                this.fillBatchesList();
                this.fillNextBatchInfo();

                this.laMessage.Text = ""; // empty string if connected
            }

            catch (System.ServiceModel.EndpointNotFoundException e)
            {
                this.myLog.LogAlert(AlertType.Error, this.GetType().ToString(), e.Message.ToString());
                this.laMessage.Text = "Connecting " + new String('.', (this.myFormTimer.Counter % 4));
            }
            catch (System.TimeoutException e)
            {
                this.myLog.LogAlert(AlertType.Error, this.GetType().ToString(), e.Message.ToString());
                this.laMessage.Text = "Connecting " + new String('.', (this.myFormTimer.Counter % 4));
            }
            catch (Exception e1)
            {
                this.myLog.LogAlert(AlertType.Error, this.GetType().ToString(), e1.Message.ToString());
            }
        }