Ejemplo n.º 1
0
        public ActionResult EditSample(RollerSampleInfo rollersampleinfo)
        {
            if (ModelState.IsValid)
            {
                rollersampleinfo.State = "准备";
                TestSampleInfo.GetInstance().AddTestSample(rollersampleinfo);
                repository.SaveRollerSampleInfo(rollersampleinfo);
                //同步中间数据库
                Entities context = new Entities();
                context.PROCEDURE_ROLLERSAMPLEINFO(0);
                context.SaveChanges();

                RollerSampleInfo rsi = repository.RollerSampleInfos.Include(x => x.RollerBaseStation).Include(x => x.RollerBaseStation.TimerCfg).Include(x => x.RollerBaseStation.ForcerCfg).FirstOrDefault(x => x.RollerSampleInfoID == rollersampleinfo.RollerSampleInfoID);
                TestSampleInfo.GetInstance().EditSampleList(rsi);
                return(RedirectToAction("ViewInfo", new { RollerProjectInfoID = rollersampleinfo.RollerProjectInfoID }));
            }
            else
            {
                SettingViewModel settingviewModel = new SettingViewModel(baserepository, wtequipmentrepo, wtsampleinfo);
                int TestID = projectrepo.RollerProjectInfos.FirstOrDefault(x => x.RollerProjectInfoID == rollersampleinfo.RollerProjectInfoID).TestID;
                ViewData["Device"]       = settingviewModel.GetLISDeviceList();
                ViewData["StationList"]  = settingviewModel.GetStationList();
                ViewData["SampleIDList"] = settingviewModel.GetSampleIDList(TestID);
                ViewData["TestTypeList"] = settingviewModel.GetTestTypeList();
                return(View(rollersampleinfo));
            }
        }
Ejemplo n.º 2
0
        public ActionResult DeleteSample(RollerSampleInfo rsi)
        {
            Entities context = new Entities();

            context.PROCEDURE_ROLLERSAMPLEINFO(rsi.RollerSampleInfoID);
            context.SaveChanges();
            //Delete post提交上来的对象其实只含有ID值,其他均为空,注意!!!
            int RollerProjectInfoID = repository.RollerSampleInfos.FirstOrDefault(x => x.RollerSampleInfoID == rsi.RollerSampleInfoID).RollerProjectInfoID;

            rollertimer.CloseRollerTimeSwitch(repository.RollerSampleInfos.FirstOrDefault(x => x.RollerSampleInfoID == rsi.RollerSampleInfoID).RollerBaseStation.TimerCfg.TimerName);
            repository.DeleteRollerSampleInfo(rsi.RollerSampleInfoID);
            TestSampleInfo.GetInstance().RemoveSampleList(rsi.RollerSampleInfoID);
            return(RedirectToAction("ViewInfo", new { RollerProjectInfoID = RollerProjectInfoID }));
        }
Ejemplo n.º 3
0
 private void RelativeMethod()
 {
     lock (TestSampleInfo.GetInstance().rollersampleinfos)
     {
         if (TestSampleInfo.GetInstance().rollersampleinfos.Count() != 0)
         {
             foreach (var p in TestSampleInfo.GetInstance().rollersampleinfos)
             {
                 if (p.TestType == "定时截尾试验" && rollerforcer.getJudgeSwitch(p.RollerBaseStation.ForcerCfg.ForcerName))
                 {
                     TimeSpan a = TimeSpan.FromHours(p.TestTime);
                     TimeSpan b = TimeSpan.Parse(rollerTime.getRollerTime(p.RollerBaseStation.TimerCfg.TimerName));
                     if (a <= b)
                     {
                         samplerepo.setsampleState(p.RollerSampleInfoID, "待结束");
                         rollerTime.CloseRollerTimeSwitch(p.RollerBaseStation.TimerCfg.TimerName);
                         rollerforcer.CloseRollerForcerSwitch(p.RollerBaseStation.ForcerCfg.ForcerName);
                         rollerforcer.setJudgeSwitch(p.RollerBaseStation.ForcerCfg.ForcerName, false);
                     }
                 }
             }
         }
     }
 }