using System.Net.Http;
using System.Text;
using System.Web.Http;
using Newtonsoft.Json.Linq;

namespace MisDataSaveDate
{
    public class IpcController : ApiController
    {
        readonly string headUrl = "Project/";

        [HttpPost]
        [Route("OnlineCheckData")]
        public HttpResponseMessage ReceiveMomPlanData([FromBody] JToken jobj)
        {
            var url = Request.RequestUri.ToString();
            return new HttpResponseMessage
            {
                Content = new StringContent(Analysis_MOM_Msg.OnlineCheckData(url, jobj.ToString()), Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }


        [HttpPost]
        [Route("OnlineCheckDataCount")]
        public HttpResponseMessage OnlineCheckDataCount([FromBody] JObject jobj)
        {

            return new HttpResponseMessage
            {
                Content = new StringContent(Analysis_MOM_Msg.OnlineCheckDataCount(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }

        /// <summary>
        /// 这个不是量产线的接口
        /// </summary>
        /// <param name="jobj"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ReceivePrintTask")]
        public HttpResponseMessage ReceivePrintTask([FromBody] JObject jobj)
        {
            return new HttpResponseMessage
            {
                Content = new StringContent(Analysis_MOM_Msg.ReceivePrintTask(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }
    }
}
