예제 #1
0
        public ActionResult Edit(DeviceLine line)
        {
            var  json      = new JsonResult();
            User loginUser = null;

            try
            {
                using (var ctx = new GlsunViewEntities())
                {
                    loginUser = (from u in ctx.User
                                 where u.ULoginName == HttpContext.User.Identity.Name
                                 select u).FirstOrDefault();
                    var route      = ctx.Route.Find(line.RID);
                    var modifyLine = ctx.DeviceLine.Find(line.ID);
                    modifyLine.DLName      = route.RName;
                    modifyLine.RID         = line.RID;
                    modifyLine.EditorID    = loginUser.ID;
                    modifyLine.EditingTime = DateTime.Now;
                    ctx.SaveChanges();
                }
                json.Data = new { Code = "", Data = "", Message = "保存成功" };
            }
            catch (Exception ex)
            {
                json.Data = new { Code = "Exception", Data = "", Message = ex.Message };
            }
            return(json);
        }
예제 #2
0
        public string Delete(int id)
        {
            object     result    = null;
            User       loginUser = null;
            string     details   = "";
            DeviceLine line      = null;

            try
            {
                using (var ctx = new GlsunViewEntities())
                {
                    loginUser = (from u in ctx.User
                                 where u.ULoginName == HttpContext.User.Identity.Name
                                 select u).FirstOrDefault();
                    var deviceLineDel = ctx.DeviceLine.Find(id);
                    line = deviceLineDel.CopyProperty();
                    ctx.DeviceLine.Remove(deviceLineDel);
                    ctx.SaveChanges();
                    var dA = ctx.Device.Find(line.DIDA);
                    var dB = ctx.Device.Find(line.DIDB);
                    details = string.Format("{0}-{1}", dA.DName, dB.DName);
                }
                result = new { Code = "", Data = id, Message = "删除成功" };
                //日志记录
                _topoLogger.Record(loginUser, "删除设备连线", details, "成功", "", line.ID, line.DLName, "设备连线");
            }
            catch (Exception ex)
            {
                result = new { Code = "Exception", Data = id, Message = ex.Message };
                //日志记录
                _topoLogger.Record(loginUser, "删除设备连线", details, "失败", string.Format("发生异常:{0}", ex.Message), line.ID, line.DLName, "设备连线");
            }

            return(new JavaScriptSerializer().Serialize(result));
        }
예제 #3
0
    // Use this for initialization
    void Awake()
    {
        //1
        xq_1 = new DeviceBelong("qt3381", 1, 1);
        xq_1.SensorSignal = 10;


        //3
        men_z        = new DeviceLine("VIFS9511", 1, new Vector3(1, 0, 0), -menSpeed, 1.606276f, 0.8332105f);
        men_y        = new DeviceLine("VIFS84711", 1, new Vector3(1, 0, 0), menSpeed, 0.09332418f, -0.2446632f);
        men_z1       = new DeviceLine("VIFS9511", 31, new Vector3(1, 0, 0), menSpeed, 1.606276f, 0.8332105f);
        men_y1       = new DeviceLine("VIFS84711", 31, new Vector3(1, 0, 0), -menSpeed, 0.09332418f, -0.2446632f);
        men_sensor_z = new DistanceSeneor(1, "VIFS9511", new Vector3(1.606276f, 0.24947f, -0.25305f));

        ka1              = new DeviceLine("zhua1", 3, new Vector3(0, 0, 1), -zhualineSpeed, -0.3012792f, -0.338398f);
        ka2              = new DeviceLine("zhua2", 3, new Vector3(0, 0, 1), zhualineSpeed, -0.4463772f, -0.4885937f);
        ka3              = new DeviceLine("zhua3", 3, new Vector3(0, 0, 1), -zhualineSpeed, -0.380332f, -0.3843685f);
        ka1_             = new DeviceLine("zhua1", 3, new Vector3(0, 0, 1), zhualineSpeed, -0.3012792f, -0.338398f, true);
        ka2_             = new DeviceLine("zhua2", 3, new Vector3(0, 0, 1), -zhualineSpeed, -0.4463772f, -0.4885937f, true);
        ka3_             = new DeviceLine("zhua3", 3, new Vector3(0, 0, 1), zhualineSpeed, -0.380332f, -0.3843685f, true);
        ka1.SensorSignal = 1; ka2.SensorSignal = 1; ka3.SensorSignal = 1;

        gj_1 = new DeviceBelong("scx0271", 2, 3);
        gj_1.detect_h_range = 0.001f;
        gj_1.detect_r_range = 0.001f;
        gj_1.SensorSignal   = 2;
        gj_1.orignalScale   = new Vector3(0.09999572f, 0.09999572f, 0.09999572f); gj_1.newScale = new Vector3(1.247476f, 1.247476f, 1.247476f);

        zhua_z              = new DeviceRotate("RB50301", 2, new Vector3(1, 0, 0), zhuaSpeed, 20, 1);
        zhua_z1             = new DeviceRotate("RB50301", 2, new Vector3(1, 0, 0), -zhuaSpeed, 19, 0.5f, true);
        zhua_y              = new DeviceRotate("RB50291", 2, new Vector3(1, 0, 0), zhuaSpeed, -1, -20);
        zhua_y1             = new DeviceRotate("RB50291", 2, new Vector3(1, 0, 0), -zhuaSpeed, -0.5f, -19, true);
        zhua_z.y            = -0.381012f; zhua_z1.y = -0.381012f; zhua_z.z = -179.9078f; zhua_z1.z = -179.9078f;
        zhua_y.y            = -0.3598938f; zhua_y1.y = -0.3598938f; zhua_y.z = 2.005913f; zhua_y1.z = 2.005913f;
        zhua_z.SensorSignal = 2; zhua_y.SensorSignal = 2;

        //6
        big_63_2_1 = new DeviceLine("big_63_2_1", 1, new Vector3(0, 0, 1), mdSpeed, -1.5f, -2.9f);
        big_63_2_2 = new DeviceLine("big_63_2_2", 1, new Vector3(0, 0, 1), -mdSpeed, 2.7f, 1.3f);

        big_63_2_1_false        = new DeviceLine("big_63_2_1", 1, new Vector3(0, 0, 1), -mdSpeed, -1.5f, -2.9f, true);
        big_63_2_2_false        = new DeviceLine("big_63_2_2", 1, new Vector3(0, 0, 1), mdSpeed, 2.7f, 1.3f, true);
        big_63_2_1.SensorSignal = 1;
        big_63_2_2.SensorSignal = 1;

        big_box = new DeviceBelong("passbox11", 1, 6);
        big_box.range_detect.range_h = 0.1f;
        big_box.range_detect.range_r = 0.1f;
        big_box.SensorSignal         = 1;
        big_box.orignalScale         = new Vector3(1, 1, 1); big_box.newScale = new Vector3(10, 10, 10);
    }
예제 #4
0
        public ActionResult AddReadings(int OxygenSaturation_input, int Pulse_input, int PatientID)
        {
            int        userid = int.Parse(Session["ID"].ToString());
            Device     d      = DB.Device.FirstOrDefault(p => p.PatientID == userid);
            DeviceLine dl     = new DeviceLine()
            {
                PatientID = userid, DeviceID = d.ID
            };
            Readings r = new Readings()
            {
                Pulse = Pulse_input, OxygenSaturation = OxygenSaturation_input, Date = DateTime.Now
            };

            r.DeviceLine.Add(dl);
            DB.Readings.Add(r);
            DB.SaveChanges();
            Helpers.AdvProg adv = new Helpers.AdvProg();
            adv.CheckForSuddenDropOrRise(r, userid);
            return(View());
        }
예제 #5
0
        public ActionResult Edit(int id)
        {
            DeviceLine line = null;
            int        RGID = 0;

            using (var ctx = new GlsunViewEntities())
            {
                line = ctx.DeviceLine.Find(id);
                if (line.RID.HasValue)
                {
                    var route = ctx.Route.Find(line.RID);
                    if (route != null)
                    {
                        RGID = route.RGID.Value;
                    }
                }
            }
            ViewBag.RGID = RGID;
            return(View(line));
        }
예제 #6
0
        public string AddReadings(int OxygenSaturation, int pulse, int cpr)
        {
            Patient    patient = DB.Patient.FirstOrDefault(p => p.CPRno == cpr);
            Device     d       = DB.Device.FirstOrDefault(p => p.PatientID == patient.ID);
            DeviceLine dl      = new DeviceLine()
            {
                PatientID = patient.ID, DeviceID = d.ID
            };
            Readings r = new Readings()
            {
                Pulse = pulse, OxygenSaturation = OxygenSaturation, Date = DateTime.Now
            };

            r.DeviceLine.Add(dl);
            DB.Readings.Add(r);
            DB.SaveChanges();

            //tjek om måling er megetafvigende:
            Helpers.AdvProg adv = new Helpers.AdvProg();
            adv.CheckForSuddenDropOrRise(r, cpr);

            return("ok");
        }
예제 #7
0
        public override DeviceInfo Generate(int line, string[] entries)
        {
            DeviceInfo di = null;

            try
            {
                DeviceLine dl = new DeviceLine(line, entries);
                di = new DeviceInfo(dl.IsWindows ? EDeviceType.Workstation : EDeviceType.Generic)
                {
                    DID       = new DeviceID(-1, dl.Name),
                    ipAddress = dl.IPAddress
                };
            }
            catch (Exception ex)
            {
                // It's not an error if the first line chokes on the "Is Windows" column.
                if (string.Compare(ex.Message, "Invalid IsWindows field: Is Windows (line 0)", true) != 0)
                {
                    throw ex;
                }
            }

            return(di);
        }
예제 #8
0
        /// <summary>
        /// 设备连线跳转到路由
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult LinkRoute(int id)
        {
            RouteViewModel routeView = new RouteViewModel();

            using (var ctx = new GlsunViewEntities())
            {
                DeviceLine line  = ctx.DeviceLine.Find(id);
                Route      route = ctx.Route.Find(line.RID);

                MachineFrame frameA = ctx.MachineFrame.Find(route.RAMFID);
                MachineFrame frameB = ctx.MachineFrame.Find(route.RBMFID);

                if (route != null)
                {
                    routeView.RouteName     = route.RName;
                    routeView.AName         = route.RAName;
                    routeView.AIP           = frameA.MFIP;
                    routeView.APort         = frameA.MFPort.Value;
                    routeView.ASlot         = route.RASlot.Value;
                    routeView.ACardPosition = string.Format("A框{0}-盘{1}", routeView.AIP, routeView.ASlot);
                    routeView.ACardType     = "OLP";
                    routeView.BName         = route.RBName;
                    routeView.BIP           = frameB.MFIP;
                    routeView.BPort         = frameB.MFPort.Value;
                    routeView.BSlot         = route.RBSlot.Value;
                    routeView.BCardPosition = string.Format("B框{0}-盘{1}", routeView.BIP, routeView.BSlot);
                    routeView.BCardType     = "OLP";
                }
            }
            OLPInfo olpInfo = new OLPInfo();
            var     tcp     = TcpClientServicePool.GetService(routeView.AIP, routeView.APort);

            if (tcp != null)
            {
                OLPCommService service = new OLPCommService(tcp, routeView.ASlot);
                try
                {
                    olpInfo.RefreshData(service);
                    routeView.ACardType  = olpInfo.Card_Type;
                    routeView.AWorkRoute = olpInfo.Manual_Switch_Channel;
                }
                catch
                {
                    routeView.ACardType  = "";
                    routeView.AWorkRoute = 1;
                }
                finally
                {
                    TcpClientServicePool.FreeService(tcp);
                }
            }
            tcp = TcpClientServicePool.GetService(routeView.BIP, routeView.BPort);
            if (tcp != null)
            {
                OLPCommService service = new OLPCommService(tcp, routeView.BSlot);
                try
                {
                    olpInfo.RefreshData(service);
                    routeView.BCardType  = olpInfo.Card_Type;
                    routeView.BWorkRoute = olpInfo.Manual_Switch_Channel;
                }
                catch
                {
                    routeView.BCardType  = "";
                    routeView.BWorkRoute = 1;
                }
                finally
                {
                    TcpClientServicePool.FreeService(tcp);
                }
            }
            return(View("Index", routeView));
        }
예제 #9
0
        public override string GenerateLine(DeviceInfo t)
        {
            DeviceLine dl = new DeviceLine(t);

            return(dl.ToLine());
        }