From 5adecb7ffd986930d2f4e195c0273e4db73b5315 Mon Sep 17 00:00:00 2001
From: kyy <3283105747@qq.com>
Date: 星期五, 07 二月 2025 18:36:51 +0800
Subject: [PATCH] 优化首检

---
 MES.Service/service/QC/RKJService.cs |   33 ++++++++++++++++++---------------
 1 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/MES.Service/service/QC/RKJService.cs b/MES.Service/service/QC/RKJService.cs
index 8d615ee..7e48bd7 100644
--- a/MES.Service/service/QC/RKJService.cs
+++ b/MES.Service/service/QC/RKJService.cs
@@ -64,31 +64,31 @@
     }*/
 
     //鏍规嵁妫�楠屾爣鍑嗘潵璁$畻妫�楠屼釜鏁�
-    public List<QsItemOqcItem> SetItems(string itemNo, decimal quantity)
+    public List<QsItemOqcItem> SetItems(decimal itemId, decimal quantity)
     {
         var db = SqlSugarHelper.GetInstance();
 
         var count = db.Queryable<MesQa>().Where(s => s.QsType == "3"
-                                                     && s.ItemNo == itemNo && s.Fsubmit == 1).Count();
+                                                     && s.ItemId == itemId && s.Fsubmit == 1).Count();
 
         if (count <= 0) return [];
 
         var qsItemOqcItems = db
             .Queryable<MesQualityStandard>()
             .Where(b => b.QsType == "3"
-                        && b.ItemNo == itemNo).Select(
+                        && b.ItemId == itemId).Select(
                 b => new QsItemOqcItem
                 {
                     ProjName = b.ProjName,
-                    ItemMod = b.ItemMod,
+                   // ItemMod = b.ItemMod,
                     InspectionMethod = b.InspectionMethod,
                     UsingInstruments = b.UsingInstruments,
                     LevelNum = SqlFunc.IsNull(
-                        SqlFunc.IsNull(b.LevelNum * b.InspectionLevel, 1),
-                        b.InspectionLevel),
-                    MaxValue = b.MaxValue,
-                    StandardValue = b.StandardValue,
-                    MinValue = b.MinValue,
+                        SqlFunc.IsNull( Convert.ToDecimal(b.LevelNum) * Convert.ToDecimal(b.InspectionLevel) , 1),
+                        Convert.ToDecimal(b.InspectionLevel)),
+                    MaxValue = Convert.ToDecimal(b.MaxValue),
+                    StandardValue = Convert.ToDecimal(b.StandardValue),
+                    MinValue = Convert.ToDecimal(b.MinValue),
                     Notes = b.Notes,
                     FcheckLevel = b.FcheckLevel,
                     FacLevel = b.FacLevel,
@@ -128,9 +128,11 @@
                     break;
                 default:
                     LEV = ""; // 榛樿鍊�
+                    
                     break;
             }
-
+            if (string.IsNullOrEmpty(LEV)) throw new Exception("璇ョ墿鏂欐湭缁存姢妫�楠岄」鐩垨妫�楠屾按骞充负绌�");
+            
             var sql =
                 "SELECT " + LEV +
                 " FROM MES_QM_AQL1 A LEFT JOIN MES_QM_AQL2 B ON B.AQL1_ID=A.ID WHERE A.SAMPLE_SIZE_NO='" +
@@ -176,7 +178,7 @@
         return db.Queryable<QsItemOqcItem, QsItemOqcItemDetail>((a, b) =>
                 new JoinQueryInfos(JoinType.Left, a.Id == b.Pid))
             .WhereIF(pid > 0, (a, b) => a.Pid == pid)
-            .WhereIF(id > 0, (a, b) => a.Id == id)
+            //.WhereIF(id > 0, (a, b) => a.Id == id)
             .GroupBy((a, b) => new
             {
                 a.Id,
@@ -465,7 +467,7 @@
             lineNo = _baseService.getUserLineNo(queryObj.createUser);
 
         return db.Queryable<QsItemOqcReq, RKJDaa001>((a, b) =>
-                new JoinQueryInfos(JoinType.Left, a.BillNo == b.RbillNo && a.ItemId ==b.ItemId))
+                new JoinQueryInfos(JoinType.Left, a.Id == b.ItemInId && a.ItemId ==b.ItemId))
             
             .WhereIF(
                 StringUtil.IsNotNullOrEmpty(queryObj.result) &&
@@ -485,7 +487,7 @@
                 CreateBy = a.CreateBy,
                 CreateDate = a.CreateDate,
                 ItemNo = a.ItemNo,
-                TaskNo = b.LotNo,
+                TaskNo = b.WorkNo,
                 ItemName = b.ItemName,
                 ItemModel = b.ItemModel,
                 LineNo = b.LineNo,
@@ -493,8 +495,9 @@
                 FcheckBy = a.FcheckBy,
                 FcheckDate = a.FcheckDate,
                 MoidNum = a.MoidNum,
-             
-                Remarks = a.Remarks
+              
+                Remarks = a.Remarks,
+                ItemId = a.ItemId
             }).OrderBy(a => a.CreateDate, OrderByType.Desc)
             .ToPageList(queryObj.PageIndex, queryObj.Limit);
     }

--
Gitblit v1.9.3