子資料庫 狀態停用
This commit is contained in:
parent
1cb05ab374
commit
f64badab88
@ -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";
|
||||
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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} ";
|
||||
|
||||
|
||||
@ -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 = "");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user