| | |
| | | using MySql.Data.MySqlClient; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using NPOI.SS.Formula.Function; |
| | | using NPOI.SS.Formula.Functions; |
| | | using Org.BouncyCastle.Asn1.X509; |
| | | using Org.BouncyCastle.Ocsp; |
| | |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics; |
| | | using System.Drawing.Imaging; |
| | | using System.IO; |
| | | using System.Linq; |
| | |
| | | mqtt.Connect(M141Config.MESchannel); |
| | | } |
| | | |
| | | InitialContinuousNGAlarm(); |
| | | InitialContinuousNGAlarm(); |
| | | } |
| | | |
| | | |
| | | |
| | | public override void Close() |
| | | { |
| | | devicestate = false; |
| | |
| | | |
| | | |
| | | Dictionary<string, List<int>> StateDIC = new Dictionary<string, List<int>>(); |
| | | List<string> AlarmTypeList = new List<string>(); |
| | | |
| | | int numplc = 0; |
| | | while (true) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | lock (StatisticRecordsFull) |
| | | if (numsum > 20) |
| | | { |
| | | if (numsum > 20) |
| | | { |
| | | numsum = 0; |
| | | using (FileStream fileStream = new FileStream(_statisticFilePath, FileMode.OpenOrCreate, FileAccess.Write)) |
| | | { |
| | | fileStream.Seek(0L, SeekOrigin.Begin); |
| | | string s = JsonConvert.SerializeObject(StatisticRecordsFull); |
| | | byte[] bytes = Encoding.UTF8.GetBytes(s); |
| | | fileStream.Write(bytes, 0, bytes.Length); |
| | | fileStream.SetLength(bytes.Length); |
| | | fileStream.Flush(); |
| | | fileStream.Close(); |
| | | } |
| | | } |
| | | numsum = 0; |
| | | StatisticRecordsFull.SaveSummaryRecord(); |
| | | } |
| | | //lock (StatisticRecordsFull) |
| | | //{ |
| | | // if (numsum > 20) |
| | | // { |
| | | // numsum = 0; |
| | | |
| | | |
| | | // using (FileStream fileStream = new FileStream(_statisticFilePath, FileMode.OpenOrCreate, FileAccess.Write)) |
| | | // { |
| | | // fileStream.Seek(0L, SeekOrigin.Begin); |
| | | // string s = JsonConvert.SerializeObject(StatisticRecordsFull); |
| | | // byte[] bytes = Encoding.UTF8.GetBytes(s); |
| | | // fileStream.Write(bytes, 0, bytes.Length); |
| | | // fileStream.SetLength(bytes.Length); |
| | | // fileStream.Flush(); |
| | | // fileStream.Close(); |
| | | // } |
| | | // } |
| | | //} |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | |
| | | var alrams = item1.AlarmDetails; |
| | | |
| | | var plcdev = DeviceCollection.FirstOrDefault(u => u.Id == item1.plcname) as PLCBase; |
| | | |
| | | if (!StateDIC.ContainsKey(plcdev.Name)) |
| | | { |
| | | StateDIC[plcdev.Name] = new List<int>(); |
| | | } |
| | | |
| | | |
| | | |
| | | foreach (var item in alrams.GroupBy(u => u.address)) |
| | | { |
| | | int add = item.Key; |
| | | |
| | | var readres = plcdev.Read(add, 1, out _)[0]; |
| | | |
| | | var Allbin = Convert.ToString(readres, 2).PadLeft(16, '0').Select(c => c - '0').ToArray(); |
| | |
| | | foreach (var item2 in item) |
| | | { |
| | | item2.value = Allbin[item2.address2]; |
| | | |
| | | if (!AlarmTypeList.Contains(item2.alarmtype)) |
| | | { |
| | | |
| | | AlarmTypeList.Add(item2.alarmtype); |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"报警类别{item2.alarmtype}加入队列,队列个数为{AlarmTypeList.Count}"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | string StateDICKey = ""; |
| | | |
| | | foreach (var item in AlarmTypeList) |
| | | { |
| | | |
| | | StateDICKey = plcdev.Name +"_"+ item; |
| | | |
| | | if (!StateDIC.ContainsKey(StateDICKey)) |
| | | { |
| | | |
| | | StateDIC[StateDICKey] = new List<int>(); |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"报警类别{StateDICKey}加入字典:StateDIC"); |
| | | |
| | | } |
| | | |
| | | //if (!StateDIC.ContainsKey(plcdev.Name)) |
| | | //{ |
| | | |
| | | // StateDIC[plcdev.Name] = new List<int>(); |
| | | //} |
| | | } |
| | | |
| | | Dictionary<string, AlarmTypeData> AlarmType = new Dictionary<string, AlarmTypeData>(); |
| | | |
| | | List<int> list = new List<int>(); |
| | | |
| | | foreach (var item in alrams) |
| | | { |
| | | csvhead += $",{item.alarmname}"; |
| | | csvdata += $",{(item.value == 1 ? "1" : "")}"; |
| | | list.Add(item.value); |
| | | } |
| | | if (!AlarmType.ContainsKey(item.alarmtype)) |
| | | { |
| | | AlarmType.Add(item.alarmtype, new AlarmTypeData() |
| | | { |
| | | CSVhead = csvhead, |
| | | CSVdata = csvdata, |
| | | }); |
| | | |
| | | if (!StateDIC[plcdev.Name].SequenceEqual(list)) |
| | | } |
| | | |
| | | if (AlarmType.ContainsKey(item.alarmtype)) |
| | | { |
| | | AlarmType[item.alarmtype].CSVhead += $",{item.alarmname}"; |
| | | |
| | | AlarmType[item.alarmtype].CSVdata += $",{(item.value == 1 ? "1" : "")}"; |
| | | |
| | | AlarmType[item.alarmtype].AlarmTypeValue.Add(item.value); |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"报警类别{item.alarmtype};数值{item.value}加入字典:AlarmType"); |
| | | } |
| | | |
| | | } |
| | | foreach(var item in AlarmType.Keys) |
| | | { |
| | | StateDIC[plcdev.Name].Clear(); |
| | | StateDIC[plcdev.Name].AddRange(list); |
| | | |
| | | CSVRecordAsync($"PLCstate_{plcdev.Name}.csv", csvdata, csvhead); |
| | | list = AlarmType[item].AlarmTypeValue; |
| | | |
| | | var showdata = alrams.Where(u => u.value == 1).Select(u => u.alarmname).ToList(); |
| | | string key = plcdev.Name+"_"+item; |
| | | |
| | | if (showdata == null) |
| | | if (!StateDIC[key].SequenceEqual(list)) |
| | | { |
| | | showdata = new List<string>(); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{plcdev.Name}报警类型:{item}的信号发生变化"); |
| | | |
| | | StateDIC[key].Clear(); |
| | | |
| | | StateDIC[key].AddRange(list); |
| | | |
| | | CSVRecordAsync($"PLCstate_{key}.csv", AlarmType[item].CSVhead, AlarmType[item].CSVdata); |
| | | |
| | | var showdata = alrams.Where(u => u.value == 1).Select(u => u.alarmname).ToList(); |
| | | |
| | | if (showdata == null) |
| | | { |
| | | showdata = new List<string>(); |
| | | } |
| | | |
| | | if (showdata.Count > 0) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"{plcdev.Name}报警 个数:{showdata.Count} {string.Join(',', showdata)}"); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{plcdev.Name}报警 个数:0"); |
| | | } |
| | | } |
| | | |
| | | if (showdata.Count > 0) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"{plcdev.Name}报警 个数:{showdata.Count} {string.Join(',', showdata)}"); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{plcdev.Name}报警 个数:0"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch |
| | | { |
| | |
| | | { |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | try |
| | | { |
| | |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | |
| | | public class AlarmTypeData |
| | | { |
| | | public List <int> AlarmTypeValue; |
| | | |
| | | public string CSVhead; |
| | | |
| | | public string CSVdata; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 网络预热 |
| | |
| | | #region plc |
| | | public ResponseMessage RunImageCheck_plc(IOperationConfig config) |
| | | { |
| | | |
| | | ResponseMessage msg = new ResponseMessage(); |
| | | msg.Result = 1; |
| | | List<MeasureBind> measureBinds = new List<MeasureBind>(); |
| | |
| | | } |
| | | |
| | | CheckPositionDoneAsync_plc(measureBinds[0].WorkPosition, inputSequence, config, cameraIds); |
| | | |
| | | |
| | | return msg; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | public async Task<List<ProductModel>> CheckPositionDoneAsync_plc(string positionName, string inputSequence, IOperationConfig config, List<string> cameraIds) |
| | | { |
| | | |
| | | string triggerSource = config.TriggerSource; |
| | | return await _taskFactory.StartNew(() => |
| | | { |
| | | try |
| | | { |
| | | |
| | | string index = config.TriggerStr.Split(',')[1]; |
| | | var positionSet = M141Config.WorkPositionCollection.FirstOrDefault(u => u.PositionName == positionName); |
| | | |
| | |
| | | |
| | | mysqlhelper.UpdateProduct(p); |
| | | |
| | | |
| | | |
| | | |
| | | if (positionSet.IsLastPosition) |
| | | { |
| | | |
| | | |
| | | //班次统计时间划分 |
| | | if (M141Config.WorkShiftList.Count == 0) |
| | | { |
| | | //生成一个报表 |
| | | string name = $"ProductRecord_{DateTime.Now.ToString("yyyyMMdd")}.csv"; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"创建{name}数据报表"); |
| | | UpdateProductResultAsync(p, name); |
| | | UpdateProductResultAsync(p, name); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | if (now.TimeOfDay >= item.ShiftTime_Start.TimeOfDay ) |
| | | if (now.TimeOfDay >= item.ShiftTime_Start.TimeOfDay) |
| | | { |
| | | //生成一个报表 |
| | | string name = $"ProductRecord_{DateTime.Now.ToString("yyyyMMdd")}_{item.ShiftName}.csv"; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //UpdateProductResultAsync(p); |
| | | |
| | | mysqlhelper.NewForAll(p, M141Config.StationCode, M141Config.defectname); |
| | | |
| | | if (M141Config.IsfinDevice) |
| | | { |
| | | |
| | | SummaryAllprodata(p); |
| | | |
| | | } |
| | | } |
| | | }); |
| | |
| | | newp.Zword = plist[0].Zword; |
| | | newp.Result = "NG"; |
| | | newp.SN = plist[0].SN; |
| | | |
| | | if (M141Config.IsfinDevice) |
| | | { |
| | | SummaryAllprodata(newp); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}提前NG加入汇总数据报表统计"); |
| | | } |
| | | if (M141Config.ISupNG) |
| | | { |
| | | var tems = Task.Run(() => mqtt.MESForProduceAsync(newp, M141Config.mesnum2.ToString(), M141Config.numpro)).Result; |
| | |
| | | newp.BasketCode = plist[0].BasketCode; |
| | | newp.Result = "NG"; |
| | | newp.SN = plist[0].SN; |
| | | if (M141Config.IsfinDevice) |
| | | { |
| | | SummaryAllprodata(newp); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}提前NG加入汇总数据报表统计"); |
| | | } |
| | | if (M141Config.ISupNG) |
| | | { |
| | | var tems = Task.Run(() => mqtt.MESForProduceAsync(newp, M141Config.mesnum2.ToString(), M141Config.numpro)).Result; |
| | |
| | | newp.Zword = plist[0].Zword; |
| | | newp.Result = "NG"; |
| | | newp.SN = plist[0].SN; |
| | | if (M141Config.IsfinDevice) |
| | | { |
| | | SummaryAllprodata(newp); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}提前NG加入汇总数据报表统计"); |
| | | } |
| | | if (M141Config.ISupNG) |
| | | { |
| | | var tems = Task.Run(() => mqtt.MESForProduceAsync(newp, M141Config.mesnum2.ToString(), M141Config.numpro)).Result; |
| | |
| | | |
| | | public void SummaryAllprodata(ProductModel p) |
| | | { |
| | | |
| | | |
| | | _taskFactory.StartNew(() => |
| | | { |
| | | try |
| | |
| | | Thread.Sleep(500); |
| | | var plist = mysqlhelper.GetProductList(p.SEQUENCE); |
| | | |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"产品{p.PID}检测结果为{p.Result}从数据库中获取的数据为产品{plist[0].PID}检测结果为{plist[0].Result}"); |
| | | if (plist != null) |
| | | { |
| | | foreach (var item in plist) |
| | |
| | | List<string> specHeadListforall = new List<string>(); |
| | | List<string> positionListforall = new List<string>(); |
| | | string csvHeadforall = newp.GetCSVHead(ref specHeadListforall, ref positionListforall); |
| | | CSVRecordAsync($"AllDeviceProductRecord.csv", newp.GetCSVData(specHeadListforall, positionListforall), csvHeadforall); |
| | | string csvDataforall = newp.GetCSVData(specHeadListforall, positionListforall); |
| | | |
| | | string data = ""; |
| | | |
| | | string Head = "时间,PID,栏具码,物料码,条码,汇总检测结果,S2_P1检测明细,S2_P2检测明细,S2_P3检测明细,S3_P1检测明细,S3_P2检测明细,S4_P1检测明细,S4_P2检测明细,S5_P1检测明细,S5_P2检测明细,S5_P3检测明细,Barcode,SPC_A,SPC_BF_A1,SPC_BF_A2,SPC_BF_A3,SPC_BF_A4,SPC_BF_A5,SPC_BF_A6,SPC_BF_A7,SPC_BF_A8,SPC_BF_A9,SPC_BS_A1,SPC_BS_A2,SPC_BS_A3,SPC_BS_A4,SPC_BS_A5,SPC_BS_A6,SPC_BS_A7,SPC_BS_A8,SPC_BS_A9,SPC_BT_A100RES,SPC_BT_A101RES,SPC_BT_A102RES,SPC_BT_A103RES,SPC_BT_A104RES,SPC_BT_A105RES,SPC_BT_A106RES,SPC_BT_A107RES,SPC_BT_A108RES,SPC_BT_A109RES,SPC_BT_A10RES,SPC_BT_A110RES,SPC_BT_A111RES,SPC_BT_A112RES,SPC_BT_A113RES,SPC_BT_A11RES,SPC_BT_A12RES,SPC_BT_A13RES,SPC_BT_A14RES,SPC_BT_A15RES,SPC_BT_A16RES,SPC_BT_A17RES,SPC_BT_A18RES,SPC_BT_A19RES,SPC_BT_A1RES,SPC_BT_A20RES,SPC_BT_A21RES,SPC_BT_A22RES,SPC_BT_A23RES,SPC_BT_A24RES,SPC_BT_A25RES,SPC_BT_A26RES,SPC_BT_A27RES,SPC_BT_A28RES,SPC_BT_A29RES,SPC_BT_A2RES,SPC_BT_A30RES,SPC_BT_A31RES,SPC_BT_A32RES,SPC_BT_A33RES,SPC_BT_A34RES,SPC_BT_A35RES,SPC_BT_A36RES,SPC_BT_A37RES,SPC_BT_A38RES,SPC_BT_A39RES,SPC_BT_A3RES,SPC_BT_A40RES,SPC_BT_A41RES,SPC_BT_A42RES,SPC_BT_A43RES,SPC_BT_A44RES,SPC_BT_A45RES,SPC_BT_A46RES,SPC_BT_A47RES,SPC_BT_A48RES,SPC_BT_A49RES,SPC_BT_A4RES,SPC_BT_A50RES,SPC_BT_A51RES,SPC_BT_A52RES,SPC_BT_A53RES,SPC_BT_A54RES,SPC_BT_A55RES,SPC_BT_A56RES,SPC_BT_A57RES,SPC_BT_A58RES,SPC_BT_A59RES,SPC_BT_A5RES,SPC_BT_A60RES,SPC_BT_A61RES,SPC_BT_A62RES,SPC_BT_A63RES,SPC_BT_A64RES,SPC_BT_A65RES,SPC_BT_A66RES,SPC_BT_A67RES,SPC_BT_A68RES,SPC_BT_A69RES,SPC_BT_A6RES,SPC_BT_A70RES,SPC_BT_A71RES,SPC_BT_A72RES,SPC_BT_A73RES,SPC_BT_A74RES,SPC_BT_A75RES,SPC_BT_A76RES,SPC_BT_A77RES,SPC_BT_A78RES,SPC_BT_A79RES,SPC_BT_A7RES,SPC_BT_A80RES,SPC_BT_A81RES,SPC_BT_A82RES,SPC_BT_A83RES,SPC_BT_A84RES,SPC_BT_A85RES,SPC_BT_A86RES,SPC_BT_A87RES,SPC_BT_A88RES,SPC_BT_A89RES,SPC_BT_A8RES,SPC_BT_A90RES,SPC_BT_A91RES,SPC_BT_A92RES,SPC_BT_A93RES,SPC_BT_A94RES,SPC_BT_A95RES,SPC_BT_A96RES,SPC_BT_A97RES,SPC_BT_A98RES,SPC_BT_A99RES,SPC_BT_A9RES,SPC_C"; |
| | | |
| | | for (int i = 0; i < Head.Split(",").ToList().Count(); i++) |
| | | { |
| | | int index = csvHeadforall.Split(",").ToList().IndexOf(Head.Split(",").ToList()[i]); |
| | | if (index != -1) |
| | | { |
| | | data += $"{string.Join(" ", csvDataforall.Split(",").ToList()[index])},"; |
| | | } |
| | | else |
| | | { |
| | | data += "NA,"; |
| | | } |
| | | } |
| | | CSVRecordAsync($"AllDeviceProductRecord.csv", data, Head); |
| | | |
| | | } |
| | | catch (Exception exx) |
| | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"连续NG数据记录"); |
| | | DefectNGRecordList.ForEach(d => |
| | | { |
| | | string alarmMsg = ""; |
| | | int alarmTypeTemp = 0; |
| | | |
| | | if (product.Result == "OK") |
| | | string alarmMsg = ""; |
| | | int alarmTypeTemp = 0; |
| | | |
| | | if (product.Result == "OK") |
| | | { |
| | | if (d.CheckIsAlarmRaised(product.Result == "OK", out alarmMsg, out alarmTypeTemp)) |
| | | { |
| | | if (d.CheckIsAlarmRaised(product.Result == "OK", out alarmMsg, out alarmTypeTemp)) |
| | | allMsg += $"{alarmMsg}\r\n"; |
| | | |
| | | isAlarmRaised = true; |
| | | ngItem = "产品结果"; |
| | | alarmType = alarmTypeTemp; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"{product.PID}数据结果为{product.Result}参与连续NG统计"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (product.Result.Contains(d.DefectName)) |
| | | { |
| | | if (d.CheckIsAlarmRaised(!product.Result.Contains(d.DefectName), out alarmMsg, out alarmTypeTemp)) |
| | | { |
| | | allMsg += $"{alarmMsg}\r\n"; |
| | | |
| | | isAlarmRaised = true; |
| | | ngItem = "产品结果"; |
| | | alarmType = alarmTypeTemp; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"{product.PID}数据结果为{product.Result}参与连续NG统计"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (product.Result.Contains(d.DefectName)) |
| | | { |
| | | if (d.CheckIsAlarmRaised(!product.Result.Contains(d.DefectName), out alarmMsg, out alarmTypeTemp)) |
| | | { |
| | | allMsg += $"{alarmMsg}\r\n"; |
| | | isAlarmRaised = true; |
| | | ngItem = "产品结果"; |
| | | alarmType = alarmTypeTemp; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"{product.PID}数据结果为{product.Result}参与连续NG统计"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Warning, $"连续NG数据记录失败"); |
| | | } |
| | | if (isAlarmRaised) |
| | | { |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Warning, $"连续NG监控报警,{allMsg}"); |
| | | if (M141Config.IsOperatorReset) |
| | | { |
| | |
| | | { |
| | | Task.Delay(50).Wait(); |
| | | ResetContinuousNGAlarm(); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | |
| | | _continuousNGAlarmFrm = new FrmContinuousNGAlarm(); |
| | | |
| | | _continuousNGAlarmFrm.TopMost = true; |
| | | |
| | | |
| | | _continuousNGAlarmFrm.FormClosed += _continuousNGAlarmFrm_FormClosed; |
| | | |
| | | |
| | | Task.Run(() => |
| | | { |
| | | _continuousNGAlarmFrm.ShowDialog(); |
| | | |
| | | }); |
| | | |
| | | }); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | _continuousNGAlarmFrm.Close(); |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | |
| | |
| | | private void _continuousNGAlarmFrm_FormClosed(object? sender, FormClosedEventArgs e) |
| | | { |
| | | ResetContinuousNGAlarm(); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"连续NG报警已复位"); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"连续NG报警已复位"); |
| | | _continuousNGAlarmFrm = null; |
| | | } |
| | | |
| | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"连续NG监控通知PLC重置报警失败,{error}"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | [ProcessMethod("", "ContinuousNGAlarmTest", "连续NG报警测试", InvokeType.TestInvoke)] |
| | |
| | | NGRecords.Add(DateTime.Now); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (NGRecords.Count >= AlarmSetting.TimePeriodNumThresold && NGRecords.Count > 0) |
| | | { |
| | | |
| | | |
| | | NGRecords = NGRecords.Skip(NGRecords.Count - AlarmSetting.TimePeriodNumThresold).OrderBy(u => u).ToList(); |
| | | |
| | | int timeInMinute = (int)Math.Ceiling((NGRecords[NGRecords.Count - 1] - NGRecords[0]).TotalMinutes); |
| | |
| | | string msg = ""; |
| | | lock (_lockObj) |
| | | { |
| | | IsAlarmRaised = false; |
| | | IsAlarmRaised = false; |
| | | if (_isContinuousAlarm) |
| | | { |
| | | { |
| | | _isContinuousAlarm = false; |
| | | ContinuousNGNum = 0; |
| | | msg += "连续NG报警 "; |
| | |
| | | |
| | | if (_timeAlarm) |
| | | { |
| | | |
| | | |
| | | _timeAlarm = false; |
| | | NGRecords.Clear(); |
| | | msg += "时段内NG报警 "; |