bom完成
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Service.mes.md;
|
||||
using ZR.Service.MES.md;
|
||||
using ZR.Service.MES.md.IService;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers.MES.md
|
||||
{
|
||||
@@ -29,5 +35,80 @@ namespace ZR.Admin.WebApi.Controllers.MES.md
|
||||
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询父产品
|
||||
/// </summary>
|
||||
/// <param name="queryString">productCode码</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("queryBOM")]
|
||||
public IActionResult List(string queryString="")
|
||||
{
|
||||
List<MdBom> data = mdBOMService.QueryBOM(queryString);
|
||||
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取全部单位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getunitList")]
|
||||
public IActionResult GetAllunitList()
|
||||
{
|
||||
List<MdUnit> data = mdBOMService.GetAllunitList();
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增BOM数据
|
||||
/// </summary>
|
||||
/// <param name="bom"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addBom")]
|
||||
public IActionResult AddBOM([FromBody] MdBom bomItem)
|
||||
{
|
||||
if(bomItem!=null&&bomItem.Id!=null)
|
||||
bomItem.ToCreate(HttpContext);
|
||||
if (bomItem.ParentProductId == 0)
|
||||
bomItem.ParentProductId = null;
|
||||
int result=mdBOMService.AddBom(bomItem);
|
||||
return ToResponse(new ApiResult(200, "success", result));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改bom数据
|
||||
/// </summary>
|
||||
/// <param name="bomItem"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("updateBom")]
|
||||
public IActionResult UpdateBOM([FromBody] MdBom bomItem)
|
||||
{
|
||||
if (bomItem != null && bomItem.Id != null)
|
||||
bomItem.ToUpdate(HttpContext);
|
||||
if (bomItem.ParentProductId == 0)
|
||||
bomItem.ParentProductId = null;
|
||||
int result = mdBOMService.UpdateBOM(bomItem);
|
||||
return ToResponse(new ApiResult(200, "success", result));
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost("delBom")]
|
||||
public IActionResult deleteBOM([FromBody] List<int> ids)
|
||||
{
|
||||
if (ids != null)
|
||||
{
|
||||
int result = mdBOMService.deleteBOM(ids.ToArray());
|
||||
return ToResponse(result);
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user