From ee917a31338db1e29bc0416ecab8f528cc9051f8 Mon Sep 17 00:00:00 2001 From: "xiaowei.song" Date: Thu, 16 Nov 2023 09:35:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=20=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pro/ProWorkplanController.cs | 22 ++++++++++++++++++- .../mes/pro/IService/IProWorkplanService.cs | 7 ++++++ ZR.Service/mes/pro/ProWorkplanService.cs | 5 +++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs index 049325ba..816242a6 100644 --- a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs @@ -253,7 +253,27 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro int data = 0; if (!string.IsNullOrEmpty(id)) { - data = proWorkplanService.DeleteWorkorder(id); + // 查询所有生产工单,根据生产计划ID + List lstWorkorder = proWorkplanService.GetWorkorderListById(id); + + if (lstWorkorder != null && lstWorkorder.Count == 1) + { + string isArrange = "0"; + + // 排产状态非空 + if (!string.IsNullOrEmpty(lstWorkorder[0].Isarrange)) + { + isArrange = lstWorkorder[0].Isarrange; + } + + // 排产状态为 0 ,可执行删除 + if ("0".Equals(isArrange)) + { + data = proWorkplanService.DeleteWorkorder(id); + } + else data = 2; + } + } 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 d0565dbc..d36708bc 100644 --- a/ZR.Service/mes/pro/IService/IProWorkplanService.cs +++ b/ZR.Service/mes/pro/IService/IProWorkplanService.cs @@ -34,6 +34,13 @@ namespace ZR.Service.mes.pro.IService /// public List GetWorkorderList(string id); + /// + /// 根据工单ID,获取工单 + /// + /// + /// + public List GetWorkorderListById(string id); + public int AddWorkorder(ProWorkorder proWorkorder); public int UpdateWorkorder(ProWorkorder proWorkorder); diff --git a/ZR.Service/mes/pro/ProWorkplanService.cs b/ZR.Service/mes/pro/ProWorkplanService.cs index c9842456..d9281cb7 100644 --- a/ZR.Service/mes/pro/ProWorkplanService.cs +++ b/ZR.Service/mes/pro/ProWorkplanService.cs @@ -60,6 +60,11 @@ namespace ZR.Service.mes.pro return Context.Queryable().Where(it => it.FkProPlanId == id).ToList(); } + public List GetWorkorderListById(string id) + { + return Context.Queryable().Where(it => it.Id == id).ToList(); + } + public int AddWorkorder(ProWorkorder proWorkorder) {