宜搭测试版
This commit is contained in:
parent
7853200e1c
commit
7347aaec64
@ -61,7 +61,9 @@ namespace YiDa_WinForm
|
||||
private int _lastRodIntervalOne = 60; // 连杆间隔
|
||||
private static bool _isRodImageUploadedOne = false; // 连杆图片是否上传
|
||||
private static bool _isRodUploadedInCycleOne = false;
|
||||
|
||||
|
||||
private static bool _isScrapImageWorkNoticeOne = false; // 报废图片工作通知标记
|
||||
private static bool _isRodImageWorkNoticeOne = false; // 连杆图片工作通知标记
|
||||
// 设备2
|
||||
private System.Timers.Timer _scrapAlarmTimerTwo; // 报废上传定时任务
|
||||
private int _lastScrapIntervalTwo = 60; // 报废间隔
|
||||
@ -70,8 +72,10 @@ namespace YiDa_WinForm
|
||||
private System.Timers.Timer _rodAlarmTimerTwo; // 连杆测试定时任务
|
||||
private int _lastRodIntervalTwo = 60; // 连杆间隔
|
||||
private static bool _isRodImageUploadedTwo = false; // 连杆图片是否上传
|
||||
|
||||
private static bool _isRodUploadedInCycleTwo = false;
|
||||
|
||||
private static bool _isScrapImageWorkNoticeTwo = false; // 报废图片工作通知标记
|
||||
private static bool _isRodImageWorkNoticeTwo = false; // 连杆图片工作通知标记
|
||||
|
||||
// 连杆工作时间配置
|
||||
private System.Timers.Timer _morningRodAlarmTimerOne; // 早上检查点定时器(工作开始+30分钟)
|
||||
@ -1291,6 +1295,7 @@ namespace YiDa_WinForm
|
||||
{
|
||||
string alarmContent = $"报废上传超时未上传凭证!<br>当前时间:{now:yyyy-MM-dd HH:mm:ss}";
|
||||
this.Invoke(new Action(() => SendDingDingAlarm(alarmContent, false, "1")));
|
||||
_isScrapImageWorkNoticeOne = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1318,6 +1323,7 @@ namespace YiDa_WinForm
|
||||
{
|
||||
string alarmContent = $"报废上传超时未上传凭证!<br>当前时间:{now:yyyy-MM-dd HH:mm:ss}";
|
||||
this.Invoke(new Action(() => SendDingDingAlarm(alarmContent, false, "2")));
|
||||
_isScrapImageWorkNoticeTwo = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1364,6 +1370,7 @@ namespace YiDa_WinForm
|
||||
{
|
||||
string alarmContent = $"连杆测试超时未上传图片!<br>当前时间:{now:yyyy-MM-dd HH:mm:ss}";
|
||||
this.Invoke(new Action(() => SendDingDingAlarm(alarmContent, true, "1")));
|
||||
_isRodImageWorkNoticeOne = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1391,6 +1398,7 @@ namespace YiDa_WinForm
|
||||
{
|
||||
string alarmContent = $"连杆测试超时未上传图片!<br>当前时间:{now:yyyy-MM-dd HH:mm:ss}";
|
||||
this.Invoke(new Action(() => SendDingDingAlarm(alarmContent, true, "2")));
|
||||
_isRodImageWorkNoticeTwo = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1414,6 +1422,16 @@ namespace YiDa_WinForm
|
||||
{
|
||||
LogHelper.AppendLog($"【钉钉报警】{(isRodAlarm ? "连杆" : "报废")}:{alarmContent}");
|
||||
await _uploadService.SendDingDingTextAlarmAsync(alarmContent, deviceCode, isRodAlarm);
|
||||
// if (deviceCode.Contains("1"))
|
||||
// {
|
||||
// _isScrapImageWorkNoticeOne = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _isScrapImageWorkNoticeTwo = true;
|
||||
// }
|
||||
|
||||
|
||||
// MessageBox.Show($"已发送钉钉{(isRodAlarm ? "连杆" : "报废")}报警:{alarmContent}", "报警提示", MessageBoxButtons.OK,
|
||||
// MessageBoxIcon.Warning);
|
||||
}
|
||||
@ -1672,6 +1690,7 @@ namespace YiDa_WinForm
|
||||
string morningAlarmContent =
|
||||
$"【早上连杆强制上传报警】<br>当前时间{now:yyyy-MM-dd HH:mm:ss},<br>已超过工作开始后30分钟({_morningCheckTimeOne:hh\\:mm}),<br>未上传连杆测试图片!";
|
||||
this.Invoke(new Action(() => SendDingDingAlarm(morningAlarmContent, true, "1")));
|
||||
_isRodImageWorkNoticeOne = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1696,6 +1715,7 @@ namespace YiDa_WinForm
|
||||
string eveningAlarmContent =
|
||||
$"【晚上连杆强制上传报警】<br>当前时间{now:yyyy-MM-dd HH:mm:ss},<br>已超过工作结束前30分钟({_eveningCheckTimeOne:hh\\:mm}),<br>未上传连杆测试图片!";
|
||||
this.Invoke(new Action(() => SendDingDingAlarm(eveningAlarmContent, true, "1")));
|
||||
_isRodImageWorkNoticeOne = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1720,6 +1740,7 @@ namespace YiDa_WinForm
|
||||
string morningAlarmContent =
|
||||
$"【早上连杆强制上传报警】<br>当前时间{now:yyyy-MM-dd HH:mm:ss},<br>已超过工作开始后30分钟({_morningCheckTimeTwo:hh\\:mm}),<br>未上传连杆测试图片!";
|
||||
this.Invoke(new Action(() => SendDingDingAlarm(morningAlarmContent, true, "2")));
|
||||
_isRodImageWorkNoticeTwo = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1744,6 +1765,7 @@ namespace YiDa_WinForm
|
||||
string eveningAlarmContent =
|
||||
$"【晚上连杆强制上传报警】<br>当前时间{now:yyyy-MM-dd HH:mm:ss},<br>已超过工作结束前30分钟({_eveningCheckTimeTwo:hh\\:mm}),<br>未上传连杆测试图片!";
|
||||
this.Invoke(new Action(() => SendDingDingAlarm(eveningAlarmContent, true, "2")));
|
||||
_isRodImageWorkNoticeTwo = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1889,8 +1911,9 @@ namespace YiDa_WinForm
|
||||
continue;
|
||||
}
|
||||
|
||||
MqttModel mqttNew = BuildMqttModel(drMatch, paramName, value, site);
|
||||
|
||||
YiDaModel yidaNew = BuildYiDaModel(drMatch, paramName, value, site);
|
||||
MqttModel mqttNew = BuildMqttModel(drMatch, paramName, value, site);
|
||||
|
||||
mqttLists.Add(mqttNew);
|
||||
yidaLists.Add(yidaNew);
|
||||
@ -1916,7 +1939,7 @@ namespace YiDa_WinForm
|
||||
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
_uploadService.UploadDatabaseDataToYiDaWithLogging(token, yidaLists1, mqttLists, this);
|
||||
_uploadService.UploadDatabaseDataToYiDaWithLogging(token, yidaLists1, mqttLists1, this);
|
||||
}));
|
||||
|
||||
LogHelper.AppendLog($"设备[{deviceCode}]成功上传{len}条数据到宜搭");
|
||||
@ -1952,7 +1975,7 @@ namespace YiDa_WinForm
|
||||
mqttNew.LeaderPart = drMatch["leader_part"].ToString();
|
||||
mqttNew.WorkStation = site;
|
||||
mqttNew.LeaderOutProtection = drMatch["leader_out_protection"].ToString();
|
||||
mqttNew.IsQualification = JudgeQualification(paramName, value, drMatch);
|
||||
mqttNew.IsQualification = JudgeQualification(paramName, value, drMatch, site);
|
||||
|
||||
return mqttNew;
|
||||
}
|
||||
@ -1976,17 +1999,43 @@ namespace YiDa_WinForm
|
||||
Convert.ToInt64((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc))
|
||||
.TotalMilliseconds);
|
||||
|
||||
yidaNew.textField_mha98nf5 = JudgeQualification(paramName, value, drMatch);
|
||||
yidaNew.textField_mha98nf5 = JudgeQualification(paramName, value, drMatch, site);
|
||||
|
||||
return yidaNew;
|
||||
}
|
||||
|
||||
private string JudgeQualification(string paramName, object value, DataRow drMatch)
|
||||
private string JudgeQualification(string paramName, object value, DataRow drMatch, string site)
|
||||
{
|
||||
if (paramName == "报警信息")
|
||||
{
|
||||
return string.Equals(value?.ToString(), "无错误", StringComparison.Ordinal) ? "合格" : "不合格";
|
||||
}
|
||||
else if ((paramName == "报废图片" || paramName == "连杆测试") && (_isScrapImageWorkNoticeOne || _isRodImageWorkNoticeOne || _isScrapImageWorkNoticeTwo || _isRodImageWorkNoticeTwo))
|
||||
{
|
||||
if (paramName == "报废图片")
|
||||
{
|
||||
if (site == "1号设备")
|
||||
{
|
||||
_isScrapImageWorkNoticeOne = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isScrapImageWorkNoticeTwo = false;
|
||||
}
|
||||
}
|
||||
if (paramName == "连杆测试")
|
||||
{
|
||||
if (site == "1号设备")
|
||||
{
|
||||
_isRodImageWorkNoticeOne = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isRodImageWorkNoticeTwo = false;
|
||||
}
|
||||
}
|
||||
return "不合格";
|
||||
}
|
||||
else if (paramName == "开模总数实时" || paramName == "托模次数" || paramName == "报废图片" || paramName == "连杆测试")
|
||||
{
|
||||
return "合格";
|
||||
|
||||
@ -53,9 +53,9 @@ namespace YiDa_WinForm.Model
|
||||
public string PV { get; set; }
|
||||
|
||||
// 报废图片
|
||||
public string BU { get; set; }
|
||||
public string BU { get; set; } = "报废图片未上传";
|
||||
|
||||
// 连杆测试
|
||||
public string CR { get; set; }
|
||||
public string CR { get; set; } = "连杆强度测试图片未上传";
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ namespace YiDa_WinForm.Service
|
||||
/// <summary>
|
||||
/// 合并数据到Mysql数据
|
||||
/// </summary>
|
||||
public async Task MergeAndSaveData(string status, string deviceCode)
|
||||
public async Task MergeAndSaveData(string operationStatus, string deviceCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -285,13 +285,13 @@ namespace YiDa_WinForm.Service
|
||||
};
|
||||
}
|
||||
|
||||
if (status == "1")
|
||||
if (operationStatus == "1")
|
||||
{
|
||||
dataModel.@params.BU = "报废已上传";
|
||||
dataModel.@params.BU = "报废图片已上传";
|
||||
}
|
||||
else
|
||||
{
|
||||
dataModel.@params.CR = "连杆已上传";
|
||||
dataModel.@params.CR = "连杆强度测试图片已上传";
|
||||
}
|
||||
|
||||
// 5. 重新序列化为JSON
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user