Exemple #1
0
        public JsonResult MapInitLeftMenu()
        {
            List <HostInfoVM> list     = new List <HostInfoVM>();
            string            imageurl = "logoMain.png";

            ViewBag.PrjectGUID = PrjGUID;
            BLL.tHostInfo bllhost = new BLL.tHostInfo();
            MainViewModel mainVM  = new MainViewModel();


            //ViewBag.MapCenterLat = GetLat("Prject_CenterPoint_Lat");
            //ViewBag.MapCenterLng = GetLng("Prject_CenterPoint_Lng");
            DataTable allhostdt = bllhost.GetHostInfo(" dbo.tHostInfo.sProjectInfoGUID='" + PrjGUID + "' ");

            if (allhostdt != null)
            {
                allhostdt.Columns.Add("hostByLightCount");
                allhostdt.Columns.Add("hostByAlarmLightCount");
                HostInfoVM hvm;
                foreach (DataRow dr in allhostdt.Rows)
                {
                    hvm = addInfo(dr);

                    mainVM.HostInfos.Add(hvm);
                }
                return(this.Json(mainVM));
            }
            return(this.Json(""));
        }
Exemple #2
0
        //刷新左侧菜单报警状态
        public JsonResult ReloadState()
        {
            if (!string.IsNullOrEmpty(PrjGUID))
            {
                BLL.tHostInfo   bllhost = new BLL.tHostInfo();
                Model.tHostInfo modhost = new Model.tHostInfo();

                MainViewModel mainVM = new MainViewModel();
                DataTable     dt     = bllhost.GetHostInfo("dbo.tHostInfo.sProjectInfoGUID='" + PrjGUID + "'");

                if (dt != null)
                {
                    dt.Columns.Add("hostByLightCount");
                    dt.Columns.Add("hostByAlarmLightCount");
                    HostInfoVM hvm;


                    foreach (DataRow dr in dt.Rows)
                    {
                        hvm = addInfo(dr);
                        mainVM.HostInfos.Add(hvm);
                    }
                    ;
                }
                return(this.Json(mainVM.HostInfos));
            }
            else
            {
                return(this.Json(""));
            }
        }
Exemple #3
0
 public ActionResult EditHostInfo(string hostGUID)
 {
     Model.tHostInfo hi = new BLL.tHostInfo().GetModel(hostGUID);
     if (hi != null)
     {
         return(PartialView(hi));
     }
     return(null);
 }
Exemple #4
0
 public ActionResult GetHostInfoByHostGUID(string hostGUID)
 {
     Model.tHostInfo hi = new BLL.tHostInfo().GetModel(hostGUID);
     if (hi != null)
     {
         return(Json(hi));
     }
     return(null);
 }
Exemple #5
0
        public ActionResult GetHostInfos()
        {
            string prjGUID = this.PrjGUID;

            if (string.IsNullOrEmpty(prjGUID))
            {
                return(null);
            }
            List <Model.tHostInfo> hiList = new BLL.tHostInfo().GetModelListByPrjGUID(prjGUID);

            return(Json(hiList));
        }
Exemple #6
0
        public ActionResult GetDeviceTreeForJson()
        {
            string prjGUID = this.PrjGUID;

            if (string.IsNullOrEmpty(prjGUID))
            {
                return(null);
            }
            BLL.tHostInfo             hiBLL  = new BLL.tHostInfo();
            BLL.tLightInfoes          liBLL  = new BLL.tLightInfoes();
            List <Model.tHostInfo>    hiList = hiBLL.GetModelListByPrjGUID(prjGUID);
            List <Model.tLightInfoes> liList;

            if (hiList.Count == 0)
            {
                return(null);
            }
            StringBuilder result = new StringBuilder();

            result.Append("[");
            for (int i = 0; i < hiList.Count; i++)
            {
                Model.tHostInfo hi = hiList[i];

                result.Append("{\"id\":\"" + hi.sGUID + "\",");
                result.Append("\"text\":\"" + hi.sName + "\",");
                result.Append("\"icon\":\"" + "fa fa-warning icon-state-danger" + "\",");
                result.Append("\"state\":{\"opened\": false},");
                result.Append("\"children\":[");  // 下面是子节点,注意]关闭
                liList = liBLL.GetModelListByHostGUID(hi.sGUID);
                for (int j = 0; j < liList.Count; j++)
                {
                    Model.tLightInfoes li = liList[j];

                    result.Append("{\"id\":\"" + li.sGUID + "\",");
                    result.Append("\"text\":\"" + li.sName + "\",");
                    result.Append("\"icon\":\"" + "fa fa-warning icon-state-danger" + "\"}");
                    if (j < liList.Count - 1)
                    {
                        result.Append(",");
                    }
                }
                result.Append("]}");
                if (i < hiList.Count - 1)
                {
                    result.Append(",");
                }
            }
            result.Append("]");
            return(Content(result.ToString()));
        }
Exemple #7
0
        public List <HostInfo> GetModelByPrjGUID(string prjGUID)
        {
            List <Model.tHostInfo> list = new BLL.tHostInfo().GetModelListByPrjGUID(prjGUID);

            if (list != null && list.Count > 0)
            {
                List <HostInfo> listHI = new List <HostInfo>();
                foreach (Model.tHostInfo hi in list)
                {
                    listHI.Add(new HostInfo(hi));
                }
                return(listHI);
            }
            return(null);
        }
Exemple #8
0
        //
        // GET: /Lamp/Main/
        public ActionResult Index()
        {
            #region 加载左侧所有主机信息

            LumluxSSYDB.Model.tUserInfoes ui    = new LumluxSSYDB.Model.tUserInfoes();
            LumluxSSYDB.BLL.tUserInfoes   uiBll = new LumluxSSYDB.BLL.tUserInfoes();

            ui = uiBll.GetModel(UserID);

            ViewBag.ConfigMap = ui.sRemark;

            ViewBag.PrjectGUID = PrjGUID;
            BLL.tHostInfo bllhost = new BLL.tHostInfo();
            MainViewModel mainVM  = new MainViewModel();

            BLL.tPrjectInfo   tp     = new BLL.tPrjectInfo();
            Model.tPrjectInfo tp_mod = tp.GetModel(PrjGUID);
            if (tp_mod != null)
            {
                mainVM.MapCenterLat = tp_mod.fLat.ToString();
                mainVM.MapCenterLng = tp_mod.fLng.ToString();
            }
            //mainVM.MapCenterLat = GetLat("Prject_CenterPoint_Lat");
            //mainVM.MapCenterLng = GetLng("Prject_CenterPoint_Lng");
            DataTable allhostdt = bllhost.GetHostInfo("dbo.tHostInfo.sProjectInfoGUID='" + PrjGUID + "'");
            if (allhostdt != null)
            {
                allhostdt.Columns.Add("hostByLightCount");
                allhostdt.Columns.Add("hostByAlarmLightCount");
                HostInfoVM hvm;
                foreach (DataRow dr in allhostdt.Rows)
                {
                    hvm = addInfo(dr);

                    mainVM.HostInfos.Add(hvm);
                }
            }
            #endregion


            #region 获取当前项目的标题
            ViewBag.Title = ToString(GetSetValue("MainTitle", "sValue")) == "" ? "无标题,请联系管理员..." : ToString(GetSetValue("MainTitle", "sValue"));
            #endregion

            ViewData["Message"] = "WW";
            return(View(mainVM));
        }
Exemple #9
0
        public JsonResult AllMarker()
        {
            BLL.tHostInfo   bllhost = new BLL.tHostInfo();
            Model.tHostInfo modhost = new Model.tHostInfo();
            MainViewModel   mainVM  = new MainViewModel();

            if (Request.QueryString["sGUID"] != null)
            {
                DataTable dt = bllhost.GetHostInfo("dbo.tHostInfo.sGUID='" + Request.QueryString["sGUID"] + "'");
                //mainVM.maxLat = GetMaxLat(Request.QueryString["sGUID"].ToString());
                //mainVM.maxlng = GetMaxLng(Request.QueryString["sGUID"].ToString());
                if (dt != null)
                {
                    dt.Columns.Add("hostByLightCount");
                    dt.Columns.Add("hostByAlarmLightCount");
                    HostInfoVM hvm;
                    foreach (DataRow dr in dt.Rows)
                    {
                        hvm = addInfo(dr);
                        //hvm = new HostInfoVM();
                        //hvm.GUID = dr["sGUID"].ToString();
                        //hvm.ID = ToString(dr["sID_Addr"]);
                        //hvm.Lat = ToString(dr["fLat"]);
                        //hvm.Lng = ToString(dr["fLng"]);
                        //hvm.Name = ToString(dr["sName"].ToString());
                        //hvm.UpdateTime = Convert.ToDateTime(ToString(dr["dUpdateTime"]) == "" ? "1999-01-01 00:00:00" : ToString(dr["dUpdateTime"]));
                        //hvm.GroupName = dr["GroupName"].ToString();
                        //hvm.Online = Convert.ToInt32(ToString(dr["iState_Online"]) == "" ? "0" : ToString(dr["iState_Online"]));
                        //hvm.Alarm = Convert.ToInt32(ToString(dr["iState_Alarm"]) == "" ? "0" : ToString(dr["iState_Alarm"]));
                        mainVM.HostInfos.Add(hvm);
                    }
                    // ViewBag.hostlist = mainVM.HostInfos;
                }
                return(this.Json(mainVM));
            }
            else
            {
                return(this.Json(""));
            }
        }
Exemple #10
0
        //模糊搜索
        public JsonResult SeachData()
        {
            if (Request.QueryString["sWhere"] != null)
            {
                BLL.tHostInfo   bllhost = new BLL.tHostInfo();
                Model.tHostInfo modhost = new Model.tHostInfo();

                MainViewModel mainVM = new MainViewModel();
                DataTable     dt     = bllhost.GetHostInfo(" dbo.tHostInfo.sProjectInfoGUID='" + PrjGUID + "' and dbo.tHostInfo.sName like'%" + Request.QueryString["sWhere"].ToString() + "%'");

                if (dt != null)
                {
                    dt.Columns.Add("hostByLightCount");
                    dt.Columns.Add("hostByAlarmLightCount");
                    HostInfoVM hvm;
                    foreach (DataRow dr in dt.Rows)
                    {
                        hvm = addInfo(dr);
                        //hvm = new HostInfoVM();
                        //hvm.GUID = dr["sGUID"].ToString();
                        //hvm.ID = ToString(dr["sID_Addr"]);
                        //hvm.Lat = ToString(dr["fLat"]);
                        //hvm.Lng = ToString(dr["fLng"]);
                        //hvm.Name = ToString(dr["sName"].ToString());
                        //hvm.sUpdateTime = ToString(dr["dUpdateTime"]) == "" ? "1999-01-01 00:00:00" : ToString(dr["dUpdateTime"]);
                        //hvm.GroupName = dr["GroupName"].ToString();
                        //hvm.Online = Convert.ToInt32(ToString(dr["iState_Online"]) == "" ? "0" : ToString(dr["iState_Online"]));
                        //hvm.Alarm = Convert.ToInt32(ToString(dr["iState_Alarm"]) == "" ? "0" : ToString(dr["iState_Alarm"]));
                        mainVM.HostInfos.Add(hvm);
                    }
                    ;
                }
                return(this.Json(mainVM.HostInfos));
            }
            else
            {
                return(this.Json(""));
            }
        }
Exemple #11
0
        public ActionResult HostRealStateDefaultView(string guid, int result, string datetime = "")
        {
            ModelState.Clear();
            BLL.tHostInfo               hostbll               = new BLL.tHostInfo();
            Model.tHostInfo             hostmodel             = new Model.tHostInfo();
            BLL.tMeasureConfigs         measureconfigbll      = new BLL.tMeasureConfigs();
            Model.tMeasureConfigs       measureconfigmodel    = new Model.tMeasureConfigs();
            BLL.tBranchConfigs          branchconfigbll       = new BLL.tBranchConfigs();
            List <Model.tBranchConfigs> branchconfigmodellist = new List <Model.tBranchConfigs>();

            BLL.tMeasureInfoes          measurebll       = new BLL.tMeasureInfoes();
            Model.tMeasureInfoes        measuremodel     = new Model.tMeasureInfoes();
            List <Model.tMeasureInfoes> measuremodellist = new List <Model.tMeasureInfoes>();

            Model.tMeasurePowerInfoes   measurepowermodel   = new Model.tMeasurePowerInfoes();
            BLL.tMeasurePowerInfoes     measurepowerbll     = new BLL.tMeasurePowerInfoes();
            Model.tMeasureCurrentInfoes measurecurrentmodel = new Model.tMeasureCurrentInfoes();
            BLL.tMeasureCurrentInfoes   measurecurrentbll   = new BLL.tMeasureCurrentInfoes();

            A = new GetAllStateVM();
            A.OneCircuitList               = new MeasureState();
            A.TwoCircuitList               = new MeasureState();
            A.ThreeCircuitList             = new MeasureState();
            A.ThreeCircuitList.CircuitList = new List <CircuitStateVM>();
            A.OneCircuitList.CircuitList   = new List <CircuitStateVM>();
            A.TwoCircuitList.CircuitList   = new List <CircuitStateVM>();
            //default
            A.Name                    = "获取失败";
            A.MesureCount             = 0;
            A.UpdateTime              = "获取失败";
            A.OneCircuitList.AState   = "获取失败";
            A.OneCircuitList.BState   = "获取失败";
            A.OneCircuitList.CState   = "获取失败";
            A.OneCircuitList.Avoltage = "N/A";
            A.OneCircuitList.Bvoltage = "N/A";
            A.OneCircuitList.Cvoltage = "N/A";
            A.guid                    = guid;

            switch (result)
            {
            case 0:
                A.Name = "参数错误";
                return(View(A));

            case 1:
                A.Name = "主机未设置地址";
                return(View(A));

            case 2:
                A.Name = "写数据库失败";
                return(View(A));

            case 3:
                A.Name = "参数错误";
                return(View(A));

            case 4:
                A.Name = "无此主机";
                return(View(A));

            case 5:
                A.Name = "未配置测量板";
                return(View(A));

            case 6:
                A.Name = "无返回";
                return(View(A));

            case 7:
                try
                {
                    DateTime ResultTime = DateTime.Parse(datetime);
                    hostmodel = hostbll.GetModel(guid);
                    if (hostmodel != null)
                    {
                        if (hostmodel.sName != null)
                        {
                            A.Name = hostmodel.sName;
                        }
                        measureconfigmodel = measureconfigbll.GetModelByHostGuid(guid);
                        if (measureconfigmodel != null)
                        {
                            if (measureconfigmodel.iMeasureNumber != null)
                            {
                                A.MesureCount = (int)measureconfigmodel.iMeasureNumber;
                                if (measuremodel.dCreateDate != null)
                                {
                                    A.UpdateTime = measuremodel.dCreateDate.ToString();
                                }
                                for (int i = 0; i < measureconfigmodel.iMeasureNumber; i++)
                                {
                                    measuremodel = measurebll.GetModelByHostGuidAndIdAndTime(guid, i + 1, ResultTime);
                                    if (measuremodel != null)
                                    {
                                        if (measuremodel.fVlotA != null)
                                        {
                                            A.OneCircuitList.Avoltage = measuremodel.fVlotA.ToString();
                                        }
                                        if (measuremodel.fVlotB != null)
                                        {
                                            A.OneCircuitList.Bvoltage = measuremodel.fVlotB.ToString();
                                        }
                                        if (measuremodel.fVlotC != null)
                                        {
                                            A.OneCircuitList.Cvoltage = measuremodel.fVlotC.ToString();
                                        }
                                        if (measuremodel.iAlarmVlotA != null)
                                        {
                                            switch ((VoltageAlarm)measuremodel.iAlarmVlotA)
                                            {
                                            case VoltageAlarm.Va_Normal: A.OneCircuitList.AState = "正常";
                                                break;

                                            case VoltageAlarm.Va_Zero: A.OneCircuitList.AState = "缺相";
                                                break;

                                            case VoltageAlarm.Va_OvUpper: A.OneCircuitList.AState = "过压";
                                                break;

                                            case VoltageAlarm.Va_OverLower: A.OneCircuitList.AState = "欠压";
                                                break;

                                            default:
                                                break;
                                            }
                                        }
                                        if (measuremodel.iAlarmVlotB != null)
                                        {
                                            switch ((VoltageAlarm)measuremodel.iAlarmVlotB)
                                            {
                                            case VoltageAlarm.Va_Normal: A.OneCircuitList.BState = "正常";
                                                break;

                                            case VoltageAlarm.Va_Zero: A.OneCircuitList.BState = "缺相";
                                                break;

                                            case VoltageAlarm.Va_OvUpper: A.OneCircuitList.BState = "过压";
                                                break;

                                            case VoltageAlarm.Va_OverLower: A.OneCircuitList.BState = "欠压";
                                                break;

                                            default:
                                                break;
                                            }
                                        }
                                        if (measuremodel.iAlarmVlotC != null)
                                        {
                                            switch ((VoltageAlarm)measuremodel.iAlarmVlotC)
                                            {
                                            case VoltageAlarm.Va_Normal: A.OneCircuitList.CState = "正常";
                                                break;

                                            case VoltageAlarm.Va_Zero: A.OneCircuitList.CState = "缺相";
                                                break;

                                            case VoltageAlarm.Va_OvUpper: A.OneCircuitList.CState = "过压";
                                                break;

                                            case VoltageAlarm.Va_OverLower: A.OneCircuitList.CState = "欠压";
                                                break;

                                            default:
                                                break;
                                            }
                                        }

                                        branchconfigmodellist = branchconfigbll.GetModelList("sMeasureConfigGUID = '" + measureconfigmodel.sGUID + "' and iEnable = " + StateEnable.Enable);
                                        if (branchconfigmodellist != null)
                                        {
                                            foreach (var item in branchconfigmodellist.OrderBy(c => c.iID))
                                            {
                                                if (item.iID != null)
                                                {
                                                    CircuitStateVM C = new CircuitStateVM();
                                                    measurepowermodel   = measurepowerbll.GetModelByHostGuidAndIDAndTime(measuremodel.sGUID, (int)item.iID);
                                                    measurecurrentmodel = measurecurrentbll.GetModelByHostGuidAndIDAndTime(measuremodel.sGUID, (int)item.iID);
                                                    if ((measurepowermodel != null) && (measurecurrentmodel != null))
                                                    {
                                                        if (measurecurrentmodel.fValue != null)
                                                        {
                                                            C.Current = measurecurrentmodel.fValue.ToString();
                                                        }
                                                        C.ID = item.iID.ToString();
                                                        if (measurepowermodel.fValue != null)
                                                        {
                                                            C.Power = measurepowermodel.fValue.ToString();
                                                        }
                                                        if (measurecurrentmodel.iAlarm != null)
                                                        {
                                                            switch ((CurrentAlarm)measurecurrentmodel.iAlarm)
                                                            {
                                                            case CurrentAlarm.I_Normal: C.State = "正常";
                                                                break;

                                                            case CurrentAlarm.IO_Nmatch_CIR: C.State = "接触器断路";
                                                                break;

                                                            case CurrentAlarm.IO_Nmatch_SW: C.State = "接触器吸合";
                                                                break;

                                                            case CurrentAlarm.IO_Nmatch_All: C.State = "回路开路";
                                                                break;

                                                            case CurrentAlarm.INO_Nmatch_CIR: C.State = "接触器未释放";
                                                                break;

                                                            case CurrentAlarm.INO_Nmatch_SW: C.State = "辅助触点故障";
                                                                break;

                                                            case CurrentAlarm.INO_Nmatch_All: C.State = "异常有电流";
                                                                break;

                                                            case CurrentAlarm.INO_OverUpper: C.State = "电流越上限";
                                                                break;

                                                            case CurrentAlarm.INO_OverLower: C.State = "电流越下限";
                                                                break;

                                                            default:
                                                                break;
                                                            }
                                                        }
                                                        if (item.iVoltType != null)
                                                        {
                                                            switch ((VoltageType)item.iVoltType)
                                                            {
                                                            case VoltageType.A: C.Phase = "A"; break;

                                                            case VoltageType.B: C.Phase = "B"; break;

                                                            case VoltageType.C: C.Phase = "C"; break;

                                                            default:
                                                                break;
                                                            }
                                                        }
                                                        if (item.iID <= 12)
                                                        {
                                                            A.OneCircuitList.CircuitList.Add(C);
                                                        }
                                                        else if (item.iID <= 24)
                                                        {
                                                            A.TwoCircuitList.CircuitList.Add(C);
                                                        }
                                                        else
                                                        {
                                                            A.ThreeCircuitList.CircuitList.Add(C);
                                                        }
                                                    }
                                                    //else
                                                    //{
                                                    //    //功率电流为null
                                                    //}
                                                }
                                                //else
                                                //{
                                                //    //item.id为null
                                                //}
                                            }
                                        }
                                        //else
                                        //{
                                        //    //回路表为空
                                        //}
                                    }
                                    //else
                                    //{
                                    //    //查询到的测量板信息为空
                                    //}
                                }
                                return(View(A));
                            }
                            else
                            {
                                //测量板个数为空
                                A.Name = "测量板个数为空";
                                return(View(A));
                            }
                        }
                        else
                        {
                            //测量板配置表为空
                            A.Name = "测量板配置表为空";
                            return(View(A));
                        }
                    }
                    else
                    {
                        //主机未找到
                        A.Name = "未找到该主机";
                        return(View(A));
                    }
                }
                catch
                {
                    //发生异常
                    A.Name = "异常错误";
                    return(View(A));
                }

            default:
                A.Name = "传输错误";
                return(View(A));
            }
        }
Exemple #12
0
        /// <summary>
        /// 发送命令
        /// </summary>
        /// <returns>Int</returns>
        public JsonResult GetHostRealStateCmdPost()
        {
            /*
             * result :
             * 0:参数错误
             * 1:主机未设置地址
             * 2:写数据库失败
             * 3:写成功
             */
            BLL.tHostInfo   bllhost = new BLL.tHostInfo();
            Model.tHostInfo modhost = new Model.tHostInfo();
            BLL.tCMDSends   bllsend = new BLL.tCMDSends();
            Model.tCMDSends modsend = new Model.tCMDSends();
            byte[]          bt1     = null;
            int             result  = 0;

            if (!string.IsNullOrWhiteSpace(Request.QueryString["sGuid"]))
            {
                Model.tHostInfo dt2 = bllhost.GetModel(Request.QueryString["sGuid"]);
                if (dt2 != null)
                {
                    if (!string.IsNullOrWhiteSpace(dt2.sID_Addr))
                    {
                        try
                        {
                            byte[] a = new byte[2];
                            a[0] = (byte)(int.Parse(dt2.sID_Addr) >> 8);
                            a[1] = (byte)(int.Parse(dt2.sID_Addr));
                            bt1  = LightGPRSProtocol.GetStringFor0x68((byte)CMDType.GetHostAllInfoCMD, a);
                            if (bt1 != null)
                            {
                                modsend.dCreateDate  = DateTime.Now;
                                modsend.dUpdateTime  = DateTime.Now;
                                modsend.sGUID        = Guid.NewGuid().ToString();
                                modsend.iContentType = (int)CMDType.GetHostAllInfoCMD;
                                string str = HexHelper.ByteArrayToHexString(bt1);
                                modsend.sContent = str;
                                modsend.iState   = (int)CMDState.NO;
                                if (dt2.iIDType != null)
                                {
                                    modsend.iHostIDType = dt2.iIDType;
                                }
                                if (dt2.iIDType != null)
                                {
                                    modsend.iHostIDType = dt2.iIDType;
                                }
                                if (!string.IsNullOrWhiteSpace(dt2.sID_Addr))
                                {
                                    modsend.sHostIDAddr = dt2.sID_Addr;
                                }
                                if (!string.IsNullOrWhiteSpace(dt2.sID_ID))
                                {
                                    modsend.sHostIDID = dt2.sID_ID;
                                }
                                if (!string.IsNullOrWhiteSpace(dt2.sID_IP))
                                {
                                    modsend.sHostIDIP = dt2.sID_IP;
                                }
                                if (!string.IsNullOrWhiteSpace(dt2.sID_MAC))
                                {
                                    modsend.sHostIDMAC = dt2.sID_MAC;
                                }
                                if (!string.IsNullOrWhiteSpace(dt2.sID_SIM))
                                {
                                    modsend.sHostIDSIM = dt2.sID_SIM;
                                }
                                if (bllsend.Add(modsend) == true)
                                {
                                    result = 3;
                                    return(Json(result));
                                }
                                else
                                {
                                    result = 2;
                                    return(Json(result));
                                }
                            }
                            else
                            {
                                result = 2;
                                return(Json(result));
                            }
                        }
                        catch (Exception)
                        {
                            result = 2;
                            return(Json(result));
                        }
                    }
                    else
                    {
                        result = 1;
                        return(Json(result));
                    }
                }
                else
                {
                    result = 0;
                    return(Json(result));
                }
            }
            else
            {
                result = 0;
                return(Json(result));
            }
        }
Exemple #13
0
        /// <summary>
        /// 获取是否返回成功
        /// </summary>
        /// <returns>StateResultClass</returns>
        public JsonResult HostRealStateReceiveState()
        {
            /*
             * 3:无GUID或sTime
             * 4: 无此主机
             * 5:没配置测量板
             * 6:无返回
             * 7:返回正确
             */

            StateResult result = new StateResult();

            BLL.tHostInfo               hostbll            = new BLL.tHostInfo();
            Model.tHostInfo             hostmodel          = new Model.tHostInfo();
            BLL.tMeasureConfigs         measureconfigbll   = new BLL.tMeasureConfigs();
            Model.tMeasureConfigs       measureconfigmodel = new Model.tMeasureConfigs();
            BLL.tMeasureInfoes          measurebll         = new BLL.tMeasureInfoes();
            Model.tMeasureInfoes        measuremodel       = new Model.tMeasureInfoes();
            List <Model.tMeasureInfoes> measuremodellist   = new List <Model.tMeasureInfoes>();

            BLL.tMeasurePowerInfoes          measurepowerbll       = new BLL.tMeasurePowerInfoes();
            List <Model.tMeasurePowerInfoes> measurepowermodellist = new List <Model.tMeasurePowerInfoes>();

            BLL.tMeasureCurrentInfoes          measurecurrentbll       = new BLL.tMeasureCurrentInfoes();
            List <Model.tMeasureCurrentInfoes> measurecurrentmodellist = new List <Model.tMeasureCurrentInfoes>();

            if (!string.IsNullOrWhiteSpace(Request.QueryString["sGuid"]) && (!string.IsNullOrWhiteSpace(Request.QueryString["sTime"])))
            {
                if ((hostmodel = hostbll.GetModel(Request.QueryString["sGuid"])) != null)
                {
                    if ((measureconfigmodel = measureconfigbll.GetModelByHostGuid(Request.QueryString["sGuid"])) != null)
                    {
                        if ((measuremodellist = measurebll.GetModelList("")).Count > 0)
                        {
                            DateTime dt1 = DateTime.Now;
                            dt1.AddSeconds(-int.Parse(Request.QueryString["sTime"]));
                            result.StateDateTime = dt1;
                            result.Stateresult   = 7;
                            return(Json(result));
                        }
                        else
                        {
                            //未返回数据
                            result.Stateresult = 6;
                            return(Json(result));
                        }
                    }
                    else
                    {
                        //没有配置测量板
                        result.Stateresult = 5;
                        return(Json(result));
                    }
                }
                else
                {
                    //没有该主机
                    result.Stateresult = 4;
                    return(Json(result));
                }
            }
            else
            {
                //没有传guid过来
                result.Stateresult = 3;
                return(Json(result));
            }
        }
Exemple #14
0
        /// <summary>
        /// 获取树形相关的数据
        /// </summary>
        /// <param name="prjGUID"></param>
        /// <returns></returns>
        public TreeData GetTreeData(string prjGUID)
        {
            td = new TreeData();
            BLL.tLightGroupInfoes          lgiBLL   = new BLL.tLightGroupInfoes();
            BLL.tLightInfoLightGroupInfoes lilgiBLL = new BLL.tLightInfoLightGroupInfoes();
            BLL.tLightInfoes liBLL = new BLL.tLightInfoes();
            // 组信息
            List <Model.tGroupInfoes> listGI = new BLL.tGroupInfoes().GetModelListByPrjGUID(prjGUID);
            // 主机信息
            List <Model.tHostInfo> listHI = new BLL.tHostInfo().GetModelListByPrjGUID(prjGUID);

            // 增加未分组的主机
            if (listGI == null)
            {
                listGI = new List <Model.tGroupInfoes>();
            }
            if ((listHI.Count(t => t.sGroupInfoGUID.Trim() == "") > 0))
            {
                listGI.Add(new Model.tGroupInfoes()
                {
                    sName = "未分组", sGUID = ""
                });
            }

            // 加入地图数据
            foreach (Model.tHostInfo mapHI in listHI)
            {
                td.ListHostInfo.Add(new HostInfo(mapHI));
                List <Model.tLightInfoes> mapListLI = liBLL.GetModelListByHostGUID(mapHI.sGUID);
                foreach (Model.tLightInfoes mapLI in mapListLI)
                {
                    td.ListLightInfo.Add(new LightInfo(mapLI, mapHI.sID_Addr));
                }
            }

            foreach (Model.tGroupInfoes gi in listGI)
            {
                // 树形数据
                TreeGroupInfo ftgi = new TreeGroupInfo();
                ftgi.GroupInfo = new GroupInfo(gi);

                List <Model.tHostInfo> flthi = listHI.Where(t => t.sGroupInfoGUID.Trim() == gi.sGUID).ToList();

                if (gi.sGUID == "" && flthi.Count == 0)
                {
                    continue;
                }

                foreach (Model.tHostInfo hi in flthi)
                {
                    TreeHostInfo ffthi = new TreeHostInfo();
                    ffthi.HostInfo = td.ListHostInfo.FirstOrDefault(v => v.GUID.Trim() == hi.sGUID.Trim());//new HostInfo(hi);

                    List <Model.tLightGroupInfoes> ffltlgi = lgiBLL.GetModelListByHostGUID(hi.sGUID);
                    //List<Model.tLightInfoes> ffltli = liBLL.GetModelListByHostGUID(hi.sGUID);
                    List <LightInfo> ffltli = td.ListLightInfo.Where(c => c.HostGUID == hi.sGUID).ToList();

                    {
                        // 增加所有单灯信息
                        // if (ffltli != null && ffltli.Count > 0)
                        {
                            if (ffltlgi == null)
                            {
                                ffltlgi = new List <Model.tLightGroupInfoes>();
                            }
                            ffltlgi.Add(new Model.tLightGroupInfoes()
                            {
                                sGUID = "", sName = "全部"
                            });
                        }
                    }

                    foreach (Model.tLightGroupInfoes lgi in ffltlgi)
                    {
                        if (lgi.sGUID == "" && ffltli != null)
                        {
                            TreeLightGroupInfo tfftlgi = new TreeLightGroupInfo();
                            tfftlgi.LightGroupInfo = new LightGroupInfo(lgi);
                            foreach (LightInfo t in ffltli)
                            {
                                TreeLightInfo tmtli = new TreeLightInfo();
                                t.RoadID        = hi.sID_Addr;
                                tmtli.LightInfo = t;

                                tfftlgi.TreeLightInfos.Add(tmtli);
                            }
                            ffthi.TreeLightGroupInfos.Add(tfftlgi);
                            continue;
                        }

                        List <Model.tLightInfoLightGroupInfoes> fftlilgi = lilgiBLL.GetModelListByLightGroupGUID(lgi.sGUID);
                        TreeLightGroupInfo fftlgi = new TreeLightGroupInfo();
                        fftlgi.LightGroupInfo = new LightGroupInfo(lgi);

                        foreach (Model.tLightInfoLightGroupInfoes tlilgi in fftlilgi)
                        {
                            LightInfo tli = ffltli.FirstOrDefault(t => t.GUID == tlilgi.sLightInfoGUID);
                            if (tli != null)
                            {
                                TreeLightInfo mtli = new TreeLightInfo();
                                tli.RoadID     = hi.sID_Addr;
                                mtli.LightInfo = tli;

                                fftlgi.TreeLightInfos.Add(mtli);
                            }
                        }

                        ffthi.TreeLightGroupInfos.Add(fftlgi);
                    }

                    ftgi.TreeHostInfos.Add(ffthi);
                }

                // 增加树形
                td.TreeGroupInfos.Add(ftgi);
            }

            return(td);
        }