|
@@ -115,7 +115,8 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
#region 定时删除设备状态表
|
|
|
if (e.ChangeType == DateTimeChangeType.HourChanged && e.TimeFlag.Hour % 2 == 0)
|
|
|
{
|
|
|
- Env.DAL.Base_DeviceStateResume.DeleteOldData(DateTime.Now);
|
|
|
+ var isSucced = Env.DAL.Base_DeviceStateResume.DeleteOldData(DateTime.Now);
|
|
|
+ if (isSucced.IsSucceed) { Log.Info("设备状态表定时删除成功"); }
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
@@ -173,30 +174,38 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
var testResult = notSyncedList.Where(i => i.ID == reportID.Key)?.FirstOrDefault();
|
|
|
testResult.ProcessDatas = processDataList[reportID.Key].ToList();
|
|
|
}
|
|
|
- for (int i = 0; i < notSyncedList.Count; i++)
|
|
|
+ try
|
|
|
{
|
|
|
- if (!CustomerEnv.MESServerConnectStatus)
|
|
|
+ for (int i = 0; i < notSyncedList.Count; i++)
|
|
|
{
|
|
|
- break;
|
|
|
+ if (!CustomerEnv.MESServerConnectStatus)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ var result = CustomerEnv.MESUploadProductData(notSyncedList[i]);
|
|
|
+ if (result.IsError)
|
|
|
+ {
|
|
|
+ Log.Info($"产品{notSyncedList[i].Barcode}过程数据上传MES失败,报错信息:{result.Message}");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ notSyncedList[i].IsSynced = true;
|
|
|
+ Log.Info($"产品{notSyncedList[i].Barcode}过程数据上传成功");
|
|
|
+ synecdList.Add(notSyncedList[i]);
|
|
|
+ }
|
|
|
}
|
|
|
- var result = CustomerEnv.MESUploadProductData(notSyncedList[i]);
|
|
|
- if (result.IsError)
|
|
|
+ if (synecdList.Any())
|
|
|
{
|
|
|
- Log.Info($"产品{notSyncedList[i].Barcode}过程数据上传MES失败,报错信息:{result.Message}");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- notSyncedList[i].IsSynced = true;
|
|
|
- Log.Info($"产品{notSyncedList[i].Barcode}过程数据上传成功");
|
|
|
- synecdList.Add(notSyncedList[i]);
|
|
|
+ Env.DAL.App_Microwave_TestResult.Update(synecdList,
|
|
|
+ t => new { t.ID },
|
|
|
+ t => new { t.IsSynced });
|
|
|
}
|
|
|
}
|
|
|
- if (synecdList.Any())
|
|
|
+ catch (Exception)
|
|
|
{
|
|
|
- Env.DAL.App_Microwave_TestResult.Update(synecdList,
|
|
|
- t => new { t.ID },
|
|
|
- t => new { t.IsSynced });
|
|
|
+ Log.Warn("调取MES接口时发生错误");
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
@@ -620,10 +629,10 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
model.DataDecode(data.ToArray(), i);
|
|
|
points.Add(model);
|
|
|
}
|
|
|
- if (points.Count <= 90 && CustomerEnv.CustomerConfig.SetPower.IsSimulationDta) //当时长不够时进行模拟数据赋值
|
|
|
- {
|
|
|
- points = ProcessData.SimulationData();
|
|
|
- }
|
|
|
+ //if (points.Count <= 90 && CustomerEnv.CustomerConfig.SetPower.IsSimulationDta) //当时长不够时进行模拟数据赋值
|
|
|
+ //{
|
|
|
+ // points = ProcessData.SimulationData();
|
|
|
+ //}
|
|
|
|
|
|
#region 测试结果判断
|
|
|
var MinNGNumber = points.Where(point => point.Power < CustomerEnv.CustomerConfig.SetPower.MinPower
|
|
@@ -652,39 +661,37 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
RunTimeStr = $"{points.Count} S",
|
|
|
};
|
|
|
|
|
|
- Env.DAL.Insert(product);
|
|
|
- foreach (var item in points)
|
|
|
- {
|
|
|
- item.ReportId = product.ID;
|
|
|
- }
|
|
|
- Env.DAL.Insert(points);
|
|
|
-
|
|
|
Log.Info($"RFID{uid},产品条码{rfidInfo.Barcode},收到{product?.ProcessDatas?.Count}");
|
|
|
TestFinish?.Invoke(this, new TestFinishEventArgs() { Product = product });
|
|
|
|
|
|
if (rfidInfo.Barcode != null && rfidInfo.Barcode != "" && product.ProcessDatas.Count > 0 && CustomerEnv.MESAPITokenExpired > DateTime.Now &&
|
|
|
CustomerEnv.MESServerConnectStatus && CustomerEnv.MESAPIToken != null && CustomerEnv.CustomerConfig.SetPower.MESUpload)
|
|
|
{
|
|
|
- MESResultMsg result;
|
|
|
try
|
|
|
{
|
|
|
- result = CustomerEnv.MESUploadProductData(product);
|
|
|
+ var result = CustomerEnv.MESUploadProductData(product);
|
|
|
+ if (result.IsError)
|
|
|
+ {
|
|
|
+ Log.Info($"产品{product.Barcode}过程数据上传MES失败,报错信息:{result.Message}");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ product.IsSynced = true;
|
|
|
+ Log.Info($"产品{product.Barcode}过程数据上传成功");
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
-
|
|
|
- throw;
|
|
|
- }
|
|
|
- if (result.IsError)
|
|
|
- {
|
|
|
- Log.Info($"产品{product.Barcode}过程数据上传MES失败,报错信息:{result.Message}");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- product.IsSynced = true;
|
|
|
- Log.Info($"产品{product.Barcode}过程数据上传成功");
|
|
|
+ Log.Warn("调取MES接口时发生错误");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ Env.DAL.Insert(product);
|
|
|
+ foreach (var item in points)
|
|
|
+ {
|
|
|
+ item.ReportId = product.ID;
|
|
|
+ }
|
|
|
+ Env.DAL.Insert(points);
|
|
|
}
|
|
|
}
|
|
|
else
|