138 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			138 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Runtime.Serialization; | |||
|  | using System.ServiceModel; | |||
|  | using System.Text; | |||
|  | using System.ServiceModel.Web; | |||
|  | namespace DeiNiu.wms.win | |||
|  | { | |||
|  |     // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的接口名“IServiceLight”。 | |||
|  |     [ServiceContract] | |||
|  |     public interface IServiceLight | |||
|  |     { | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |            Method = "GET", | |||
|  |            RequestFormat = WebMessageFormat.Json, | |||
|  |            ResponseFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "turnOnLightById?id={id}" | |||
|  |            )] | |||
|  |         string turnOnLightById(int id); | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |            Method = "GET", | |||
|  |            RequestFormat = WebMessageFormat.Json, | |||
|  |            ResponseFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "turnOffLightById?id={id}" | |||
|  |            )] | |||
|  |         string turnOffLightById(int id); | |||
|  | 
 | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |            Method = "GET", | |||
|  |            RequestFormat = WebMessageFormat.Json, | |||
|  |            ResponseFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "getCarIp?car={carNo}" | |||
|  |            )] | |||
|  |         Cart getCarUrl(string carNo); | |||
|  | 
 | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |            Method = "GET", | |||
|  |            RequestFormat = WebMessageFormat.Json, | |||
|  |            ResponseFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "turnOnLight?id={id}&which={which}&port={port}" | |||
|  |            )] | |||
|  |         string turnOnLight(int id, byte which, int port); | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |            Method = "GET", | |||
|  |            RequestFormat = WebMessageFormat.Json, | |||
|  |            ResponseFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "turnOffLight?id={id}&which={which}&port={port}" | |||
|  |            )] | |||
|  |         string turnOffLight(int id, byte which, int port); | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |            Method = "GET", | |||
|  |            RequestFormat = WebMessageFormat.Json, | |||
|  |            ResponseFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "clearLables?port={port}&order={order}" | |||
|  |            )] | |||
|  |         void clearLables( int port,int order); | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |            Method = "GET", | |||
|  |            RequestFormat = WebMessageFormat.Json, | |||
|  |            ResponseFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "showLabelId?port={port}" | |||
|  |            )] | |||
|  |         void showLableId(int port); | |||
|  |          | |||
|  | 
 | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, | |||
|  |             UriTemplate = "lightLabels")] | |||
|  |         string lightLabels(List<ELabel> labels); | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, | |||
|  |             UriTemplate = "resetPort")] | |||
|  |         string resetLabels(int port); | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |            Method = "POST", | |||
|  |            RequestFormat = WebMessageFormat.Json, | |||
|  |            ResponseFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "testpost" | |||
|  |            )] | |||
|  |         ELabel testPost(ELabel label); | |||
|  | 
 | |||
|  |          | |||
|  |        /* [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, | |||
|  |             UriTemplate = "printMsg")] | |||
|  |         */ | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |           Method = "GET", | |||
|  |           RequestFormat = WebMessageFormat.Json, | |||
|  |           ResponseFormat = WebMessageFormat.Json, | |||
|  |           UriTemplate = "printMsg?msg={msg}" | |||
|  |           )] | |||
|  |         void printMsg(string msg); | |||
|  | 
 | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, | |||
|  |             UriTemplate = "lightOn")] | |||
|  |         string lightOn(List<ELight> lights); | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, | |||
|  |             UriTemplate = "lightOff")] | |||
|  |         string lightOff(List<ELight> lights); | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "labelOff")] | |||
|  |         string labelOff(List<ELabel> labels); | |||
|  |     } | |||
|  | 
 | |||
|  |     [DataContract] | |||
|  |     public class Cart | |||
|  |     { | |||
|  |         [DataMember] | |||
|  |         public string carNo { get; set; } | |||
|  |         [DataMember] | |||
|  |         public string ip { get; set; } | |||
|  |     } | |||
|  | } |