| | |
| | | [DisplayName("获取设备对应工位列表")] |
| | | public async Task<List<WcsDeviceTaskOrderDto>> WcsPackStationPlcList([FromQuery] WcsDeviceBaseInput entry) |
| | | { |
| | | return await _wcsDeviceRep.Context.Queryable<WcsDevice>() |
| | | //var list = await _wcsDeviceRep.AsQueryable() |
| | | // .LeftJoin<WcsPlc>((a, b) => a.PlcId == b.Id) |
| | | // .Where((a, b) => a.DeviceType == DeviceTypeEnum.Business) |
| | | // .Select<WcsDeviceOutput>((a, b) => new WcsDeviceOutput() { Type = b.Type }, true) |
| | | // .ToListAsync(); |
| | | |
| | | |
| | | var list = await _wcsDeviceRep.Context.Queryable<WcsDevice>() |
| | | .InnerJoin<WcsPlc>((device, plc) => device.PlcId == plc.Id) |
| | | .LeftJoin<WcsCheckTask>((device, plc, task) => device.StationNum == task.Port) |
| | | .Where((device, plc, task) => device.PlcId == entry.PlcId) |
| | |
| | | PZNo = task.PZNo, |
| | | Qty = task.Qty, |
| | | |
| | | PlcId=device.PlcId, |
| | | Type = plc.Type |
| | | }) |
| | | .ToListAsync(); |
| | | |
| | | bool connStatus = false; |
| | | //获取设备的状态 |
| | | var modPlc = await _wcsDeviceRep.Context.Queryable<WcsPlc>().FirstAsync(s => s.Id == list[0].PlcId); |
| | | PLCUtil modUtil = new PLCUtil(modPlc); |
| | | if (modUtil.Connected) |
| | | { |
| | | connStatus = true; |
| | | } |
| | | foreach (var item in list) |
| | | { |
| | | item.PlcStatus = connStatus; |
| | | } |
| | | return list; |
| | | } |
| | | #endregion |
| | | } |