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 PreStorageScaleService
    {
        /// <summary>
        /// 平台默认查询接口，0表示get接口
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<List<PreStorageScale>> doQueryWf(PreStorageScale info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<PreStorageScale>>> rm = db.doOption<PageList<List<PreStorageScale>>>("prestoragescales", "/", new object[] { info }, 0);

            RESTfulResult<List<PreStorageScale>> result = new RESTfulResult<List<PreStorageScale>>();
            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<PreStorageScale>> doQueryTenWf(PreStorageScale info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<List<PreStorageScale>> rm = db.doOption<List<PreStorageScale>>("prestoragescales", "doQueryWf", new object[] { info }, 0);
            return rm;
        }


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


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