From d37d5a268555d0fb09719a8631bdbd0bad2318f8 Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期四, 19 九月 2024 11:11:14 +0800
Subject: [PATCH] 工作台绑定结束工位

---
 Admin.NET/WCS.Application/Hub/IPlcHub.cs       |    1 +
 Web/src/views/device/deviceInfo/index.vue      |    2 ++
 Admin.NET/WCS.Application/Entity/WcsDevice.cs  |    5 +++++
 Admin.NET/WCS.Application/PLC/PLCTaskAction.cs |   14 ++++++++++++--
 Web/src/views/device/deviceInfo/data.ts        |    2 +-
 5 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/Admin.NET/WCS.Application/Entity/WcsDevice.cs b/Admin.NET/WCS.Application/Entity/WcsDevice.cs
index fec62ff..37eb5ce 100644
--- a/Admin.NET/WCS.Application/Entity/WcsDevice.cs
+++ b/Admin.NET/WCS.Application/Entity/WcsDevice.cs
@@ -85,4 +85,9 @@
     /// </summary>
     [SugarColumn(IsIgnore = true)]
     public int BoxHeight { get; set; }
+    /// <summary>
+    /// 鐩殑宸ヤ綅
+    /// </summary>
+    [SugarColumn(IsIgnore = true)]
+    public string EndLocat { get; set; }
 }
diff --git a/Admin.NET/WCS.Application/Hub/IPlcHub.cs b/Admin.NET/WCS.Application/Hub/IPlcHub.cs
index 74c3350..580024e 100644
--- a/Admin.NET/WCS.Application/Hub/IPlcHub.cs
+++ b/Admin.NET/WCS.Application/Hub/IPlcHub.cs
@@ -47,5 +47,6 @@
         public bool BoHaveItem { get; set; }
         public PLCTypeEnum Type { get; set; }
         public int BoxHeight { get; set; }
+        public string EndLocat { get; set; }
     }
 }
diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
index f2a77a3..73cd1e3 100644
--- a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -397,14 +397,24 @@
                                     {
                                         var value = Convert.ToInt32(item.Value);
                                         var height = Math.Round(value / 790000d * 200).ToInt();
-                                        if (modDevice.BoxHeight != height)
+                                        var modPosition = listPlcPosition.FirstOrDefault(s => s.DeviceId == modDevice.Id && s.Text == "鐩殑宸ヤ綅");
+                                        string EndLocat = "";
+                                        if (modPosition != null)
                                         {
+                                            var (result2, value2) = modPlcUtil.GetPlcDBValue(modPosition.PosType, modDevice.DbNumber, modPosition.PlcPos);
+                                            if (result2.IsSucceed)
+                                                EndLocat = Convert.ToString(value2);
+                                        }
+                                        if (modDevice.BoxHeight != height || modDevice.EndLocat != EndLocat)
+                                        {
+                                            modDevice.EndLocat = EndLocat;
                                             modDevice.BoxHeight = Math.Round(value / 790000d * 200).ToInt();
                                             var modInfo = new PlcPositionInfo()
                                             {
                                                 Type = modPlc.Type,
                                                 StationNum = modDevice.StationNum,
-                                                BoxHeight = modDevice.BoxHeight
+                                                BoxHeight = modDevice.BoxHeight,
+                                                EndLocat = EndLocat,
                                             };
                                             HubUtil.PublicPosition(modInfo);
                                             UpdatePosition(modInfo);
diff --git a/Web/src/views/device/deviceInfo/data.ts b/Web/src/views/device/deviceInfo/data.ts
index b7dc8cc..e21997b 100644
--- a/Web/src/views/device/deviceInfo/data.ts
+++ b/Web/src/views/device/deviceInfo/data.ts
@@ -2,7 +2,7 @@
 //鍫嗗灈鏈烘暟鎹�
 const cellsDataLine = ref<any>([
 	{ Id: 1, Code: '001', LineCode: '', EndLocat: '', IsShow: 1, IsUse: 0, BoxHeight: 10 },
-	{ Id: 2, Code: '10', LineCode: '01', EndLocat: '01010101', IsShow: 0, IsUse: 0, BoxHeight: 0 },
+	{ Id: 2, Code: '10', LineCode: '01', EndLocat: '', IsShow: 0, IsUse: 0, BoxHeight: 0 },
 	{ Id: 3, Code: '003', LineCode: '', EndLocat: '', IsShow: 1, IsUse: 0, BoxHeight: 10 },
 	{ Id: 4, Code: '004', LineCode: '', EndLocat: '', IsShow: 1, IsUse: 0, BoxHeight: 10 },
 	{ Id: 5, Code: '005', LineCode: '', EndLocat: '', IsShow: 1, IsUse: 0, BoxHeight: 10 },
diff --git a/Web/src/views/device/deviceInfo/index.vue b/Web/src/views/device/deviceInfo/index.vue
index cac9429..14fe6f2 100644
--- a/Web/src/views/device/deviceInfo/index.vue
+++ b/Web/src/views/device/deviceInfo/index.vue
@@ -100,6 +100,7 @@
 			if (foundCell) {
 				//淇敼楂樺害
 				foundCell.BoxHeight = s.boxHeight;
+				foundCell.EndLocat = s.endLocat;
 			}
 		}
 		else if (s.type == 1) {
@@ -166,6 +167,7 @@
 	debugger;
 	const foundCell = cellsDataLine.value.find(cell => cell.Code === data.stationNum);
 	if (foundCell) {
+		foundCell.EndLocat = data.endLocat;
 		const startHeight = foundCell.BoxHeight;
 		const targetHeight = data.boxHeight;
 		const duration = 1000; // 鍔ㄧ敾鎸佺画鏃堕棿锛堟绉掞級

--
Gitblit v1.8.0