diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs index 6f124724..43cf33bb 100644 --- a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs @@ -49,8 +49,8 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro int data = 0; if (proWorkplan!=null) { - data = proWorkplanService.AddWorkPlan(proWorkplan); proWorkplan.ToCreate(HttpContext); + data = proWorkplanService.AddWorkPlan(proWorkplan); } return ToResponse(new ApiResult(200, "success", data)); @@ -67,8 +67,9 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro int data = 0; if (proWorkplan != null) { - data = proWorkplanService.UpdateWorkPlan(proWorkplan); proWorkplan.ToUpdate(HttpContext); + data = proWorkplanService.UpdateWorkPlan(proWorkplan); + } return ToResponse(new ApiResult(200, "success", data)); @@ -108,5 +109,60 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro return ToResponse(new ApiResult(200, "success", lst)); } + + /// + /// 新增生产工单 + /// + /// 生产工单对象 + /// + [HttpPost("addworkorder")] + public IActionResult AddWorkorder([FromBody] ProWorkorder proWorkorder) + { + int data = 0; + if (proWorkorder != null) + { + proWorkorder.ToCreate(HttpContext); + data = proWorkplanService.AddWorkorder(proWorkorder); + + } + + return ToResponse(new ApiResult(200, "success", data)); + } + + /// + /// 更新生产工单 + /// + /// 生产工单对象 + /// + [HttpPost("updateworkplan")] + public IActionResult UpdateWorkorder([FromBody] ProWorkorder proWorkorder) + { + int data = 0; + if (proWorkorder != null) + { + proWorkorder.ToUpdate(HttpContext); + data = proWorkplanService.UpdateWorkorder(proWorkorder); + + } + + return ToResponse(new ApiResult(200, "success", data)); + } + + /// + /// 删除生产工单 + /// + /// 工单ID + /// + [HttpGet("deleteworkorder/{id}")] + public IActionResult DeleteWorkorder(string id) + { + int data = 0; + if (!string.IsNullOrEmpty(id)) + { + data = proWorkplanService.DeleteWorkPlan(id); + } + + return ToResponse(new ApiResult(200, "success", data)); + } } } diff --git a/ZR.Service/mes/pro/IService/IProWorkplanService.cs b/ZR.Service/mes/pro/IService/IProWorkplanService.cs index f02daa0d..27723f6c 100644 --- a/ZR.Service/mes/pro/IService/IProWorkplanService.cs +++ b/ZR.Service/mes/pro/IService/IProWorkplanService.cs @@ -21,5 +21,11 @@ namespace ZR.Service.mes.pro.IService public int DeleteWorkPlan(string id); public List GetWorkorderList(string id); + + public int AddWorkorder(ProWorkorder proWorkorder); + + public int UpdateWorkorder(ProWorkorder proWorkorder); + + public int DeleteWorkorder(string id); } } diff --git a/ZR.Service/mes/pro/ProWorkplanService.cs b/ZR.Service/mes/pro/ProWorkplanService.cs index 2ecbea53..a767886b 100644 --- a/ZR.Service/mes/pro/ProWorkplanService.cs +++ b/ZR.Service/mes/pro/ProWorkplanService.cs @@ -54,5 +54,21 @@ namespace ZR.Service.mes.pro { return Context.Queryable().Where(it => it.FkProPlanId == id).ToList(); } + + public int AddWorkorder(ProWorkorder proWorkorder) + { + proWorkorder.Id = DateTime.Now.ToString("yyyyMMddHHmmss"); + return Context.Insertable(proWorkorder).ExecuteCommand(); + } + + public int UpdateWorkorder(ProWorkorder proWorkorder) + { + return Context.Updateable(proWorkorder).ExecuteCommand(); + } + + public int DeleteWorkorder(string id) + { + return Context.Deleteable().In(id).ExecuteCommand(); + } } }