Exemple #1
0
        /// <summary>
        /// 加载小层数据
        /// </summary>
        private void loading_oc_xcsj()
        {
            oc_xcsj.Clear();

            StringBuilder sql = new StringBuilder();

            sql.Append(" select * from oil_well_c ");
            sql.AppendFormat(" where jh = \"{0}\" ", tpjing.jh);
            sql.Append(" and stl <> 0 and syds <> 0 and skqk<>''");
            sql.Append(" order by syds ");
            DataTable dt = DbHelperOleDb.Query(sql.ToString()).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ccwx_xcsj_model model = new ccwx_xcsj_model();
                model.JH    = Unity.ToString(dt.Rows[i]["jh"]);
                model.YCZ   = Unity.ToString(dt.Rows[i]["ycz"]);
                model.XCH   = Unity.ToString(dt.Rows[i]["xch"]);
                model.XCXH  = dt.Rows[i]["xcxh"].ToString();
                model.YXHD  = Unity.ToDecimal(dt.Rows[i]["yxhd"]);
                model.STL   = Unity.ToDecimal(dt.Rows[i]["stl"]);
                model.HYBHD = Unity.ToDecimal(dt.Rows[i]["hybhd"]);
                model.fdd   = false;
                model.zzd   = false;
                oc_xcsj.Add(model);
            }
        }
Exemple #2
0
        /// <summary>
        /// 汇总计算
        /// </summary>
        /// <returns></returns>
        public ccwx_tpjing_model calculate()
        {
            if (tpjing == null)
            {
                return(null);
            }

            try
            {
                ccwx_xcsj_model xcsj = oc_xcsj.Where(p => p.Selected == true).First(); // 抛出异常:ArgumentNullException

                // 判断数值为 0 时,则返回空模型
                if (xcsj.STL == 0 || xcsj.zrfs == 0)
                {
                    return(null);
                }
                if ((tpjing.yxhd - tpjing.zzhd) == 0 || tpjing.zzhd == 0)
                {
                    return(null);
                }

                decimal k1, k1u, k1d;
                decimal k2, k2u, k2d;

                k1u = ((decimal)tpjing.zrfs - (decimal)tpjing.zzrfs) * xcsj.STL * xcsj.YXHD; // k1u = (zrfs - zzrfs) * kh
                k1d = (decimal)xcsj.zrfs * ((decimal)tpjing.yxhd - (decimal)tpjing.zzhd);    // k1d = zrfs * (yxhd - zzhd)
                k1  = k1u / k1d;                                                             // k1  = ((zrfs - zzrfs) * kh) / (zrfs * (yxhd - zzhd))

                k2u = (decimal)tpjing.zzrfs * xcsj.STL * xcsj.YXHD;                          // k2u = zzrfs * kh
                k2d = (decimal)xcsj.zrfs * (decimal)tpjing.zzhd;                             // k2d = zrfs * zzhd
                k2  = k2u / k2d;                                                             // k2  = (zzrfs * kh) / (zrfs * zzhd)

                return(new ccwx_tpjing_model()
                {
                    jh = tpjing.jh,
                    k1 = (double)k1,
                    k2 = (double)k2,
                    calculate_type = 2
                });
            }
            catch
            {
                return(null);
            }
        }