zly пре 5 месеци
родитељ
комит
c6d2a25ec3
1 измењених фајлова са 24 додато и 4 уклоњено
  1. 24 4
      TeamAAS-VM/Core/Management.cs

+ 24 - 4
TeamAAS-VM/Core/Management.cs

@@ -1299,6 +1299,10 @@ namespace TeamAAS_VP.Core
         /// </summary>
         string PartSN = "";
         /// <summary>
+        /// 压力曲线编号
+        /// </summary>
+        int pngindex = 100;
+        /// <summary>
         /// 产品SN
         /// </summary>
         string[] ProductMainSN = new string[10];//产品主sn
@@ -2882,13 +2886,20 @@ namespace TeamAAS_VP.Core
                                                         DateTime dt = DateTime.Now;
                                                         string filename = $"{ProductMainSN[i]}_{dt.ToString("yyyyMMddHHmmss")}";
                                                         string csvfilename = $"{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}";
-                                                        var device = _configService.GetDeviceInfo();
+                                                        var device = _configService.GetDeviceInfo(i);
+                                                        var systemConfig = _configService.GetSystemConfiguration();
+                                                        var pressureSensorConfig = systemConfig.PressureSensorConfig.FirstOrDefault();
                                                         (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
                                                         if (isSuc)
                                                         {
                                                             LogHelper.WriteLogMes($"上传数据成功");
                                                             SendTaskMessage($"上传数据成功", MessageLevel.Debug);
                                                             string filePath = $"D:\\image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
+                                                            string source_csv2 = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}";
+                                                            if (!Directory.Exists(filePath))
+                                                            {
+                                                                Directory.CreateDirectory(filePath);
+                                                            }
                                                             //复制csv
                                                             string source_csv = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}.csv";
                                                             string target_csv = Path.Combine(filePath, Path.GetFileName(source_csv)); ;
@@ -2897,6 +2908,15 @@ namespace TeamAAS_VP.Core
                                                             string source_log = $"..\\Log\\LogInfo\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}.txt";
                                                             string target_log = Path.Combine(filePath, Path.GetFileName(source_log));
                                                             File.Copy(source_log, target_log, true);
+                                                            if (pressureSensorConfig.IsSavePressureCurve && i == pngindex)
+                                                            {
+                                                                //复制曲线图
+                                                                string pngfile_path = $"{pressureSensorConfig.PressureCurvePath}\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
+                                                                string pngfileName = $"{pngfile_path}\\pressure-{ProductMainSN[i]}-{pngindex}.png";
+                                                                string target_png = Path.Combine(filePath, Path.GetFileName(pngfileName));
+                                                                File.Copy(pngfileName, target_png, true);
+                                                                SendTaskMessage($"曲线图{pngindex}复制完成", MessageLevel.Debug);
+                                                            }
                                                             CompressionImage(filePath, filename, device.Station, device.FixtureId);
 
                                                             //上传csv
@@ -2907,7 +2927,7 @@ namespace TeamAAS_VP.Core
                                                             if (isAfter20 && isNewDay && !_hasCompressedToday)
                                                             {
                                                                 // 执行压缩
-                                                                CompressionImage(source_csv, csvfilename, device.Station, device.FixtureId);
+                                                                CompressionImage(source_csv2, csvfilename, device.Station, device.FixtureId);
                                                                 _lastCompressDate = dt;
                                                                 _hasCompressedToday = true;
                                                                 LogHelper.WriteLogMes("csv上传数据成功");
@@ -2988,7 +3008,7 @@ namespace TeamAAS_VP.Core
                                 {
                                     SendTaskMessage($"收到开始保压信号[{i}]...", MessageLevel.Debug);
                                     // 开始采集压力值
-                                    StartPressureCollection(currentProduct.Name, code, i);
+                                    StartPressureCollection(currentProduct.Name, ProductMainSN[i], i);
                                 }
                                 else
                                 {
@@ -3022,7 +3042,7 @@ namespace TeamAAS_VP.Core
                                     await plc.WriteNodeAsync(string.Format(addressConfig.In_WorkDone.Address, i), (Int16)0);
                                     var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
                                     // 停止采集压力并保存
-                                    await StopAndSavePressureCollectionAsync(currentProduct.Name, code, i);
+                                    await StopAndSavePressureCollectionAsync(currentProduct.Name, ProductMainSN[i], i);
                                 }
                                 else
                                 {