IService.cs 2.2 KB
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Threading.Tasks;
using System.Web.UI;
using System.Xml.Linq;
using System.Runtime.Serialization;
namespace OnlineStore.DeviceLibrary.ESS
{
    [ServiceContract(Name = "Service")]
    internal interface IService
    {
        [OperationContract]
        [WebInvoke(UriTemplate = "/conveyor/loadContainerFinish", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        Result loadContainerFinish(Stream stream);

        [OperationContract]
        [WebInvoke(UriTemplate = "/conveyor/unloadContainerFinish", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        Result unloadContainerFinish(Stream stream);

        [OperationContract]
        [WebInvoke(UriTemplate = "/conveyor/unloadContainerReq", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        Result unloadContainerReq(Stream stream);
        [OperationContract]
        [WebInvoke(UriTemplate = "task/callback", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        Result taskCallBack(Stream stream);
        [OperationContract]
        [WebInvoke(UriTemplate = "/exception/callback", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        Result exceptionCallBack(Stream stream);
    }

    [DataContract]
    internal class Result
    {
        /// <summary>
        /// 状态码,0为正常
        /// </summary>
        [DataMember]
        public int code { get; set; } = 0;
        /// <summary>
        /// 返回数据
        /// </summary>
        [DataMember]
        public Allow data { get; set; }
        /// <summary>
        /// 提示信息
        /// </summary>
        [DataMember]
        public string msg { get; set; } = "ok";

    }
    public class Allow
    {
        public bool allow { get; set; }
    }
}