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

namespace Common
{
    /// <summary>
    /// 皮带秤预报表相关接口
    /// </summary>
    public class PreBeltScalePreService
    {
        /// <summary>
        /// 平台默认查询接口，0表示get接口
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<List<PreBeltScaleForecast>> doQueryWf(PreBeltScaleForecast info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<PreBeltScaleForecast>>> rm = db.doOption<PageList<List<PreBeltScaleForecast>>>("prebeltscales", "/", new object[] { info }, 0);

            RESTfulResult<List<PreBeltScaleForecast>> result = new RESTfulResult<List<PreBeltScaleForecast>>();
            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<PreBeltScaleForecast>> doQueryTenWf(CommonPage<PreBeltScaleForecast> info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<List<PreBeltScaleForecast>> rm = db.doOption<List<PreBeltScaleForecast>>("prebeltscales", "doQueryLikeInfo", new object[] { info }, 1);
            return rm;
        }

        //皮带秤预报查询 like
        public RESTfulResult<List<PreBeltScaleForecast>> doQueryWflike(CommonPage<PreBeltScaleForecast> info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<List<PreBeltScaleForecast>> rm = db.doOption<List<PreBeltScaleForecast>>("prebeltscales", "doQueryWflike", new object[] { info }, 1);
            return rm;
        }




        /// <summary>
        /// 成品秤预报数据保存
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<string> doAddBeltScalePrediction(PreBeltScaleForecast lt)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("prebeltscales", "doAddBeltScalePrediction", new object[] { lt }, 1);
            return rm;
        }


        /// <summary>
        /// 成品秤预报数据更新
        /// </summary>
        /// <param name="lt"></param>
        /// <returns></returns>
        public RESTfulResult<string> doUpdateWf(PreBeltScaleForecast lt)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("prebeltscales", "doUpdateWf", new object[] { lt }, 1);
            return rm;
        }

        /// <summary>
        /// 成品秤预报数据更新状态
        /// </summary>
        /// <param name="lt"></param>
        /// <returns></returns>
        public RESTfulResult<int> doUpdateFlags(List<PreBeltScaleForecast> lt)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<int> rm = db.doOption<int>("prebeltscales", "doUpdateFlags", new object[] { lt }, 1);
            return rm;
        }
    }
}
