Пример #1
0
        public static void AddHolerec(Holerec holeRecod)
        {
            var _holeRecord = new Holerec()
            {
                Data        = holeRecod.Data,
                TestTime    = holeRecod.TestTime,
                MaxPressure = holeRecod.MaxPressure,
                MacId       = holeRecod.MacId,
                SerialNo    = holeRecod.SerialNo,
                HoleNumber  = holeRecod.HoleNumber,
                LayerNo     = holeRecod.LayerNo
            };

            using var db = new DrillContext();
            var temp = db.Holerec.Where(h => h.SerialNo == holeRecod.SerialNo && h.HoleNumber == holeRecod.HoleNumber).FirstOrDefault();

            if (temp != null)
            {
                temp.Data        = holeRecod.Data;
                temp.TestTime    = holeRecod.TestTime;
                temp.MaxPressure = holeRecod.MaxPressure;
                temp.MacId       = holeRecod.MacId;
                db.Holerec.Update(temp);
            }
            else
            {
                db.Holerec.Add(_holeRecord);
            }
            db.SaveChanges();
        }
Пример #2
0
 public TestViewModel(IEventAggregator eventAggregator, IWindowManager windowManager)
 {
     //初始化
     _windowManager      = windowManager;
     _eventAggregator    = eventAggregator;
     _connectStatusEvent = new ConnectStatusEvent("离线!", "离线!");
     Workrec1            = new Workrec();
     Workrec2            = new Workrec();
     Holerec1            = new Holerec();
     Holerec2            = new Holerec();
     Point1       = new Models.Point();
     Point2       = new Models.Point();
     ActualPoint1 = new ActualPoint();
     ActualPoint2 = new ActualPoint();
     StartTime    = DateTime.Now.AddDays(-5);
     CanRedo2     = CanStop1 = CanRedo1 = CanStop2 = Working1 = Working2 = SubWorking1 = SubWorking2 = false;
     CanStart1    = CanStart2 = true;
     ReadValue.ConnnectPlc1();
     InitalChart();
     // 默认情况下开始画面曲线数据刷新
     IsReading = IsWorking1 = true;
     Read1();
     FreshCurve();
 }