feat(物料管理): 新增物料库存相关功能及接口
- 在MmMaterial类中添加ParentMaterialCode字段支持物料层级关系 - 扩展MmRecordOutbound类增加供应商信息字段 - 重构FeedProcessReportwork方法支持原材料工单领料和库存ID指定 - 新增物料库存查询、领料、成品入库、出货等接口 - 完善库存操作逻辑,支持根据库存ID直接操作 - 添加相关DTO类支持新功能的数据传输
This commit is contained in:
@@ -400,7 +400,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(500, ex.Message);
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
return ToResponse(500, ex.Message);
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -447,7 +447,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(500, ex.Message);
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(500, ex.Message);
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,7 +497,185 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(500, ex.Message);
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工单号查询物料库存
|
||||
/// </summary>
|
||||
/// <param name="workorder">工单号</param>
|
||||
/// <returns>物料库存信息列表</returns>
|
||||
[HttpGet("GetMaterialInventoryList/{workorder}")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:query")]
|
||||
public IActionResult GetMaterialInventoryList(string workorder)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(workorder))
|
||||
{
|
||||
return ToResponse(ApiResult.Error($"工单号不能为空"));
|
||||
}
|
||||
|
||||
var response = _ProWorkorderMaterialService.GetMaterialInventoryList(workorder);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 领料接口
|
||||
/// </summary>
|
||||
/// <param name="request">领料请求参数</param>
|
||||
/// <returns>操作结果</returns>
|
||||
[HttpPost("TakeMaterial")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:edit")]
|
||||
[Log(Title = "领料操作", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult TakeMaterial([FromBody] MaterialTakeRequestDto request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
return ToResponse(ApiResult.Error($"领料请求参数不能为空"));
|
||||
}
|
||||
|
||||
var response = _ProWorkorderMaterialService.TakeMaterial(request);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 成品入库接口
|
||||
/// </summary>
|
||||
/// <param name="request">成品入库请求参数</param>
|
||||
/// <returns>操作结果</returns>
|
||||
[HttpPost("StoreProduct")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:edit")]
|
||||
[Log(Title = "成品入库操作", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult StoreProduct([FromBody] ProductStorageRequestDto request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
return ToResponse(ApiResult.Error($"成品入库请求参数不能为空"));
|
||||
}
|
||||
|
||||
var response = _ProWorkorderMaterialService.StoreProduct(request);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 出货接口
|
||||
/// </summary>
|
||||
/// <param name="request">出货请求参数</param>
|
||||
/// <returns>操作结果</returns>
|
||||
[HttpPost("ShipProduct")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:edit")]
|
||||
[Log(Title = "出货操作", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult ShipProduct([FromBody] ShipmentRequestDto request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
return ToResponse(ApiResult.Error($"出货请求参数不能为空"));
|
||||
}
|
||||
|
||||
var response = _ProWorkorderMaterialService.ShipProduct(request);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工单号获取可领料工单清单
|
||||
/// </summary>
|
||||
/// <param name="workorder">工单号</param>
|
||||
/// <returns>可领料工单清单</returns>
|
||||
[HttpGet("GetPickableWorkordersByWorkorder/{workorder}")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:query")]
|
||||
public IActionResult GetPickableWorkordersByWorkorder(string workorder)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(workorder))
|
||||
{
|
||||
return ToResponse(ApiResult.Error($"工单号不能为空"));
|
||||
}
|
||||
|
||||
var response = _ProWorkorderMaterialService.GetPickableWorkordersByWorkorder(workorder);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工单号获取可出货订单清单
|
||||
/// </summary>
|
||||
/// <param name="workorder">工单号</param>
|
||||
/// <returns>可出货订单清单</returns>
|
||||
[HttpGet("GetShippableOrdersByWorkorder/{workorder}")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:query")]
|
||||
public IActionResult GetShippableOrdersByWorkorder(string workorder)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(workorder))
|
||||
{
|
||||
return ToResponse(ApiResult.Error($"工单号不能为空"));
|
||||
}
|
||||
|
||||
var response = _ProWorkorderMaterialService.GetShippableOrdersByWorkorder(workorder);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工单号查询成品库存
|
||||
/// </summary>
|
||||
/// <param name="workorder">工单号</param>
|
||||
/// <returns>成品库存信息列表</returns>
|
||||
[HttpGet("GetProductInventoryList/{workorder}")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:query")]
|
||||
public IActionResult GetProductInventoryList(string workorder)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(workorder))
|
||||
{
|
||||
return ToResponse(ApiResult.Error($"工单号不能为空"));
|
||||
}
|
||||
|
||||
var response = _ProWorkorderMaterialService.GetProductInventoryList(workorder);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user