|
@@ -81,9 +81,9 @@ namespace TeamAAS_VP.Core
|
|
|
List<LockResult> lockResultsAll = new List<LockResult>();//一个产品的总结果
|
|
List<LockResult> lockResultsAll = new List<LockResult>();//一个产品的总结果
|
|
|
string productSn = "";//产品sn
|
|
string productSn = "";//产品sn
|
|
|
DateTime StartScrewTime = DateTime.Now;//开始锁附的时间
|
|
DateTime StartScrewTime = DateTime.Now;//开始锁附的时间
|
|
|
- List<string> torqueList = new List<string>();//扭力数据集合
|
|
|
|
|
- List<string> pressureList = new List<string>();//压力数据集合
|
|
|
|
|
- List<string> turnList = new List<string>();//圈数数据集合
|
|
|
|
|
|
|
+ //List<string> torqueList = new List<string>();//扭力数据集合
|
|
|
|
|
+ //List<string> pressureList = new List<string>();//压力数据集合
|
|
|
|
|
+ //List<string> turnList = new List<string>();//圈数数据集合
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region 属性
|
|
#region 属性
|
|
@@ -1293,6 +1293,7 @@ namespace TeamAAS_VP.Core
|
|
|
string[] model_num { get; set; } = new string[10];//产品model_num
|
|
string[] model_num { get; set; } = new string[10];//产品model_num
|
|
|
string[] wo { get; set; } = new string[10];//产品wo
|
|
string[] wo { get; set; } = new string[10];//产品wo
|
|
|
string[] color { get; set; } = new string[10];//产品color
|
|
string[] color { get; set; } = new string[10];//产品color
|
|
|
|
|
+ Dictionary<string, string> dataToMes = new Dictionary<string, string>();//上传mes的数据
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// PLC命令触发时
|
|
/// PLC命令触发时
|
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -1878,14 +1879,18 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
}
|
|
|
if (lockResult.Number == 1)
|
|
if (lockResult.Number == 1)
|
|
|
{
|
|
{
|
|
|
- torqueList.Clear();
|
|
|
|
|
- pressureList.Clear();
|
|
|
|
|
- turnList.Clear();
|
|
|
|
|
|
|
+ //torqueList.Clear();
|
|
|
|
|
+ //pressureList.Clear();
|
|
|
|
|
+ //turnList.Clear();
|
|
|
|
|
+ dataToMes.Clear();
|
|
|
lockResultsAll.Clear();
|
|
lockResultsAll.Clear();
|
|
|
}
|
|
}
|
|
|
- torqueList.Add($"{lockResult.Number}-{lockResult.LockTorque:F2}");
|
|
|
|
|
- pressureList.Add($"{lockResult.Number}-{lockResult.Pressure:F2}");
|
|
|
|
|
- turnList.Add($"{lockResult.Number}-{lockResult.LockTurns:F2}");
|
|
|
|
|
|
|
+ //torqueList.Add($"{lockResult.Number}-{lockResult.LockTorque:F2}");
|
|
|
|
|
+ //pressureList.Add($"{lockResult.Number}-{lockResult.Pressure:F2}");
|
|
|
|
|
+ //turnList.Add($"{lockResult.Number}-{lockResult.LockTurns:F2}");
|
|
|
|
|
+ dataToMes.Add($"Torque{lockResult.Number}", $"{lockResult.LockTorque:F2}");
|
|
|
|
|
+ dataToMes.Add($"Pressure{lockResult.Number}", $"{lockResult.Pressure:F2}");
|
|
|
|
|
+ dataToMes.Add($"Turn{lockResult.Number}", $"{lockResult.LockTurns:F2}");
|
|
|
SendTaskMessage($"螺丝序号:{lockResult.Number},扭力:{lockResult.LockTorque},压力:{lockResult.Pressure},圈数:{lockResult.LockTurns}", MessageLevel.Info);
|
|
SendTaskMessage($"螺丝序号:{lockResult.Number},扭力:{lockResult.LockTorque},压力:{lockResult.Pressure},圈数:{lockResult.LockTurns}", MessageLevel.Info);
|
|
|
|
|
|
|
|
lockResultsAll.Add(lockResult);
|
|
lockResultsAll.Add(lockResult);
|
|
@@ -2210,6 +2215,7 @@ namespace TeamAAS_VP.Core
|
|
|
_LastMesCheckTime[i] = DateTime.Now;
|
|
_LastMesCheckTime[i] = DateTime.Now;
|
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
|
|
|
+ dataToMes.Clear();
|
|
|
if (systemConfig.IsBasePartCodeGetSN)//是否基于零件码,判断是否过站
|
|
if (systemConfig.IsBasePartCodeGetSN)//是否基于零件码,判断是否过站
|
|
|
{
|
|
{
|
|
|
SendTaskMessage($"基于零件码,判断是否过站", MessageLevel.Debug);
|
|
SendTaskMessage($"基于零件码,判断是否过站", MessageLevel.Debug);
|
|
@@ -2448,12 +2454,12 @@ namespace TeamAAS_VP.Core
|
|
|
LogHelper.WriteLogMes($"【mes开始ADD】");
|
|
LogHelper.WriteLogMes($"【mes开始ADD】");
|
|
|
SendTaskMessage($"mes开始ADD", MessageLevel.Info);
|
|
SendTaskMessage($"mes开始ADD", MessageLevel.Info);
|
|
|
//上传mes
|
|
//上传mes
|
|
|
- string torque = string.Join(",", torqueList);
|
|
|
|
|
- string pressure = string.Join(",", pressureList);
|
|
|
|
|
- string turn = string.Join(",", turnList);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //string torque = string.Join(",", torqueList);
|
|
|
|
|
+ //string pressure = string.Join(",", pressureList);
|
|
|
|
|
+ //string turn = string.Join(",", turnList);
|
|
|
|
|
+
|
|
|
//这里现在上传的结果都是锁付站的,如果存在其他附属站的数据需要上传时,将不适用,要根据实际情况进行调整
|
|
//这里现在上传的结果都是锁付站的,如果存在其他附属站的数据需要上传时,将不适用,要根据实际情况进行调整
|
|
|
- (bool isSuccess, string response) = await _mesService.SubmitGetAsync(ProductMainSN[i], "", torque, pressure, turn, resultIndex == 1 ? true : false, _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
|
|
|
|
+ (bool isSuccess, string response) = await _mesService.SubmitGetAsync(ProductMainSN[i], "", dataToMes, resultIndex == 1 ? true : false, _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
if (isSuccess)
|
|
if (isSuccess)
|
|
|
{
|
|
{
|
|
|
LogHelper.WriteLogMes($"上传mes成功");
|
|
LogHelper.WriteLogMes($"上传mes成功");
|
|
@@ -2566,7 +2572,7 @@ namespace TeamAAS_VP.Core
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
DateTime dt = DateTime.Now;
|
|
DateTime dt = DateTime.Now;
|
|
|
- string filename = $"{currentProduct.Name}_{dt.ToString("yyyyMMdd")}_{ProductMainSN[i]}_{dt.ToString("yyyyMMddHHmmss")}";
|
|
|
|
|
|
|
+ string filename = $"{ProductMainSN[i]}_{dt.ToString("yyyyMMddHHmmss")}";
|
|
|
var device = _configService.GetDeviceInfo();
|
|
var device = _configService.GetDeviceInfo();
|
|
|
(bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
|
|
(bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
|
|
|
if (isSuc)
|
|
if (isSuc)
|
|
@@ -2575,14 +2581,14 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
|
string filePath = $"D:\\image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
string filePath = $"D:\\image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
//复制csv
|
|
//复制csv
|
|
|
- string source_csv = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DataInfo.PROCESS_NAME}_{dt.ToString("yyyy-MM-dd")}.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)); ;
|
|
string target_csv = Path.Combine(filePath, Path.GetFileName(source_csv)); ;
|
|
|
File.Copy(source_csv, target_csv, true);
|
|
File.Copy(source_csv, target_csv, true);
|
|
|
//复制log
|
|
//复制log
|
|
|
string source_log = $"..\\Log\\LogInfo\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}.txt";
|
|
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));
|
|
string target_log = Path.Combine(filePath, Path.GetFileName(source_log));
|
|
|
File.Copy(source_log, target_log, true);
|
|
File.Copy(source_log, target_log, true);
|
|
|
- CompressionImage(filePath, filename, device.FixtureId);
|
|
|
|
|
|
|
+ CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -2926,7 +2932,13 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- sb.Append($"{item.LockPassed},{item.ResultDetails},{item.LockTorque},{item.TargetTorqueUpperLimit},{item.TargetTorqueLowerLimit},{item.LockTurns},{item.TargetTurnsUpperLimit},{item.TargetTurnsLowerLimit},{item.Pressure},{item.PositionX},{item.PositionY},{item.StartPositionZ},{item.EndPositionZ},{item.LockDescentSpeed},");
|
|
|
|
|
|
|
+ string res = "";
|
|
|
|
|
+ if (item.LockPassed)
|
|
|
|
|
+ {
|
|
|
|
|
+ res = "Pass";
|
|
|
|
|
+ }
|
|
|
|
|
+ else res = "Fail";
|
|
|
|
|
+ sb.Append($"{res},{item.ResultDetails},{item.LockTorque},{item.TargetTorqueUpperLimit},{item.TargetTorqueLowerLimit},{item.LockTurns},{item.TargetTurnsUpperLimit},{item.TargetTurnsLowerLimit},{item.Pressure},{item.PositionX},{item.PositionY},{item.StartPositionZ},{item.EndPositionZ},{item.LockDescentSpeed},");
|
|
|
}
|
|
}
|
|
|
catch (Exception)
|
|
catch (Exception)
|
|
|
{
|
|
{
|
|
@@ -3275,7 +3287,14 @@ namespace TeamAAS_VP.Core
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region 压缩图片文件夹
|
|
#region 压缩图片文件夹
|
|
|
- public async void CompressionImage(string sourcePath, string zipname, string fixid)
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 压缩文件
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="sourcePath">原路径</param>
|
|
|
|
|
+ /// <param name="zipname">压缩后文件的名称</param>
|
|
|
|
|
+ /// <param name="station">mes中的station</param>
|
|
|
|
|
+ /// <param name="fixid">mes中的fixtureID</param>
|
|
|
|
|
+ public async void CompressionImage(string sourcePath, string zipname, string station,string fixid)
|
|
|
{
|
|
{
|
|
|
string zipPath = "";
|
|
string zipPath = "";
|
|
|
try
|
|
try
|
|
@@ -3283,7 +3302,13 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"开始压缩文件", MessageLevel.Info);
|
|
SendTaskMessage($"开始压缩文件", MessageLevel.Info);
|
|
|
await Task.Run(() =>
|
|
await Task.Run(() =>
|
|
|
{
|
|
{
|
|
|
- zipPath = $"Z:\\{fixid}\\{DateTime.Now.ToString("yyyyMMdd")}\\{zipname}.zip";//生成的zip文件路径
|
|
|
|
|
|
|
+ zipPath = $"Z:\\{station}\\{fixid}\\{DateTime.Now.ToString("yyyyMMdd")}\\{zipname}.zip";//生成的zip文件路径
|
|
|
|
|
+ string path = $"Z:\\{station}\\{fixid}\\{DateTime.Now.ToString("yyyyMMdd")}";
|
|
|
|
|
+ if (!Directory.Exists(path))
|
|
|
|
|
+ {
|
|
|
|
|
+ Directory.CreateDirectory(path);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
ZipFile.CreateFromDirectory(sourcePath, zipPath);
|
|
ZipFile.CreateFromDirectory(sourcePath, zipPath);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -3291,14 +3316,6 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
LogHelper.WriteLogError($"压缩文件时出错", ex);
|
|
LogHelper.WriteLogError($"压缩文件时出错", ex);
|
|
|
}
|
|
}
|
|
|
- finally
|
|
|
|
|
- {
|
|
|
|
|
- // 清理临时文件
|
|
|
|
|
- if (File.Exists(zipPath))
|
|
|
|
|
- {
|
|
|
|
|
- File.Delete(zipPath);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|