diff --git a/SlnMesnac.Business/ProdCompletionBusiness.cs b/SlnMesnac.Business/ProdCompletionBusiness.cs index 07ade6e..d7f07f0 100644 --- a/SlnMesnac.Business/ProdCompletionBusiness.cs +++ b/SlnMesnac.Business/ProdCompletionBusiness.cs @@ -576,9 +576,29 @@ namespace SlnMesnac.Business { dmsRecordAlarmInfo.UpdateTime = DateTime.Now; dmsRecordAlarmInfo.UpdateBy = "SlnMesnac"; + sqlSugarClient.AsTenant().GetConnection("mes").Updateable(dmsRecordAlarmInfo).ExecuteCommand(); } + else + { + DmsBaseAlarmRule dmsBaseAlarmRule = sqlSugarClient.AsTenant().GetConnection("mes").Queryable().First(x => x.AlarmRuleId == warnRuleId); + + dmsRecordAlarmInfo = new DmsRecordAlarmInfo(); + dmsRecordAlarmInfo.DeviceId = dmsRecordAlarmTime.DeviceId; + dmsRecordAlarmInfo.AlarmRuleId = warnRuleId; + dmsRecordAlarmInfo.AlarmBeginTime = DateTime.Now; + dmsRecordAlarmInfo.AlarmStatus = "0"; + dmsRecordAlarmInfo.NoticeStatus = "0"; + dmsRecordAlarmInfo.ContinueTime = dmsBaseAlarmRule.ContinueTime; + dmsRecordAlarmInfo.AlarmReason = dmsBaseAlarmRule.AlarmReason; + dmsRecordAlarmInfo.AlarmReason = dmsBaseAlarmRule.AlarmReason; + dmsRecordAlarmInfo.AlarmData = warnStatusEnum.ToString(); + dmsRecordAlarmInfo.HandleSuggest = dmsBaseAlarmRule.HandleSuggest; + dmsRecordAlarmInfo.CreateBy = "SlnMesnac"; + dmsRecordAlarmInfo.CreateTime = DateTime.Now; + sqlSugarClient.AsTenant().GetConnection("mes").Insertable(dmsRecordAlarmInfo).ExecuteCommand(); + } + sqlSugarClient.AsTenant().GetConnection("mes").Updateable(dmsRecordAlarmTime).ExecuteCommand(); - sqlSugarClient.AsTenant().GetConnection("mes").Updateable(dmsRecordAlarmInfo).ExecuteCommand(); }