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

namespace MeterConditionLibrary
{
    /// <summary>
    /// 验证门岗进厂的数据：返回空则说明已有进厂记录，允许计量
    /// </summary>
    public class validDoorPost
    {
        public bool ValidMethod(PreTrackScale scale)
        {
            //若计量员记录则不验证，则为true
            if (PbCache.isNotValid)
            {
                return true;
            }
            TmsExecuteAService service = new TmsExecuteAService();
            TmsExecuteA info = new TmsExecuteA();
            info.carLicense = scale.carNo;
            info.predictionNo= scale.predictionNo;
            RESTfulResult<string> rmR = service.doQueryExecute(info);
            if (rmR.Succeed)
            {
                //验证门岗进厂的数据：返回空则说明已有进厂记录，允许计量
                if (rmR.Data.ToUpper().Equals("TRUE"))
                {
                    return true;
                }
                else
                {
                    PbCache.ResultMessage = rmR.Data;
                    return false;
                }
            }
            else
            {
                PbCache.ResultMessage = "获取门岗进厂数据失败！";
                return false;
            }
        }
    }
}
