private static void Load_IF_CT_FACILITYRESULTHISTORY() { var table = InputMart.Instance.IF_CT_FACILITYRESULTHISTORY; if (MainHelper.CheckActiveAction(table.TableName) == false) { return; } if (table == null || table.Rows.Count == 0) { return; } var result = OutputMart.Instance.RSL_RTS_EQP_STATUS_IF; var modelContext = ModelContext.Current; DateTime now = modelContext.StartTime; string factoryID = LcdHelper.GetTargetFactoryID(); var group = table.Rows.GroupBy(t => t.MACHINENAME); foreach (var it in group) { string eqpID = it.Key; //按时间最近进行排序 //최근 순으로 정렬 var infos = it.OrderByDescending(t => t.EVENTTIME); if (infos == null) { continue; } var finds = InputMart.Instance.RTS_EQPbyEqpID.FindRows(eqpID); if (finds == null) { continue; } var eqp = finds.FirstOrDefault(); if (eqp == null) { continue; } var entity = infos.FirstOrDefault(); if (entity == null) { continue; } string shopID = eqp.SHOP_ID; float density = LcdHelper.ToFloat(entity.PARAVALUE); if (density <= 0) { continue; } var find = result.Find(factoryID, shopID, eqpID); if (find == null) { find = new RSL_RTS_EQP_STATUS_IF(); find.FACTORY_ID = factoryID; find.SHOP_ID = shopID; find.EQP_ID = eqpID; find.LAST_ACID_DENSITY = 0; result.Add(find); } find.LAST_ACID_DENSITY = density; find.UPDATE_DTTM = now; } }