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 MeterBaseBeltMaterialpmService
    {
          public RESTfulResult<List<MeterBasemeterMaterialpm>> doQueryWf(MeterBasemeterMaterialpm info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<MeterBasemeterMaterialpm>>> rm = db.doOption<PageList<List<MeterBasemeterMaterialpm>>>("meterbasebeltmaterialpms", "/", new object[] { info }, 0);

            RESTfulResult<List<MeterBasemeterMaterialpm>> result = new RESTfulResult<List<MeterBasemeterMaterialpm>>();
            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;
        }
        //皮带秤预报查询 like
        public RESTfulResult<List<MeterBasemeterMaterialpm>> doQueryByBeltType(CommonPage<PreBeltScaleForecast> info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<List<MeterBasemeterMaterialpm>> rm = db.doOption<List<MeterBasemeterMaterialpm>>("meterbasebeltmaterialpms", "doQueryByBeltType", new object[] { info }, 1);
            return rm;
        }


        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<string> doAddBeltScalePrediction(MeterBasemeterMaterialpm lt)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("meterbasebeltmaterialpms", "doAddMaterialPm", new object[] { lt }, 1);
            return rm;
        }


        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="lt"></param>
        /// <returns></returns>
        public RESTfulResult<string> doUpdateWf(MeterBasemeterMaterialpm lt)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("meterbasebeltmaterialpms", "updateMaterialPm", new object[] { lt }, 1);
            return rm;
        }

        /// <summary>
        /// 更新状态
        /// </summary>
        /// <param name="lt"></param>
        /// <returns></returns>
        public RESTfulResult<int> doUpdateFlags(List<MeterBasemeterMaterialpm> lt)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<int> rm = db.doOption<int>("meterbasebeltmaterialpms", "doUpdateFlags", new object[] { lt }, 1);
            return rm;
        }


    }
}
