| | |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseController; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | |
| | | namespace WIDESEAWCS_Server.Controllers.QuartzJob |
| | |
| | | { |
| | | public DeviceProtocolController(IDeviceProtocolService service) : base(service) |
| | | { |
| | | |
| | | } |
| | | [HttpPost, Route("GetImportData"), AllowAnonymous] |
| | | public WebResponseContent GetImportData(List<IFormFile> fileInput) |
| | |
| | | dt_Devices.Add(dt_DeviceProtoco9); |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | foreach (var deviceProtocol in dt_Devices) |
| | | { |
| | | base.AddData(deviceProtocol); |
| | |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | |
| | | [HttpPost, HttpPost,Route("AddCommonConveyorLineProtocol"), AllowAnonymous] |
| | | public WebResponseContent AddCommonConveyorLineProtocol(int DeviceId, string DeviceChildCode, decimal DeviceProOffset) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | var protocols = new List<Dt_DeviceProtocol> |
| | | { |
| | | CreateDeviceProtocol(DeviceId, DeviceChildCode, DeviceProOffset, "DeviceCommand"), |
| | | CreateDeviceProtocol(DeviceId, DeviceChildCode, DeviceProOffset+8, "ReadDeviceCommand"), |
| | | }; |
| | | foreach (var deviceProtocol in protocols) |
| | | { |
| | | base.AddData(deviceProtocol); |
| | | } |
| | | return content.OK(); |
| | | } |
| | | |
| | | private Dt_DeviceProtocol CreateDeviceProtocol(int DeviceID, string DeviceChildCode, decimal DeviceProOffset, string DeviceProParamType) |
| | | { |
| | | return new Dt_DeviceProtocol |
| | | { |
| | | DeviceId = DeviceID, |
| | | DeviceChildCode = DeviceChildCode, |
| | | DeviceProDataBlock = "DB50", |
| | | DeviceProOffset = DeviceProOffset, |
| | | DeviceProDataLength = 1, |
| | | DeviceProDataType = "int", |
| | | DeviceProParamName = "InteractiveSignal", |
| | | DeviceProParamType = DeviceProParamType, |
| | | DeviceProParamDes = "1", |
| | | DeviceProRemark = "", |
| | | Creater = "admin", |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | } |
| | | } |
| | | } |