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 MeterWorkRailwayActFirstService
    {
        /// <summary>
        /// 根据预报编号查数据
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<List<MeterWorkRailwayActFirst>> doQueryWf(MeterWorkRailwayActFirst info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<MeterWorkRailwayActFirst>>> rm = db.doOption<PageList<List<MeterWorkRailwayActFirst>>>("meterworkrailwayactfirsts", "/", new object[] { info }, 0);

            RESTfulResult<List<MeterWorkRailwayActFirst>> result = new RESTfulResult<List<MeterWorkRailwayActFirst>>();
            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;
        }

        public RESTfulResult<List<MeterWorkRailwayActFirst>> doQueryMoWf(MeterWorkRailwayActFirst info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<MeterWorkRailwayActFirst>>> rm = db.doOption<PageList<List<MeterWorkRailwayActFirst>>>("meterworkrailwayactfirsts", "doQueryWf", new object[] { info }, 0);

            RESTfulResult<List<MeterWorkRailwayActFirst>> result = new RESTfulResult<List<MeterWorkRailwayActFirst>>();
            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<MeterWorkRailwayActFirst>> doQuerySelectSta(MeterWorkRailwayActFirst info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<MeterWorkRailwayActFirst>>> rm = db.doOption<PageList<List<MeterWorkRailwayActFirst>>>("meterworkrailwayactfirsts", "selectSta", new object[] { info }, 0);

            RESTfulResult<List<MeterWorkRailwayActFirst>> result = new RESTfulResult<List<MeterWorkRailwayActFirst>>();
            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<string> doAddWfStatic(MeterWorkRailwayActFirst info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("meterworkrailwayactfirsts", "doAddWfStatic", new object[] { info }, 1);
            return rm;
        }

        /// <summary>
        /// 静态轨道衡复磅保存方法
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<string> doAddWfRecover(MeterWorkRailwayActFirst info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("meterworkrailwayactfirsts", "doAddWfRecover", new object[] { info }, 1);
            return rm;
        }


        /// <summary>
        /// 动态轨道衡新增
        /// </summary>
        /// <param name="prs">预报信息</param>
        /// <param name="info">计量数据</param>
        /// <returns></returns>
        public RESTfulResult<string> doAddMotoriaWf(PreRailwayScale prs, List<MeterWorkRailwayActFirst> info, MeterBaseRailwayWeight baseWeight)
        {
            DbHelper db = new DbHelper();
            PbSomeModel<PreRailwayScale, List<MeterWorkRailwayActFirst>, MeterBaseRailwayWeight, MeterBaseRailwayWeight> pbSomeModel = new PbSomeModel<PreRailwayScale, List<MeterWorkRailwayActFirst>, MeterBaseRailwayWeight, MeterBaseRailwayWeight>();
            pbSomeModel.one = prs;
            pbSomeModel.two = info;
            pbSomeModel.three = baseWeight;
            RESTfulResult<string> rm = db.doOption<string>("meterworkrailwayactfirsts", "doAddMotoriaWf", new object[] { pbSomeModel }, 1);
            return rm;
        }

        public RESTfulResult<string> doEditMotoriaWf(List<MeterWorkRailwayActual> lmwrf)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("meterworkrailwayactfirsts", "doEditMotoriaWf", new object[] { lmwrf }, 1);
            return rm;
        }
    }
}
