Ejemplo n.º 1
0
        /// <summary>
        /// 数据采集处理
        /// </summary>
        /// <param name="m">参见模型T_COLLECTLINES_Model</param>
        /// <returns>参见模型Message</returns>
        public static Message Manager(T_COLLECTLINES_Model m)
        {
            if (m.opMethod == "ADD")
            {
                T_COLLECTLINES_SW sw = new T_COLLECTLINES_SW();
                var id = BaseDT.T_COLLECTLINES.GetLineMaxObjID();
                sw.OBJECTID = Convert.ToInt32(id) + 1;
                sw.NAME     = m.NAME;
                sw.TypeId   = m.TypeId;
                sw.Shape    = m.Shape;
                SystemCls.LogSave("11", "空间线:" + m.NAME, ClsStr.getModelContent(m));
                Message msgUser = BaseDT.T_COLLECTLINES.AddLines(sw);
                return(new Message(msgUser.Success, msgUser.Msg, ""));
            }

            return(new Message(false, "无效操作", ""));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 采集管理
        /// </summary>
        /// <returns>参见模型</returns>
        public JsonResult SaveCollectDataAjax()
        {
            string cid      = Request.Params["cid"];
            string describe = Request.Params["describe"];
            string result   = Request.Params["result"];
            string typeid   = Request.Params["typeid"];
            string state    = Request.Params["state"];

            if (string.IsNullOrEmpty(cid))
            {
                return(Json(new Message(false, "cid参数传递失败", "")));
            }
            var m = new T_IPSCOL_COLLECT_Model();

            m.opMethod    = "Man";
            m.COLLECTID   = cid;
            m.MANUSERID   = SystemCls.getUserID();
            m.MANRESULT   = result;
            m.COLLECTNAME = describe;
            var ms  = T_IPSCOL_COLLECTCls.Manager(m);
            var sde = System.Configuration.ConfigurationManager.AppSettings["IsInsertSDE"].ToString();

            if (sde == "1")
            {
                #region 空间数据库
                //空间数据库处理
                if (state != "1")      //1表示已处理
                {
                    if (typeid != "3") //非线类型
                    {
                        T_IPSCOL_COLLECT_SW sw = new T_IPSCOL_COLLECT_SW();
                        sw.COLLECTID = cid;
                        var reocrdlist = T_IPSCOL_COLLECTCls.getDetailModelList(sw);
                        if (reocrdlist.Any())
                        {
                            var point = reocrdlist.OrderByDescending(p => p.COLLECTTIME).FirstOrDefault();
                            T_COLLECTPOINTS_Model pointmodel = new T_COLLECTPOINTS_Model();//点
                            pointmodel.TypeId = Convert.ToInt32(typeid);
                            pointmodel.NAME   = m.COLLECTNAME;
                            //POINT (117.14508056640625 31.764892578125)
                            //geometry::STGeomFromText('POINT(103.397553 23.365441)',4326)
                            pointmodel.Shape    = " POINT (" + point.LONGITUDE + " " + point.LATITUDE + ")";
                            pointmodel.opMethod = "ADD";
                            T_COLLECTPOINTSCls.Manager(pointmodel);
                        }
                    }
                    else//线
                    {
                        T_IPSCOL_COLLECT_SW sw = new T_IPSCOL_COLLECT_SW();
                        sw.COLLECTID = cid;
                        var reocrdlist = T_IPSCOL_COLLECTCls.getDetailModelList(sw);
                        if (reocrdlist.Any())
                        {
                            string line = "";
                            int    i    = 0;
                            foreach (var item in reocrdlist)
                            {
                                if (i == reocrdlist.Count() - 1)//最后一条记录
                                {
                                    line += item.LONGITUDE + " " + item.LATITUDE;
                                }
                                else
                                {
                                    line += item.LONGITUDE + " " + item.LATITUDE + ",";
                                }
                                i++;
                            }

                            T_COLLECTLINES_Model linemodel = new T_COLLECTLINES_Model();//线
                            linemodel.TypeId = Convert.ToInt32(typeid);
                            linemodel.NAME   = m.COLLECTNAME;
                            //LINESTRING (116.9428721060001 31.786694108000063, 117.22840742700009 31.74386381000005)
                            //geometry::STGeomFromText()
                            linemodel.Shape    = "geometry::STGeomFromText('LINESTRING (" + line + ")',4326)";
                            linemodel.opMethod = "ADD";
                            T_COLLECTLINESCls.Manager(linemodel);
                        }
                    }
                }
                #endregion
            }
            return(Json(ms));
        }