示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            HellaAPCECOMannager MyHellaAPCECOMannager = new HellaAPCECOMannager();
            CountingHelper      MyCountingHelper      = new CountingHelper(CounterID, ServerTaskID, 1, 1);

            ReturnValue = CountingHelper.DoUpdateWork(MyHellaAPCECOMannager, MyCountingHelper);
            OutMessage(null, 3);
            //OutInforRichTextBox.AppendText(nn.ToString()+"\n");
        }
示例#2
0
        private void Preprocessing(NotificationContainer notification, Task[] Mytasks)
        {
            LGJSynchTcpClient MyLGJSynchTcpClient = new LGJSynchTcpClient(null, null, null, "8000");
            //Type MyType = notification.Item.GetType();
            //MyLGJSynchTcpClient.SendMessage("xxxx#"+MyType..FullName+"  Tasks:"+ Mytasks.Length.ToString());
            string MessageTypeStr = notification.Item.ToString();

            MessageTypeStr = MessageTypeStr.Substring(MessageTypeStr.IndexOf(".") + 1);
            MyLGJSynchTcpClient.SendMessage("Types#" + MessageTypeStr + "  Tasks:" + Mytasks.Length.ToString());

            string NotificationStr = null;

            if (notification.Item is CountNotification)
            {
                CountNotification MyCountNotifi = notification.Item as CountNotification;
                NotificationStr = "count#" + MyCountNotifi.customer_ID + ",IN:" + MyCountNotifi.count_in.ToString() + ";OUT:" + MyCountNotifi.count_out.ToString() + ",TaskID:" + MyCountNotifi.serverTask_ID.ToString() + ",GateID:" + MyCountNotifi.counting_gate_id.id;

                HellaAPCECOMannager MyHellaAPCECOManager = new HellaAPCECOMannager();
                CountingHelper      MyCountingHelper     = new CountingHelper(MyCountNotifi.customer_ID, MyCountNotifi.serverTask_ID, (int)MyCountNotifi.count_in, (int)MyCountNotifi.count_out);
                //CountingMannager MyCountingMannager = new CountingMannager("ABC987654321", 1000, 1, 1);
                CountingHelper.DoUpdateWork(MyHellaAPCECOManager, MyCountingHelper);
            }

            if (notification.Item is StartupNotification)
            {
                StartupNotification MyStartNotifi = notification.Item as StartupNotification;
                NotificationStr = "start#" + MyStartNotifi.customer_ID + ",TaskID:" + MyStartNotifi.serverTask_ID.ToString() + "," + MyStartNotifi.ip_address + "," + MyStartNotifi.mac_address;
            }

            if (notification.Item is AliveNotification)
            {
                AliveNotification MyAliveNotifi = notification.Item as AliveNotification;
                NotificationStr = "keepalive#" + MyAliveNotifi.customer_ID + ",TaskID:" + MyAliveNotifi.serverTask_ID.ToString() + "," + MyAliveNotifi.ip_address + "," + MyAliveNotifi.mac_address;
            }

            if (NotificationStr != null)
            {
                MyLGJSynchTcpClient.SendMessage(NotificationStr);

                //SoapMessageLogExtension MySoapMessageLogExtension = new SoapMessageLogExtension();
                //MySoapMessageLogExtension.LGJLogTextMessage(NotificationStr, notification.Item.GetType());
            }
        }
示例#3
0
 private void Start()
 {
     countingCanvas = GameObject.Find("Canvas_3");
     countingScript = countingCanvas.GetComponent <CountingHelper>();
 }
示例#4
0
        private Task[] PreprocessingEx(NotificationContainer notification)
        {
            LGJSynchTcpClient MyLGJSynchTcpClient = new LGJSynchTcpClient(null, null, null, "8000");
            string            MessageTypeStr      = notification.Item.ToString();

            MessageTypeStr = MessageTypeStr.Substring(MessageTypeStr.IndexOf(".") + 1);
            MyLGJSynchTcpClient.SendMessage("APC-Types#" + MessageTypeStr);

            string NotificationStr = null;

            uint GetTaskID = 0;
            uint OldTaskID = 0;

            if (notification.Item is CountNotification)
            {
                CountNotification MyCountNotifi = notification.Item as CountNotification;
                NotificationStr = "APC-count#" + MyCountNotifi.customer_ID + ",IN:" + MyCountNotifi.count_in.ToString() + ";OUT:" + MyCountNotifi.count_out.ToString() + ",TaskID:" + MyCountNotifi.serverTask_ID.ToString() + ",GateID:" + MyCountNotifi.counting_gate_id.id;
                MyLGJSynchTcpClient.SendMessage(NotificationStr);

                OldTaskID = MyCountNotifi.serverTask_ID;
                HellaAPCECOMannager MyHellaAPCECOManager = new HellaAPCECOMannager();
                CountingHelper      MyCountingHelper     = new CountingHelper(MyCountNotifi.customer_ID, MyCountNotifi.serverTask_ID, (int)MyCountNotifi.count_in, (int)MyCountNotifi.count_out);
                GetTaskID = (uint)CountingHelper.DoUpdateWork(MyHellaAPCECOManager, MyCountingHelper);

                if (GetTaskID > 0)
                {
                    return(CreateCounterTaskList4(OldTaskID, GetTaskID));
                }
                else
                {
                    return(null);
                }
            }

            if (notification.Item is StartupNotification)
            {
                StartupNotification MyStartNotifi = notification.Item as StartupNotification;
                NotificationStr = "APC-start#" + MyStartNotifi.customer_ID + ",TaskID:" + MyStartNotifi.serverTask_ID.ToString() + "," + MyStartNotifi.ip_address + "," + MyStartNotifi.mac_address;
                MyLGJSynchTcpClient.SendMessage(NotificationStr);

                HellaAPCECOMannager MyHellaAPCECOManager = new HellaAPCECOMannager();
                HellaApcHelper      MyHellaApcHelper     = new HellaApcHelper(MyStartNotifi.customer_ID, "startup");
                GetTaskID = HellaApcHelper.DoUpdateWork(MyHellaAPCECOManager, MyHellaApcHelper);
                if (GetTaskID > 0)
                {
                    return(CreateCounterTaskList3(GetTaskID));
                }
                else
                {
                    return(null);
                }
            }

            if (notification.Item is AliveNotification)
            {
                AliveNotification MyAliveNotifi = notification.Item as AliveNotification;
                NotificationStr = "APC-keepalive#" + MyAliveNotifi.customer_ID + ",TaskID:" + MyAliveNotifi.serverTask_ID.ToString() + "," + MyAliveNotifi.ip_address + "," + MyAliveNotifi.mac_address;
                MyLGJSynchTcpClient.SendMessage(NotificationStr);


                OldTaskID = MyAliveNotifi.serverTask_ID;
                HellaAPCECOMannager MyHellaAPCECOManager = new HellaAPCECOMannager();
                HellaApcHelper      MyHellaApcHelper     = new HellaApcHelper(MyAliveNotifi.customer_ID, "keepalive");
                GetTaskID = HellaApcHelper.DoUpdateWork(MyHellaAPCECOManager, MyHellaApcHelper);

                if (GetTaskID > 0)
                {
                    return(CreateCounterTaskList4(OldTaskID, GetTaskID));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }


            /*
             * if (NotificationStr != null)
             * {
             *  MyLGJSynchTcpClient.SendMessage(NotificationStr);
             *
             *  //SoapMessageLogExtension MySoapMessageLogExtension = new SoapMessageLogExtension();
             *  //MySoapMessageLogExtension.LGJLogTextMessage(NotificationStr, notification.Item.GetType());
             *
             * }
             */
            //------最后返回数据库-------------------------------------------------------------

            /*
             * if (GetTaskID > 0)
             *  return CreateCounterTaskList3(GetTaskID);
             * else
             *  return null;
             */
        }
示例#5
0
        private Task[] Preprocessing(NotificationBase notification)
        {
            string MessageTypeStr = notification.ToString();

            MessageTypeStr = MessageTypeStr.Substring(MessageTypeStr.LastIndexOf(".") + 1);
            OutPut(MessageTypeStr);
            string NotificationStr = null;

            uint GetTaskID = 0;
            uint OldTaskID = 0;

            if (notification is CountNotification)
            {
                CountNotification MyCountNotifi = notification as CountNotification;
                NotificationStr = "count#" + MyCountNotifi.customer_ID + ",IN:" + string.Format("{0:D3}", MyCountNotifi.count_in) + ";OUT:" + string.Format("{0:D3}", MyCountNotifi.count_out) + ",TaskID:" + string.Format("{0:D8}", MyCountNotifi.serverTask_ID) + ",NotificationID:" + MyCountNotifi.notification_ID.ToString() + ",Date:" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", MyCountNotifi.timestamp);
                OutPut(NotificationStr);

                OldTaskID = MyCountNotifi.serverTask_ID;
                HellaAPCECOMannager MyHellaAPCECOManager = new HellaAPCECOMannager();
                CountingHelper      MyCountingHelper     = new CountingHelper(MyCountNotifi.customer_ID, MyCountNotifi.serverTask_ID, (int)MyCountNotifi.count_in, (int)MyCountNotifi.count_out);
                GetTaskID = (uint)CountingHelper.DoUpdateWork(MyHellaAPCECOManager, MyCountingHelper);

                if (GetTaskID > 0)
                {
                    return(CreateCounterTaskList4(OldTaskID, GetTaskID));
                }
                else
                {
                    return(null);
                }
            }

            if (notification is StartupNotification)
            {
                StartupNotification MyStartNotifi = notification as StartupNotification;
                NotificationStr = "start#" + MyStartNotifi.customer_ID + ",TaskID:" + MyStartNotifi.serverTask_ID.ToString() + ",NotificationID:" + MyStartNotifi.notification_ID.ToString() + ",IP:" + MyStartNotifi.ip_address + ",MAC:" + MyStartNotifi.mac_address + ",[Date:" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", MyStartNotifi.timestamp) + ":" + string.Format("{0:D3}]", MyStartNotifi.timestamp.Millisecond);
                OutPut(NotificationStr);

                HellaAPCECOMannager MyHellaAPCECOManager = new HellaAPCECOMannager();
                HellaApcHelper      MyHellaApcHelper     = new HellaApcHelper(MyStartNotifi.customer_ID, "startup");
                GetTaskID = HellaApcHelper.DoUpdateWork(MyHellaAPCECOManager, MyHellaApcHelper);
                if (GetTaskID > 0)
                {
                    return(CreateCounterTaskList3(GetTaskID));
                }
                else
                {
                    return(null);
                }
            }

            if (notification is AliveNotification)
            {
                AliveNotification MyAliveNotifi = notification as AliveNotification;
                NotificationStr = "keepalive#" + MyAliveNotifi.customer_ID + ",TaskID:" + MyAliveNotifi.serverTask_ID.ToString() + ",NotificationID:" + MyAliveNotifi.notification_ID.ToString() + "," + MyAliveNotifi.ip_address + "," + MyAliveNotifi.mac_address + ",Date:" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", MyAliveNotifi.timestamp);
                OutPut(NotificationStr);


                OldTaskID = MyAliveNotifi.serverTask_ID;
                HellaAPCECOMannager MyHellaAPCECOManager = new HellaAPCECOMannager();
                HellaApcHelper      MyHellaApcHelper     = new HellaApcHelper(MyAliveNotifi.customer_ID, "keepalive");
                GetTaskID = HellaApcHelper.DoUpdateWork(MyHellaAPCECOManager, MyHellaApcHelper);

                if (GetTaskID > 0)
                {
                    return(CreateCounterTaskList4(OldTaskID, GetTaskID));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }