Преглед на файлове

增强数据保存,增加产品信息字段

在数据保存逻辑中,新增获取当前产品信息的步骤,并在保存数据时增加产品名称和编号字段,提升数据完整性和可追溯性。
徐孝锋 преди 6 месеца
родител
ревизия
1da9cda736
променени са 1 файла, в които са добавени 7 реда и са изтрити 1 реда
  1. 7 1
      TeamAAS-VM/Core/Management.cs

+ 7 - 1
TeamAAS-VM/Core/Management.cs

@@ -2857,6 +2857,12 @@ namespace TeamAAS_VP.Core
                 //获取当前工位的配置
                 var stationConfig = _configService.GetDeviceInfo(stationIndex);
                 if (stationConfig == null) return false;
+                // 获取当前产品
+                var currentProduct = _productService.GetCurrentProduct();
+                if (currentProduct == null)
+                {
+                    return false;
+                }
                 //如果保存路径为空,则不保存
                 if (string.IsNullOrEmpty(savePath)) return false;
                 string fullPath = savePath;
@@ -2891,7 +2897,7 @@ namespace TeamAAS_VP.Core
                     }
                     sb.AppendLine();
                 }
-                sb.Append($"{timestamp:yyyy-MM-dd HH:mm:ss},{productMainSN},{Math.Round(ct, 3)},{stationIndex},{stationConfig.DeviceName},,,,");
+                sb.Append($"{timestamp:yyyy-MM-dd HH:mm:ss},{productMainSN},{Math.Round(ct, 3)},{stationIndex},{stationConfig.DeviceName},{currentProduct.Name},{currentProduct.NumberCode},");
                 foreach (var item in dataItems)
                 {
                     sb.Append($"{item.Value},");