diff --git a/DOAN.Admin.WebApi/Controllers/MES/Material/productionMaterial/MmInventoryController.cs b/DOAN.Admin.WebApi/Controllers/MES/Material/productionMaterial/MmInventoryController.cs index f25774e..251ec29 100644 --- a/DOAN.Admin.WebApi/Controllers/MES/Material/productionMaterial/MmInventoryController.cs +++ b/DOAN.Admin.WebApi/Controllers/MES/Material/productionMaterial/MmInventoryController.cs @@ -110,6 +110,17 @@ namespace DOAN.Admin.WebApi.Controllers.BZFM return SUCCESS(response); } /// + /// 获取库位下拉数据 + /// + /// + [HttpPost("GetLocationOption")] + public IActionResult GetLocationOption() + { + var response = _MmInventoryService.GetLocationOption(); + + return SUCCESS(response); + } + /// /// 获取出/入库操作类型下拉数据 /// /// diff --git a/DOAN.Model/MES/Material/Dto/MmLocationDto.cs b/DOAN.Model/MES/Material/Dto/MmLocationDto.cs index f530b6c..e681e31 100644 --- a/DOAN.Model/MES/Material/Dto/MmLocationDto.cs +++ b/DOAN.Model/MES/Material/Dto/MmLocationDto.cs @@ -50,4 +50,16 @@ namespace DOAN.Model.BZFM.Dto [ExcelColumn(Name = "库位类型(半成品/成品/临时/返工/报废)")] public string LocationTypeLabel { get; set; } } + + /// + /// 库位下拉选择 + /// + public class MmLocationOption + { + public string LocationCode { get; set; } + public string LocationName { get; set; } + public string WarehouseCode { get; set; } + public string WarehouseName { get; set; } + public string LocationType { get; set; } + } } \ No newline at end of file diff --git a/DOAN.Service/MES/Material/IService/IMmInventoryService.cs b/DOAN.Service/MES/Material/IService/IMmInventoryService.cs index 324c2f8..918efe0 100644 --- a/DOAN.Service/MES/Material/IService/IMmInventoryService.cs +++ b/DOAN.Service/MES/Material/IService/IMmInventoryService.cs @@ -21,6 +21,11 @@ namespace DOAN.Service.BZFM.IBZFMService /// List GetMaterialOption(); + /// + /// 获取库位下拉数据 + /// + List GetLocationOption(); + /// /// 获取出/入库操作类型下拉数据 /// diff --git a/DOAN.Service/MES/Material/MmInventoryService.cs b/DOAN.Service/MES/Material/MmInventoryService.cs index d2e5b85..9a532f0 100644 --- a/DOAN.Service/MES/Material/MmInventoryService.cs +++ b/DOAN.Service/MES/Material/MmInventoryService.cs @@ -102,6 +102,30 @@ namespace DOAN.Service.BZFM } } + + public List GetLocationOption() + { + try + { + return Context.Queryable() + .Where(it => it.Status == "启用") + .Select(it => new MmLocationOption + { + WarehouseCode = it.WarehouseCode, + WarehouseName = it.WarehouseName, + LocationCode = it.LocationCode, + LocationName = it.LocationName, + LocationType = it.LocationType + }) + .ToList(); + } + catch (Exception) + { + + throw; + } + } + public List GetTransactionOption() { try @@ -149,17 +173,14 @@ namespace DOAN.Service.BZFM } // 验证信息 - MmLocation mmLocation = Context.Queryable() + .Where(it => it.WarehouseCode == parm.WarehouseCode) .Where(it => it.LocationCode == parm.LocationCode) .First(); if (mmLocation == null) { - return "仓库不存在!"; + return "仓库编码或库位编码不存在!"; } - - - bool hasInventory = true; MmInventory mmInventory = Context.Queryable() .Where(it => it.MaterialCode == parm.MaterialCode) @@ -265,11 +286,12 @@ namespace DOAN.Service.BZFM // 验证信息 MmLocation mmLocation = Context.Queryable() + .Where(it => it.WarehouseCode == parm.WarehouseCode) .Where(it => it.LocationCode == parm.LocationCode) .First(); if (mmLocation == null) { - return "仓库不存在!"; + return "仓库编码或库位编码不存在!"; } bool hasInventory = true; MmInventory mmInventory = Context.Queryable() @@ -339,5 +361,6 @@ namespace DOAN.Service.BZFM return ex.Message; } } + } } \ No newline at end of file