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

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

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

        /// <summary>
        /// 检化验计量后，进行卸货单位修改
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<string> updateLoadInfoFroInterface(PreTrackScale info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("appservice/pretrackscales", "updateLoadInfoFroInterface", new object[] { info }, 1);
            return rm;
        }

        #region JISCO特殊接口
        /// <summary>
        /// 根据车号查询委托表中未使用和使用中的委托
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<List<PreTrackScale>> doQueryByFlag(PreTrackScale info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<List<PreTrackScale>> rm = db.doOption<List<PreTrackScale>>("pretrackscales", "/queryByFlag", new object[] { info }, 1);

            return rm;
        }
        #endregion
    }
}
