| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using Microsoft.AspNetCore.Mvc;
- using WCS.Core;
- using WCS.WorkEngineering.Systems;
- namespace WCS.WorkEngineering.WebApi.Controllers
- {
- /// <summary>
- /// WCS相关接口控制器
- /// </summary>
- [ApiController]
- [Route("api/[controller]/[action]")]
- public class WcsController : ControllerBase, IDeviceWriter
- {
- /// <summary>
- /// 设备信息写入接口
- /// </summary>
- /// <param name="deviceType">需要写入信息的设备类型</param>
- /// <param name="devCode">设备编号</param>
- /// <param name="protocol">设备协议类名</param>
- /// <param name="propName">写入字段名</param>
- /// <param name="value">值</param>
- [HttpPost]
- public void Write(DeviceTypeEnum deviceType, string devCode, string protocol, string propName, string value)
- {
- World.GetSystemInstance<DeviceWriteSystem>().Invoke(new DeviceWriteInfo
- {
- DeviceType = deviceType,
- Code = devCode,
- Protocol = protocol,
- Property = propName,
- Value = value
- });
- }
- /// <summary>
- /// 获取设备配置信息接口
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public List<Device> GetDeviceList()
- {
- return Device.All.ToList();
- }
- }
- public interface IDeviceWriter
- {
- [HttpPost]
- void Write(DeviceTypeEnum deviceType, string devCode, string protocol, string propName, string value);
- }
- }
|