diff --git a/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmAreaController.cs b/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmAreaController.cs index 98cd3f86..ecf7bd60 100644 --- a/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmAreaController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmAreaController.cs @@ -103,13 +103,21 @@ namespace ZR.Admin.WebApi.Controllers.andon } - [HttpGet("getPullDown")] + [HttpGet("getPullDownP")] [ActionPermissionFilter(Permission = "business:andonalarmarea:list")] - public ApiResult GetPullDown() + public ApiResult GetPullDownP() { - var response = _AndonAlarmAreaService.GetPullDown(); + var response = _AndonAlarmAreaService.GetPullDownP(); return response; } + + [HttpPost("getPullDownByPID")] + [ActionPermissionFilter(Permission = "business:andonalarmarea:list")] + public ApiResult GetPullDownByPID([FromBody] AlarmAreaPullDownDto parm) + { + var response = _AndonAlarmAreaService.GetPullDownByPID(parm); + return response; + } } } \ No newline at end of file diff --git a/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmRecordController.cs b/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmRecordController.cs index 29105514..86aeabca 100644 --- a/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmRecordController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmRecordController.cs @@ -80,6 +80,16 @@ namespace ZR.Admin.WebApi.Controllers.andon public IActionResult UpdateAndonAlarmRecord([FromBody] AndonAlarmRecordDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); + if (parm.Area != null && parm.Area.Length > 0) + { + modal.Area1 = parm.Area.Length > 0 ? parm.Area[0] : string.Empty; + modal.Area2 = parm.Area.Length > 1 ? parm.Area[1] : string.Empty; + } + else + { + modal.Area1 = string.Empty; + modal.Area2 = string.Empty; + } var response = _AndonAlarmRecordService.UpdateAndonAlarmRecord(modal); return ToResponse(response); diff --git a/ZR.Model/MES/andon/Dto/AndonAlarmAreaDto.cs b/ZR.Model/MES/andon/Dto/AndonAlarmAreaDto.cs index 917869b0..584f4c23 100644 --- a/ZR.Model/MES/andon/Dto/AndonAlarmAreaDto.cs +++ b/ZR.Model/MES/andon/Dto/AndonAlarmAreaDto.cs @@ -31,14 +31,6 @@ namespace ZR.Model.MES.andon.Dto } public class AlarmAreaPullDownDto - { - public string label { get; set; } - public int value { get; set; } - - public List children { get; set; } - } - - public class AlarmAreaPullDown2Dto { public string label { get; set; } public int value { get; set; } diff --git a/ZR.Service/mes/andon/AndonAlarmAreaService.cs b/ZR.Service/mes/andon/AndonAlarmAreaService.cs index ed016312..d5cf96a6 100644 --- a/ZR.Service/mes/andon/AndonAlarmAreaService.cs +++ b/ZR.Service/mes/andon/AndonAlarmAreaService.cs @@ -76,31 +76,36 @@ namespace ZR.Service.mes.andon return Update(model, true); } - public ApiResult GetPullDown() + public ApiResult GetPullDownP() { var response = Queryable() .Where(a => a.ParentId == null || a.ParentId == 0) .Select(a => new AlarmAreaPullDownDto { label = a.Area, - value = a.Id, - children = new List() - }) - .ToList(); - foreach (var item in response) - { - item.children = Queryable() - .Where(a => a.ParentId == item.value) - .Select(a => new AlarmAreaPullDown2Dto - { - label = a.Area, - value = a.Id, - }) - .ToList(); - } + value = a.Id + }).ToList(); return ApiResult.Success("成功", response); } + public ApiResult GetPullDownByPID(AlarmAreaPullDownDto parm) + { + if (parm != null) + { + var response = Queryable() + .Where(a => a.ParentId == parm.value) + .Select(a => new AlarmAreaPullDownDto + { + label = a.Area, + value = a.Id + }).ToList(); + return ApiResult.Success("成功", response); + } + else + { + return ApiResult.Error("参数错误"); + } + } } } \ No newline at end of file diff --git a/ZR.Service/mes/andon/IService/IAndonAlarmAreaService.cs b/ZR.Service/mes/andon/IService/IAndonAlarmAreaService.cs index 857e87d1..05937a22 100644 --- a/ZR.Service/mes/andon/IService/IAndonAlarmAreaService.cs +++ b/ZR.Service/mes/andon/IService/IAndonAlarmAreaService.cs @@ -19,6 +19,7 @@ namespace ZR.Service.mes.andon.Iservice { AndonAlarmArea AddAndonAlarmArea(AndonAlarmArea parm); int UpdateAndonAlarmArea(AndonAlarmArea parm); - ApiResult GetPullDown(); + ApiResult GetPullDownP(); + ApiResult GetPullDownByPID(AlarmAreaPullDownDto parm); } }