FIC_Solar/SolarPower/Models/PowerStation.cs
2021-07-06 20:25:51 +08:00

623 lines
21 KiB
C#

using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SolarPower.Models.PowerStation
{
public enum SolarTypeEnum : byte
{
SelfSold = 0, //自建躉售
HireSold = 1, //租建躉售
SelfUse = 2 //自建自用
}
public class PowerStation : Created
{
private string electricityMeterAt = "", tpcContractAt = "", tpcPurchaseElectricityAt = "", tpcSellElectricityAt = "";
public int Id { get; set; }
public byte HealthStatus { get; set; } //狀態
public int CompanyId { get; set; }
public int CityId { get; set; } //縣市
public string CityName { get; set; } //縣市名稱
public int AreaId { get; set; } //地區
public string AreaName { get; set; } //地區
public string Address { get; set; } //地址
public string Name { get; set; } //名稱
public string MainDisplay { get; set; } //主要顯示圖片
public string Code { get; set; } //電站代碼
public string SerialNumber { get; set; } //四碼流水號
public byte IsEscrow { get; set; } //是否被代管
public string EscrowName { get; set; } //被代管公司
public string ElectricityMeterAt //台電掛錶日
{
get
{
if (!string.IsNullOrEmpty(electricityMeterAt))
{
return Convert.ToDateTime(electricityMeterAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { electricityMeterAt = value; }
}
public int EstimatedRecoveryTime { get; set; } //預計回收年限
public double GeneratingCapacity { get; set; } //發電容量
public double PowerRate { get; set; } //授電費率
public List<int> OperationPersonnelIds { get; set; } //運維人員編號
public string Coordinate { get; set; } //座標
public string InverterBrand { get; set; } //逆變器廠牌
public string InverterProductModel { get; set; } //逆變器型號
public int InverterAmount { get; set; } //逆變器數量
public string PhotovoltaicPanelBrand { get; set; } //光電板廠牌
public string PhotovoltaicPanelProductModel { get; set; } //光電板型號
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格
public string BoEFileName { get; set; } //能源局原檔案名
public string BoEFile { get; set; } //能源局檔案
public int BoEDiscountRate { get; set; } //能源局折扣率
public string BoEDeviceRegisterNumber { get; set; } //能源局設備登記編號
public int BoERentRatio { get; set; } //能源局租金比例
public string TPCContractNumber { get; set; } //台電契約編號
public string TPCContractAt //台電簽約日期
{
get
{
if (!string.IsNullOrEmpty(tpcContractAt))
{
return Convert.ToDateTime(tpcContractAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { tpcContractAt = value; }
}
public int TPCSellDeadline { get; set; } //台電售電期限(年)
public int TPCMeterReading { get; set; } //台電每期抄錶日
public string TPCPurchaseElectricityAt //台電正式購電日
{
get
{
if (!string.IsNullOrEmpty(tpcPurchaseElectricityAt))
{
return Convert.ToDateTime(tpcPurchaseElectricityAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { tpcPurchaseElectricityAt = value; }
}
public string TPCSellElectricityAt //台電正式售電日
{
get
{
if (!string.IsNullOrEmpty(tpcPurchaseElectricityAt))
{
return Convert.ToDateTime(tpcPurchaseElectricityAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { tpcPurchaseElectricityAt = value; }
}
public List<LandBuilding> LandBuildings { get; set; } //土地房屋資料
public byte SolarType { get; set; } //電站類型
public double kwh { get; set; } //
public double Today_kWh { get; set; } //今日發電量
public double Total_kWh { get; set; } //總發電量
public double Today_Monery { get; set; } //今日發電金額
public double Total_Monery { get; set; } //總發電金額
public double Today_kwhkwp { get; set; }
public double Avg_kwhkwp { get; set; }
public double Today_PR { get; set; }
public double Avg_PR { get; set; }
public double Today_Carbon { get; set; } //今日減碳量
public double Total_Carbon { get; set; } //總減碳量
public double SolarHour { get; set; } //總運轉小時
public string SiteDB { get; set; } //電站 DB name: solar_com
public string TodayWeather { get; set; } //今日天氣
public double TodayWeatherTemp { get; set; } //今日溫度
public string CreatorName { get; set; } //創建者名稱
}
public class LandBuilding : Created
{
private string leaseNotarizationAt;
public int Id { get; set; }
public int PowerStationId { get; set; }
public string Address { get; set; }
public string LeaseNotarizationAt //租約公證日期
{
get
{
if (!string.IsNullOrEmpty(leaseNotarizationAt))
{
return Convert.ToDateTime(leaseNotarizationAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { leaseNotarizationAt = value; }
}
public string Landowner { get; set; } //地主姓名
public string Purpose { get; set; } //房屋用途
public int LeaseRate { get; set; } //租金比例
public string Coordinate { get; set; } //經緯度
public string Phone { get; set; } //電話
public string CreatorName { get; set; } //創建者名稱
}
public class PowerStationOperationPersonnel : Created
{
public int PowerStationId { get; set; }
public int UserId { get; set; }
}
public class PostPowerStationInfo
{
public int Id { get; set; }
public int CityId { get; set; } //縣市
public int AreaId { get; set; } //地區
public string Address { get; set; } //地址
public string Name { get; set; } //名稱
//public string Code { get; set; }
public byte IsEscrow { get; set; } //是否被代管
public string EscrowName { get; set; } //被代管公司
public string ElectricityMeterAt { get; set; } //台電掛錶日
public int EstimatedRecoveryTime { get; set; } //預計回收年限
public double GeneratingCapacity { get; set; } //發電容量
public double PowerRate { get; set; } //授電費率
public string Coordinate { get; set; } //座標
public List<int> OperationPersonnelIds { get; set; } //運維人員編號
public string InverterBrand { get; set; } //逆變器廠牌
public string InverterProductModel { get; set; } //逆變器型號
public int InverterAmount { get; set; } //逆變器數量
public string PhotovoltaicPanelBrand { get; set; } //光電板廠牌
public string PhotovoltaicPanelProductModel { get; set; } //光電板型號
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格
public byte SolarType { get; set; } //電站類型
}
public class UpdatePowerStationInfo : Updated
{
public int CityId { get; set; } //縣市
public int AreaId { get; set; } //地區
public string Address { get; set; } //地址
public string Name { get; set; } //名稱
public byte IsEscrow { get; set; } //是否被代管
public string EscrowName { get; set; } //被代管公司
public string ElectricityMeterAt { get; set; } //台電掛錶日
public int EstimatedRecoveryTime { get; set; } //預計回收年限
public double GeneratingCapacity { get; set; } //發電容量
public double PowerRate { get; set; } //授電費率
public string Coordinate { get; set; } //座標
public string InverterBrand { get; set; } //逆變器廠牌
public string InverterProductModel { get; set; } //逆變器型號
public int InverterAmount { get; set; } //逆變器數量
public string PhotovoltaicPanelBrand { get; set; } //光電板廠牌
public string PhotovoltaicPanelProductModel { get; set; } //光電板型號
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格
public byte SolarType { get; set; } //電站類型
}
public class PostBoETPCInfo
{
public int Id { get; set; }
public IFormFile BoEFile { get; set; }
public int BoEDiscountRate { get; set; }
public string BoEDeviceRegisterNumber { get; set; }
public int BoERentRatio { get; set; }
public string TPCContractNumber { get; set; }
public string TPCContractAt { get; set; }
public int TPCSellDeadline { get; set; }
public int TPCMeterReading { get; set; }
public string TPCPurchaseElectricityAt { get; set; }
public string TPCSellElectricityAt { get; set; }
}
public class UpdateBoETPCInfo : Updated
{
public string BoEFileName { get; set; }
public string BoEFile { get; set; }
public int BoEDiscountRate { get; set; }
public string BoEDeviceRegisterNumber { get; set; }
public int BoERentRatio { get; set; }
public string TPCContractNumber { get; set; }
public string TPCContractAt { get; set; }
public int TPCSellDeadline { get; set; }
public int TPCMeterReading { get; set; }
public string TPCPurchaseElectricityAt { get; set; }
public string TPCSellElectricityAt { get; set; }
}
public class PostLandBuildingInfo
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public string Address { get; set; }
public string LeaseNotarizationAt { get; set; }
public string Landowner { get; set; }
public string Purpose { get; set; }
public int LeaseRate { get; set; }
public string Coordinate { get; set; }
public string Phone { get; set; }
}
public class UpdateLandBuilding : Updated
{
public string Address { get; set; }
public string LeaseNotarizationAt { get; set; }
public string Landowner { get; set; }
public string Purpose { get; set; }
public int LeaseRate { get; set; }
public string Coordinate { get; set; }
public string Phone { get; set; }
}
public class CitySelectItemList
{
public string Text { get; set; }
public string Value { get; set; }
}
public class AreaSelectItemList
{
public string Text { get; set; }
public string Value { get; set; }
}
public class Zipcode
{
public string City { get; set; }
public string Area { get; set; }
}
public class City
{
public int Id { get; set; }
public string Name { get; set; }
public string ZipCode { get; set; }
public int Priority { get; set; }
}
public class Area
{
public int Id { get; set; }
public int CityId { get; set; }
public string Name { get; set; }
public string ZipCode { get; set; }
}
public class OperationInfo : Created
{
public int Id { get; set; }
public int PowerStationId { get; set; }//電廠id
public int Type { get; set; }//廠商類別
public string Name { get; set; }//名稱
public string ContactPerson { get; set; }//聯絡人
public string Phone { get; set; }//電話
public string Email { get; set; }//Email
}
/// <summary>
/// 針對電站管理的運維、設備及異常設定
/// </summary>
public class PostPowerStationIdAndSelectedId
{
public int PowerStationId { get; set; }
public int SelectedId { get; set; }
}
public class OperationTable : OperationInfo
{
public string CreatedName { get; set; }//建立者名稱
public string Function { get; set; }//功能
public string TypeName { get; set; }
}
/// <summary>
/// 設備裝置下拉選單
/// </summary>
public class Type
{
public string Name { get; set; }
public string EName { get; set; }
}
public class Root
{
public List<Type> Type { get; set; }
}
/// <summary>
/// 表Variable 取來解析
/// </summary>
public class Variable
{
public string name { get; set; }
public string value { get; set; }
}
/// <summary>
/// 設備
/// </summary>
public class DeviceInfo
{
public int Id { get; set; }
public int PowerStationId { get; set; }//所屬電站編號
public string Name { get; set; }//名稱
public string Type { get; set; }//類型
public string Brand { get; set; }//廠牌
public string ProductModel { get; set; }//型號
public string DBName { get; set; }
public string TableName { get; set; }
public string ColName { get; set; }
public string Remark { get; set; }
public int ControllerId { get; set; }
public string TypeName { get; set; }//類型名稱
}
public class Device : DeviceInfo
{
public string UID { get; set; }//設備編號
public int CreatedBy { get; set; }//建立者
public string SerialNumber { get; set; }
public string PowerStationName { get; set; }
}
/// <summary>
///設備dataTable
/// </summary>
public class DeviceTable : DeviceInfo
{
public string ControllerName { get; set; }
public string UID { get; set; }//設備編號
public string Function { get; set; }//功能
public string PowerStationName { get; set; }
}
/// <summary>
/// 異常modal
/// </summary>
public class ExceptionModal : Created
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public byte Type { get; set; }
public decimal UpperLimit { get; set; }
public decimal LowerLimit { get; set; }
public byte Alarm { get; set; }
}
/// <summary>
/// 異常設定Table
/// </summary>
public class ExceptionTable : ExceptionModal
{
public string PowerStationName { get; set; }
public string PowerStationCode { get; set; }
public string Function { get; set; }//功能
public string TypeName { get; set; }
public string AlarmName { get; set; }
}
/// <summary>
/// 上傳電站圖片
/// </summary>
public class PostPowerStationImage
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public IFormFile[] StationImages { get; set; }
}
/// <summary>
/// 電站圖片資訊
/// </summary>
public class PowerStationImage : Created
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public byte IsMainDisplay { get; set; }
public string Image { get; set; }
}
/// <summary>
/// 上傳卡片顯示圖
/// </summary>
public class PostChangeMainDisplay
{
public int PowerStationId { get; set; }
public int TargetImageId { get; set; }
}
/// <summary>
/// 更新電站圖片
/// </summary>
public class UpdataPowerStationImage: Updated
{
public int PowerStationId { get; set; }
public byte IsMainDisplay { get; set; }
public string Image { get; set; }
}
/// <summary>
/// 上傳單線圖
/// </summary>
public class PostPowerStationSingleLine
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public IFormFile[] SingleLineImages { get; set; }
}
/// <summary>
/// 單線圖片資訊
/// </summary>
public class PowerStationSingleLine : Created
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public string Image { get; set; }
}
/// <summary>
/// 電站縣市分佈
/// </summary>
public class SolarCityAmount
{
public int CityId { get; set; }
public string City { get; set; }
public int Amount { get; set; }
}
public class OperationPersonnelSelectItemList
{
public string Text { get; set; }
public string Value { get; set; }
}
/// <summary>
/// 控制器
/// </summary>
public class DeviceController : Created
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public string SerialNumber { get; set; }
public string ControllerId { get; set; }
}
public class DeviceControllerModal : DeviceController
{
public int Count { get; set; }//數量
}
/// <summary>
/// 控制器datatable
/// </summary>
public class DeviceControllerTable : DeviceController
{
public string CreatedName { get; set; }
public string Function { get; set; }
}
/// <summary>
/// 逆變器
/// </summary>
public class Inverter : UserInfo
{
private string installDate;
public int ControllerId { get; set; }//控制器
public string InverterName { get; set; }//逆變器名稱
public string InstallDate { get { return Convert.ToDateTime(installDate).ToString("yyyy-MM-dd"); } set { installDate = value; } } //安裝日期
public string Brand { get; set; }//廠牌
public string Model { get; set; }//型號
public double Capacity { get; set; }//裝置容量 kWp
public int Pyrheliometer { get; set; }//日照計設備流水號
public int PowerStationId { get; set; }//電站
public int Enabled { get; set; }//是否啟用
public int Status { get; set; }//狀態
public string SerialNumber { get; set; }//流水號
public string InverterId { get; set; }//逆變器id
}
/// <summary>
/// 控制器datatable
/// </summary>
public class InverterTable : Inverter
{
public string ControllerName { get; set; }
public string CreatedName { get; set; }
public string Function { get; set; }
public string EnabledName { get; set; }
public string StatusName { get; set; }
public string PyrheliometerName { get; set; }
}
/// <summary>
/// 下拉式選單用
/// </summary>
public class PowerstationOption
{
public string Text { get; set; }
public string Value { get; set; }
}
/// <summary>
/// 共享設備
/// </summary>
public class Sharedevice : Created
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public int DeviceId { get; set; }
}
public class PowerStationHistory
{
public int PowerStationId { get; set; }
public Int64 Timestamp { get; set; }
public string SITEID { get; set; }
public string SiteType { get; set; }
public double KWH { get; set; }
public double TodayKWh { get; set; }
public double TotalKWH { get; set; }
public double KWHKWP { get; set; }
public double PR { get; set; }
public double MP { get; set; }
public double SolarHour { get; set; }
}
public class AvgPowerStationHistory
{
public int PowerStationId { get; set; }
public double AvgKWHKWP { get; set; }
public double AvgPR { get; set; }
}
public class PowerStationHistoryDay
{
public int PowerStationId { get; set; }
public string Timestamp { get; set; }
public string SITEID { get; set; }
public string SiteType { get; set; }
public double TodayKWh { get; set; }
public double TotalKWH { get; set; }
public double KWHKWP { get; set; }
public double PR { get; set; }
public double MP { get; set; }
public double SolarHour { get; set; }
}
public class PowerStationHistoryMonth
{
public int PowerStationId { get; set; }
public string Timestamp { get; set; }
public string SITEID { get; set; }
public string SiteType { get; set; }
public double MONTHKWH { get; set; }
public double TotalKWH { get; set; }
public double KWHKWP { get; set; }
public double PR { get; set; }
public double MP { get; set; }
public double SolarHour { get; set; }
}
}