2023-11-14 11:29:05 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2023-11-15 08:46:54 +08:00
|
|
|
|
using ZR.Admin.WebApi.Extensions;
|
2023-11-14 11:29:05 +08:00
|
|
|
|
using ZR.Model.mes.md;
|
2023-11-14 14:30:14 +08:00
|
|
|
|
using ZR.Model.mes.pro;
|
|
|
|
|
|
using ZR.Service.mes.pro.IService;
|
2023-11-14 11:29:05 +08:00
|
|
|
|
using ZR.Service.MES.md;
|
|
|
|
|
|
|
|
|
|
|
|
namespace ZR.Admin.WebApi.Controllers.MES.pro
|
|
|
|
|
|
{
|
2023-11-15 14:03:55 +08:00
|
|
|
|
//
|
|
|
|
|
|
//
|
2023-11-14 11:29:05 +08:00
|
|
|
|
|
|
|
|
|
|
[Route("mes/pro/workplan")]
|
|
|
|
|
|
public class ProWorkplanController : BaseController
|
|
|
|
|
|
{
|
2023-11-14 14:30:14 +08:00
|
|
|
|
private readonly IProWorkplanService proWorkplanService;
|
|
|
|
|
|
|
|
|
|
|
|
public ProWorkplanController(IProWorkplanService proWorkplanService)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.proWorkplanService = proWorkplanService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-11-14 11:29:05 +08:00
|
|
|
|
|
|
|
|
|
|
[HttpGet("list")]
|
2023-11-14 18:12:27 +08:00
|
|
|
|
public IActionResult List(int pageNum, int pageSize, int year=-1, int week=-1, string partNumber = "", string color = "")
|
2023-11-14 11:29:05 +08:00
|
|
|
|
{
|
2023-11-14 14:30:14 +08:00
|
|
|
|
(List<ProWorkplan>,int) data = proWorkplanService.GetAllData(pageNum, pageSize, year, week, partNumber, color);
|
2023-11-14 11:29:05 +08:00
|
|
|
|
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-14 16:43:35 +08:00
|
|
|
|
[HttpPost("addworkplan")]
|
2023-11-14 17:02:14 +08:00
|
|
|
|
public IActionResult AddWorkPlan([FromBody] ProWorkplan proWorkplan)
|
2023-11-14 16:43:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
int data = 0;
|
|
|
|
|
|
if (proWorkplan!=null)
|
|
|
|
|
|
{
|
|
|
|
|
|
data = proWorkplanService.AddWorkPlan(proWorkplan);
|
2023-11-15 08:46:54 +08:00
|
|
|
|
proWorkplan.ToCreate(HttpContext);
|
2023-11-14 16:43:35 +08:00
|
|
|
|
}
|
2023-11-14 11:29:05 +08:00
|
|
|
|
|
2023-11-14 16:43:35 +08:00
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
2023-11-14 11:29:05 +08:00
|
|
|
|
|
2023-11-14 18:46:59 +08:00
|
|
|
|
[HttpPost("updateworkplan")]
|
|
|
|
|
|
public IActionResult UpdateWorkPlan([FromBody] ProWorkplan proWorkplan)
|
|
|
|
|
|
{
|
|
|
|
|
|
int data = 0;
|
|
|
|
|
|
if (proWorkplan != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
data = proWorkplanService.UpdateWorkPlan(proWorkplan);
|
2023-11-15 08:46:54 +08:00
|
|
|
|
proWorkplan.ToUpdate(HttpContext);
|
2023-11-14 18:46:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[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));
|
|
|
|
|
|
}
|
2023-11-15 14:38:10 +08:00
|
|
|
|
|
|
|
|
|
|
[HttpGet("getworkorderList/{id}")]
|
|
|
|
|
|
public IActionResult GetWorkorderList(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<ProWorkorder> lst = new List<ProWorkorder>();
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
|
|
|
|
{
|
|
|
|
|
|
lst = proWorkplanService.GetWorkorderList(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", lst));
|
|
|
|
|
|
}
|
2023-11-14 11:29:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|