From 4f88a7d41fea9435c859e256c906a8daeed9953f Mon Sep 17 00:00:00 2001 From: wbc <2597324127@qq.com> Date: 星期六, 15 三月 2025 16:37:15 +0800 Subject: [PATCH] 首件巡检优化更改 --- MES.Service/service/QC/LljService.cs | 60 ++++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 36 insertions(+), 24 deletions(-) diff --git a/MES.Service/service/QC/LljService.cs b/MES.Service/service/QC/LljService.cs index 2d9397c..262c14c 100644 --- a/MES.Service/service/QC/LljService.cs +++ b/MES.Service/service/QC/LljService.cs @@ -1,5 +1,4 @@ 锘縰sing System.Data; -using System.Dynamic; using MES.Service.DB; using MES.Service.Dto.service; using MES.Service.Modes; @@ -12,13 +11,15 @@ public class LljService { - public List<LtsLlj> GetPage(XJPageResult queryObj) + public (List<LtsLlj> item, int TotalCount) GetPage(XJPageResult queryObj) { var db = SqlSugarHelper.GetInstance(); var id = Convert.ToDecimal(queryObj.id); - return db.Queryable<LtsLlj>() + var totalCount = 0; + + var pageList = db.Queryable<LtsLlj>() .WhereIF( StringUtil.IsNotNullOrEmpty(queryObj.result) && "鏈畬鎴�".Equals(queryObj.result), @@ -27,9 +28,17 @@ StringUtil.IsNotNullOrEmpty(queryObj.result) && !"鏈畬鎴�".Equals(queryObj.result), a => a.FcheckResu != null) - .WhereIF(id > 0, (a) => a.Id == id) - .OrderByDescending(a=>a.Id) - .ToPageList(queryObj.PageIndex, queryObj.Limit); + .WhereIF(id > 0, a => a.Id == id) + //鍔犵瓫閫夋潯浠�,鏍规嵁渚涘簲鍟嗭紝鐗╂枡缂栫爜锛岀墿鏂欏悕绉版悳绱� + //.WhereIF(queryObj.SearchValue!=null && queryObj.SearchValue!="", (a) => a.SuppName == queryObj.SearchValue|| a.ItemName == queryObj.SearchValue || a.ItemNo == queryObj.SearchValue ) + .WhereIF(queryObj.SearchValue != null && queryObj.SearchValue != "", + (a) => (a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()) + || a.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()) + || a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))) + .OrderByDescending(a => a.Id) + .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); + + return (pageList, totalCount); } //鏍规嵁妫�楠屾爣鍑嗘潵璁$畻妫�楠屼釜鏁� @@ -66,7 +75,7 @@ // FcheckItemDesc = "0", // FcheckResu = "0", FcheckTool = b.FcheckTool, - FspecRequ = b.FspecRequ, + FspecRequ = b.FspecRequ // FtextType = "0", // Funit = "0", // LastupdateBy = "0", @@ -79,31 +88,37 @@ string LEV = null; switch (item.FcheckLevel) { - case string s when s.Contains("S1"): + case null: + LEV = ""; // 榛樿鍊� + break; + case { } s when s.Contains("S1"): LEV = "B.FLEVEL_S1"; break; - case string s when s.Contains("S2"): + case { } s when s.Contains("S2"): LEV = "B.FLEVEL_S2"; break; - case string s when s.Contains("S3"): + case { } s when s.Contains("S3"): LEV = "B.FLEVEL_S3"; break; - case string s when s.Contains("S4"): + case { } s when s.Contains("S4"): LEV = "B.FLEVEL_S4"; break; - case string s when s.Contains("(I)"): + case { } s when s.Contains("(I)"): LEV = "B.FLEVEL_I"; break; - case string s when s.Contains("(II)"): + case { } s when s.Contains("(II)"): LEV = "B.FLEVEL_II"; break; - case string s when s.Contains("(III)"): + case { } s when s.Contains("(III)"): LEV = "B.FLEVEL_III"; break; default: LEV = ""; // 榛樿鍊� break; } + + if (string.IsNullOrEmpty(LEV)) + throw new Exception(item.SampleSizeNo + "鐨勬楠屾按骞充笉姝g‘"); var sql = "SELECT " + LEV + @@ -114,9 +129,15 @@ var maxBillNo = db.Ado.SqlQuerySingle<string>(sql); + if (string.IsNullOrEmpty(maxBillNo)) + throw new Exception(item.SampleSizeNo + "涓嬬殑" + quantity + + "杩欎釜鑼冨洿涓嬫病鏈夊尮閰嶅埌妫�楠岄」鐩�"); var result = ExtractSubstring(item.FacLevel, '(', ')'); + if (string.IsNullOrEmpty(result)) + throw new Exception(item.SampleSizeNo + "涓嬬殑" + quantity + + "鎷掓敹姘村钩涓嶆纭�"); sql = "SELECT FSAMPLE_SIZE_WORD, " + result + " Result FROM MES_QM_AQL1 A LEFT JOIN MES_QM_AQL3 C ON C.AQL1_ID=A.ID WHERE A.SAMPLE_SIZE_NO= '" + @@ -176,17 +197,11 @@ .Where(x1 => x1.MainId == s.Id).Count(); if (ifck > s.FreQty && s.CheckQyt == count) - { s.FcheckResu = "涓嶅悎鏍�"; - } else if (ifck < s.FreQty && s.CheckQyt == count) - { s.FcheckResu = "鍚堟牸"; - } else - { s.FcheckResu = "鏈畬鎴�"; - } var detail = new MesQaItemsDetectDetail12(); @@ -590,10 +605,7 @@ var resultValue = outputResult.Value?.ToString(); var messageValue = outputMessage.Value?.ToString(); - if ("1".Equals(resultValue)) - { - throw new Exception(messageValue); - } + if ("1".Equals(resultValue)) throw new Exception(messageValue); return true; } -- Gitblit v1.9.3