示例#1
0
        /// <summary>
        /// 获取井位信息
        /// </summary>
        /// <param name="table_name">
        ///     water_well_month : 水井表
        ///     oil_well_month   : 油井表
        /// </param>
        /// <returns></returns>
        public ObservableCollection <zcjz_well_model> get_wells(string table_name)
        {
            /*  select distinct ww.jh, zzbx, hzby, mdczzbx, mdchzby
             *  from water_well_month as ww, well_status as w
             *  where ww.jh = w.jh
             *  order by ww.jh
             */

            StringBuilder sql = new StringBuilder();

            sql.Append(" select distinct ww.jh, w.zb_x, w.zb_y ");
            sql.AppendFormat(" from {0} as ww, well_status as w ", table_name);
            sql.Append(" where ww.zt=0 and ww.jh = w.jh ");
            sql.Append(" order by ww.jh ");
            DataTable dt = DbHelperOleDb.Query(sql.ToString()).Tables[0];

            ObservableCollection <zcjz_well_model> wells = new ObservableCollection <zcjz_well_model>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                zcjz_well_model model = new zcjz_well_model();
                model.JH   = Unity.ToString(dt.Rows[i]["jh"]);
                model.ZB_X = Unity.ToDouble(dt.Rows[i]["zb_x"]);
                model.ZB_Y = Unity.ToDouble(dt.Rows[i]["zb_y"]);
                wells.Add(model);
            }

            return(wells);
        }
示例#2
0
 private void Dg_well_group_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
 {
     foreach (var item in dg_well_group.SelectedItems)
     {
         zcjz_well_model well = Unity.ToModel <zcjz_well_model>(item);
         bll.auxiliary_datagrid_oil_wells(well);
     }
     //zcjz_well_model well = Unity.ToModel<zcjz_well_model>(dg_well_group.SelectedItem);
     //bll.auxiliary_datagrid_oil_wells(well);
 }
示例#3
0
        /// <summary>
        /// 两井间的距离计算
        /// </summary>
        /// <param name="well1"></param>
        /// <param name="well2"></param>
        /// <returns></returns>
        private double get_distance(zcjz_well_model well1, zcjz_well_model well2)
        {
            decimal x1 = Convert.ToDecimal(well1.ZB_X);
            decimal y1 = Convert.ToDecimal(well1.ZB_Y);
            decimal x2 = Convert.ToDecimal(well2.ZB_X);
            decimal y2 = Convert.ToDecimal(well2.ZB_Y);

            decimal x = x1 - x2;
            decimal y = y1 - y2;

            return(Math.Sqrt((double)(x * x + y * y)));

            //return Math.Sqrt(Math.Pow((double)x, 2) + Math.Pow((double)y, 2));
        }
示例#4
0
 /// <summary>
 /// 辅助 Datagrid 的油井集操作,将选中的井组的油井,在油井列表中的选中状态为真
 /// </summary>
 public void auxiliary_datagrid_oil_wells(zcjz_well_model well)
 {
     foreach (zcjz_well_model ow in oc_oil_well)
     {
         if (well.oil_wells != null && well.oil_wells.Contains(ow.JH))
         {
             ow.Selected = true;
         }
         else
         {
             ow.Selected = false;
         }
     }
 }
示例#5
0
        /// <summary>
        /// 每个油井以水井为中心,逆时针排序
        /// </summary>
        /// <param name="water_well"></param>
        /// <param name="oil_wells"></param>
        /// <returns></returns>
        private string oil_wells_sort(zcjz_well_model water_well, List <zcjz_well_model> oil_wells)
        {
            List <zcjz_well_model> gt_y = new List <zcjz_well_model>();
            List <zcjz_well_model> lt_y = new List <zcjz_well_model>();

            foreach (zcjz_well_model well in oil_wells)
            {
                if ((well.ZB_Y - water_well.ZB_Y) > 0)
                {
                    gt_y.Add(well);
                }
                if ((well.ZB_Y - water_well.ZB_Y) < 0)
                {
                    lt_y.Add(well);
                }
            }

            //gt_y = gt_y.OrderByDescending(p => p.zb_x).ToList();
            //lt_y = lt_y.OrderBy(p => p.zb_x).ToList();
            return(string.Join(",", gt_y.OrderByDescending(p => p.ZB_X).Concat(lt_y.OrderBy(p => p.ZB_X)).Select(p => p.JH).ToArray()));
        }