瀏覽代碼

修复曲线二次保存问题

KWD 5 月之前
父節點
當前提交
a1b9fe3f4d
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9 9
      TeamAAS-VM/Core/Management.cs

+ 9 - 9
TeamAAS-VM/Core/Management.cs

@@ -1877,7 +1877,7 @@ namespace TeamAAS_VP.Core
                             Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);
                             SendTaskMessage(string.Format(Lang.编号0, positionIndex), MessageLevel.Info);
                             // 开始采集压力值
-                            //StartPressureCollection(currentProduct.Name, _productService.CurrentProductCode, 0);
+                            StartPressureCollection(currentProduct.Name, _productService.CurrentProductCode, 0);
                         }
                         else
                         {
@@ -2034,7 +2034,7 @@ namespace TeamAAS_VP.Core
 
                             await plc.WriteNodeAsync(addressConfig.In_WorkDone.Address, (Int16)0);
                             // 停止采集压力并保存
-                            //await StopAndSavePressureCollectionAsync(currentProduct.Name, _productService.CurrentProductCode, positionIndex);
+                            await StopAndSavePressureCollectionAsync(currentProduct.Name, _productService.CurrentProductCode, positionIndex);
                             pressure = 0;
                         }
                         else
@@ -2882,9 +2882,9 @@ namespace TeamAAS_VP.Core
                                                                 {
                                                                     string target_Directory = filePath + "\\扭力曲线\\";
                                                                     string source_Torque_Image = config.ScrewCurvePath + $"\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
-                                                                    var col = Directory.GetFiles(source_Torque_Image);
                                                                     try
                                                                     {
+                                                                        var col = Directory.GetFiles(source_Torque_Image);
                                                                         Directory.CreateDirectory(target_Directory);
                                                                         foreach (var item in col)
                                                                         {
@@ -3134,11 +3134,11 @@ namespace TeamAAS_VP.Core
                     }
                     SendTaskMessage($"Pressure {_pressureSamples}", MessageLevel.Debug);
                     // if cancelled due to timeout
-                    if (_pressureTimeoutCts[positionIndex].IsCancellationRequested && !_pressureCts[positionIndex].IsCancellationRequested)
-                    {
-                        SendTaskMessage("Pressure collection timed out, saving collected data.", MessageLevel.Alarm);
-                        await StopAndSavePressureCollectionAsync(productName, productCode, positionIndex);
-                    }
+                    //if (_pressureTimeoutCts[positionIndex].IsCancellationRequested && !_pressureCts[positionIndex].IsCancellationRequested)
+                    //{
+                    //    SendTaskMessage("Pressure collection timed out, saving collected data.", MessageLevel.Alarm);
+                    //    await StopAndSavePressureCollectionAsync(productName, productCode, positionIndex);
+                    //}
                 }, token);
             }
             catch (Exception ex)
@@ -3169,7 +3169,7 @@ namespace TeamAAS_VP.Core
                 // cancel sampling
                 //_pressureCts?.Cancel();
                 // allow worker to observe cancel
-                await Task.Delay(50);
+                //await Task.Delay(50);
 
                 List<(DateTime Timestamp, float Value)> snapshot;
                 lock (_pressureSamples)