From 8b0d749cfbec8bf0afe71a8956bfeeed6f27cdfc Mon Sep 17 00:00:00 2001
From: chengsc <11752@DESKTOP-DS49RCP>
Date: 星期四, 16 一月 2025 15:32:30 +0800
Subject: [PATCH] Merge branch 'csc'

---
 Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs b/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs
index ae15fb6..7aa3764 100644
--- a/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs
+++ b/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs
@@ -30,11 +30,12 @@
         input.SearchKey = input.SearchKey?.Trim();
         var query = _wcsPlcRep.AsQueryable()
             .WhereIF(!string.IsNullOrEmpty(input.SearchKey), u =>
-                u.IP.Contains(input.SearchKey)
+                u.IP.Contains(input.SearchKey) && u.Text.Contains(input.SearchKey)
             )
             .WhereIF(input.PLCType.HasValue, u => u.PLCType == input.PLCType)
             .WhereIF(!string.IsNullOrWhiteSpace(input.IP), u => u.IP.Contains(input.IP.Trim()))
             .WhereIF(input.Type.HasValue, u => u.Type == input.Type)
+            .WhereIF(input.Enable.HasValue, u => u.Enable == input.Enable)
             .Select<WcsPlcOutput>();
         return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
     }
@@ -106,7 +107,7 @@
     [DisplayName("鑾峰彇PLC鍒楄〃")]
     public async Task<List<WcsPlcOutput>> List([FromQuery] PageWcsPlcInput input)
     {
-        return await _wcsPlcRep.AsQueryable().Select<WcsPlcOutput>().ToListAsync();
+        return await _wcsPlcRep.AsQueryable().WhereIF(input.Type != null, s => s.Type == input.Type).Select<WcsPlcOutput>().ToListAsync();
     }
 
     /// <summary>
@@ -124,9 +125,9 @@
             .ToListAsync();
         foreach (var modPlc in listPlc)
         {
-            if (_sysCacheService.ExistKey("PlcConn" + modPlc.Id))
+            if (_sysCacheService.ExistKey("PLCCONN:" + modPlc.Id))
             {
-                var cachePlc = _sysCacheService.Get<WcsPlc>("PlcConn" + modPlc.Id);
+                var cachePlc = _sysCacheService.Get<WcsPlc>("PLCCONN:" + modPlc.Id);
                 modPlc.IsConn = cachePlc.IsConn;
             }
             else
@@ -135,8 +136,19 @@
             }
         }
         //鏈嶅姟鐘舵��
-        var modService = new { PLCTaskAction.boRunningState, PLCTaskAction.boOffline, PLCTaskAction.boRefresh };
+        var modService = new { PLCTaskAction.boRunningState, PLCTaskAction.boOffline, PLCTaskAction.boRefresh, PLCTaskAction.boDemo, PLCTaskAction.boDrumReversal, PLCTaskAction.boOutLock, PLCTaskAction.boEnterLock };
         return new { listPlc, modService };
     }
-
+    /// <summary>
+    /// 鑾峰彇浣嶇疆淇℃伅
+    /// </summary>
+    /// <returns></returns>
+    [HttpGet]
+    [ApiDescriptionSettings(Name = "ListPosition")]
+    [DisplayName("鑾峰彇浣嶇疆淇℃伅")]
+    public List<PlcPositionInfo> ListPosition()
+    {
+        var list = PLCTaskAction.listPositionInfo.ToList();
+        return list;
+    }
 }

--
Gitblit v1.8.0