| | |
| | | |
| | | #endregion |
| | | |
| | | return vm; |
| | | |
| | | return vm; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 修正日测点数据 (临时) |
| | | /// </summary> |
| | | [Route("RepairEtaDayRecordList")] |
| | | [HttpGet] |
| | | public bool RepairEtaDayRecordList([FromQuery] long CorpID, DateTime StartTime, DateTime EndTime) |
| | | { |
| | | |
| | | var spanDays = (EndTime - StartTime).TotalDays; |
| | | |
| | | //获取业务区域 |
| | | var logic_catalog_list = new Service.LogicCatalog().GetByCorpID(CorpID); |
| | | if (logic_catalog_list == null || logic_catalog_list.Count < 1) |
| | | return false; |
| | | |
| | | var service_EtaLogicRealRecord = new Service.EtaLogicRealRecord(); |
| | | var service_EtaSumLogicRecord = new Service.EtaSumLogicRecord(); |
| | | |
| | | var service_EtaMultiRealRecord = new Service.EtaMultiRealRecord(); |
| | | var service_EtaSumMultiRecord = new Service.EtaSumMultiRecord(); |
| | | |
| | | var service_EtaSingleRealRecord = new Service.EtaSingleRealRecord(); |
| | | var service_EtaSumSingleRecord = new Service.EtaSumSingleRecord(); |
| | | |
| | | |
| | | //遍历业务类别 |
| | | foreach (var logicCataog in logic_catalog_list) |
| | | { |
| | | //获取业务清单 |
| | | var logicTreeList = new Service.LogicTree().GetByCatalogID(CorpID, logicCataog.ID); |
| | | if (logicTreeList == null || logicTreeList.Count < 1) |
| | | continue; |
| | | |
| | | foreach (var logicTree in logicTreeList) |
| | | { |
| | | if (logicTree.LogicType == ObjectType.LogicArea) |
| | | { |
| | | for (int i = 0; i <= spanDays; i++) |
| | | { |
| | | var currentTime = StartTime.AddDays(i); |
| | | var realRecordList = service_EtaLogicRealRecord.GetByObjectOfDay(CorpID, ObjectType.LogicArea, logicTree.LogicID, currentTime); |
| | | if (realRecordList == null || realRecordList.Count < 1) |
| | | continue; |
| | | var cureentDayRecord = service_EtaSumLogicRecord.GetDayByObjectOfDay(CorpID, ObjectType.LogicArea, logicTree.LogicID, currentTime); |
| | | var record = EtaSumLogicDayHelper.Sum(CorpID, ObjectType.LogicArea, logicTree.LogicID, currentTime, realRecordList); |
| | | if (cureentDayRecord == null) |
| | | { |
| | | service_EtaSumLogicRecord.Insert(record); |
| | | } |
| | | else |
| | | { |
| | | service_EtaSumLogicRecord.Update(record); |
| | | } |
| | | } |
| | | } |
| | | else if (logicTree.LogicType == IStation.ObjectType.Station) |
| | | { |
| | | var station = new Service.Station().GetByID(CorpID, logicTree.LogicID); |
| | | if (station == null) |
| | | continue; |
| | | for (int i = 0; i <= spanDays; i++) |
| | | { |
| | | var currentTime = StartTime.AddDays(i); |
| | | var realRecordList = service_EtaMultiRealRecord.GetByObjectOfDay(CorpID, ObjectType.Station, station.ID, currentTime); |
| | | if (realRecordList == null || realRecordList.Count < 1) |
| | | continue; |
| | | var cureentDayRecord = service_EtaSumMultiRecord.GetDayByObjectOfDay(CorpID, ObjectType.Station, station.ID, currentTime); |
| | | var record = EtaSumMultiDayHelper.Sum(CorpID, ObjectType.Station, station.ID, currentTime, realRecordList); |
| | | if (cureentDayRecord == null) |
| | | { |
| | | service_EtaSumMultiRecord.Inserts(record); |
| | | } |
| | | else |
| | | { |
| | | service_EtaSumMultiRecord.Updates(record); |
| | | } |
| | | } |
| | | |
| | | //获取管路 |
| | | var pipeLineList = new Service.PipeLine().GetEnginePumpListByBelongTypeAndBelongID(CorpID, IStation.ObjectType.Station, station.ID); |
| | | if (pipeLineList == null || pipeLineList.Count < 1) |
| | | continue; |
| | | foreach (var pipeLine in pipeLineList) |
| | | { |
| | | for (int i = 0; i <= spanDays; i++) |
| | | { |
| | | var currentTime = StartTime.AddDays(i); |
| | | var realRecordList = service_EtaSingleRealRecord.GetByObjectOfDay(CorpID, ObjectType.PipeLine, pipeLine.ID, currentTime); |
| | | if (realRecordList == null || realRecordList.Count < 1) |
| | | continue; |
| | | var cureentDayRecord = service_EtaSumSingleRecord.GetDayByObjectOfDay(CorpID, ObjectType.PipeLine, pipeLine.ID, currentTime); |
| | | var record = EtaSumSingleDayHelper.Sum(CorpID, ObjectType.PipeLine, pipeLine.ID, currentTime, realRecordList); |
| | | if (cureentDayRecord == null) |
| | | { |
| | | service_EtaSumSingleRecord.Insert(record); |
| | | } |
| | | else |
| | | { |
| | | service_EtaSumSingleRecord.Update(record); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 修正泵站日测点数据 (临时) |
| | | /// </summary> |
| | | [Route("RepairEtaSumMultiRecordList")] |
| | | [HttpGet] |
| | | public bool RepairEtaSumMultiRecordList([FromQuery] long CorpID, long StationID, DateTime StartTime, DateTime EndTime) |
| | | { |
| | | var spanDays = (EndTime - StartTime).TotalDays; |
| | | |
| | | //获取业务区域 |
| | | var logic_catalog_list = new Service.LogicCatalog().GetByCorpID(CorpID); |
| | | if (logic_catalog_list == null || logic_catalog_list.Count < 1) |
| | | return false; |
| | | |
| | | var service_eta= new Service.EtaMultiRealRecord(); |
| | | var service_eta_sum = new Service.EtaSumMultiRecord(); |
| | | |
| | | for (int i = 0; i <= spanDays; i++) |
| | | { |
| | | var currentTime = StartTime.AddDays(i); |
| | | var realRecordList = service_eta.GetByObjectOfDay(CorpID, ObjectType.Station, StationID, currentTime); |
| | | if (realRecordList == null || realRecordList.Count < 1) |
| | | continue; |
| | | var cureentDayRecord = service_eta_sum.GetDayByObjectOfDay(CorpID, ObjectType.Station, StationID, currentTime); |
| | | var records =EtaSumMultiDayHelper.Sum(CorpID, ObjectType.Station, StationID, currentTime, realRecordList); |
| | | if (cureentDayRecord == null) |
| | | { |
| | | service_eta_sum.Inserts(records); |
| | | } |
| | | else |
| | | { |
| | | service_eta_sum.Updates(records); |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |