|
|
@@ -3266,17 +3266,16 @@ 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")}";
|
|
|
+ string csvfilename = $"{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}";
|
|
|
var device = _configService.GetDeviceInfo(i);
|
|
|
var systemConfig = _configService.GetSystemConfiguration();
|
|
|
var pressureSensorConfig = systemConfig.PressureSensorConfig.FirstOrDefault();
|
|
|
- (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
|
|
|
+ (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename, device);
|
|
|
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);
|
|
|
@@ -3322,7 +3321,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (isAfter20 && isNewDay && !_hasCompressedToday)
|
|
|
{
|
|
|
// 执行压缩
|
|
|
- CompressionImage(source_csv2, filename, device.Station, device.FixtureId);
|
|
|
+ CompressionSingleCsv(source_csv, csvfilename, device.Station, device.FixtureId);
|
|
|
_lastCompressDate = dt;
|
|
|
_hasCompressedToday = true;
|
|
|
LogHelper.WriteLogMes("csv上传数据成功");
|
|
|
@@ -3887,6 +3886,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
|
|
|
ZipFile.CreateFromDirectory(sourcePath, zipPath);
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
@@ -3894,7 +3894,43 @@ namespace TeamAAS_VP.Core
|
|
|
LogHelper.WriteLogError($"压缩文件时出错", ex);
|
|
|
}
|
|
|
}
|
|
|
+ public async void CompressionSingleCsv(string csvFilePath, string zipname, string station, string fixid)
|
|
|
+ {
|
|
|
+ string zipPath = "";
|
|
|
+ try
|
|
|
+ {
|
|
|
+ SendTaskMessage("开始压缩CSV文件", MessageLevel.Info);
|
|
|
+ await Task.Run(() =>
|
|
|
+ {
|
|
|
+ if (!File.Exists(csvFilePath))
|
|
|
+ {
|
|
|
+ LogHelper.WriteLogMes($"CSV文件不存在,不压缩:{csvFilePath}");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
+ zipPath = $"Z:\\{station}\\{fixid}\\{DateTime.Now.ToString("yyyyMMdd")}\\{zipname}.zip";
|
|
|
+ string path = $"Z:\\{station}\\{fixid}\\{DateTime.Now.ToString("yyyyMMdd")}";
|
|
|
+
|
|
|
+ if (!Directory.Exists(path))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(path);
|
|
|
+ }
|
|
|
+
|
|
|
+ using (FileStream fs = new FileStream(zipPath, FileMode.Create))
|
|
|
+ {
|
|
|
+ using (ZipArchive archive = new ZipArchive(fs, ZipArchiveMode.Create))
|
|
|
+ {
|
|
|
+ archive.CreateEntryFromFile(csvFilePath, Path.GetFileName(csvFilePath));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ SendTaskMessage("CSV文件压缩完成", MessageLevel.Debug);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ LogHelper.WriteLogError("压缩CSV文件失败", ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
#endregion
|
|
|
#endregion
|
|
|
}
|