diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs index d6dc1f28..8cf88aa6 100644 --- a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanController.cs @@ -179,12 +179,14 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro public IActionResult UpdateWorkorder([FromBody] ProWorkorder proWorkorder) { // TODO 判断更新的数量是否超过计划数 + int data = 0; - if (proWorkorder != null) + if (proWorkorder != null) // 工单对象不为空 { string workPlanId = proWorkorder.FkProPlanId; string workorderId = proWorkorder.Id; + // 判断计划ID,工单ID要非空 if (!string.IsNullOrEmpty(workPlanId) && !string.IsNullOrEmpty(workorderId)) { string isArrange = "0"; @@ -196,9 +198,9 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro ProWorkorder currentWorkorder = null; foreach (ProWorkorder item in lstWorkorder) { - if(item.Id.Equals(workorderId) && !string.IsNullOrEmpty(item.Isarrange)) + if(item.Id.Equals(workorderId)) // 找到当前工单ID的对象 { - isArrange = item.Isarrange; + if(!string.IsNullOrEmpty(item.Isarrange)) isArrange = item.Isarrange; currentWorkorder = item; break; } @@ -260,6 +262,7 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro // 查询所有生产工单,根据生产计划ID List lstWorkorder = proWorkplanService.GetWorkorderListById(id); + // 查询工单非空,数量必须为1个 if (lstWorkorder != null && lstWorkorder.Count == 1) { string isArrange = "0";