diff --git a/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs b/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs index bc826974..3eb6df6d 100644 --- a/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs +++ b/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs @@ -82,7 +82,6 @@ namespace Aucma.Core.BoxFoam.Business RefreshSystemDataDelegateEvent?.Invoke(systemKeys); RefreshGunDataDelegateEvent?.Invoke(gunKeys); - foreach (KeyValuePair kvPair in gunKeys) { //程序启动缓存没数据查数据库 @@ -91,6 +90,8 @@ namespace Aucma.Core.BoxFoam.Business BoxLastShotRecord record = _lastShotRecordServices.Query(x => x.System == kvPair.Value.System && x.ProductLineCode == kvPair.Value.ProductLineCode && x.GunCode == kvPair.Value.GunCode).OrderByDescending(x => x.CreateTime).FirstOrDefault(); if (record == null) { + kvPair.Value.ProductLineCode = "CX_02"; + kvPair.Value.StationNumber = "1004"; // 数据库也没数据 int a = _lastShotRecordServices.AddAsync(kvPair.Value).Result; RefreshLastShotDataDelegateEvent?.Invoke(kvPair.Value); @@ -100,6 +101,9 @@ namespace Aucma.Core.BoxFoam.Business } if (!kvPair.Value.MixpistOff.Equals(tempKeys[kvPair.Key].MixpistOff)) { + kvPair.Value.ProductLineCode = "CX_02"; + kvPair.Value.StationNumber = "1004"; + int b = _lastShotRecordServices.AddAsync(kvPair.Value).Result; RefreshLastShotDataDelegateEvent?.Invoke(kvPair.Value); } @@ -206,6 +210,28 @@ namespace Aucma.Core.BoxFoam.Business BoxLastShotRecord lastShotRecord = new BoxLastShotRecord(); lastShotRecord.System = gunCode.Substring(1, 1); lastShotRecord.GunCode = gunCode; + if(lastShotRecord.System == "1") + { + if(obj.plc.ReadBool("DB50.388.0")) + { + lastShotRecord.SystemStatus = 1; + } + else + { + lastShotRecord.SystemStatus = 0; + } + } + else + { + if (obj.plc.ReadBool("DB50.642.0")) + { + lastShotRecord.SystemStatus = 1; + } + else + { + lastShotRecord.SystemStatus = 0; + } + } lastShotRecord.ProductLineCode = "CX_02"; lastShotRecord.PolTemp = byteToFloat(info.Skip(0).Take(4).ToArray()).ToString();