From 82dac540156cb29e58c86f7d7d840e3c7e548c15 Mon Sep 17 00:00:00 2001 From: xwt <2740516069@qq.com> Date: 星期四, 14 八月 2025 19:55:41 +0800 Subject: [PATCH] 来料检,入库检,首检巡检。 --- StandardInterface/MESApplication/Controllers/QC/XJController.cs | 179 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 168 insertions(+), 11 deletions(-) diff --git a/StandardInterface/MESApplication/Controllers/QC/XJController.cs b/StandardInterface/MESApplication/Controllers/QC/XJController.cs index 25228a3..e515b8c 100644 --- a/StandardInterface/MESApplication/Controllers/QC/XJController.cs +++ b/StandardInterface/MESApplication/Controllers/QC/XJController.cs @@ -15,7 +15,7 @@ [HttpPost("getAll")] public ResponseResult getAll([FromBody] JObject data) { - var modify1Flag = Convert.ToInt32(data["modify1Flag"].ToString()); + var modify1Flag = Convert.ToInt32(data["modify1Flag"]?.ToString() ?? "0"); try { dynamic resultInfos = new ExpandoObject(); @@ -88,13 +88,36 @@ [HttpPost("getDaa001")] public ResponseResult getDaa001([FromBody] JObject data) { - var daa020 = data["daa020"].ToString(); - var item = data["item"].ToString(); + var daa020 = data["daa020"]?.ToString() ?? ""; try { dynamic resultInfos = new ExpandoObject(); - var tbBillList = - new XJService().getDaa001(daa020, item); + var tbBillList = new XJService().getDaa001(daa020); + resultInfos.tbBillList = tbBillList; + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鑾峰彇宸ュ崟璇︾粏淇℃伅锛堝寘鍚墿鏂欎俊鎭級 + /// </summary> + [HttpPost("getWorkOrderWithItem")] + public ResponseResult getWorkOrderWithItem([FromBody] JObject data) + { + var daa020 = data["daa020"]?.ToString() ?? ""; + try + { + dynamic resultInfos = new ExpandoObject(); + var tbBillList = new XJService().getWorkOrderWithItem(daa020); resultInfos.tbBillList = tbBillList; return new ResponseResult { @@ -116,12 +139,14 @@ [HttpPost("getBoardItem")] public ResponseResult getBoardItem([FromBody] JObject data) { - var lineNo = data["lineNo"].ToString(); + var lineNo = data["lineNo"]?.ToString() ?? ""; try { dynamic resultInfos = new ExpandoObject(); var tbBillList = new XJService().getBoardItem(lineNo); + // 鎸� itemNo 鍘婚噸 + tbBillList = tbBillList.GroupBy(x => x.ItemNo).Select(g => g.First()).ToList(); resultInfos.tbBillList = tbBillList; return new ResponseResult { @@ -140,7 +165,7 @@ [HttpPost("getItem")] public ResponseResult getItem([FromBody] JObject data) { - var daa001 = data["daa001"].ToString(); + var daa001 = data["daa001"]?.ToString() ?? ""; try { dynamic resultInfos = new ExpandoObject(); @@ -164,7 +189,7 @@ [HttpPost("setJYItem")] public ResponseResult setJYItem([FromBody] JObject data) { - var itemNo = data["itemNo"].ToString(); + var itemNo = data["itemNo"]?.ToString() ?? ""; try { dynamic resultInfos = new ExpandoObject(); @@ -191,9 +216,12 @@ try { dynamic resultInfos = new ExpandoObject(); - var tbBillList = - new XJService().save(xjDto); - resultInfos.tbBillList = tbBillList; + var result = new XJService().save(xjDto); + + // 杩斿洖瀹屾暣鐨刋JDto瀵硅薄锛屽寘鍚洿鏂板悗鐨刬tems + resultInfos.tbBillList = result; + resultInfos.xjDto = xjDto; // 鍖呭惈瀹屾暣鐨勬楠岄」鐩俊鎭� + return new ResponseResult { status = 0, @@ -442,4 +470,133 @@ return ResponseResult.ResponseError(ex); } } + + //鍒锋柊妫�楠岄」鐩� + [HttpPost("GenUpdate")] + public ResponseResult GenUpdate([FromBody] JObject data) + { + try + { + decimal? id = data["id"]?.ToObject<decimal>(); + string? no = data["no"]?.ToString(); + string? user = data["user"]?.ToString(); + + var (result, message) = new XJService().GenUpdate(id, no, user); + + dynamic resultInfos = new ExpandoObject(); + resultInfos.result = result; + resultInfos.message = message; + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + //鎻愪氦妫�楠� + [HttpPost("SjSubmit")] + public ResponseResult SjSubmit([FromBody] SJDto sjDto) + { + try + { + dynamic resultInfos = new ExpandoObject(); + var tbBillList = new XJService().SjSubmit(sjDto); + resultInfos.tbBillList = tbBillList; + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鑾峰彇鏈夌嚎浣撶殑閮ㄩ棬鍒楄〃 + /// </summary> + [HttpPost("getDepartmentsWithLines")] + public ResponseResult GetDepartmentsWithLines() + { + try + { + dynamic resultInfos = new ExpandoObject(); + var tbBillList = new XJService().GetDepartmentsWithLines(); + resultInfos.tbBillList = tbBillList; + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇濆瓨閮ㄩ棬閫夋嫨 + /// </summary> + [HttpPost("saveDepartmentSelection")] + public ResponseResult SaveDepartmentSelection([FromBody] JObject data) + { + try + { + var id = Convert.ToDecimal(data["id"]); + var departmentId = data["departmentId"]?.ToString() ?? ""; + var departmentName = data["departmentName"]?.ToString() ?? ""; + + dynamic resultInfos = new ExpandoObject(); + var result = new XJService().SaveDepartmentSelection(id, departmentId, departmentName); + resultInfos.tbBillList = result; + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁閮ㄩ棬ID鑾峰彇璇ラ儴闂ㄤ笅鐨勭嚎浣撳垪琛� + /// </summary> + [HttpPost("getLinesByDepartment")] + public ResponseResult GetLinesByDepartment([FromBody] JObject data) + { + try + { + var departmentId = data["departmentId"]?.ToString() ?? ""; + + dynamic resultInfos = new ExpandoObject(); + var tbBillList = new XJService().GetLinesByDepartment(departmentId); + resultInfos.tbBillList = tbBillList; + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } } \ No newline at end of file -- Gitblit v1.9.3