IService.cs
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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/containerArrived", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result containerArrived(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/task/create", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
ServerData1 createTask(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/task/cancel", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
ServerData1 cancelTask(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";
}
[DataContract]
public class ServerData1
{
[DataMember]
public int code { get; set; }
[DataMember]
public string msg { get; set; }
[DataMember]
public Dictionary<string, object> data { get; set; }
}
public class Allow
{
public bool allow { get; set; }
}
}