FIC_Solar/SolarPower/Repository/Interface/IPowerStationRepository.cs
Kai 4efe001136 1. bug fix
2. 電站交叉分析完成
2021-07-30 20:11:40 +08:00

564 lines
24 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using SolarPower.Models;
using SolarPower.Models.PowerStation;
using SolarPower.Models.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SolarPower.Repository.Interface
{
public interface IPowerStationRepository : IRepositoryBase<PowerStation>
{
/// <summary>
/// 取得當前使用者可操作的電站
/// </summary>
/// <param name="myUser"></param>
/// <returns></returns>
List<MyPowerStationSummary> GetMyPowerStationSummary(MyUser myUser, string filter = "");
/// <summary>
/// 查詢縣市列表
/// </summary>
/// <param name="CompanyId"></param>
/// <returns></returns>
Task<List<CitySelectItemList>> GetCitySelectOptionListAsync();
/// <summary>
/// 查詢地區列表
/// </summary>
/// <param name="CompanyId"></param>
/// <returns></returns>
Task<List<AreaSelectItemList>> GetAreaSelectOptionListAsync(int cityId);
Task<List<OperationPersonnelSelectItemList>> GetOperationPersonnelSelectOptionListAsync(int powerStationId);
/// <summary>
/// 透過編號取得,縣市資訊
/// </summary>
/// <param name="cityId"></param>
/// <returns></returns>
Task<City> GetOneCityByIdAsync(int cityId);
/// <summary>
/// 透過編號取得,地區資訊
/// </summary>
/// <param name="areaId"></param>
/// <returns></returns>
Task<Area> GetOneAreaByIdAsync(int areaId);
/// <summary>
/// 取得縣市地區代碼
/// </summary>
/// <param name="areaId"></param>
/// <returns></returns>
Task<Zipcode> GetCityAreaZipcodeAsync(int areaId);
/// <summary>
/// 透過縣市地區編號,取得該縣市地區最後的流水號
/// </summary>
/// <param name="cityId"></param>
/// <param name="areaId"></param>
/// <returns></returns>
Task<string> GetLastSerialNumberByCityAreaIdAsync(int cityId, int areaId);
/// <summary>
/// 新增電站資料至 主、子資料庫
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<int> AddOnePowerStationAsync(PowerStation entity, List<string> properties, string db_name);
/// <summary>
/// 修改主、子資料庫電站基本資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task UpdatePowerStationInfo(UpdatePowerStationInfo entity, List<string> properties, string db_name);
/// <summary>
/// 修改主、子資料庫能源局與台電資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task UpdateBoETPCInfo(UpdateBoETPCInfo entity, List<string> properties, string db_name);
/// <summary>
/// 透過電站編號,取得所有土地房屋資訊
/// </summary>
/// <param name="id"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<List<LandBuilding>> GetAllLandBuildingInfoByPowerStationId(int id, string db_name);
/// <summary>
/// 取得 土地房屋資訊
/// </summary>
/// <param name="id"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<LandBuilding> GetOneLandBuildingInfo(int id, string db_name);
/// <summary>
/// 新增 土地房屋資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task<int> AddOneLandBuildingInfo(LandBuilding entity, List<string> properties, string db_name);
/// <summary>
/// 更新 土地房屋資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task UpdateLandBuildingInfo(UpdateLandBuilding entity, List<string> properties, string db_name);
/// <summary>
/// 軟刪除土地房屋資訊
/// </summary>
/// <param name="id"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task DeleteOneLandBuildingInfo(int id, string db_name);
/// <summary>
/// 新增運維
/// </summary>
/// <param name="operation"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<int> AddOperation(OperationInfo operation, List<string> properties, string db_name);
/// <summary>
/// 運維dataTable
/// </summary>
/// <param name="stationId"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<List<OperationTable>> OperationTable(int stationId, string db_name);
/// <summary>
/// 取一筆運維
/// </summary>
/// <param name="stationId"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<OperationInfo> OneOperationInfo(int stationId, string db_name);
/// <summary>
/// 更新運維
/// </summary>
/// <param name="operation"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task UpdateOperation(OperationInfo operation, List<string> properties, string db_name);
/// <summary>
/// 裝置類型下拉式選單
/// </summary>
/// <returns></returns>
Task<List<UserSelectItemList>> DeviceType();
/// <summary>
/// 新增 裝置
/// </summary>
/// <param name=""></param>
/// <returns></returns>
Task AddDevice(Device DeviceInfo, List<string> properties, string db_name);
/// <summary>
/// 修改 裝置
/// </summary>
/// <param name="DeviceInfo"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task UpdateDevice(Device DeviceInfo, List<string> properties, string db_name);
/// <summary>
/// 設備datatable
/// </summary>
/// <param name="stationId"></param>
/// <returns></returns>
Task<List<DeviceTable>> DeviceTable(int stationId, string db_name);
/// <summary>
/// 異常datatable
/// </summary>
/// <param name="stationId"></param>
/// <returns></returns>
Task<List<ExceptionTable>> ExceptionTable(int stationId, string db_name);
/// <summary>
/// 取單一筆DeviceInfo
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<DeviceInfo> OneDeviceInfo(int id, string db_name);
/// <summary>
/// 新增 異常設定
/// </summary>
/// <param name="Exception"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task AddException(ExceptionModal Exception, List<string> properties, string db_name);
/// <summary>
/// 取一筆異常設定
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<ExceptionModal> OneException(int id, string db_name);
/// <summary>
/// 更新異常設定
/// </summary>
/// <param name="Exception"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task UpdateException(ExceptionModal Exception, List<string> properties, string db_name);
/// <summary>
/// 取最後一個設備流水號
/// </summary>
/// <param name="PowerStationId"></param>
/// <param name="Type"></param>
/// <returns></returns>
Task<string> GetFinalSerialNumber(int PowerStationId, string Type, string db_name);
/// <summary>
/// 透過電站編號,取得該電站的運維人員編號
/// </summary>
/// <param name="powerStationId"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<List<int>> GetOperationPersonnelIdsByPowerStatioinId(int powerStationId);
/// <summary>
/// 新增電站運維人員
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task<int> AddOperationPersonnelAsync(List<PowerStationOperationPersonnel> entity, List<string> properties);
/// <summary>
/// 軟刪除電站運維人員
/// </summary>
/// <param name="operationPersonnels"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task DeleteOperationPersonnel(List<PowerStationOperationPersonnel> operationPersonnels);
/// <summary>
/// 電站管理 新增電站圖片
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<int> AddPowerStationImageAsync(List<PowerStationImage> entity, List<string> properties, string db_name);
/// <summary>
/// 電站管理 取得所有電站圖片的資料
/// </summary>
/// <param name="powerStationId"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<List<PowerStationImage>> GetAllPowerStationImageAsync(int powerStationId, string db_name);
/// <summary>
/// 電站管理 取得單一電站圖片的資料
/// </summary>
/// <param name="id"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<PowerStationImage> GetOnePowerStationImageAsync(int id, string db_name);
/// <summary>
/// 軟刪除 單一電站圖片
/// </summary>
/// <param name="id"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task DeleteOnePowerStationImage(int id, string db_name);
/// <summary>
/// 電站管理 取得主要卡片顯示圖
/// </summary>
/// <param name="powerStationId"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<PowerStationImage> GetMainDisplayAsync(int powerStationId, string db_name);
/// <summary>
/// 電站管理 更新上傳圖片
/// </summary>
/// <param name="image"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task UpdatePowerStationImage(UpdataPowerStationImage image, List<string> properties, string db_name);
/// <summary>
/// 電站管理 新增單線圖
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<int> AddPowerStationSingleLineAsync(List<PowerStationSingleLine> entity, List<string> properties, string db_name);
/// <summary>
/// 電站管理 取得所有單線圖的資料
/// </summary>
/// <param name="powerStationId"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<List<PowerStationSingleLine>> GetAllPowerStationSingleLineAsync(int powerStationId, string db_name);
/// <summary>
/// 電站管理 取得單一單線圖的資料
/// </summary>
/// <param name="id"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<PowerStationSingleLine> GetOnePowerStationSingleLineAsync(int id, string db_name);
/// <summary>
/// 軟刪除 單一單線圖
/// </summary>
/// <param name="id"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task DeleteOnePowerStationSingleLine(int id, string db_name);
/// <summary>
/// 取得電站分佈縣市以及數量
/// </summary>
/// <param name="User"></param>
/// <returns></returns>
Task<List<SolarCityAmount>> GetSolarCitySummary(MyUser User);
/// <summary>
/// 透過縣市取得電站卡片資訊
/// </summary>
/// <param name="User"></param>
/// <param name="CityId"></param>
/// <returns></returns>
Task<List<PowerStation>> GetSolarByCity(MyUser User, List<int> CityId);
/// <summary>
/// 新增控制器
/// </summary>
/// <param name="deviceController"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task AddDeviceController(DeviceController deviceController, List<string> properties, string db_name);
/// <summary>
/// 控制器dataTable
/// </summary>
/// <param name="stationId"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<List<DeviceControllerTable>> DeviceControllerTable(int stationId, string db_name);
/// <summary>
/// 新增逆變器
/// </summary>
/// <param name="inverter"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task AddInverter(Inverter inverter, List<string> properties, string db_name);
/// <summary>
/// 取得控制器所有id
/// </summary>
Task<List<int>> GetAllDeviceControllerId(int stationId, string db_name);
/// <summary>
/// 逆變器dataTable
/// </summary>
/// <param name="controllerid"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<List<InverterTable>> InverterTable(List<int> controllerid, string db_name);
/// <summary>
/// 電站下拉式選單
/// </summary>
/// <returns></returns>
Task<List<PowerstationOption>> GetPowerstationOptionAsync(string db_name, int stationId);
/// <summary>
/// 設備編號下拉式選單
/// </summary>
/// <param name="db_name"></param>
/// <param name="stationId"></param>
/// <returns></returns>
Task<List<PowerstationOption>> GetDeviceUIDListAsync(string db_name, int stationId);
/// <summary>
/// 新增共享設備
/// </summary>
/// <param name="sharedevice"></param>
/// <param name="properties"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task AddShareDevice(Sharedevice sharedevice, List<string> properties, string db_name);
/// <summary>
/// 共享裝置dataTable
/// </summary>
/// <param name="stationId"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<List<DeviceTable>> shareDeviceTables(int stationId, string db_name);
/// <summary>
/// 取一筆各型態資料
/// </summary>
/// <typeparam name="A"></typeparam>
/// <param name="where"></param>
/// <param name="db_name"></param>
/// <param name="table_name"></param>
/// <returns></returns>
Task<A> GetoneData<A>(string where, string db_name, string table_name);
/// <summary>
/// 透過電站Id取得所有控制器編碼
/// </summary>
/// <param name="stationId"></param>
/// <param name="db_name"></param>
/// <returns></returns>
Task<List<string>> GetAllDeviceControllerByPowerStationId(int stationId, string db_name);
/// <summary>
/// 透過當前時間,取得電站歷史資料
/// </summary>
/// <param name="dateTime"></param>
/// <param name="table_name"></param>
/// <returns></returns>
Task<PowerStationHistory> GetPowerStationHistoryPerHour(string dateTime, string table_name);
/// <summary>
/// 透過當前日期計算往前推算30天的平均值
/// </summary>
/// <param name="nowDay"></param>
/// <param name="table_name"></param>
/// <returns></returns>
Task<AvgPowerStationHistory> CalcAvgPowerStationHistory30day(string nowDay, string table_name);
Task<int> AddPowerStationHistory(List<PowerStationHistory> entity, List<string> properties);
Task<int> UpdateList(List<PowerStation> entity, List<string> properties);
/// <summary>
/// 透過日期,取得最後一筆資料
/// </summary>
/// <param name="day"></param>
/// <param name="table_name"></param>
/// <returns></returns>
Task<PowerStationHistoryDay> GetLastOnePowerStationHistoryByDay(string day, string table_name);
/// <summary>
/// 新增資料,至每日的電站歷史記錄
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task<int> AddPowerStationHistoryDayList(List<PowerStationHistoryDay> entity, List<string> properties);
/// <summary>
/// 透過月份,取得單一筆資料
/// </summary>
/// <param name="day"></param>
/// <param name="table_name"></param>
/// <returns></returns>
Task<PowerStationHistoryMonth> GetOnePowerStationHistoryByPowerStationIdAndMonth(int powerStationId, string month);
/// <summary>
/// 透過電站編號、月份,計算該月份資訊
/// </summary>
/// <param name="day"></param>
/// <param name="table_name"></param>
/// <returns></returns>
Task<PowerStationHistoryMonth> ClacPowerStationHistoryMonthDataByPowerStationId(int powerStationId, string month);
Task<int> AddPowerStationHistoryMonthList(List<PowerStationHistoryMonth> entity, List<string> properties);
Task<int> UpdatePowerStationHistoryMonthList(List<PowerStationHistoryMonth> entity);
/// <summary>
/// 電站日照計列表
/// </summary>
/// <param name="db_name"></param>
/// <param name="stationId"></param>
/// <returns></returns>
Task<List<PowerstationOption>> GetPowerstationPyrheliometerAsync(string db_name, int stationId);
Task<List<DeviceInfo>> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name);
Task<List<DeviceInfo>> GetListTempByPowerStationId(int powerStationId, string db_name);
Task<PyrheliometerHistory> GetPyrheliometerHistoryPerHour(string dateTime, List<DeviceInfo> deviceInfos,int Type);
Task<int> AddTempHistory(List<PyrheliometerHistory> entity, List<string> properties);
Task<int> AddPyrheliometerHistory(List<PyrheliometerHistory> entity, List<string> properties);
Task<AvgPyrheliometerHistory> CalcAvgPyrheliometerHistory30day(string nowDay, int powerStationId);
Task<PyrheliometerHistory> CalcPyrheliometerHistoryDayDataByPowerStationId(string nowDay, int powerStationId);
Task<int> AddPyrheliometerHistoryDayList(List<PyrheliometerHistory> entity, List<string> properties);
Task<PyrheliometerHistory> CalcPyrheliometerHistoryMonthDataByPowerStationId(string month, int powerStationId);
Task<PyrheliometerHistory> GetOnePyrheliometerHistoryByMonth(string month, int powerStationId);
Task<int> AddPyrheliometerHistoryMonthList(List<PyrheliometerHistory> entity, List<string> properties);
Task<int> UpdatePyrheliometerHistoryMonthList(List<PyrheliometerHistory> entity);
Task<int> UpdateInverter(Inverter entity, List<string> properties, string db_name);
Task<A> Getonediv<A>(string where, string db_name, string table_name);
Task<List<InverterHistory>> CalcInverterHisyort15minData(string dateTime, string db_name, string table_name, List<string> inverterIds);
Task<int> AddInverter15minHistory(List<InverterHistory> entity, List<string> properties);
Task<List<InverterHistory>> CalcInverterHisyortHourData(string dateTime, string db_name, string table_name, List<string> inverterIds);
Task<DeviceInfo> GetFirstPyrheliometerInfo(int powerStationId, string db_name);
Task<double> GetFirstPyrheliometerValue(string dateTime, string db_name, string table_name, string col_name);
Task<int> AddInverterHistory(List<InverterHistory> entity, List<string> properties);
Task<List<InverterHistory>> CalcInverterHistoryDayDataByPowerStationId(string nowDay, string db_name, int powerStationId);
Task<int> AddInverterHistoryDayList(List<InverterHistory> entity, List<string> properties);
Task<List<InverterHistory>> GetInverterHistoryByPowerStationIdAndMonth(string month, int powerStationId);
Task<List<InverterHistory>> CalcInverterHistoryMonthDataByPowerStationId(string month, string db_name, int powerStationId);
Task<int> AddInverterHistoryMonthList(List<InverterHistory> entity, List<string> properties);
Task<int> UpdateInverterHistoryMonthList(List<InverterHistory> entity);
Task<List<int>> GetPowerStationIdsByUserRole(MyUser myUser);
Task AddWeatherObservation(List<WeatherObservation> entity, List<string> properties);
Task AddWeatherForecast(List<WeatherForecast> entity, List<string> properties);
Task<NowWeather> SelectNowWeather(int CityId);
Task<MoneyAndCarbon> GetMoneyAndCarbonWithHistoryHour(int powerstationId, string dateTime, int type);
Task<MoneyAndCarbon> GetLastMoneyAndCarbonInHour(int powerstationId,int type,string time);
Task<string> ExistTable(string db_name, string table_name);
Task<SensorAvgHistory> CalcSensorAvgHistory(string dateTime, string table_name);
Task<int> AddSensorAvgHistory(List<SensorAvgHistory> entity, List<string> properties);
Task<SensorAvgHistory> CalcSensorAvgDayDataByPowerStationId(string nowDay, int powerStationId);
Task<int> AddSensorAvgHistoryDayList(List<SensorAvgHistory> entity, List<string> properties);
Task<SensorAvgHistory> GetSensorAvgHistoryByPowerStationIdAndMonth(string month, int powerStationId);
Task<SensorAvgHistory> CalcSensorAvgHistoryMonthDataByPowerStationId(string month, int powerStationId);
Task<int> AddSensorAvgHistoryMonthList(List<SensorAvgHistory> entity, List<string> properties);
Task<int> UpdateSensorAvgHistoryMonthList(List<SensorAvgHistory> entity);
Task<List<PowerStation>> GetPowerStationsByCompanyId(int companyId);
Task<List<PowerStationInverter>> GetPowerStationInverter(Dictionary<string, List<int>> dic, string filter);
Task<List<PowerStationDevice>> GetPowerStationDevice(Dictionary<string, List<int>> dic, string filter);
Task<List<InverterHistory>> GetInverterHistoryRowData(string nowDay, List<StationCodeWithInverterIds> entities);
Task<List<InverterHistory>> GetInverterHistoryByDate(string startDay, string endDay, List<StationIdWithInverterIds> entities);
Task<List<InverterHistory>> GetInverterHistoryByYear(string year, List<StationIdWithInverterIds> entities);
Task<List<PowerStationIdAndCity>> GetPowerStationsByCompanyIdWithfilter(int companyId,string filter);
Task<List<PowerStationIdAndCity>> GetPowerStationsAllWithfilter(string filter);
Task<List<Device>> GetDeviceByPowerStationIdAndDeviceIds(string db_name, int powerStationId, List<string> deviceIds);
Task<dynamic> GetSensorAvgByDevices(string date, byte searchType, List<Device> devices);
Task<List<PowerStationHistory>> GetPowerStationHistory(string date, byte searchType, List<int> entities);
Task<List<MeterHistory>> GetMeterHistory(string date, byte searchType, List<StationIdWithMeterIds> entities);
}
}