修改
This commit is contained in:
parent
4647cd36a3
commit
955723f14a
|
|
@ -121,8 +121,8 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
FrameId = frame.Id,
|
||||
FrameName = frame.PortsName,
|
||||
Name = $"{(row + 1)}-{(port + 1)}",
|
||||
RowNumber = row,
|
||||
PortNumber = port,
|
||||
RowNumber = row + 1,
|
||||
PortNumber = port + 1,
|
||||
OpticalAttenuation = "",
|
||||
HistoryRemarks = "",
|
||||
Remarks = "",
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
{
|
||||
return ToResponse(ResultCode.FAIL, "没有要导出的数据");
|
||||
}
|
||||
|
||||
var result = ExportExcelMini(list, "端口", "端口");
|
||||
return ExportExcel(result.Item2, result.Item1);
|
||||
}
|
||||
|
|
@ -337,6 +338,7 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
{
|
||||
return ToResponse(ResultCode.FAIL, "没有要导出的数据");
|
||||
}
|
||||
|
||||
var result = ExportExcelMini(list, "端口数据", "端口数据");
|
||||
return ExportExcel(result.Item2, result.Item1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,8 +174,8 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
FrameId = frame.Id,
|
||||
FrameName = frame.PortsName,
|
||||
Name = $"{(row + 1)}-{(port + 1)}",
|
||||
RowNumber = row,
|
||||
PortNumber = port,
|
||||
RowNumber = row + 1,
|
||||
PortNumber = port + 1,
|
||||
OpticalAttenuation = "",
|
||||
HistoryRemarks = "",
|
||||
Remarks = "",
|
||||
|
|
@ -241,9 +241,23 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
[HttpPost("delete/{ids}")]
|
||||
[ActionPermissionFilter(Permission = "odfracks:delete")]
|
||||
[Log(Title = "机架列表", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteOdfRacks([FromRoute] string ids)
|
||||
public async Task<IActionResult> DeleteOdfRacks([FromRoute] string ids)
|
||||
{
|
||||
var idArr = Tools.SplitAndConvert<int>(ids);
|
||||
foreach (var racksId in idArr)
|
||||
{
|
||||
var racks = _OdfRacksService.GetById(racksId);
|
||||
if (racks == null)
|
||||
{
|
||||
return ToResponse(ResultCode.FAIL, "删除失败");
|
||||
}
|
||||
//删除机房下的所有端口
|
||||
await _OdfPortsService.AsDeleteable().Where(it => it.RackId == racks.Id).ExecuteCommandAsync();
|
||||
//删除机房下所有的框
|
||||
var deletedCount = await _OdfFramesService.AsDeleteable().Where(it => it.RackId == racks.Id).ExecuteCommandAsync();
|
||||
//删除机架
|
||||
_OdfRacksService.Delete(racks);
|
||||
}
|
||||
|
||||
return ToResponse(_OdfRacksService.Delete(idArr, "删除机架列表"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,8 +322,8 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
FrameId = frame.Id,
|
||||
FrameName = frame.PortsName,
|
||||
Name = $"{(row + 1)}-{(port + 1)}",
|
||||
RowNumber = row,
|
||||
PortNumber = port,
|
||||
RowNumber = row + 1,
|
||||
PortNumber = port + 1,
|
||||
OpticalAttenuation = "",
|
||||
HistoryRemarks = "",
|
||||
Remarks = "",
|
||||
|
|
@ -438,11 +438,32 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
[HttpPost("delete/{ids}")]
|
||||
[ActionPermissionFilter(Permission = "odfrooms:delete")]
|
||||
[Log(Title = "机房列表", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteOdfRooms([FromRoute] string ids)
|
||||
public async Task<IActionResult> DeleteOdfRooms([FromRoute] string ids)
|
||||
{
|
||||
var idArr = Tools.SplitAndConvert<int>(ids);
|
||||
foreach (var roomId in idArr)
|
||||
{
|
||||
var room = _OdfRoomsService.GetById(roomId);
|
||||
if (room == null)
|
||||
{
|
||||
return ToResponse(ResultCode.FAIL, "删除失败,未找到机房数据");
|
||||
}
|
||||
//删除机房下的所有端口
|
||||
await _OdfPortsService.AsDeleteable().Where(it => it.RoomId == room.Id).ExecuteCommandAsync();
|
||||
// delete odf_frames where exists ( select id from odf_racks where roomid=1 and id=odf_frames.RackId )
|
||||
//删除机房下所有的框
|
||||
var deletedCount = await _OdfFramesService.AsDeleteable()
|
||||
.Where(f => SqlFunc.Subqueryable<OdfRacks>()
|
||||
.Where(r => r.RoomId == room.Id && r.Id == f.RackId)
|
||||
.Any())
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
return ToResponse(_OdfRoomsService.Delete(idArr, "删除机房列表"));
|
||||
//删除机房下所有的机架
|
||||
await _OdfRacksService.AsDeleteable().Where(it => it.RoomId == room.Id).ExecuteCommandAsync();
|
||||
|
||||
_OdfRoomsService.Delete(room.Id, "删除机房");
|
||||
}
|
||||
return ToResponse(ids.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -533,6 +554,10 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
successCount++;
|
||||
continue;
|
||||
}
|
||||
if (excelItem.CreateRoomInfo == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (excelItem.RacksCount > 0)
|
||||
{
|
||||
var roomId = room.Id;
|
||||
|
|
@ -608,12 +633,12 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
FrameId = frame.Id,
|
||||
FrameName = frame.PortsName,
|
||||
Name = $"{(row + 1)}-{(port + 1)}",
|
||||
RowNumber = row,
|
||||
PortNumber = port,
|
||||
RowNumber = row + 1,
|
||||
PortNumber = port + 1,
|
||||
OpticalAttenuation = "",
|
||||
HistoryRemarks = "",
|
||||
Remarks = "",
|
||||
Status = 1,
|
||||
Status = excelItem.PortsStatus ?? 1,
|
||||
UpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -243,9 +243,9 @@ namespace ZR.Model.Business.Dto
|
|||
[ExcelColumnName("端口号(1-12)")]
|
||||
public int PortNumber { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "连接状态,0正常,1断开不能为空")]
|
||||
[ExcelColumn(Name = "连接状态,1正常,0断开")]
|
||||
[ExcelColumnName("连接状态,1正常,0断开")]
|
||||
[Required(ErrorMessage = "连接状态,0断开,1连接不能为空")]
|
||||
[ExcelColumn(Name = "连接状态,0断开,1连接")]
|
||||
[ExcelColumnName("连接状态,0断开,1连接")]
|
||||
public int Status { get; set; }
|
||||
|
||||
[ExcelColumn(Name = "备注")]
|
||||
|
|
@ -325,9 +325,9 @@ namespace ZR.Model.Business.Dto
|
|||
[ExcelColumnName("端口号(1-12)")]
|
||||
public int PortNumber { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "连接状态,0正常,1断开不能为空")]
|
||||
[ExcelColumn(Name = "连接状态,0正常,1断开")]
|
||||
[ExcelColumnName("连接状态,0正常,1断开")]
|
||||
[Required(ErrorMessage = "连接状态,0断开,1连接不能为空")]
|
||||
[ExcelColumn(Name = "连接状态,0断开,1连接")]
|
||||
[ExcelColumnName("连接状态,0断开,1连接")]
|
||||
public int Status { get; set; }
|
||||
|
||||
[ExcelColumn(Name = "备注")]
|
||||
|
|
|
|||
|
|
@ -142,6 +142,14 @@ namespace ZR.Model.Business.Dto
|
|||
[ExcelColumn(Name = "是否生成端口数据,1生成,0只导入机房列表")]
|
||||
[ExcelColumnName("是否生成端口数据,1生成,0只导入机房列表")]
|
||||
public int? CreateRoomInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "端口连接状态,0断开,1连接")]
|
||||
[ExcelColumnName("端口连接状态,0断开,1连接")]
|
||||
|
||||
public int? PortsStatus { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user