diff --git a/AMESCoreStudio.Web/Controllers/REPController.cs b/AMESCoreStudio.Web/Controllers/REPController.cs index 903cae4e..b4a54040 100644 --- a/AMESCoreStudio.Web/Controllers/REPController.cs +++ b/AMESCoreStudio.Web/Controllers/REPController.cs @@ -533,6 +533,16 @@ namespace AMESCoreStudio.Web.Controllers } } + if (old_part_no == "") + { + return Json(new { _msg = "舊組件序號不可為空" }); + } + + if (new_part_no == "") + { + return Json(new { _msg = "新組件序號不可為空" }); + } + NgKeypart model = new NgKeypart(); model.ComponentID = component_id; model.OldPartNo = old_part_no; @@ -562,6 +572,16 @@ namespace AMESCoreStudio.Web.Controllers } } + if (old_part_no == "") + { + return Json(new { _msg = "舊組件序號不可為空" }); + } + + if (new_part_no == "") + { + return Json(new { _msg = "新組件序號不可為空" }); + } + NgKeypart ng_key_part = new NgKeypart(); ng_key_part.ComponentID = component_id; ng_key_part.OldPartNo = old_part_no; @@ -944,17 +964,19 @@ namespace AMESCoreStudio.Web.Controllers } } + var ng_keypart = await _repApi.GetNgKeyparts(model.ngComponent.ComponentID); + List items = new List(); //判斷組件是否更換 - for (int i = 0; i < ng_component.Count; i++) + for (int i = 0; i < ng_keypart.Count; i++) { - if (ng_component[i].NewPartNo != "" && ng_component[i].NewPartNo != null) + if (ng_keypart[i].NewPartNo != "" && ng_keypart[i].NewPartNo != null) { items.Add(new BarCodeCheckDto.inputItem { inputType = "KP", - inputData = ng_component[i].NewPartNo, - oldInputData = ng_component[i].OldPartNo + inputData = ng_keypart[i].NewPartNo, + oldInputData = ng_keypart[i].OldPartNo }); } }