/// <summary> /// 汇总计算调剖层相关信息,并返回一个调剖层实体 /// </summary> /// <returns></returns> public tpc_model calculate_tpc() { // 拟调层数据 List <tpc_xcsj_model> list = oc_xcsj.Where(p => p.ntc == 1).ToList(); tpc_xcsj_model first_model = list.First(); tpc_xcsj_model last_model = list.Last(); double yxhd = (double)list.Sum(p => p.YXHD); double dcxs_ntc = list.Sum(p => p.dcxs); double dcxs_sum = oc_xcsj.Sum(x => x.dcxs); // 拟堵段数据(条件查询:拟调层和拟堵段) List <tpc_xcsj_model> list_ndd = oc_xcsj.Where(p => p.ntc == 1 && p.ndd == 1).ToList(); double dcxs_ndd = list_ndd.Sum(p => p.dcxs); double yxhd_ndd = (double)list_ndd.Sum(p => p.YXHD); // 返回调剖层实体 return(new tpc_model() { jh = tpc.jh, cd = first_model.YCZ + " " + first_model.XCH + " " + first_model.XCXH + "~" + last_model.YCZ + " " + last_model.XCH + " " + last_model.XCXH, yxhd = yxhd, yxhd_ds = (double)first_model.SYDS, zrfs = dcxs_ntc / dcxs_sum * 100, zzhd = yxhd - yxhd_ndd, zzbl = yxhd == 0 ? 0 : (yxhd - yxhd_ndd) / yxhd, zzrfs = (dcxs_ntc - dcxs_ndd) / dcxs_sum * 100, bs_string = "小层数据" }); }
/// <summary> /// 获取调剖层数据,根据被选中调剖层的井号获取数据 /// </summary> public void get_tpc_xcsj() { oc_xcsj.Clear(); StringBuilder sql = new StringBuilder(); sql.Append(" select * from oil_well_c "); sql.AppendFormat(" where jh=\"{0}\" ", tpc.jh); sql.Append(" and syds <> 0 and stl <> 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++) { tpc_xcsj_model model = new tpc_xcsj_model(); model.JH = Unity.ToString(dt.Rows[i]["jh"]); model.YCZ = Unity.ToString(dt.Rows[i]["ycz"]); model.YCZ = Unity.ToString(dt.Rows[i]["ycz"]); model.XCH = Unity.ToString(dt.Rows[i]["xch"]); model.XCXH = Unity.ToString(dt.Rows[i]["xcxh"]); model.SYDS = Unity.ToDecimal(dt.Rows[i]["syds"]); model.YXHD = Unity.ToDecimal(dt.Rows[i]["yxhd"]); model.STL = Unity.ToDecimal(dt.Rows[i]["stl"]); model.dcxs = (double)(model.YXHD * model.STL); oc_xcsj.Add(model); } }