| | |
| | | { |
| | | Id = u.Id, |
| | | PlcId = u.PlcId, |
| | | DeviceType = (DeviceTypeEnum)u.DeviceType, |
| | | PlcIdIP = plcid.IP, |
| | | Level = (DeviceLevelEnum)u.Level, |
| | | DbNumber = u.DbNumber, |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设备信息列表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ApiDescriptionSettings(Name = "List")] |
| | | [DisplayName("获取设备信息列表")] |
| | | public async Task<List<WcsDeviceOutput>> List([FromQuery] PageWcsDeviceInput input) |
| | | { |
| | | return await _wcsDeviceRep.AsQueryable().Select<WcsDeviceOutput>().ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取PlcId列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | |
| | | await _wcsDeviceRep.Context.Insertable(listPosition).ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设备信息列表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ApiDescriptionSettings(Name = "List")] |
| | | [DisplayName("获取设备信息列表")] |
| | | public async Task<List<WcsDeviceOutput>> List([FromQuery] PageWcsDeviceInput input) |
| | | { |
| | | var list = await _wcsDeviceRep.AsQueryable() |
| | | .LeftJoin<WcsPlc>((a, b) => a.PlcId == b.Id) |
| | | .Select<WcsDeviceOutput>((a, b) => new WcsDeviceOutput() { Type = b.Type }, true) |
| | | .ToListAsync(); |
| | | //获取跺机的状态 |
| | | var listConn = PLCTaskAction.listPlcConn; |
| | | foreach (var modDevice in list) |
| | | { |
| | | var modUtil = listConn.FirstOrDefault(s => s != null && s.PlcId == modDevice.PlcId); |
| | | modDevice.Status = modUtil == null ? false : modUtil.Connected; |
| | | } |
| | | |
| | | |
| | | return list; |
| | | } |
| | | } |