public void SendAgvMisson(AgvMissonModel obj) { SendAgvMissonEvent?.Invoke(obj); //if (obj != null) //{ // SendSignalrEvent?.Invoke(AgvSendActionEnum.SendInMissionFinMessage.EnumToString(), obj as AgvInMissonModel); // SendSignalrEvent?.Invoke(AgvSendActionEnum.SendOutMissionFinMessage.EnumToString(), obj as AgvOutMissonModel); //} }
public AgvMissionManagerClient(IControlDevice _carryDevice) { missionContext = new MissionContext(_carryDevice); missionContext.SendAgvMissionServiceStateMessageEvent += (obj) => ShowLogEvent?.Invoke(obj); missionContext.SendSignalrEvent += (action, obj) => SendSignalrEvent?.Invoke(action, obj); missionContext.SendAgvMissonEvent += (s) => SendAgvMissonEvent?.Invoke(s); InitMissionState(); }
public void PushInMission(AgvInMissonModel mission) { var count = missionContext.MissionInNodes.Where(x => x.Id == mission.Id && (x.Process != AgvMissonProcessEnum.CLOSE || x.CarryProcess != CarryMissonProcessEnum.CLOSE)).Count(); if (count == 0) { mission.AgvProcessChangeEvent += (s, e) => AgvMissonChangeEvent?.Invoke(s, e); AgvMissonChangeEvent?.Invoke(mission, true); missionContext.MissionInNodes.Add(mission); SendAgvMissonEvent?.Invoke(mission); } }
public void AgvStateChange(string s) { try { var data = s.Split('_'); var obj = missionContext.MissionOutNodes.LastOrDefault(d => d.Id == $"{data[0]}_{data[1]}"); if (obj != null) { obj.Process = (AgvMissonProcessEnum)Enum.Parse(typeof(AgvMissonProcessEnum), data[2]); SendAgvMissonEvent?.Invoke(obj); } var objIn = missionContext.MissionInNodes.LastOrDefault(d => d.Id == $"{data[0]}_{data[1]}"); if (objIn != null) { objIn.Process = (AgvMissonProcessEnum)Enum.Parse(typeof(AgvMissonProcessEnum), data[2]); SendAgvMissonEvent?.Invoke(obj); } } catch (Exception ex) { ShowLogEvent?.Invoke("AgvStateChange Error:" + ex.Message); } }