| | |
| | | public class WcsPositionService : IDynamicApiController, ITransient |
| | | { |
| | | private readonly SqlSugarRepository<WcsPosition> _WcsPositionRep; |
| | | public WcsPositionService(SqlSugarRepository<WcsPosition> WcsPositionRep) |
| | | private readonly SqlSugarRepository<WcsPlc> _wcsPlcRep; |
| | | public WcsPositionService(SqlSugarRepository<WcsPosition> WcsPositionRep, SqlSugarRepository<WcsPlc> wcsPlcRep) |
| | | { |
| | | _WcsPositionRep = WcsPositionRep; |
| | | _wcsPlcRep = wcsPlcRep; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | var query = _WcsPositionRep.AsQueryable() |
| | | .WhereIF(!string.IsNullOrEmpty(input.SearchKey), u => |
| | | u.Text.Contains(input.SearchKey) |
| | | || u.StationNum.Contains(input.SearchKey) |
| | | ) |
| | | .WhereIF(input.DeviceId > 0, u => u.DeviceId == input.DeviceId) |
| | | .WhereIF(!string.IsNullOrWhiteSpace(input.Text), u => u.Text.Contains(input.Text.Trim())) |
| | |
| | | ).ToListAsync(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取设备ID列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [ApiDescriptionSettings(Name = "WcsPlcIdDropdown"), HttpGet] |
| | | [DisplayName("获取设备ID列表")] |
| | | public async Task<dynamic> WcsPlcIdDropdown() |
| | | { |
| | | return await _wcsPlcRep.Context.Queryable<WcsPlc>() |
| | | .Select(u => new |
| | | { |
| | | Label = u.Text, |
| | | Value = u.Id |
| | | } |
| | | ).ToListAsync(); |
| | | } |
| | | |
| | | |
| | | } |