Exemplo n.º 1
0
        public void handleRecivedData(string str)
        {
            if (string.IsNullOrEmpty(str))
            {
                return;
            }

            if (str == "new order")
            {
                sendNewOrder();
            }

            if (str == "finish order")
            {
                MESClient.finishOrder(true);
            }


            Program.GetVM().logWriteLine($"PLC Rx: {str}");

            var regex = new Regex(@"PackML: (.+)", RegexOptions.IgnoreCase);

            var match = regex.Match(str);

            if (match.Success)
            {
                //group 0 = PackML: Idle
                //group 1 = Idle

                //Send stuff to MES
                var state = match.Groups[1].Value;

                MESClient.Log("PML_" + state, "No comment");

                Program.GetVM().Status = state;

                if ((state == "Aborting" || state == "Stopping") && Program.GetVM().CurrentOrder.id != -1)
                {
                    Program.GetVM().logWriteLine("Deleting current order.");
                    MESClient.finishOrder(false);
                    //Program.GetVM().CurrentOrder = null;
                    //Program.GetVM().CurrentOrderKey = "";
                    //MESClient.currentOrderName = null;
                    //MESClient.currentOrderKey = null;
                }
            }
        }
Exemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     Task.Run(() => { MESClient.GetNewOrder().Wait(); Task.Delay(new TimeSpan(0, 0, 20)).Wait(); MESClient.finishOrder(true).Wait(); });
 }