|
@@ -112,6 +112,13 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
|
|
|
private async void Schedual_DateTimeChanged(object sender, SCADA.CommonLib.DateTimeChangedArgs e)
|
|
|
{
|
|
|
+ #region 定时删除设备状态表
|
|
|
+ if (e.ChangeType == DateTimeChangeType.HourChanged && e.TimeFlag.Hour % 2 == 0)
|
|
|
+ {
|
|
|
+ Env.DAL.Base_DeviceStateResume.DeleteOldData(DateTime.Now);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 90s后读回绑定队列产品数据
|
|
|
if (e.ChangeType == DateTimeChangeType.SecondChanged && e.TimeFlag.Second % 5 == 0)
|
|
|
{
|
|
@@ -645,10 +652,29 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
RunTimeStr = $"{points.Count} S",
|
|
|
};
|
|
|
|
|
|
- if (rfidInfo.Barcode != null && rfidInfo.Barcode != "" && product.ProcessDatas.Count > 0 &&
|
|
|
+ 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)
|
|
|
{
|
|
|
- var result = CustomerEnv.MESUploadProductData(product);
|
|
|
+ MESResultMsg result;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ result = CustomerEnv.MESUploadProductData(product);
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+
|
|
|
+ throw;
|
|
|
+ }
|
|
|
if (result.IsError)
|
|
|
{
|
|
|
Log.Info($"产品{product.Barcode}过程数据上传MES失败,报错信息:{result.Message}");
|
|
@@ -659,16 +685,6 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
Log.Info($"产品{product.Barcode}过程数据上传成功");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- 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 });
|
|
|
}
|
|
|
}
|
|
|
else
|