コード例 #1
0
        public static TempMaster CreateItem()
        {
            TempMaster result = new TempMaster()
            {
                CarNo = $"辽A{new Random().Next(10000, 99999)}",
                UDP   = DateTime.Now
            };

            return(result);
        }
コード例 #2
0
        void UpdateRTD(TempMaster item)
        {
            item.Detect1 = true;
            var props      = typeof(TempMaster).GetProperties();
            var detectList = props.Where(x => x.Name.Contains("Detect")).ToList();

            foreach (var det in detectList)
            {
                var temp = det.GetValue(item);
                if (temp == null)
                {
                    det.SetValue(item, true);
                    break;
                }
            }
        }
コード例 #3
0
 public MasterControlViewModel()
 {
     Data.Add(TempMaster.CreateItem());
     Stations.Add(new StationModel()
     {
         StationNo = "一工位", DetectName = "尾气检测"
     });
     Stations.Add(new StationModel()
     {
         StationNo = "二工位", DetectName = "测重检测"
     });
     Stations.Add(new StationModel()
     {
         StationNo = "三工位", DetectName = "外廓检测"
     });
     Stations.Add(new StationModel()
     {
         StationNo = "四工位", DetectName = "灯光检测"
     });
     StartUpdate();
 }
コード例 #4
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            Data.BeginUpdate();
            foreach (var item in Data)
            {
                if (item.Detect6 == null)
                {
                    UpdateRTD(item);
                }
            }
            if (Data.First().Detect6 != null)
            {
                Data.Insert(0, (TempMaster.CreateItem()));
            }
            Data.EndUpdate();

            Stations.BeginUpdate();
            if (CarIndex == 0)
            {
                Stations.First().CarNo = Data.First().CarNo;
            }
            else if (CarIndex == 4)
            {
                Stations[3].CarNo = string.Empty;
                CarIndex          = 0;
                Stations.First().CarNo = Data.First().CarNo;
            }

            if (CarIndex != 0)
            {
                Stations[CarIndex].CarNo     = Stations[CarIndex - 1].CarNo;
                Stations[CarIndex - 1].CarNo = string.Empty;
            }
            //if (CarIndex == 3)
            //    CarIndex = 0;
            //else
            CarIndex++;

            Stations.EndUpdate();
        }