From e79cf581b2f0038a41de5da1c6eadb3541f4d69e Mon Sep 17 00:00:00 2001 From: IPC-610 <IPC-610@DESKTOP-6LEOOS3> Date: 星期六, 28 九月 2024 08:10:13 +0800 Subject: [PATCH] 问题修改 --- Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs index 65fd3b0..612c67d 100644 --- a/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs +++ b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs @@ -40,8 +40,10 @@ var query = _wcsDeviceRep.AsQueryable() .WhereIF(!string.IsNullOrEmpty(input.SearchKey), u => u.Text.Contains(input.SearchKey) + || u.StationNum.Contains(input.SearchKey) ) .WhereIF(input.PlcId > 0, u => u.PlcId == input.PlcId) + .WhereIF(!string.IsNullOrWhiteSpace(input.StationNum), u => u.StationNum.Contains(input.StationNum.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Text), u => u.Text.Contains(input.Text.Trim())) //澶勭悊澶栭敭鍜孴reeSelector鐩稿叧瀛楁鐨勮繛鎺� .LeftJoin<WcsPlc>((u, plcid) => u.PlcId == plcid.Id) @@ -553,7 +555,14 @@ [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) @@ -572,9 +581,24 @@ 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 } -- Gitblit v1.8.0