Example #1
0
        private void ResetAll_bt_Click(object sender, EventArgs e)
        {
            Transaction Txn;

            foreach (AlarmInfo eachA in AlarmManagement.GetAll())
            {
                if (!eachA.NeedReset)
                {
                    AlarmManagement.Remove(eachA);
                }
            }



            //foreach (Node node in NodeManagement.GetList())
            //{
            //    node.State = node.LastState;
            //}

            var NodeList = AlarmManagement.GetAll().GroupBy(t => t.NodeName);

            foreach (var group in NodeList)
            {
                string Message = "";
                Txn        = new Transaction();
                Txn.Method = Transaction.Command.RobotType.Reset;
                Txn.TaskId = "";
                //NodeManagement.Get(group.First().NodeName).State = "Alarm";
                NodeManagement.Get(group.First().NodeName).SendCommand(Txn, out Message);
                AlarmManagement.Remove(group.First().NodeName);
            }
            //NodeStatusUpdate.UpdateCurrentState("Idle");
            AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll());
        }
Example #2
0
        public void On_Command_TimeOut(Node Node, Transaction Txn)
        {
            logger.Debug("On_Command_TimeOut");
            AlarmInfo CurrentAlarm = new AlarmInfo();

            CurrentAlarm.NodeName  = Node.Name;
            CurrentAlarm.AlarmCode = "00200002";
            CurrentAlarm.NeedReset = false;
            try
            {
                AlarmMessage Detail = AlmMapping.Get("SYSTEM", CurrentAlarm.AlarmCode);

                CurrentAlarm.SystemAlarmCode = Detail.CodeID;
                CurrentAlarm.Desc            = Detail.Code_Cause;
                CurrentAlarm.EngDesc         = Detail.Code_Cause_English;
                CurrentAlarm.Type            = Detail.Code_Type;
                CurrentAlarm.IsStop          = Detail.IsStop;
                if (CurrentAlarm.IsStop)
                {
                    //RouteCtrl.Stop();
                }
            }
            catch (Exception e)
            {
                CurrentAlarm.Desc = "未定義";
                logger.Error(Node.Controller + "-" + Node.AdrNo + "(GetAlarmMessage)" + e.Message + "\n" + e.StackTrace);
            }
            CurrentAlarm.TimeStamp = DateTime.Now;
            AlarmManagement.Add(CurrentAlarm);
            AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll());
            AlarmUpdate.UpdateAlarmHistory(AlarmManagement.GetHistory());
        }
Example #3
0
        public void On_Connection_Error(string DIOName, string ErrorMsg)
        {
            //斷線 發ALARM
            logger.Debug("On_Error_Occurred");
            AlarmInfo CurrentAlarm = new AlarmInfo();

            CurrentAlarm.NodeName  = DIOName;
            CurrentAlarm.AlarmCode = "00200001";
            CurrentAlarm.NeedReset = false;
            try
            {
                AlarmMessage Detail = AlmMapping.Get("DIO", CurrentAlarm.AlarmCode);

                CurrentAlarm.SystemAlarmCode = Detail.CodeID;
                CurrentAlarm.Desc            = Detail.Code_Cause;
                CurrentAlarm.EngDesc         = Detail.Code_Cause_English;
                CurrentAlarm.Type            = Detail.Code_Type;
                CurrentAlarm.IsStop          = Detail.IsStop;
                if (CurrentAlarm.IsStop)
                {
                    //RouteCtrl.Stop();
                }
            }
            catch (Exception e)
            {
                CurrentAlarm.Desc = "未定義";
                logger.Error(DIOName + "(GetAlarmMessage)" + e.Message + "\n" + e.StackTrace);
            }
            CurrentAlarm.TimeStamp = DateTime.Now;
            AlarmManagement.Add(CurrentAlarm);
            AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll());
            AlarmUpdate.UpdateAlarmHistory(AlarmManagement.GetHistory());
        }
Example #4
0
 public static void Add(AlarmInfo Alm)
 {
     AlarmList.Add(Alm);
     AlarmHistory.Add(Alm);
     AlarmUpdate.UpdateStatusSignal(Alm.NodeName, "Red");
     AlarmUpdate.UpdateMessage(Alm.NodeName + " Alarm Happen " + Alm.AlarmCode + ":" + Alm.Desc);
     AlarmUpdate.UpdateAlarmList(AlarmList.ToList());
     AlarmUpdate.UpdateAlarmHistory(AlarmHistory.ToList());
 }
Example #5
0
 private void button3_Click_1(object sender, EventArgs e)
 {
     if (!MainProcess._Mode.Equals("Stop") && !MainProcess._Mode.Equals(""))
     {
         AlarmUpdate.UpdateMessage("目前狀態為 " + MainProcess._Mode + " 模式,請先停止動作。");
         return;
     }
     MainProcess.SetMode("Initial");
     LockUI(true);
 }
Example #6
0
 public override void OnReceive(Context context, Intent intent)
 {
     if (intent.Action == Message.Dist)
     {
         DistanceUpdate?.Invoke(this, new DistanceEventArgs(intent.GetDoubleExtra(Message.ValueKey, -1)));
     }
     if (intent.Action == Message.Dbg)
     {
         DebugUpdate?.Invoke(this, new MessageEventArgs(intent.GetStringExtra(Message.ValueKey)));
     }
     if (intent.Action == Message.Alarm)
     {
         AlarmUpdate?.Invoke(this, new MessageEventArgs(intent.GetStringExtra(Message.ValueKey)));
     }
 }
Example #7
0
        /// <summary>
        /// Update an existing alarm
        /// </summary>
        /// <param name="alarmId"></param>
        /// <param name="enabled"></param>
        /// <param name="time"></param>
        /// <param name="repetition"></param>
        /// <returns>The updated alarm</returns>
        public async Task <Alarm> UpdateAlarm(string alarmId, bool enabled, DayTime time, Repetition repetition)
        {
            string endpoint = $"{BaseUrl}alarms/alarm/{alarmId}";

            AlarmUpdate update = new AlarmUpdate
            {
                Repetition = repetition,
                Enabled    = enabled,
                Time       = time.ToString()
            };

            return(await RequestData(endpoint,
                                     _client.RequestAsyncPut(endpoint, update, _token),
                                     _responseParser.ParseAlarm));
        }
Example #8
0
        public void On_Command_Error(Node Node, Transaction Txn, CommandReturnMessage Msg)
        {
            switch (Txn.FormName)
            {
            case "FormManual":
                switch (Node.Type)
                {
                case "LOADPORT":
                    //ManualPortStatusUpdate.LockUI(false);
                    break;
                }
                break;
            }
            logger.Debug("On_Command_Error");
            AlarmInfo CurrentAlarm = new AlarmInfo();

            CurrentAlarm.NodeName  = Node.Name;
            CurrentAlarm.AlarmCode = Msg.Value;
            CurrentAlarm.NeedReset = true;
            try
            {
                AlarmMessage Detail = AlmMapping.Get(Node.Name, CurrentAlarm.AlarmCode);

                CurrentAlarm.SystemAlarmCode = Detail.CodeID;
                CurrentAlarm.Desc            = Detail.Code_Cause;
                CurrentAlarm.EngDesc         = Detail.Code_Cause_English;
                CurrentAlarm.Type            = Detail.Code_Type;
                CurrentAlarm.IsStop          = Detail.IsStop;
                if (CurrentAlarm.IsStop)
                {
                    // RouteCtrl.Stop();
                }
            }
            catch (Exception e)
            {
                CurrentAlarm.Desc = "未定義";
                logger.Error(Node.Controller + "-" + Node.AdrNo + "(GetAlarmMessage)" + e.Message + "\n" + e.StackTrace);
            }
            CurrentAlarm.TimeStamp = DateTime.Now;

            AlarmManagement.Add(CurrentAlarm);

            AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll());
            AlarmUpdate.UpdateAlarmHistory(AlarmManagement.GetHistory());
        }
Example #9
0
        public static void Remove(string NodeName)
        {
            var find = from Alm in AlarmList.ToList()
                       where Alm.NodeName.Equals(NodeName)
                       select Alm;

            if (find.Count() != 0)
            {
                foreach (AlarmInfo each in find)
                {
                    AlarmList.Remove(each);
                }
            }
            AlarmUpdate.UpdateAlarmList(GetAll());
            if (NodeManagement.Get(NodeName).InitialComplete)
            {
                AlarmUpdate.UpdateStatusSignal(NodeName, "Green");
            }
        }
Example #10
0
        public void On_TaskJob_Aborted(TaskJobManagment.CurrentProceedTask Task, string NodeName, string ReportType, string Message)
        {
            if (Task.Id.Equals("FormManual"))
            {
                ManualPortStatusUpdate.LockUI(false);
            }
            AlarmInfo CurrentAlarm = new AlarmInfo();

            CurrentAlarm.NodeName  = "SYSTEM";
            CurrentAlarm.AlarmCode = Message;
            CurrentAlarm.NeedReset = false;
            try
            {
                AlarmMessage Detail = AlmMapping.Get("SYSTEM", CurrentAlarm.AlarmCode);
                if (!Detail.Code_Group.Equals("UNDEFINITION"))
                {
                    CurrentAlarm.SystemAlarmCode = Detail.CodeID;
                    CurrentAlarm.Desc            = Detail.Code_Cause;
                    CurrentAlarm.EngDesc         = Detail.Code_Cause_English;
                    CurrentAlarm.Type            = Detail.Code_Type;
                    CurrentAlarm.IsStop          = Detail.IsStop;
                    if (CurrentAlarm.IsStop)
                    {
                        //RouteCtrl.Stop();
                    }
                    CurrentAlarm.TimeStamp = DateTime.Now;

                    AlarmManagement.Add(CurrentAlarm);

                    AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll());
                    AlarmUpdate.UpdateAlarmHistory(AlarmManagement.GetHistory());
                }
            }
            catch (Exception e)
            {
                CurrentAlarm.Desc = "未定義";
                logger.Error("(GetAlarmMessage)" + e.Message + "\n" + e.StackTrace);
            }
        }
Example #11
0
 private void AlarmFrom_Load(object sender, EventArgs e)
 {
     AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll());
 }
Example #12
0
        public void On_Command_Excuted(Node Node, Transaction Txn, CommandReturnMessage Msg)
        {
            logger.Debug("On_Command_Excuted");
            string Message = "";

            Transaction SendTxn = new Transaction();

            if (Txn.Method == Transaction.Command.LoadPortType.Reset)
            {
                AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll());
            }



            switch (Node.Type)
            {
            case "LOADPORT":
                switch (Txn.Method)
                {
                case Transaction.Command.LoadPortType.GetMapping:
                case Transaction.Command.LoadPortType.Unload:
                case Transaction.Command.LoadPortType.MappingUnload:
                case Transaction.Command.LoadPortType.DoorUp:
                case Transaction.Command.LoadPortType.InitialPos:
                case Transaction.Command.LoadPortType.ForceInitialPos:
                    WaferAssignUpdate.RefreshMapping(Node.Name);
                    MonitoringUpdate.UpdateNodesJob(Node.Name);
                    RunningUpdate.UpdateNodesJob(Node.Name);
                    break;

                case Transaction.Command.LoadPortType.GetCassetteSize:
                    ManualPortStatusUpdate.UpdateParameter("CASSETTE_SIZE_tb", Msg.Value);
                    break;

                case Transaction.Command.LoadPortType.GetSlotOffset:
                    ManualPortStatusUpdate.UpdateParameter("SLOT_OFFSET_tb", Msg.Value);
                    break;

                case Transaction.Command.LoadPortType.GetWaferOffset:
                    ManualPortStatusUpdate.UpdateParameter("WAFER_OFFSET_tb", Msg.Value);
                    break;

                case Transaction.Command.LoadPortType.GetTweekDistance:
                    ManualPortStatusUpdate.UpdateParameter("TWEEK_tb", Msg.Value);
                    break;

                case Transaction.Command.LoadPortType.GetSlotPitch:
                    ManualPortStatusUpdate.UpdateParameter("SLOT_PITCH_tb", Msg.Value);
                    break;
                }
                break;

            case "ROBOT":
                switch (Txn.Method)
                {
                case Transaction.Command.RobotType.GetMapping:
                    WaferAssignUpdate.RefreshMapping(Node.CurrentPosition);
                    MonitoringUpdate.UpdateNodesJob(Node.CurrentPosition);
                    RunningUpdate.UpdateNodesJob(Node.CurrentPosition);
                    break;
                }
                break;
            }

            switch (Txn.FormName)
            {
            case "FormStatus":
                Util.StateUtil.UpdateSTS(Node.Name, Msg.Value);
                break;

            case "PauseProcedure":

                break;

            case "FormManual":
                switch (Node.Type)
                {
                case "SMARTTAG":
                    if (!Txn.Method.Equals(Transaction.Command.SmartTagType.GetLCDData))
                    {
                        //ManualPortStatusUpdate.LockUI(false);
                    }
                    break;

                case "LOADPORT":
                    if (!Txn.CommandType.Equals("MOV") && !Txn.CommandType.Equals("HCS"))
                    {
                        //ManualPortStatusUpdate.LockUI(false);
                    }
                    else
                    {
                        if (Txn.Method.Equals(Transaction.Command.LoadPortType.Reset))
                        {
                            // ManualPortStatusUpdate.LockUI(false);
                        }
                    }
                    ManualPortStatusUpdate.UpdateLog(Node.Name, Msg.Command + " Excuted");
                    switch (Txn.Method)
                    {
                    case Transaction.Command.LoadPortType.ReadVersion:
                        ManualPortStatusUpdate.UpdateVersion(Node.Name, Msg.Value);
                        break;

                    case Transaction.Command.LoadPortType.GetLED:
                        ManualPortStatusUpdate.UpdateLED(Node.Name, Msg.Value);
                        break;

                    case Transaction.Command.LoadPortType.ReadStatus:
                        ManualPortStatusUpdate.UpdateSmifStatus(Node.Name, Msg.Value);
                        break;

                    case Transaction.Command.LoadPortType.GetCount:

                        break;

                    case Transaction.Command.LoadPortType.GetMapping:
                        ManualPortStatusUpdate.UpdateMapping(Node.Name, Msg.Value);
                        break;
                    }
                    break;

                case "OCR":
                    switch (Txn.Method)
                    {
                    case Transaction.Command.OCRType.GetOnline:
                        //OCRUpdate.UpdateOCRStatus(Node.Name, Msg.Value);
                        break;
                    }
                    break;

                case "ROBOT":
                    switch (Txn.Method)
                    {
                    case Transaction.Command.RobotType.Speed:
                    case Transaction.Command.RobotType.Mode:
                    case Transaction.Command.RobotType.Reset:
                    case Transaction.Command.RobotType.Servo:

                        ManualRobotStatusUpdate.UpdateGUI(Txn, Node.Name, Msg.Value);            //update 手動功能畫面
                        break;

                    case Transaction.Command.RobotType.GetSpeed:
                    case Transaction.Command.RobotType.GetRIO:
                    case Transaction.Command.RobotType.GetError:
                    case Transaction.Command.RobotType.GetMode:
                    case Transaction.Command.RobotType.GetStatus:
                    case Transaction.Command.RobotType.GetSV:
                        ManualRobotStatusUpdate.UpdateGUI(Txn, Node.Name, Msg.Value);            //update 手動功能畫面
                        break;

                    case Transaction.Command.RobotType.GetCombineStatus:
                        ManualRobotStatusUpdate.UpdateGUI(Txn, Node.Name, Msg.Command);            //update 手動功能畫面
                        break;
                    }
                    break;

                case "ALIGNER":
                    switch (Txn.Method)
                    {
                    case Transaction.Command.AlignerType.Speed:
                    case Transaction.Command.AlignerType.Mode:
                    case Transaction.Command.AlignerType.Reset:
                    case Transaction.Command.AlignerType.Servo:
                    //Thread.Sleep(500);
                    ////向Aligner 詢問狀態
                    //Node aligner = NodeManagement.Get(Node.Name);
                    //String script_name = aligner.Brand.ToUpper().Equals("SANWA") ? "AlignerStateGet" : "AlignerStateGet(Kawasaki)";
                    ////aligner.ExcuteScript(script_name, "FormManual", out Message);
                    //ManualAlignerStatusUpdate.UpdateGUI(Txn, Node.Name, Msg.Value);//update
                    //break;
                    case Transaction.Command.AlignerType.GetMode:
                    case Transaction.Command.AlignerType.GetSV:
                    case Transaction.Command.AlignerType.GetStatus:
                    case Transaction.Command.AlignerType.GetSpeed:
                    case Transaction.Command.AlignerType.GetRIO:
                    case Transaction.Command.AlignerType.GetError:
                        ManualAlignerStatusUpdate.UpdateGUI(Txn, Node.Name, Msg.Value);            //update 手動功能畫面
                        break;

                    case Transaction.Command.RobotType.GetCombineStatus:
                        ManualAlignerStatusUpdate.UpdateGUI(Txn, Node.Name, Msg.Command);            //update 手動功能畫面
                        break;
                    }
                    break;
                }
                break;

            default:

                break;
            }
        }
Example #13
0
 private void FormAlarmHis_Load(object sender, EventArgs e)
 {
     From.Value = DateTime.Now.AddDays(-1);
     To.Value   = DateTime.Now;
     AlarmUpdate.UpdateAlarmHistory(AlarmManagement.GetHistory(From.Value, To.Value));
 }
Example #14
0
        private void button4_Click(object sender, EventArgs e)
        {
            LockUI(true);
            if (!MainProcess._Mode.Equals("Stop") && !MainProcess._Mode.Equals(""))
            {
                AlarmUpdate.UpdateMessage("目前狀態為 " + MainProcess._Mode + " 模式,請先停止動作。");
                return;
            }

            NodeManagement.InitialNodes();
            JobManagement.Initial();

            if (PortSetting1Active_ck.Checked)
            {
                if (!PortSetting1Aligner_cb.Text.Equals(""))
                {
                    Node Aligner1 = NodeManagement.Get(PortSetting1Aligner_cb.Text);
                    if (Aligner1 != null)
                    {
                        Aligner1.LockByNode = PortSetting1Name_cb.Text;
                    }
                }
                Node P1 = NodeManagement.Get(PortSetting1Name_cb.Text);

                int SlotMode = 0;
                if (PortSetting1SlotMode_ck.Checked)
                {
                    SlotMode = 1;
                }
                else
                {
                    SlotMode = 2;
                }
                for (int i = Convert.ToInt16(PortSetting1StartSlot_tb.Text); i <= Convert.ToInt16(PortSetting1EndSlot_tb.Text); i = i + SlotMode)
                {
                    Job w = new Job();
                    w.Job_Id = "Wafer" + i.ToString("000");

                    w.AlignerFlag     = true;
                    w.OCRFlag         = false;
                    w.Position        = P1.Name;
                    w.ProcessFlag     = false;
                    w.FromPort        = P1.Name;
                    w.Slot            = i.ToString();
                    w.Destination     = PortSetting1Dest_cb.Text;
                    w.DestinationSlot = i.ToString();;
                    JobManagement.Add(w.Job_Id, w);
                    P1.JobList.TryAdd(w.Slot, w);
                }
            }

            if (PortSetting2Active_ck.Checked)
            {
                if (!PortSetting2Aligner_cb.Text.Equals(""))
                {
                    Node Aligner2 = NodeManagement.Get(PortSetting2Aligner_cb.Text);
                    if (Aligner2 != null)
                    {
                        Aligner2.LockByNode = PortSetting2Name_cb.Text;
                    }
                }
                Node P2 = NodeManagement.Get(PortSetting2Name_cb.Text);

                int SlotMode = 0;
                if (PortSetting2SlotMode_ck.Checked)
                {
                    SlotMode = 1;
                }
                else
                {
                    SlotMode = 2;
                }
                if (Convert.ToInt16(PortSetting2StartSlot_tb.Text) != 0 && Convert.ToInt16(PortSetting2EndSlot_tb.Text) != 0)
                {
                    for (int i = Convert.ToInt16(PortSetting2StartSlot_tb.Text); i <= Convert.ToInt16(PortSetting2EndSlot_tb.Text); i = i + SlotMode)
                    {
                        Job w = new Job();
                        w.Job_Id = "Wafer" + (i + 25).ToString("000");

                        w.AlignerFlag     = true;
                        w.OCRFlag         = false;
                        w.Position        = P2.Name;
                        w.ProcessFlag     = false;
                        w.FromPort        = P2.Name;
                        w.Slot            = i.ToString();
                        w.Destination     = PortSetting2Dest_cb.Text;
                        w.DestinationSlot = i.ToString();;
                        JobManagement.Add(w.Job_Id, w);
                        P2.JobList.TryAdd(w.Slot, w);
                    }
                }
            }
            NodeManagement.UpdatePortToUI();
            if (AutoIni_ck.Checked)
            {
                MainProcess.SetMode("AutoInitial");//initial
            }
            else
            {
                MainProcess.SetMode("Auto");
            }
        }