|
|
@@ -2621,7 +2621,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (i == 0)
|
|
|
{
|
|
|
_productService.CurrentProductCode = ProductMainSN[i];
|
|
|
- _eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
+ //_eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
}
|
|
|
SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
@@ -2726,7 +2726,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (i == 0)
|
|
|
{
|
|
|
_productService.CurrentProductCode = ProductMainSN[i];
|
|
|
- _eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
+ //_eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
}
|
|
|
SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
@@ -2812,7 +2812,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (i == 0)
|
|
|
{
|
|
|
_productService.CurrentProductCode = ProductMainSN[i];
|
|
|
- _eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
+ //_eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
}
|
|
|
|
|
|
LogHelper.WriteLogMes($"【未启用mes】");
|
|
|
@@ -2836,7 +2836,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (i == 0)
|
|
|
{
|
|
|
CTtime = ct;
|
|
|
- _eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(false);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
+ _eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
}
|
|
|
|
|
|
//从PLC获取零件编号
|
|
|
@@ -3131,29 +3131,37 @@ namespace TeamAAS_VP.Core
|
|
|
//上传数据
|
|
|
try
|
|
|
{
|
|
|
- DateTime dt = DateTime.Now;
|
|
|
- string filename = $"{ProductMainSN[i]}_{dt.ToString("yyyyMMddHHmmss")}";
|
|
|
- var device = _configService.GetDeviceInfo();
|
|
|
- (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
|
|
|
- if (isSuc)
|
|
|
+ if (stationConfig.EnableMES)
|
|
|
{
|
|
|
- LogHelper.WriteLogMes($"上传数据成功");
|
|
|
- SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
|
- string filePath = $"D:\\image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
- //复制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)); ;
|
|
|
- File.Copy(source_csv, target_csv, true);
|
|
|
- //复制log
|
|
|
- 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);
|
|
|
- CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
|
+ DateTime dt = DateTime.Now;
|
|
|
+ string filename = $"{ProductMainSN[i]}_{dt.ToString("yyyyMMddHHmmss")}";
|
|
|
+ var device = _configService.GetDeviceInfo();
|
|
|
+ (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]}";
|
|
|
+ //复制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)); ;
|
|
|
+ File.Copy(source_csv, target_csv, true);
|
|
|
+ //复制log
|
|
|
+ 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);
|
|
|
+ CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.WriteLogMes($"上传数据失败");
|
|
|
+ SendTaskMessage($"上传数据失败", MessageLevel.Error);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LogHelper.WriteLogMes($"上传数据失败");
|
|
|
- SendTaskMessage($"上传数据失败", MessageLevel.Error);
|
|
|
+ LogHelper.WriteLogMes($"未启用mes");
|
|
|
+ SendTaskMessage($"未启用mes", MessageLevel.Error);
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
@@ -3548,7 +3556,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (string.IsNullOrEmpty(savePath)) return false;
|
|
|
string fullPath = savePath;
|
|
|
//如果保存路径是一个文件路径,则直接保存,否则按照工位和日期进行保存
|
|
|
- if (File.Exists(savePath) || Path.HasExtension(savePath))
|
|
|
+ if (!File.Exists(savePath) || !Path.HasExtension(savePath))
|
|
|
{
|
|
|
fullPath = savePath;
|
|
|
//如果路径不存在,则创建
|
|
|
@@ -3559,15 +3567,14 @@ namespace TeamAAS_VP.Core
|
|
|
Directory.CreateDirectory(directory);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- //结果保存至CSV文件,文件名格式:savePath\yyyy-MM\工位编号_工位名称_yyyy-MM-dd.csv
|
|
|
- string datePath = timestamp.ToString("yyyy-MM") + "\\";
|
|
|
- string dirPath = Path.Combine(savePath, datePath);
|
|
|
- if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath);
|
|
|
- string fileName = $"{stationIndex}_{stationConfig.DeviceName}_{timestamp.ToString("yyyy-MM-dd")}.csv";
|
|
|
- fullPath = Path.Combine(dirPath, fileName);
|
|
|
- }
|
|
|
+
|
|
|
+ //结果保存至CSV文件,文件名格式:savePath\yyyy-MM\工位编号_工位名称_yyyy-MM-dd.csv
|
|
|
+ string datePath = timestamp.ToString("yyyy-MM") + "\\";
|
|
|
+ string dirPath = Path.Combine(savePath, datePath);
|
|
|
+ if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath);
|
|
|
+ string fileName = $"{stationIndex}_{stationConfig.DeviceName}_{timestamp.ToString("yyyy-MM-dd")}.csv";
|
|
|
+ fullPath = Path.Combine(dirPath, fileName);
|
|
|
+
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
if (!File.Exists(fullPath))
|
|
|
{
|