public void OnLoaded() { //绑定实时参数 var onlineCpmsDict = App.Store.GetState().CpmState.OnlineCpmsDict; CpmsTab.BindSource(MachineCode, onlineCpmsDict[MachineCode]); //绑定报警 var alarmsDict = App.Store.GetState().AlarmState.AlarmsDict; AlarmTab.BindSource(MachineCode, alarmsDict[MachineCode]); //绑定任务 var mqTaskDict = App.Store.GetState().DMesState.MqSchTasksDict; SchTaskTab.BindSource(MachineCode, mqTaskDict[MachineCode]); //初始化人员卡 var mqEmpRfids = App.Store.GetState().DMesState.MqEmpRfidDict; SchTaskTab.InitEmployees(mqEmpRfids[MachineCode]); //初始化来料 var scanMaterialDict = App.Store.GetState().DMesState.MqScanMaterialDict; if (scanMaterialDict.TryGetValue(MachineCode, out var material)) { ScanMaterialTab.Update(material); } //绑定485通讯状态 var com485Dict = App.Store.GetState().CpmState.Com485StatusDict; var status = com485Dict.Where(c => MachineConfig.MachineCodeToIpsDict[MachineCode].Contains(c.Key)) .Select(c => c.Value).ToList(); Com485Tab.BindSource(MachineCode, status); //回填参数 //var dpms = App.Store.GetState().DpmStore.DpmsDict; //DpmsTab.BindSource(dpms[MachineCode]); //绑定制程质检 unsubscribe += ProcessCheckTab.BindSource(MachineCode); ////绑定曲线参数界面 CpmDetailTab.BindSource(MachineCode, onlineCpmsDict[MachineCode]); //绑定选中的tab ViewStore = App.Store.GetState().ViewStoreState.DMewCoreViewDict[MachineCode]; unsubscribe += App.Store.Subscribe(actionExecDict, false); App.Store.Dispatch(new SysActions.CloseLoadingSplash()); }
/// <summary> /// 有工单被顶掉,更新选中的任务 /// </summary> /// <param name="state"></param> /// <param name="action"></param> void whenSchTaskReplaced(AppState state, IAction action) { var mqAction = (MqActions.SchTaskReplaced)action; //设置默认选中的工单任务 if (mqAction.MachineCode == MachineCode) { DispatcherService.BeginInvoke(() => { SchTaskTab.SetDefaultSelected(); }); } }
/// <summary> /// 接收到Rfid数据 /// </summary> /// <param name="state"></param> /// <param name="action"></param> void whenRfidAccept(AppState state, IAction action) { var dmesAction = (DMesActions.RfidAccpet)action; if (dmesAction.MachineCode != MachineCode) { return; } //上机卡 if (dmesAction.RfidType == DMesActions.RfidType.EmpStartMachine) { var mqRfid = (MqEmpRfid)dmesAction.MqData; SchTaskTab.AddEmployee(mqRfid.name); } //下机卡 if (dmesAction.RfidType == DMesActions.RfidType.EmpEndMachine) { var mqRfid = (MqEmpRfid)dmesAction.MqData; SchTaskTab.RemoveEmployee(mqRfid.name); } }
/// <summary> /// 清空任务 /// </summary> /// <param name="state"></param> /// <param name="action"></param> void clearSchTask(AppState state, IAction action) { SchTaskTab.Clear(); }