diff --git a/DOAN.Admin.WebApi/Controllers/MES/Material/productionMaterial/MmMaterialController.cs b/DOAN.Admin.WebApi/Controllers/MES/Material/productionMaterial/MmMaterialController.cs
index 84e5aaa..36e89a2 100644
--- a/DOAN.Admin.WebApi/Controllers/MES/Material/productionMaterial/MmMaterialController.cs
+++ b/DOAN.Admin.WebApi/Controllers/MES/Material/productionMaterial/MmMaterialController.cs
@@ -99,22 +99,18 @@ namespace DOAN.Admin.WebApi.Controllers.BZFM
return ToResponse(_MmMaterialService.Delete(idArr));
}
- [ApiController]
- [Route("api/mm-material-category")]
- public class MmMaterialCategoryController : ControllerBase
+ ///
+ /// 获取物料表类别下拉框
+ ///
+ ///
+ [HttpPost("GetMmMaterialCategoryOptions")]
+ [AllowAnonymous]
+ public IActionResult GetMmMaterialCategoryOptions([FromBody] MmMaterialCategoryDto parm)
{
- private readonly IMmMaterialService _service;
- public MmMaterialCategoryController(IMmMaterialService service)
- {
- _service = service;
- }
-
- [HttpGet("list")]
- public IActionResult GetCategoryList([FromQuery] MmMaterialCategoryQueryDto parm)
- {
- var response = _service.GetMmMaterialCategoryList(parm);
- return Ok(response);
- }
+ var response = _MmMaterialService.GetMmMaterialCategoryOptions(parm);
+ return SUCCESS(response);
}
+
+
}
}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Material/Dto/MmMaterialCategoryDto.cs b/DOAN.Model/MES/Material/Dto/MmMaterialCategoryDto.cs
index 9b37b42..3943d70 100644
--- a/DOAN.Model/MES/Material/Dto/MmMaterialCategoryDto.cs
+++ b/DOAN.Model/MES/Material/Dto/MmMaterialCategoryDto.cs
@@ -13,13 +13,8 @@ namespace DOAN.Model.BZFM.Dto
///
public class MmMaterialCategoryDto
{
- [Required(ErrorMessage = "主键ID不能为空")]
public int Id { get; set; }
-
- [Required(ErrorMessage = "分类编码不能为空")]
public string CategoryCode { get; set; }
-
- [Required(ErrorMessage = "分类名称不能为空")]
public string CategoryName { get; set; }
public string ParentCode { get; set; }
@@ -33,10 +28,16 @@ namespace DOAN.Model.BZFM.Dto
public DateTime? CreatedTime { get; set; }
public DateTime? UpdatedTime { get; set; }
-
-
-
[ExcelColumn(Name = "状态(0/1)")]
public string StatusLabel { get; set; }
}
+
+ ///
+ /// 物料类别下拉框对象
+ ///
+ public class MmMaterialCategoryOptionsDto
+ {
+ public string Label { get; set; }
+ public string Value { get; set; }
+ }
}
\ No newline at end of file
diff --git a/DOAN.Service/MES/Material/IService/IMmMaterialService.cs b/DOAN.Service/MES/Material/IService/IMmMaterialService.cs
index 250b5a4..40fa3d4 100644
--- a/DOAN.Service/MES/Material/IService/IMmMaterialService.cs
+++ b/DOAN.Service/MES/Material/IService/IMmMaterialService.cs
@@ -15,10 +15,10 @@ namespace DOAN.Service.BZFM.IBZFMService
MmMaterial AddMmMaterial(MmMaterial parm);
- PagedInfo GetMmMaterialCategoryList(MmMaterialCategoryQueryDto parm);
-
int UpdateMmMaterial(MmMaterial parm);
+ // 查询物料类别下拉框
+ List GetMmMaterialCategoryOptions(MmMaterialCategoryDto parm);
}
}
diff --git a/DOAN.Service/MES/Material/MmMaterialService.cs b/DOAN.Service/MES/Material/MmMaterialService.cs
index 94f99d5..d73c2f4 100644
--- a/DOAN.Service/MES/Material/MmMaterialService.cs
+++ b/DOAN.Service/MES/Material/MmMaterialService.cs
@@ -79,5 +79,33 @@ namespace DOAN.Service.BZFM
.AndIF(!string.IsNullOrEmpty(parm.Status), m => m.Status == parm.Status);
return predicate;
}
+
+ ///
+ /// 获取物料类别下拉框
+ ///
+ ///
+ ///
+ ///
+ public List GetMmMaterialCategoryOptions(MmMaterialCategoryDto parm)
+ {
+ try
+ {
+ return Context.Queryable()
+ .WhereIF(!string.IsNullOrEmpty(parm.CategoryCode),it => it.CategoryCode.Contains(parm.CategoryCode))
+ .WhereIF(!string.IsNullOrEmpty(parm.CategoryName), it => it.CategoryName.Contains(parm.CategoryName))
+ .Select(it => new MmMaterialCategoryOptionsDto
+ {
+ Label = it.CategoryName,
+ Value = it.CategoryCode
+ }
+ ).ToList();
+ }
+ catch (Exception)
+ {
+ // TODO 处理错误日志
+
+ throw;
+ }
+ }
}
}
\ No newline at end of file