新增库位下拉接口及相关DTO与错误提示优化
新增 GetLocationOption 接口,完善 Controller、Service 层及 MmLocationOption DTO,实现库位下拉数据获取。修正仓库或库位不存在时的错误提示信息。
This commit is contained in:
@@ -110,6 +110,17 @@ namespace DOAN.Admin.WebApi.Controllers.BZFM
|
|||||||
return SUCCESS(response);
|
return SUCCESS(response);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 获取库位下拉数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("GetLocationOption")]
|
||||||
|
public IActionResult GetLocationOption()
|
||||||
|
{
|
||||||
|
var response = _MmInventoryService.GetLocationOption();
|
||||||
|
|
||||||
|
return SUCCESS(response);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// 获取出/入库操作类型下拉数据
|
/// 获取出/入库操作类型下拉数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|||||||
@@ -50,4 +50,16 @@ namespace DOAN.Model.BZFM.Dto
|
|||||||
[ExcelColumn(Name = "库位类型(半成品/成品/临时/返工/报废)")]
|
[ExcelColumn(Name = "库位类型(半成品/成品/临时/返工/报废)")]
|
||||||
public string LocationTypeLabel { get; set; }
|
public string LocationTypeLabel { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 库位下拉选择
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,11 @@ namespace DOAN.Service.BZFM.IBZFMService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
List<MmMaterialOption> GetMaterialOption();
|
List<MmMaterialOption> GetMaterialOption();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取库位下拉数据
|
||||||
|
/// </summary>
|
||||||
|
List<MmLocationOption> GetLocationOption();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取出/入库操作类型下拉数据
|
/// 获取出/入库操作类型下拉数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -102,6 +102,30 @@ namespace DOAN.Service.BZFM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<MmLocationOption> GetLocationOption()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Context.Queryable<MmLocation>()
|
||||||
|
.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<MmTransactionOption> GetTransactionOption()
|
public List<MmTransactionOption> GetTransactionOption()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -149,17 +173,14 @@ namespace DOAN.Service.BZFM
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 验证信息
|
// 验证信息
|
||||||
|
|
||||||
MmLocation mmLocation = Context.Queryable<MmLocation>()
|
MmLocation mmLocation = Context.Queryable<MmLocation>()
|
||||||
|
.Where(it => it.WarehouseCode == parm.WarehouseCode)
|
||||||
.Where(it => it.LocationCode == parm.LocationCode)
|
.Where(it => it.LocationCode == parm.LocationCode)
|
||||||
.First();
|
.First();
|
||||||
if (mmLocation == null)
|
if (mmLocation == null)
|
||||||
{
|
{
|
||||||
return "仓库不存在!";
|
return "仓库编码或库位编码不存在!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool hasInventory = true;
|
bool hasInventory = true;
|
||||||
MmInventory mmInventory = Context.Queryable<MmInventory>()
|
MmInventory mmInventory = Context.Queryable<MmInventory>()
|
||||||
.Where(it => it.MaterialCode == parm.MaterialCode)
|
.Where(it => it.MaterialCode == parm.MaterialCode)
|
||||||
@@ -265,11 +286,12 @@ namespace DOAN.Service.BZFM
|
|||||||
// 验证信息
|
// 验证信息
|
||||||
|
|
||||||
MmLocation mmLocation = Context.Queryable<MmLocation>()
|
MmLocation mmLocation = Context.Queryable<MmLocation>()
|
||||||
|
.Where(it => it.WarehouseCode == parm.WarehouseCode)
|
||||||
.Where(it => it.LocationCode == parm.LocationCode)
|
.Where(it => it.LocationCode == parm.LocationCode)
|
||||||
.First();
|
.First();
|
||||||
if (mmLocation == null)
|
if (mmLocation == null)
|
||||||
{
|
{
|
||||||
return "仓库不存在!";
|
return "仓库编码或库位编码不存在!";
|
||||||
}
|
}
|
||||||
bool hasInventory = true;
|
bool hasInventory = true;
|
||||||
MmInventory mmInventory = Context.Queryable<MmInventory>()
|
MmInventory mmInventory = Context.Queryable<MmInventory>()
|
||||||
@@ -339,5 +361,6 @@ namespace DOAN.Service.BZFM
|
|||||||
return ex.Message;
|
return ex.Message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user