This commit is contained in:
Kai 2021-09-08 18:36:54 +08:00
commit d654170415
4 changed files with 16 additions and 6 deletions

View File

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

View File

@ -546,6 +546,7 @@ namespace SolarPower.Repository.Implement
`CompanyId` 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 '',
`Status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT ' 0: 1:',
`HealthStatus` TINYINT(4) UNSIGNED NOT NULL DEFAULT '1' COMMENT '1: 2: 3:',
`Address` VARCHAR(100) 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
{
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();
}
@ -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())
{
@ -5700,7 +5700,7 @@ namespace SolarPower.Repository.Implement
{
try
{
var sql = @$"UPDATE power_station
var sql = @$"UPDATE {subDB}power_station
SET Status = {status}
WHERE Id = {stationId} ";

View File

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