using com.hnshituo.core.webapp.vo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public class PreRailwayScaleService
    {
        /// <summary>
        /// 根据预报编号查数据
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<List<PreRailwayScale>> doQueryWf(PreRailwayScale info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<PreRailwayScale>>> rm = db.doOption<PageList<List<PreRailwayScale>>>("prerailwayscales", "/", new object[] { info }, 0);

            RESTfulResult<List<PreRailwayScale>> result = new RESTfulResult<List<PreRailwayScale>>();
            result.Succeed = rm.Succeed;
            result.Status = rm.Status;
            result.Message = rm.Message;
            result.ResultMessage = rm.ResultMessage;
            result.Code = rm.Code;
            if (rm.Data != null && rm.Data.list != null && rm.Data.list.Count > 0)
            {
                result.Data = rm.Data.list;
            }

            return result;
        }

        /// <summary>
        /// 按照时间查询预报数据；
        /// 默认查询value_flage in ('1','4');startTime  endTime
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<List<PreRailwayScale>> doQueryWfTime(PreRailwayScale info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<PreRailwayScale>>> rm = db.doOption<PageList<List<PreRailwayScale>>>("prerailwayscales", "doQueryWf", new object[] { info }, 0);

            RESTfulResult<List<PreRailwayScale>> result = new RESTfulResult<List<PreRailwayScale>>();
            result.Succeed = rm.Succeed;
            result.Status = rm.Status;
            result.Message = rm.Message;
            result.ResultMessage = rm.ResultMessage;
            result.Code = rm.Code;
            if (rm.Data != null && rm.Data.list != null && rm.Data.list.Count > 0)
            {
                result.Data = rm.Data.list;
            }

            return result;
        }


        /// <summary>
        /// 根据车号查所有有效预报编 正使用，待使用
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<List<PreRailwayScale>> doQueryTenWf(PreRailwayScale info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<List<PreRailwayScale>> rm = db.doOption<List<PreRailwayScale>>("prerailwayscales", "doQueryByCar", new object[] { info }, 0);
            return rm;
        }

        /// <summary>
        /// 根据车号查所有有效预报编 正使用，待使用
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<List<PreRailwayScale>> doQueryJLByCar(PreRailwayScale info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<List<PreRailwayScale>> rm = db.doOption<List<PreRailwayScale>>("prerailwayscales", "doQueryJLByCar", new object[] { info }, 0);
            return rm;
        }
    }
}
