98 lines
2.9 KiB
C#
98 lines
2.9 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Model.DBModel;
|
|
using ZR.Admin.WebApi.Extensions;
|
|
using ZR.Model.mes.pro;
|
|
using ZR.Service.mes.pro.IService;
|
|
|
|
namespace ZR.Admin.WebApi.Controllers.mes.pro
|
|
{
|
|
[Route("mes/pro/workplan_v2")]
|
|
public class ProWorkplanV2Controller : BaseController
|
|
{
|
|
|
|
private readonly IProWorkplanServiceV2 proWorkplanService;
|
|
|
|
public ProWorkplanV2Controller(IProWorkplanServiceV2 proWorkplanService)
|
|
{
|
|
this.proWorkplanService = proWorkplanService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取生产计划列表
|
|
/// </summary>
|
|
/// <param name="pageNum">页编号</param>
|
|
/// <param name="pageSize">页大小</param>
|
|
/// <param name="year">年份</param>
|
|
/// <param name="week">周数</param>
|
|
/// <param name="partNumber">零件号</param>
|
|
/// <param name="color">颜色</param>
|
|
/// <returns></returns>
|
|
[HttpGet("list")]
|
|
public IActionResult List(int pageNum, int pageSize, int year = -1, int week = -1, string partNumber = "", string color = "")
|
|
{
|
|
(List<ProWorklplan_v2>, int) data = proWorkplanService.GetAllData(pageNum, pageSize, year, week, partNumber, color);
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 新增生产计划
|
|
/// </summary>
|
|
/// <param name="proWorkplan">生产计划对象</param>
|
|
/// <returns></returns>
|
|
[HttpPost("addworkplan")]
|
|
public IActionResult AddWorkPlan([FromBody] ProWorklplan_v2 proWorkplan)
|
|
{
|
|
int data = 0;
|
|
if (proWorkplan != null)
|
|
{
|
|
proWorkplan.ToCreate(HttpContext);
|
|
data = proWorkplanService.AddWorkPlan(proWorkplan);
|
|
}
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 删除生产计划
|
|
/// </summary>
|
|
/// <param name="id">计划ID</param>
|
|
/// <returns></returns>
|
|
[HttpGet("deleteitem/{id}")]
|
|
public IActionResult DeleteItem(string id)
|
|
{
|
|
int data = 0;
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
data = proWorkplanService.DeleteWorkPlan(id);
|
|
}
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 更新生产计划
|
|
/// </summary>
|
|
/// <param name="proWorkplan">生产计划对象</param>
|
|
/// <returns></returns>
|
|
[HttpPost("updateworkplan")]
|
|
public IActionResult UpdateWorkPlan([FromBody] ProWorklplan_v2 proWorkplan)
|
|
{
|
|
int data = 0;
|
|
if (proWorkplan != null)
|
|
{
|
|
proWorkplan.ToUpdate(HttpContext);
|
|
data = proWorkplanService.UpdateWorkPlan(proWorkplan);
|
|
|
|
}
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
}
|
|
|
|
}
|
|
}
|