public void RefreshData()
        {
            code = FactoryCheckDialog.EndProductNo;
            DataProductionResponse DataProductionResponse = LocalApi.ExecuteVulnerable(new DataProductionRequest()
            {
                Keyword    = this.Keyword,
                ProcessDID = this.ProcessDID,
                PageNumber = this.pager.PageNumber,
                TimeStart  = this.TimeStart,
                TimeEnd    = this.TimeEnd,
                PageSize   = 10,
                code       = this.code
            });

            this.pager.Setup(DataProductionResponse.DataVulnerables);
            this.dataGrid.ItemsSource = DataProductionResponse.DataVulnerables;
        }
        public void RefreshData()
        {
            DataProductionResponse DataProductionResponse = LocalApi.ExecuteDataReal(new DataProductionRequest()
            {
                Keyword    = this.Keyword,
                ProcessDID = this.ProcessDID,
                PageNumber = this.pager.PageNumber,
                //PageNumber = pageNumber.Value,
                TimeStart = this.TimeStart,
                TimeEnd   = this.TimeEnd,
                PageSize  = 10,
                code      = this.code
            });

            this.pager.Setup(DataProductionResponse.DataProductions);
            this.dataGrid.ItemsSource = DataProductionResponse.DataProductions;
        }
        public void RefreshStates()
        {
            foreach (ProcessModel process in (LocalApi.Execute(new ProcessListRequest()
            {
                CraftDID = this.CraftDID
            })).Processes)
            {
                string shortNo = CommonHelper.GetProcessShortNO(process.ProcessNO);
                StateCycle.StateCycleItem stateCycleItem = this.stateCycleItems.FirstOrDefault <StateCycle.StateCycleItem>(m => m.Name == shortNo);
                if (stateCycleItem != null)
                {
                    //设备状态
                    stateCycleItem.State = process.State;
                    stateCycleItem.Tag   = process.ProcessDID;
                }
            }
            this.stateCycle.Setup(this.stateCycleItems);

            PLCStateListResponse stateListResponse = LocalApi.Execute(new PLCStateListRequest()
            {
                CraftDID = this.CraftDID
            });

            if (stateListResponse.PLCStates == null)
            {
                return;
            }
            this.plcList.BindData(stateListResponse.PLCStates);

            AlarmCheckResponse alarmCheckResponse = LocalApi.AlarmExecute(new AlarmCheckRequest()
            {
            });
            DataProductionResponse DataProductionResponse = LocalApi.VulnerableExecute(new DataProductionRequest()
            {
            });

            Vulnerable_U = DataProductionResponse.CheckVulnerables.Select(m => m.Used).ToArray();
            Vulnerable_E = DataProductionResponse.CheckVulnerables.Select(m => m.Expect).ToArray();
            AlarmCheck   = alarmCheckResponse.AlarmCheck.Select(m => m.AlarmCheck).ToArray();
            FacilityDid  = alarmCheckResponse.AlarmCheck.Select(m => m.FacilityDid).ToArray();
            AlarmDid     = alarmCheckResponse.AlarmCheck.Select(m => m.AlarmDid).ToArray();
            for (int i = 0; i < Vulnerable_E.Length; i++)
            {
                if (Vulnerable_U[i] == Vulnerable_E[i])
                {
                    VulnerableFlag = i + 1;
                    Box(VulnerableFlag);
                }
            }
            if (AlarmFlag == 0)
            {
                if (FacilityDid[0] == "701")
                {
                    if (AlarmCheck[0] == "0x0D0D01")
                    {
                        MessageBox.Show("电芯检测批量不合格", "警告");
                        AlarmFlag = 1;
                        if (AlarmDid.Length != 0)
                        {
                            LastDid = AlarmDid[0];
                        }
                        else
                        {
                            LastDid = 0;
                        }
                    }
                }
            }
            if (AlarmDid.Length != 0)
            {
                if (AlarmDid[0] != LastDid)
                {
                    AlarmFlag = 0;
                }
            }
        }
        public void RefreshStates()
        {
            foreach (ProcessModel process in (LocalApi.Execute(new ProcessListRequest()
            {
                CraftDID = this.CraftDID
            })).Processes)
            {
                string shortNo = CommonHelper.GetProcessShortNO(process.ProcessNO);
                StateCycle.StateCycleItem stateCycleItem = this.stateCycleItems.FirstOrDefault <StateCycle.StateCycleItem>(m => m.Name == shortNo);
                if (stateCycleItem != null)
                {
                    //设备状态
                    stateCycleItem.State = process.State;
                    stateCycleItem.Tag   = process.ProcessDID;
                }
            }
            this.stateCycle.Setup(this.stateCycleItems);
            ThreadPool.QueueUserWorkItem(o =>
            {
                code = FactoryCheckDialog.EndProductNo;
                CraftProbablyGetResponse probablyGetResponse = LocalApi.Execute(new CraftProbablyGetRequest()
                {
                    CraftDID = this.CraftDID, code = this.code
                });
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new Action(() =>
                {
                    if (probablyGetResponse.CraftProbably != null)
                    {
                        this.craftProbably.BindData(probablyGetResponse.CraftProbably);
                    }
                }));
            });

            PLCStateListResponse stateListResponse = LocalApi.Execute(new PLCStateListRequest()
            {
                CraftDID = this.CraftDID
            });

            if (stateListResponse.PLCStates == null)
            {
                return;
            }
            this.plcList.BindData(stateListResponse.PLCStates);

            AlarmCheckResponse alarmCheckResponse = LocalApi.AlarmExecute(new AlarmCheckRequest()
            {
            });
            DataProductionResponse DataProductionResponse = LocalApi.VulnerableExecute(new DataProductionRequest()
            {
            });

            Vulnerable_U = DataProductionResponse.CheckVulnerables.Select(m => m.Used).ToArray();
            Vulnerable_E = DataProductionResponse.CheckVulnerables.Select(m => m.Expect).ToArray();
            AlarmCheck   = alarmCheckResponse.AlarmCheck.Select(m => m.AlarmCheck).ToArray();
            FacilityDid  = alarmCheckResponse.AlarmCheck.Select(m => m.FacilityDid).ToArray();
            AlarmDid     = alarmCheckResponse.AlarmCheck.Select(m => m.AlarmDid).ToArray();
            for (int i = 0; i < Vulnerable_E.Length; i++)
            {
                if (Vulnerable_U[i] == Vulnerable_E[i])
                {
                    VulnerableFlag = i + 1;
                    Box(VulnerableFlag);
                }
            }
            if (AlarmFlag == 0)
            {
                if (FacilityDid[0] == "701")
                {
                    if (AlarmCheck[0] == "0x0D0D01")
                    {
                        MessageBox.Show("电芯检测批量不合格", "警告");
                        AlarmFlag = 1;
                        if (AlarmDid.Length != 0)
                        {
                            LastDid = AlarmDid[0];
                        }
                        else
                        {
                            LastDid = 0;
                        }
                    }
                }
            }
            if (AlarmDid.Length != 0)
            {
                if (AlarmDid[0] != LastDid)
                {
                    AlarmFlag = 0;
                }
            }
        }