From c53a461aef16902ca78cdb7bd0c62305e2fee809 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期二, 29 七月 2025 19:23:04 +0800
Subject: [PATCH] Update OQC search API functionality

---
 MES.Service/service/SpotCheck/SpotCheckService.cs |   27 +++++++--------------------
 1 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/MES.Service/service/SpotCheck/SpotCheckService.cs b/MES.Service/service/SpotCheck/SpotCheckService.cs
index a1ef1c6..f62174a 100644
--- a/MES.Service/service/SpotCheck/SpotCheckService.cs
+++ b/MES.Service/service/SpotCheck/SpotCheckService.cs
@@ -1,25 +1,21 @@
 锘縰sing MES.Service.DB;
 using MES.Service.Dto.service;
 using MES.Service.Modes;
-using Newtonsoft.Json;
 using SqlSugar;
 
 namespace MES.Service.service.SpotCheck;
 
 public class SpotCheckService
 {
-  
     public async Task<DjDetailResult> GetDjDetail(DJPageResultDto queryObj)
     {
         // 澶勭悊浼犲叆鐨� releaseNo 涓� null 鐨勬儏鍐�
         if (string.IsNullOrEmpty(queryObj.eqNo))
-        {
             return new DjDetailResult
             {
                 MesEqKeepsType02List = new List<MesEqKeepsType02>(),
                 EqInfoList = new List<MesEqMaintain>()
             };
-        }
 
         using (var db = SqlSugarHelper.GetInstance())
         {
@@ -30,20 +26,20 @@
                 var todayEnd = todayStart.AddDays(1);
 
                 var results = await db.Queryable<MesEqMaintain>()
-                    .Where(x => x.EqNo == queryObj.eqNo && x.CreateDate >= todayStart && x.CreateDate < todayEnd &&
+                    .Where(x => x.EqNo == queryObj.eqNo &&
+                                x.CreateDate >= todayStart &&
+                                x.CreateDate < todayEnd &&
                                 x.Flag == 0)
                     .Select(x => new
                     {
-                        Id = x.Id,
+                        x.Id,
                         x.EqName,
                         x.PlanNo,
                         x.EqNo
                     })
                     .ToListAsync();
                 if (results == null || results.Count == 0)
-                {
                     throw new Exception("鍗曟嵁涓嶅瓨鍦�");
-                }
 
                 var ids = results.Select(r => (decimal)r.Id).ToList();
 
@@ -55,13 +51,11 @@
                 }).ToList();
 
                 if (ids.Count == 0)
-                {
                     return new DjDetailResult
                     {
                         MesEqKeepsType02List = new List<MesEqKeepsType02>(),
                         EqInfoList = new List<MesEqMaintain>()
                     };
-                }
 
                 // 鏍规嵁鑾峰彇鐨� id 鍒楄〃鏌ヨ MesEqKeepsType02 琛�
                 var keepsType02List = await db.Queryable<MesEqKeepsType02>()
@@ -98,13 +92,12 @@
         }
     }
 
-    public async Task<List<MesEqMaintain>> UpdateDjDetail(DJPageResultDto updateObj)
+    public async Task<List<MesEqMaintain>> UpdateDjDetail(
+        DJPageResultDto updateObj)
     {
         // 澶勭悊浼犲叆鐨� releaseNo 涓� null 鎴栫┖瀛楃涓茬殑鎯呭喌
         if (string.IsNullOrEmpty(updateObj.releaseNo))
-        {
             return new List<MesEqMaintain>();
-        }
 
         using (var db = SqlSugarHelper.GetInstance())
         {
@@ -120,17 +113,14 @@
                         CheckBy = updateObj.userNo,
                         Flag = 1,
                         CheckDate = DateTime.Now
-                    }) 
+                    })
                     .Where(x => x.PlanNo == updateObj.releaseNo && x.Flag == 0)
                     .ExecuteCommandAsync();
 
                 // 鏍规嵁 inspectionItems 鍒楄〃鐨� id 鏇存柊 MesEqKeepsType02 琛�
                 if (updateObj.inspectionItems != null)
-                {
                     foreach (var item in updateObj.inspectionItems)
-                    {
                         if (item.id.HasValue)
-                        {
                             await db.Updateable<MesEqKeepsType02>()
                                 .SetColumns(x => new MesEqKeepsType02
                                 {
@@ -138,9 +128,6 @@
                                 })
                                 .Where(x => x.Id == item.id.Value)
                                 .ExecuteCommandAsync();
-                        }
-                    }
-                }
 
                 // 鎻愪氦浜嬪姟
                 db.Ado.CommitTran();

--
Gitblit v1.9.3