using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using MesWork;

namespace CentralControl
{
    internal class CALL_Interfalce_WebAPI
    {
        public static ResponseBody_WebAPI_Boms Get_BOMs_ByWebAPI(string lineid, string productcode)
        {
            var m_msgRequest = new RequestBody_WebAPI_Boms
            {
                lineId = lineid,
                productCode = productcode
            };

            return RequestPost_Boms_AMS_To_SAP(m_msgRequest);
        }
        public static ResponseBody_WebAPI_Boms RequestPost_Boms_AMS_To_SAP(RequestBody_WebAPI_Boms m_msg)
        {
            var demoData = JsonConvert.SerializeObject(m_msg);
            return JsonConvert.DeserializeObject<ResponseBody_WebAPI_Boms>(HttpCli.Post(MesWorkForm.WebAPI_Url_Boms, demoData));

            //var Gen_ProductPlan = File.ReadAllText("C:\\项目\\AMS计划下达.json");
            //return JsonConvert.DeserializeObject<ResponseBody_WebAPI_Boms>(Gen_ProductPlan);
        }

        public static ResponseBody_WebAPI_Boms RequestPost_UploadMeasureData_To_SAP(string demoData)
        {
            return JsonConvert.DeserializeObject<ResponseBody_WebAPI_Boms>(HttpCli.Post(MesWorkForm.WebAPI_Url_Quality, demoData));
        }
    }

}
