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 |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
index bcb8ec0..612c67d 100644
--- a/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
+++ b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
@@ -555,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)
@@ -574,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