子資料庫 狀態停用

This commit is contained in:
b110212000 2021-09-08 18:23:51 +08:00
parent 1cb05ab374
commit f64badab88
4 changed files with 16 additions and 6 deletions

View File

@ -1182,7 +1182,8 @@ namespace SolarPower.Controllers
"TableName" "TableName"
}; };
await powerStationRepository.AddAnyThing<BackFillSchedule>(backFillSchedule, properties, "back_fill_schedule"); await powerStationRepository.AddAnyThing<BackFillSchedule>(backFillSchedule, properties, "back_fill_schedule");
await powerStationRepository.StationStatus(Device.PowerStationId, 0);
await powerStationRepository.StationStatus(Device.PowerStationId, 0,powerStation.SiteDB + ".");
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Msg = "新增成功"; apiResult.Msg = "新增成功";
} }
@ -1234,6 +1235,8 @@ namespace SolarPower.Controllers
properties.Add("WarrantyDate"); properties.Add("WarrantyDate");
} }
await powerStationRepository.UpdateDevice(DeviceInfo, properties, powerStation.SiteDB); await powerStationRepository.UpdateDevice(DeviceInfo, properties, powerStation.SiteDB);
await powerStationRepository.StationStatus(Device.PowerStationId, 0);
await powerStationRepository.StationStatus(Device.PowerStationId, 0, powerStation.SiteDB + ".");
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Msg = "儲存成功"; apiResult.Msg = "儲存成功";
} }
@ -2465,7 +2468,8 @@ namespace SolarPower.Controllers
"TableName" "TableName"
}; };
await powerStationRepository.AddAnyThing<BackFillSchedule>(backFillSchedule, properties, "back_fill_schedule"); await powerStationRepository.AddAnyThing<BackFillSchedule>(backFillSchedule, properties, "back_fill_schedule");
await powerStationRepository.StationStatus(post.PowerStationId, 0);
await powerStationRepository.StationStatus(post.PowerStationId, 0, powerStation.SiteDB + ".");
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Msg = "新增成功"; apiResult.Msg = "新增成功";
} }
@ -2514,6 +2518,8 @@ namespace SolarPower.Controllers
properties.Add("WarrantyDate"); properties.Add("WarrantyDate");
} }
await powerStationRepository.UpdateInverter(inverter, properties, powerStation.SiteDB); await powerStationRepository.UpdateInverter(inverter, properties, powerStation.SiteDB);
await powerStationRepository.StationStatus(post.PowerStationId, 0);
await powerStationRepository.StationStatus(post.PowerStationId, 0, powerStation.SiteDB + ".");
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Msg = "更新成功"; apiResult.Msg = "更新成功";
} }
@ -3177,6 +3183,7 @@ namespace SolarPower.Controllers
else else
{ {
await powerStationRepository.StationStatus(Id,1); await powerStationRepository.StationStatus(Id,1);
await powerStationRepository.StationStatus(Id, 1, powerStation.SiteDB + ".");
apiResult.Msg = "電站啟用成功"; apiResult.Msg = "電站啟用成功";
apiResult.Code = "0000"; apiResult.Code = "0000";
} }
@ -3196,7 +3203,9 @@ namespace SolarPower.Controllers
ApiResult<string> apiResult = new ApiResult<string>(); ApiResult<string> apiResult = new ApiResult<string>();
try try
{ {
var powerstation = await powerStationRepository.GetOneAsync(Id);
await powerStationRepository.StationStatus(Id, 0); await powerStationRepository.StationStatus(Id, 0);
await powerStationRepository.StationStatus(Id, 0,powerstation.SiteDB + ".");
apiResult.Msg = "電站停用成功"; apiResult.Msg = "電站停用成功";
apiResult.Code = "0000"; apiResult.Code = "0000";

View File

@ -546,6 +546,7 @@ namespace SolarPower.Repository.Implement
`CompanyId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '', `CompanyId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`CityId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '', `CityId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`AreaId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '', `AreaId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`Status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT ' 0: 1:',
`HealthStatus` TINYINT(4) UNSIGNED NOT NULL DEFAULT '1' COMMENT '1: 2: 3:', `HealthStatus` TINYINT(4) UNSIGNED NOT NULL DEFAULT '1' COMMENT '1: 2: 3:',
`Address` VARCHAR(100) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci', `Address` VARCHAR(100) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`Name` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci', `Name` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',

View File

@ -1913,7 +1913,7 @@ namespace SolarPower.Repository.Implement
{ {
try try
{ {
var sql = $@"SELECT Id AS Value, Code AS Text ,Name FROM {db_name}.power_station WHERE Deleted = 0 AND Id !={stationId}"; var sql = $@"SELECT Id AS Value, Code AS Text ,Name FROM {db_name}.power_station WHERE Deleted = 0 AND Id !={stationId} AND Status = 1";
result = (await conn.QueryAsync<PowerstationOptionAndName>(sql)).ToList(); result = (await conn.QueryAsync<PowerstationOptionAndName>(sql)).ToList();
} }
@ -5691,7 +5691,7 @@ namespace SolarPower.Repository.Implement
} }
} }
public async Task StationStatus(int stationId , int status) public async Task StationStatus(int stationId , int status , string subDB = "")
{ {
using (IDbConnection conn = this._databaseHelper.GetConnection()) using (IDbConnection conn = this._databaseHelper.GetConnection())
{ {
@ -5700,7 +5700,7 @@ namespace SolarPower.Repository.Implement
{ {
try try
{ {
var sql = @$"UPDATE power_station var sql = @$"UPDATE {subDB}power_station
SET Status = {status} SET Status = {status}
WHERE Id = {stationId} "; WHERE Id = {stationId} ";

View File

@ -604,6 +604,6 @@ namespace SolarPower.Repository.Interface
Task DropShareDevice(int powerstationId, string DBname); Task DropShareDevice(int powerstationId, string DBname);
Task DeleteALLPowerStationOperationPersonnel(int stationId); Task DeleteALLPowerStationOperationPersonnel(int stationId);
Task<List<string>> CheckStationStatus(string code, string DBname); Task<List<string>> CheckStationStatus(string code, string DBname);
Task StationStatus(int stationId, int status); Task StationStatus(int stationId, int status, string subDB = "");
} }
} }