/// <summary> /// 获取最低级的tree /// </summary> /// <param name="car"></param> /// <returns></returns> public static JObject getLastJobjectCar(DC_CAR_Model car) { var model = T_SYS_DICTCls.getListModel(new T_SYS_DICTSW { DICTTYPEID = "33", DICTVALUE = car.CARTYPE }).FirstOrDefault(); var name = car.NAME + "【" + model.DICTNAME + "】"; //getPosition StringBuilder sb = new StringBuilder(); string carimage = "car_" + car.CARTYPE; //偏移量计算 // double[] arr = ClsPositionUtil.gcj_To_Gps84(double.Parse(car.WD), double.Parse(car.JD)); if (!string.IsNullOrEmpty(car.JD) || !string.IsNullOrEmpty(car.WD)) { double[] arr = ClsPositionTrans.GpsTransform(double.Parse(car.WD), double.Parse(car.JD), ConfigCls.getSDELonLatTransform()); if (arr.Length > 0) { car.JD = arr[1].ToString(); car.WD = arr[0].ToString(); } //string sb = "<a onClick="">" + name + "</a>"; sb.AppendFormat("<font onClick='movetocar(\"{0}\",\"{1}\",\"{2}\")'>{3}</font>", car.JD, car.WD, carimage, name); } else { sb.AppendFormat("<font onClick='alert(\"缺少经纬度无法定位。\")'>{0}</font>", name); } JObject root = new JObject { { "id", car.DC_CAR_ID }, { "text", sb.ToString() } }; return(root); }
/// <summary> /// 护林员上传 /// </summary> /// <param name="filePath">文件路径</param> public static void CarUpload(string filePath) { HSSFWorkbook hssfworkbook; try { using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { hssfworkbook = new HSSFWorkbook(file); } } catch (Exception e) { throw e; } NPOI.SS.UserModel.ISheet sheet = hssfworkbook.GetSheetAt(0); int rowCount = sheet.LastRowNum; for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++) { IRow row = sheet.GetRow(i); string[] arr = new string[12]; for (int k = 0; k < arr.Length; k++) { if (k != 6) { arr[k] = row.GetCell(k) == null ? "" : row.GetCell(k).ToString();//循环获取每一单元格内容 } else { arr[k] = row.GetCell(k).DateCellValue.ToString("yyyy-MM-dd"); } } DC_CAR_Model m = new DC_CAR_Model(); //单位 车辆类型 名称 编号 号牌 存储地点 购买年份 购买价格 驾驶员 联系方式 经度 纬度 if (string.IsNullOrEmpty(arr[0]) || string.IsNullOrEmpty(arr[2])) { continue; } m.BYORGNO = BaseDT.T_SYS_ORG.getCodeByName(arr[0]); m.NAME = arr[2]; m.NUMBER = arr[3]; m.PLATENUM = arr[4]; m.STOREADDR = arr[5]; m.BUYYEAR = arr[6]; if (m.BUYYEAR == "9999-12-31") { m.BUYYEAR = "1900-01-01"; } m.BUYPRICE = arr[7]; m.DRIVER = arr[8]; m.CONTACTS = arr[9]; string jd = arr[10]; string wd = arr[11]; if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false) { double[] brr = ClsPositionTrans.GpsTransform(double.Parse(wd), double.Parse(jd), "1"); m.JD = brr[1].ToString(); m.WD = brr[0].ToString(); } if (arr[1].Trim() == "指挥车")//装备类型 { m.CARTYPE = "1"; } else if (arr[1].Trim() == "运兵车") { m.CARTYPE = "2"; } else if (arr[1].Trim() == "供水车") { m.CARTYPE = "3"; } else if (arr[1].Trim() == "通讯车") { m.CARTYPE = "4"; } else if (arr[1].Trim() == "宣传车") { m.CARTYPE = "5"; } else { m.CARTYPE = "1"; } BaseDT.DC_CAR.Add(m); string a = row.GetCell(0).ToString(); string a1 = row.GetCell(1).ToString(); string a2 = row.GetCell(2).ToString(); } }
/// <summary> /// 护林员上传 /// </summary> /// <param name="filePath">文件路径</param> public static void ARMYUpload(string filePath) { HSSFWorkbook hssfworkbook; try { using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { hssfworkbook = new HSSFWorkbook(file); } } catch (Exception e) { throw e; } NPOI.SS.UserModel.ISheet sheet = hssfworkbook.GetSheetAt(0); int rowCount = sheet.LastRowNum; for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++) { IRow row = sheet.GetRow(i); string[] arr = new string[9]; for (int k = 0; k < arr.Length; k++) { arr[k] = row.GetCell(k) == null ? "" : row.GetCell(k).ToString(); //循环获取每一单元格内容 } DC_ARMY_Model m = new DC_ARMY_Model(); //单位 队伍类型 名称 编号 人数 队长 联系方式 if (string.IsNullOrEmpty(arr[0]) || string.IsNullOrEmpty(arr[1]) || string.IsNullOrEmpty(arr[2])) { continue; } m.BYORGNO = BaseDT.T_SYS_ORG.getCodeByName(arr[0]); m.NAME = arr[2]; m.NUMBER = arr[3]; m.ARMYMEMBERCOUNT = arr[4]; m.ARMYLEADER = arr[5]; m.CONTACTS = arr[6]; string jd = arr[7]; string wd = arr[8]; if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false) { double[] brr = ClsPositionTrans.GpsTransform(double.Parse(wd), double.Parse(jd), "1"); m.JD = brr[1].ToString(); m.WD = brr[0].ToString(); } if (arr[1].Trim() == "专业队伍")//性别 { m.ARMYTYPE = "1"; } else if (arr[1].Trim() == "半专业队伍") { m.ARMYTYPE = "2"; } else if (arr[1].Trim() == "应急队伍") { m.ARMYTYPE = "3"; } else if (arr[1].Trim() == "群众队伍") { m.ARMYTYPE = "4"; } else { m.ARMYTYPE = "1"; } var ms = BaseDT.DC_ARMY.Add(m); if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false) { Firedepartment_Model m1 = new Firedepartment_Model(); m1.OBJECTID = ms.Url; m1.NAME = m.NAME; m1.TYPE = m.ARMYTYPE; m1.JD = jd; m1.WD = wd; m1.Shape = "geometry::STGeomFromText('POINT(" + m1.JD + " " + m1.WD + ")',4326)"; BaseDT.Firedepartment.Add(m1); } string a = row.GetCell(0).ToString(); string a1 = row.GetCell(1).ToString(); string a2 = row.GetCell(2).ToString(); //DataRow dataRow = table.NewRow(); //if (row != null) //{ // for (int j = row.FirstCellNum; j < cellCount; j++) // { // //if (row.GetCell(j) != null) // //dataRow[j] = GetCellValue(row.GetCell(j)); // } //} //table.Rows.Add(dataRow); } // return table; }
/// <summary> /// 瞭望台上传 /// </summary> /// <param name="filePath">文件路径</param> public static void OVERWATCHUpload(string filePath) { HSSFWorkbook hssfworkbook; try { using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { hssfworkbook = new HSSFWorkbook(file); } } catch (Exception e) { throw e; } NPOI.SS.UserModel.ISheet sheet = hssfworkbook.GetSheetAt(0); int rowCount = sheet.LastRowNum; for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++) { IRow row = sheet.GetRow(i); string[] arr = new string[11]; for (int k = 0; k < arr.Length; k++) { if (k != 6) { arr[k] = row.GetCell(k) == null ? "" : row.GetCell(k).ToString();//循环获取每一单元格内容 } else { arr[k] = row.GetCell(k).DateCellValue.ToString("yyyy-MM-dd"); } } DC_UTILITY_OVERWATCH_Model m = new DC_UTILITY_OVERWATCH_Model(); //单位 结构类型 名称 编号 建筑面积 楼层 建设日期 附属设施 价值 经度 纬度 if (string.IsNullOrEmpty(arr[0]) || string.IsNullOrEmpty(arr[2])) { continue; } m.ORGNOS = BaseDT.T_SYS_ORG.getCodeByName(arr[0]); m.NAME = arr[2]; m.NUMBER = arr[3]; m.AREA = arr[4]; m.FLOOR = arr[5]; m.BUILDDATE = arr[6]; if (m.BUILDDATE == "9999-12-31") { m.BUILDDATE = "1900-01-01"; } m.SUBFACILITIES = arr[7]; m.WORTH = arr[8]; string jd = arr[9]; string wd = arr[10]; if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false) { double[] brr = ClsPositionTrans.GpsTransform(double.Parse(wd), double.Parse(jd), "1"); m.JD = brr[1].ToString(); m.WD = brr[0].ToString(); } if (arr[1].Trim() == "钢构")//结构类型 { m.STRUCTURETYPE = "1"; } else if (arr[1].Trim() == "砖混") { m.STRUCTURETYPE = "2"; } else if (arr[1].Trim() == "钢混") { m.STRUCTURETYPE = "3"; } else { m.STRUCTURETYPE = "1"; } var ms = BaseDT.DC_UTILITY_OVERWATCH.Add(m); if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false) { TD_OVERWATCH_Model m1 = new TD_OVERWATCH_Model(); m1.OBJECTID = ms.Url; m1.NAME = m.NAME; m1.TYPE = m.STRUCTURETYPE; m1.JD = jd; m1.WD = wd; m1.Shape = "geometry::STGeomFromText('POINT(" + m1.JD + " " + m1.WD + ")',4326)"; BaseDT.SDE.TD_OVERWATCH.Add(m1); } string a = row.GetCell(0).ToString(); string a1 = row.GetCell(1).ToString(); string a2 = row.GetCell(2).ToString(); } }
/// <summary> /// 三维整合页面 /// </summary> /// <returns></returns> public ActionResult Total3DIndex() { var type = Request.Params["type"]; if (type == "0") { pubViewBag("020003", "020003", "三维护林员"); } else if (type == "1") { pubViewBag("012006", "012006", "应急处置"); } else if (type == "2") { pubViewBag("018003", "018003", "三维首页"); } else if (type == "3") { pubViewBag("017001", "017001", "公益林"); } else if (type == "4") { pubViewBag("044001", "044001", "动物三维"); } else if (type == "5") { pubViewBag("045001", "045001", "植物三维"); } else if (type == "6") { pubViewBag("046001", "046001", "生物三维"); } CookieModel cookieInfo1 = SystemCls.getCookieInfo(); ViewBag.LAYERNAME = T_SYS_LAYERCls.getLayerNameStr(new T_SYS_LAYER_SW { USERID = cookieInfo1.UID }); ViewBag.DEFAULTCH = T_SYS_LAYERCls.getLayerDEFAULTCHStr(new T_SYS_LAYER_SW { USERID = cookieInfo1.UID }); ViewBag.LAYERID = T_SYS_LAYERCls.getLayerFireLAYERID(new T_SYS_LAYER_SW { USERID = cookieInfo1.UID }); ViewBag.Fire = T_SYS_LAYERCls.getTreeFireQuery(new T_SYS_LAYER_SW { USERID = cookieInfo1.UID }); ViewBag.AllNAME = T_SYS_LAYERCls.getLayerAllNAME(); var xcenter = Request.Params["xcenter"]; var ycenter = Request.Params["ycenter"]; var scale = Request.Params["scale"]; if (string.IsNullOrEmpty(xcenter) == false && string.IsNullOrEmpty(ycenter) == false) { double[] arr = ClsPositionTrans.GpsTransform(double.Parse(ycenter), double.Parse(xcenter), "2"); xcenter = arr[1].ToString(); ycenter = arr[0].ToString(); } if (string.IsNullOrEmpty(scale) == false) { if (Convert.ToDouble(scale) >= 2311162) { scale = "571830"; } else if (Convert.ToDouble(scale) >= 1155581 && Convert.ToDouble(scale) < 2311162) { scale = "321000"; } else if (Convert.ToDouble(scale) >= 557790 && Convert.ToDouble(scale) < 1155581) { scale = "138440"; } else if (Convert.ToDouble(scale) >= 288895 && Convert.ToDouble(scale) < 557790) { scale = "65890"; } else if (Convert.ToDouble(scale) >= 144447 && Convert.ToDouble(scale) < 288895) { scale = "37210"; } else if (Convert.ToDouble(scale) >= 72223 && Convert.ToDouble(scale) < 144447) { scale = "12660"; } else if (Convert.ToDouble(scale) >= 36111 && Convert.ToDouble(scale) < 72223) { scale = "5981"; } else if (Convert.ToDouble(scale) >= 18055 && Convert.ToDouble(scale) < 36111) { scale = "3789"; } else if (Convert.ToDouble(scale) >= 9027 && Convert.ToDouble(scale) < 18055) { scale = "2390"; } else if (Convert.ToDouble(scale) >= 4513 && Convert.ToDouble(scale) < 9027) { scale = "1096"; } else if (Convert.ToDouble(scale) >= 2256 && Convert.ToDouble(scale) < 4513) { scale = "635"; } else if (Convert.ToDouble(scale) < 1130) { scale = "300"; } } //从数据库里获取三维图层树 CookieModel cookieInfo = SystemCls.getCookieInfo(); string result = T_SYS_LAYERCls.getTree(new T_SYS_LAYER_SW { USERID = cookieInfo.UID }); ViewBag.TreeData = result; ViewBag.xcenter = xcenter; ViewBag.ycenter = ycenter; ViewBag.scale = scale; string strmenue = ViewBag.getPageMenuStr; ViewBag.getPageMenuStr = strmenue.Replace("window.location.href='/Home/Total3DIndex?type=0'", "showHlyFun()").Replace("window.location.href='/Home/Total3DIndex?type=1'", "showYjczFun()").Replace("window.location.href='/Home/Total3DIndex?type=2';", "showSyzrFun()").Replace("window.location.href='/Home/Total3DIndex?type=3';", "showGylFun()").Replace("window.location.href='/Home/Total3DIndex?type=4';", "showYsdwFun()").Replace("window.location.href='/Home/Total3DIndex?type=5';", "showYszwFun()").Replace("window.location.href='/Home/Total3DIndex?type=6';", "showYhswFun()"); var reportMenuList = new List <MenuTypeModel>();//数据上报菜单 var reportList = T_SYS_MENUCls.getT_SYS_MENUModel(new T_SYS_MENU_SW { MENUCODE = "002", SYSFLAG = ConfigCls.getSystemFlag() }).FirstOrDefault(); //数据上报 if (reportList != null) { foreach (var item in reportList.subMenuModel) { var reportmodel = new MenuTypeModel(); reportmodel.DICTTYPEID = "5"; reportmodel.LICLASS = item.LICLASS; reportmodel.MENUNAME = item.MENUNAME; reportmodel.DICTVALUE = item.MENUURL.Substring(item.MENUURL.Length - 1, 1); reportMenuList.Add(reportmodel); } } ViewBag.reportlist = reportMenuList;//数据上报项目获取 var collectList = T_SYS_MENUCls.getT_SYS_MENUModel(new T_SYS_MENU_SW { MENUCODE = "003", SYSFLAG = ConfigCls.getSystemFlag() }).FirstOrDefault(); //数据采集 var collectMenuList = new List <MenuTypeModel>(); //数据采集 if (collectList != null) { foreach (var item in collectList.subMenuModel) { var collectmodel = new MenuTypeModel(); collectmodel.DICTTYPEID = "4"; collectmodel.LICLASS = item.LICLASS; collectmodel.MENUNAME = item.MENUNAME; collectmodel.DICTVALUE = item.MENUURL.Substring(item.MENUURL.Length - 1, 1); collectMenuList.Add(collectmodel); } } ViewBag.collectList = collectMenuList;//数据采集项目获取 //var modelfirelist = GetCUrFireList();//当前火情 return(View()); }
/// <summary> /// 获取反馈火情相关数据 /// </summary> /// <param name="jcfid">监测火情id</param> /// <returns></returns> public static JCFireFKInfoModel GetFKFireInfoData(string jcfid) { DataTable dt = BaseDT.JC_FIRETICKLING.GetFKDT(jcfid);//获取反馈信息记录 JCFireFKInfoModel m = new JCFireFKInfoModel(); if (dt.Rows.Count == 1) { #region 监测火情信息 m.JC_FireData.JCFID = dt.Rows[0]["JCFID"].ToString(); m.JC_FireData.WXBH = dt.Rows[0]["WXBH"].ToString(); m.JC_FireData.DQRDBH = dt.Rows[0]["DQRDBH"].ToString(); m.JC_FireData.RSMJ = dt.Rows[0]["RSMJ"].ToString(); m.JC_FireData.JD = dt.Rows[0]["JCJD"].ToString(); m.JC_FireData.WD = dt.Rows[0]["JCWD"].ToString(); m.JC_FireData.RECEIVETIME = ClsSwitch.SwitTM(dt.Rows[0]["RECEIVETIME"].ToString()); m.JC_FireData.ISSUEDTIME = ClsSwitch.SwitTM(dt.Rows[0]["ISSUEDTIME"].ToString()); m.JC_FireData.ZQWZ = dt.Rows[0]["ZQWZ"].ToString(); m.JC_FireData.JCMANSTATE = dt.Rows[0]["JCMANSTATE"].ToString(); m.JC_FireData.FIRENAME = dt.Rows[0]["FIRENAME"].ToString(); m.JC_FireData.FIREFROMID = dt.Rows[0]["FIREFROMID"].ToString(); //火情原始id m.JC_FireData.FIREFROM = dt.Rows[0]["FIREFROM"].ToString(); m.JC_FireData.BYORGNO = dt.Rows[0]["XFORGNO"].ToString(); //下发单位 m.JC_FireData.FIRETIME = ClsSwitch.SwitTM(dt.Rows[0]["FIRETIME"].ToString()); m.JC_FireData.PFFLAG = dt.Rows[0]["PFFLAG"].ToString(); #endregion #region 火情反馈信息 m.JC_FireFKData.DL = dt.Rows[0]["DL"].ToString(); m.JC_FireFKData.FORESTNAME = dt.Rows[0]["FORESTNAME"].ToString(); m.JC_FireFKData.FORESTFIRETYPE = dt.Rows[0]["FORESTFIRETYPE"].ToString(); m.JC_FireFKData.FUELTYPE = dt.Rows[0]["FUELTYPE"].ToString(); m.JC_FireFKData.HOTTYPE = dt.Rows[0]["HOTTYPE"].ToString(); m.JC_FireFKData.CHECKTIME = ClsSwitch.SwitTM(dt.Rows[0]["CHECKTIME"].ToString()); m.JC_FireFKData.YY = dt.Rows[0]["YY"].ToString(); m.JC_FireFKData.JXHQSJ = dt.Rows[0]["JXHQSJ"].ToString(); m.JC_FireFKData.FIREBEGINTIME = ClsSwitch.SwitTM(dt.Rows[0]["FIREBEGINTIME"].ToString()); m.JC_FireFKData.FIREENDTIME = ClsSwitch.SwitTM(dt.Rows[0]["FIREENDTIME"].ToString()); m.JC_FireFKData.ISOUTFIRE = dt.Rows[0]["ISOUTFIRE"].ToString(); m.JC_FireFKData.BURNEDAREA = dt.Rows[0]["BURNEDAREA"].ToString(); m.JC_FireFKData.OVERDOAREA = dt.Rows[0]["OVERDOAREA"].ToString(); m.JC_FireFKData.LOSTFORESTAREA = dt.Rows[0]["LOSTFORESTAREA"].ToString(); m.JC_FireFKData.ELSELOSSINTRO = dt.Rows[0]["ELSELOSSINTRO"].ToString(); m.JC_FireFKData.FIREINTRO = dt.Rows[0]["FIREINTRO"].ToString(); m.JC_FireFKData.BYORGNO = dt.Rows[0]["BYORGNO"].ToString(); m.JC_FireFKData.MANUSERID = dt.Rows[0]["MANUSERID"].ToString(); m.JC_FireFKData.MANSTATE = dt.Rows[0]["MANSTATE"].ToString(); m.JC_FireFKData.MANTIME = dt.Rows[0]["MANTIME"].ToString(); m.JC_FireFKData.AUDITREASON = dt.Rows[0]["AUDITREASON"].ToString(); //审核不通过理由 m.JC_FireFKData.ADDRESS = dt.Rows[0]["ADDRESS"].ToString(); //实际发生地 //坐标偏移量计算 84坐标转火星坐标 string jd = string.IsNullOrEmpty(dt.Rows[0]["JD"].ToString()) ? dt.Rows[0]["JCJD"].ToString() : dt.Rows[0]["JD"].ToString(); //实际发生经度 string wd = string.IsNullOrEmpty(dt.Rows[0]["WD"].ToString()) ? dt.Rows[0]["JCWD"].ToString() : dt.Rows[0]["WD"].ToString(); //实际发生纬度 if (!string.IsNullOrEmpty(jd) && !string.IsNullOrEmpty(wd)) { double[] drr = ClsPositionTrans.GpsTransform(double.Parse(wd), double.Parse(jd), "1");//中心点偏移 m.JC_FireFKData.JD = drr[1].ToString(); m.JC_FireFKData.WD = drr[0].ToString(); } // m.JC_FireFKData.JD = string.IsNullOrEmpty(dt.Rows[0]["JD"].ToString()) ? dt.Rows[0]["JCJD"].ToString() : dt.Rows[0]["JD"].ToString();//实际发生经度 //m.JC_FireFKData.WD = string.IsNullOrEmpty(dt.Rows[0]["WD"].ToString()) ? dt.Rows[0]["JCWD"].ToString() : dt.Rows[0]["WD"].ToString();//实际发生纬度 #endregion //组织机构名 if (string.IsNullOrEmpty(m.JC_FireFKData.BYORGNO)) { m.JC_FireFKData.BYORGNO = SystemCls.getCurUserOrgNo(); } DataTable orgdt = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW() { ORGNO = m.JC_FireFKData.BYORGNO }); m.OrgName = BaseDT.T_SYS_ORG.getName(orgdt, m.JC_FireFKData.BYORGNO); //用户名 if (string.IsNullOrEmpty(m.JC_FireFKData.MANUSERID)) { m.JC_FireFKData.MANUSERID = SystemCls.getUserID(); } m.UserName = T_SYSSEC_IPSUSERCls.getModel(new T_SYSSEC_IPSUSER_SW() { USERID = m.JC_FireFKData.MANUSERID }).USERNAME; } dt.Clear(); dt.Dispose(); return(m); }
/// <summary> /// 二维整合页面 /// </summary> /// <returns></returns> public ActionResult Total2DIndex() { pubViewBag("030", "030", "二维护林员"); var CenterX = Request.Params["CenterX"]; var CenterY = Request.Params["CenterY"]; var CenterZ = Request.Params["CenterZ"]; if (string.IsNullOrEmpty(CenterX) == false && string.IsNullOrEmpty(CenterY) == false) { double[] arr = ClsPositionTrans.GpsTransform(double.Parse(CenterY), double.Parse(CenterX), "1"); CenterX = arr[1].ToString(); CenterY = arr[0].ToString(); } else { CenterX = ConfigCls.getConfigValue("Longitude"); CenterY = ConfigCls.getConfigValue("Latitude"); } if (string.IsNullOrEmpty(CenterZ) == false) { if (Convert.ToDouble(CenterZ) >= 571000) { CenterZ = "8"; } else if (Convert.ToDouble(CenterZ) >= 321000 && Convert.ToDouble(CenterZ) < 571000) { CenterZ = "9"; } else if (Convert.ToDouble(CenterZ) >= 138000 && Convert.ToDouble(CenterZ) < 321000) { CenterZ = "10"; } else if (Convert.ToDouble(CenterZ) >= 65000 && Convert.ToDouble(CenterZ) < 138000) { CenterZ = "11"; } else if (Convert.ToDouble(CenterZ) >= 37000 && Convert.ToDouble(CenterZ) < 65000) { CenterZ = "12"; } else if (Convert.ToDouble(CenterZ) >= 12600 && Convert.ToDouble(CenterZ) < 37000) { CenterZ = "13"; } else if (Convert.ToDouble(CenterZ) >= 5980 && Convert.ToDouble(CenterZ) < 12600) { CenterZ = "14"; } else if (Convert.ToDouble(CenterZ) >= 3700 && Convert.ToDouble(CenterZ) < 5980) { CenterZ = "15"; } else if (Convert.ToDouble(CenterZ) >= 2390 && Convert.ToDouble(CenterZ) < 3700) { CenterZ = "16"; } else if (Convert.ToDouble(CenterZ) >= 1096 && Convert.ToDouble(CenterZ) < 2390) { CenterZ = "17"; } else if (Convert.ToDouble(CenterZ) >= 635 && Convert.ToDouble(CenterZ) < 1096) { CenterZ = "18"; } else if (Convert.ToDouble(CenterZ) < 635) { CenterZ = "19"; } } else { CenterZ = "10"; } ViewBag.CenterX = CenterX; ViewBag.CenterY = CenterY; ViewBag.CenterZ = CenterZ; ViewBag.rights = T_SYSSEC_RIGHTCls.getRightStrByUID(new T_SYSSEC_IPSUSER_SW { USERID = SystemCls.getUserID() }); return(View()); }
/// <summary> /// 菜单 /// </summary> /// <returns></returns> public ActionResult Index() { pubViewBag("020002", "020002", "二维护林员"); var CenterX = Request.Params["CenterX"]; var CenterY = Request.Params["CenterY"]; var CenterZ = Request.Params["CenterZ"]; if (string.IsNullOrEmpty(CenterX) == false && string.IsNullOrEmpty(CenterY) == false) { double[] arr = ClsPositionTrans.GpsTransform(double.Parse(CenterY), double.Parse(CenterX), "1"); CenterX = arr[1].ToString(); CenterY = arr[0].ToString(); } else { CenterX = ConfigCls.getConfigValue("Longitude"); CenterY = ConfigCls.getConfigValue("Latitude"); } if (string.IsNullOrEmpty(CenterZ) == false) { if (Convert.ToDouble(CenterZ) >= 571000) { CenterZ = "8"; } else if (Convert.ToDouble(CenterZ) >= 321000 && Convert.ToDouble(CenterZ) < 571000) { CenterZ = "9"; } else if (Convert.ToDouble(CenterZ) >= 138000 && Convert.ToDouble(CenterZ) < 321000) { CenterZ = "10"; } else if (Convert.ToDouble(CenterZ) >= 65000 && Convert.ToDouble(CenterZ) < 138000) { CenterZ = "11"; } else if (Convert.ToDouble(CenterZ) >= 37000 && Convert.ToDouble(CenterZ) < 65000) { CenterZ = "12"; } else if (Convert.ToDouble(CenterZ) >= 12600 && Convert.ToDouble(CenterZ) < 37000) { CenterZ = "13"; } else if (Convert.ToDouble(CenterZ) >= 5980 && Convert.ToDouble(CenterZ) < 12600) { CenterZ = "14"; } else if (Convert.ToDouble(CenterZ) >= 3700 && Convert.ToDouble(CenterZ) < 5980) { CenterZ = "15"; } else if (Convert.ToDouble(CenterZ) >= 2390 && Convert.ToDouble(CenterZ) < 3700) { CenterZ = "16"; } else if (Convert.ToDouble(CenterZ) >= 1096 && Convert.ToDouble(CenterZ) < 2390) { CenterZ = "17"; } else if (Convert.ToDouble(CenterZ) >= 635 && Convert.ToDouble(CenterZ) < 1096) { CenterZ = "18"; } else if (Convert.ToDouble(CenterZ) < 635) { CenterZ = "19"; } } else { CenterZ = "10"; } ViewBag.CenterX = CenterX; ViewBag.CenterY = CenterY; ViewBag.CenterZ = CenterZ; ViewBag.rights = T_SYSSEC_RIGHTCls.getRightStrByUID(new T_SYSSEC_IPSUSER_SW { USERID = SystemCls.getUserID() }); string method = Request.Params["Method"]; string str = ViewBag.getPageMenuStr; ViewBag.getPageMenuStr = str.Replace("window.location.href='/Home/Index?Method=report&TID=1';", "getReport("1","0","火情")") .Replace("window.location.href='/Home/Index?Method=report&TID=2';", "getReport("2","0","病虫害")") .Replace("window.location.href='/Home/Index?Method=report&TID=3';", "getReport("3","0","盗砍盗伐")") .Replace("window.location.href='/Home/Index?Method=report&TID=4';", "getReport("4","0","安全隐患")") .Replace("window.location.href='/Home/Index?Method=collect&TID=1';", "getCollect("1","0","建筑物")") .Replace("window.location.href='/Home/Index?Method=collect&TID=2';", "getCollect("2","0","消防设施")") .Replace("window.location.href='/Home/Index?Method=collect&TID=3';", "getCollect("3","0","道路")") .Replace("window.location.href='/Home/Index?Method=collect&TID=4';", "getCollect("4","0","可燃物载量")") .Replace("window.location.href='/Home/Index';", "(getLonLat(""))") .Replace("window.location.href='/Home/Index?Method=dm';", "(GetDmFun())") .Replace("window.location.href='/Home/Index?Method=hot';", "(getHot("0"))") .Replace("window.location.href='/Home/Index?Method=alarm';", "(getAlarm("0"))") .Replace("window.location.href='/Home/Index?Method=dl';", "(GetElecFun())"); ViewBag.getPageMenuStr = ViewBag.getPageMenuStr; switch (method) { case "alarm": ViewBag.loadFunc = "getAlarm(\"0\")"; //一键报警 break; case "hot": ViewBag.loadFunc = "getHot(\"0\")"; //热点 break; case "report": //数据上报 var reportsw = new T_SYS_DICTSW(); reportsw.DICTTYPEID = "5"; reportsw.DICTVALUE = Request.Params["TID"]; var reportmodel = T_SYS_DICTCls.getModel(reportsw); ViewBag.loadFunc = "getReport(\"" + Request.Params["TID"] + "\",\"0\",\"" + reportmodel.DICTNAME + "\")"; //1 火情 2 病虫害 3 盗砍盗伐 //第一个参数是数据类型 第二个参数是处理状态 break; case "collect": //数据采集 var sw = new T_SYS_DICTSW(); sw.DICTTYPEID = "4"; sw.DICTVALUE = Request.Params["TID"]; var model = T_SYS_DICTCls.getModel(sw); ViewBag.loadFunc = "getCollect(\"" + Request.Params["TID"] + "\",\"0\",\"" + model.DICTNAME + "\")"; //第一个参数是数据类型 第二个参数是处理状态 第三个参数名字 break; default: ViewBag.loadFunc = "getLonLat(\"\")"; break; } string TID = Request.Params["TID"]; if (method == "report")//上报 { var sw = new T_SYS_DICTSW(); sw.DICTTYPEID = "5"; sw.DICTVALUE = TID; var model = T_SYS_DICTCls.getModel(sw); if (TID.Length == 1) { pubViewBag("00200" + TID, "00200" + TID, model.DICTNAME); } else if (TID.Length == 2) { pubViewBag("0020" + TID, "0020" + TID, model.DICTNAME); } else { pubViewBag("002" + TID, "002" + TID, model.DICTNAME); } } else if (method == "collect")//采集 { var sw = new T_SYS_DICTSW(); sw.DICTTYPEID = "4"; sw.DICTVALUE = TID; var model = T_SYS_DICTCls.getModel(sw); if (TID.Length == 1) { pubViewBag("00300" + TID, "00300" + TID, model.DICTNAME); } else if (TID.Length == 2) { pubViewBag("0030" + TID, "0030" + TID, model.DICTNAME); } else { pubViewBag("003" + TID, "003" + TID, model.DICTNAME); } } else if (method == "dm") { pubViewBag("001002", "001002", "点名管理"); } else if (method == "dl") { pubViewBag("001005", "001005", "电量查询"); } else if (method == "hot") { pubViewBag("001003", "001003", "热点追踪"); } else if (method == "alarm") { pubViewBag("001004", "001004", "报警管理"); } else { pubViewBag("001001", "001001", "巡查监控"); } ViewBag.Method = Request.Params["Method"]; //类别方法 用于GIS页面 ViewBag.TID = Request.Params["TID"]; //类别ID return(View()); }
/// <summary> /// 护林员上传 /// </summary> /// <param name="filePath">文件路径</param> public static void RELAYUpload(string filePath) { HSSFWorkbook hssfworkbook; try { using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { hssfworkbook = new HSSFWorkbook(file); } } catch (Exception e) { throw e; } NPOI.SS.UserModel.ISheet sheet = hssfworkbook.GetSheetAt(0); int rowCount = sheet.LastRowNum; for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++) { IRow row = sheet.GetRow(i); string[] arr = new string[12]; for (int k = 0; k < arr.Length; k++) { if (k != 7) { arr[k] = row.GetCell(k) == null ? "" : row.GetCell(k).ToString();//循环获取每一单元格内容 } else { arr[k] = row.GetCell(k).DateCellValue.ToString("yyyy-MM-dd"); } } DC_UTILITY_RELAY_Model m = new DC_UTILITY_RELAY_Model(); //单位 通讯方式 名称 编号 型号 使用现状 维护管理类型 建设日期 价值 地址 经度 纬度 if (string.IsNullOrEmpty(arr[0]) || string.IsNullOrEmpty(arr[2])) { continue; } m.BYORGNO = BaseDT.T_SYS_ORG.getCodeByName(arr[0]); m.NAME = arr[2]; m.NUMBER = arr[3]; m.MODEL = arr[4]; m.BUILDDATE = arr[7]; if (m.BUILDDATE == "9999-12-31") { m.BUILDDATE = "1900-01-01"; } m.WORTH = arr[8]; m.ADDRESS = arr[9]; string jd = arr[10]; string wd = arr[11]; if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false) { double[] brr = ClsPositionTrans.GpsTransform(double.Parse(wd), double.Parse(jd), "1"); m.JD = brr[1].ToString(); m.WD = brr[0].ToString(); } if (arr[5].Trim() == "在用")//使用类型 { m.USESTATE = "1"; } else if (arr[5].Trim() == "储存") { m.USESTATE = "2"; } else if (arr[5].Trim() == "报废") { m.USESTATE = "3"; } else { m.USESTATE = "1"; } if (arr[6].Trim() == "未维护")//维护管理类型 { m.MANAGERSTATE = "1"; } else if (arr[6].Trim() == "维护") { m.MANAGERSTATE = "2"; } else { m.MANAGERSTATE = "1"; } if (arr[1].Trim() == "短波")//通讯方式 { m.COMMUNICATIONWAY = "1"; } else if (arr[1].Trim() == "超短波") { m.COMMUNICATIONWAY = "2"; } else if (arr[1].Trim() == "微波") { m.COMMUNICATIONWAY = "3"; } else { m.COMMUNICATIONWAY = "1"; } var ms = BaseDT.DC_UTILITY_RELAY.Add(m); if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false) { TD_RELAY_Model m1 = new TD_RELAY_Model(); m1.OBJECTID = ms.Url; m1.NAME = m.NAME; m1.TYPE = m.COMMUNICATIONWAY; m1.JD = jd; m1.WD = wd; m1.Shape = "geometry::STGeomFromText('POINT(" + m1.JD + " " + m1.WD + ")',4326)"; BaseDT.SDE.TD_RELAY.Add(m1); } string a = row.GetCell(0).ToString(); string a1 = row.GetCell(1).ToString(); string a2 = row.GetCell(2).ToString(); } }
/// <summary> /// 护林员上传 /// </summary> /// <param name="filePath">文件路径</param> public static void EQUIPUpload(string filePath) { HSSFWorkbook hssfworkbook; try { using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { hssfworkbook = new HSSFWorkbook(file); } } catch (Exception e) { throw e; } NPOI.SS.UserModel.ISheet sheet = hssfworkbook.GetSheetAt(0); int rowCount = sheet.LastRowNum; for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++) { IRow row = sheet.GetRow(i); string[] arr = new string[12]; for (int k = 0; k < arr.Length; k++) { if (k != 6) { arr[k] = row.GetCell(k) == null ? "" : row.GetCell(k).ToString();//循环获取每一单元格内容 } else { arr[k] = row.GetCell(k).DateCellValue.ToString("yyyy-MM-dd"); } } DC_EQUIP_NEW_Model m = new DC_EQUIP_NEW_Model(); //单位 装备类型 名称 编号 型号 使用现状 购买年份 存储地点 数量 价值 经度 纬度 if (string.IsNullOrEmpty(arr[0]) || string.IsNullOrEmpty(arr[2])) { continue; } m.BYORGNO = BaseDT.T_SYS_ORG.getCodeByName(arr[0]); m.NAME = arr[2]; m.NUMBER = arr[3]; m.MODEL = arr[4]; m.BUYYEAR = arr[6]; if (m.BUYYEAR == "9999-12-31") { m.BUYYEAR = "1900-01-01"; } m.STOREADDR = arr[7]; m.EQUIPAMOUNT = arr[8]; m.WORTH = arr[9]; string jd = arr[10]; string wd = arr[11]; if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false) { double[] brr = ClsPositionTrans.GpsTransform(double.Parse(wd), double.Parse(jd), "1"); m.JD = brr[1].ToString(); m.WD = brr[0].ToString(); } if (arr[1].Trim() == "扑救类")//装备类型 { m.EQUIPTYPE = "1"; } else if (arr[1].Trim() == "阻隔类") { m.EQUIPTYPE = "2"; } else if (arr[1].Trim() == "防护类") { m.EQUIPTYPE = "3"; } else if (arr[1].Trim() == "通讯类") { m.EQUIPTYPE = "4"; } else if (arr[1].Trim() == "户外类") { m.EQUIPTYPE = "5"; } else if (arr[1].Trim() == "运输类") { m.EQUIPTYPE = "6"; } else { m.EQUIPTYPE = "1"; } if (arr[5].Trim() == "在用")//使用类型 { m.USESTATE = "1"; } else if (arr[5].Trim() == "储存") { m.USESTATE = "2"; } else if (arr[5].Trim() == "报废") { m.USESTATE = "3"; } else { m.USESTATE = "1"; } var ms = BaseDT.DC_EQUIP_NEW.Add(m); if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false) { TD_EQUIP_Model m1 = new TD_EQUIP_Model(); m1.OBJECTID = ms.Url; m1.NAME = m.NAME; m1.TYPE = m.EQUIPTYPE; m1.JD = jd; m1.WD = wd; m1.Shape = "geometry::STGeomFromText('POINT(" + m1.JD + " " + m1.WD + ")',4326)"; BaseDT.SDE.TD_EQUIP.Add(m1); } string a = row.GetCell(0).ToString(); string a1 = row.GetCell(1).ToString(); string a2 = row.GetCell(2).ToString(); } }
/// <summary> /// 转换为护林员巡检线和责任区 /// </summary> /// <returns></returns> public JsonResult ConvertHlyLineArea() { Message msg = new Message(false, "转化失败!", ""); string cid = Request.Params["cid"]; //采集id string hid = Request.Params["hid"]; //护林员id string htype = Request.Params["htype"]; //护林员转换类型 0 表是线 1 表示面 var sw = new T_IPSCOL_COLLECT_SW(); sw.COLLECTID = cid; var list = T_IPSCOL_COLLECTCls.getDetailModelList(sw); if (list.Any()) { string pointstr = string.Empty; int j = 0; string str = string.Empty; foreach (var item in list) { if (htype == "1")//面 特殊处理 { if (j == 0) { str = item.LONGITUDE + "," + item.LATITUDE + "|"; } } //pointstr += item.ORILONGITUDE + "," + item.ORILATITUDE + ",,|"; pointstr += item.LONGITUDE + "," + item.LATITUDE + "|"; j++; } pointstr += str; var m = new T_IPSFR_ROUTERAIL_Model();//巡检线和责任区 m.HID = hid; m.longitLatitList = pointstr; m.longitLatitList = m.longitLatitList.Replace("|", ", , |"); m.longitLatitList = m.longitLatitList + ";"; m.opMethod = "AddBatch"; m.ROADTYPE = htype; var ms = T_IPSFR_ROUTERAILCls.Manager(m); if (ms.Success) { string jd = ""; string wd = ""; string line = ""; string polygon = ""; //入三维空间库 #region 责任线 if (htype == "0") { m.longitLatitList = m.longitLatitList.Substring(0, m.longitLatitList.LastIndexOf(";")); m.longitLatitList = m.longitLatitList.Replace(",,", ""); if (!string.IsNullOrEmpty(m.longitLatitList)) { var result = T_IPSFR_USERCls.getListModel(new T_IPSFR_USER_SW { HID = hid }).FirstOrDefault(); //获取护林员信息 var m1 = new TD_DUTYROUTE_Model(); //三维责任路线模型 m1.opMethod = m.opMethod; m1.NAME = result.HNAME; m1.OBJECTID = result.HID; m1.ORGNAME = result.ORGNAME; m1.TELEPHONE = result.PHONE; string[] arr = m.longitLatitList.Split('|'); for (int i = 0; i < arr.Length; i++) { if (!string.IsNullOrEmpty(arr[i])) { string[] brr = arr[i].Split(','); double[] drr = ClsPositionTrans.GpsTransform(double.Parse(brr[1]), double.Parse(brr[0]), ConfigCls.getSDELonLatTransform());//坐标系转换 wd = drr[0].ToString(); jd = drr[1].ToString(); } if (i == arr.Length - 1)//最后一条记录 { line += jd + " " + wd; } else { line += jd + " " + wd + ","; } } #region 中心点获取 if (arr.Length % 2 == 0) { string[] crr = arr[arr.Length / 2].Split(','); double[] drr = ClsPositionTrans.GpsTransform(double.Parse(crr[1]), double.Parse(crr[0]), ConfigCls.getSDELonLatTransform()); m1.DISPLAY_X = drr[1].ToString(); m1.DISPLAY_Y = drr[0].ToString(); } else { string[] crr = arr[(arr.Length + 1) / 2].Split(','); double[] drr = ClsPositionTrans.GpsTransform(double.Parse(crr[1]), double.Parse(crr[0]), ConfigCls.getSDELonLatTransform());//中心点偏移 m1.DISPLAY_X = drr[1].ToString(); m1.DISPLAY_Y = drr[0].ToString(); } #endregion m1.Shape = "geometry::STGeomFromText('LINESTRING(" + line + ")',4326).MakeValid()"; DC_DUTYROUTECls.Manager(m1); } } #endregion #region 责任面 else { m.longitLatitList = m.longitLatitList.Substring(0, m.longitLatitList.LastIndexOf(";")); m.longitLatitList = m.longitLatitList.Replace(",,", ""); if (!string.IsNullOrEmpty(m.longitLatitList)) { var result = T_IPSFR_USERCls.getListModel(new T_IPSFR_USER_SW { HID = hid }).FirstOrDefault(); //获取护林员信息 var m2 = new TD_DUTYAREA_Model(); //三维责任区模型 m2.opMethod = m.opMethod; m2.NAME = result.HNAME; m2.OBJECTID = result.HID; m2.ORGNAME = result.ORGNAME; m2.TELEPHONE = result.PHONE; string[] arr = m.longitLatitList.Split('|'); for (int i = 0; i < arr.Length; i++) { if (!string.IsNullOrEmpty(arr[i])) { string[] brr = arr[i].Split(','); double[] drr = ClsPositionTrans.GpsTransform(double.Parse(brr[1]), double.Parse(brr[0]), ConfigCls.getSDELonLatTransform());//坐标系转换 wd = drr[0].ToString(); jd = drr[1].ToString(); } if (i == arr.Length - 1)//最后一条记录 { polygon += jd + " " + wd; } else { polygon += jd + " " + wd + ","; } } #region 中心点获取 if (arr.Length % 2 == 0) { string[] crr = arr[arr.Length / 2].Split(','); double[] drr = ClsPositionTrans.GpsTransform(double.Parse(crr[1]), double.Parse(crr[0]), ConfigCls.getSDELonLatTransform()); m2.DISPLAY_X = drr[1].ToString(); m2.DISPLAY_Y = drr[0].ToString(); } else { string[] crr = arr[(arr.Length + 1) / 2].Split(','); double[] drr = ClsPositionTrans.GpsTransform(double.Parse(crr[1]), double.Parse(crr[0]), ConfigCls.getSDELonLatTransform());//中心点偏移 m2.DISPLAY_X = drr[1].ToString(); m2.DISPLAY_Y = drr[0].ToString(); } #endregion m2.Shape = "geometry::STGeomFromText('Polygon((" + polygon + "))',4326).MakeValid()"; DC_DUTYAREACls.Manager(m2); } } msg = new Message(true, "转换成功!", ""); #endregion } } return(Json(msg)); }