From 54445846644d77fb7a89f736f2c5bfe673ce3653 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期一, 23 九月 2024 13:51:30 +0800
Subject: [PATCH] 更改匹配检验项目的提示

---
 MES.Service/service/QC/RKJService.cs |   49 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/MES.Service/service/QC/RKJService.cs b/MES.Service/service/QC/RKJService.cs
index 3f2b5b6..589da1a 100644
--- a/MES.Service/service/QC/RKJService.cs
+++ b/MES.Service/service/QC/RKJService.cs
@@ -106,31 +106,36 @@
             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.QsCode+"涓嬬殑妫�楠屾按骞崇淮鎶ょ殑涓嶆纭�");
 
             var sql =
                 "SELECT " + LEV +
@@ -140,9 +145,13 @@
 
             var maxBillNo = db.Ado.SqlQuerySingle<string>(sql);
 
+            if (string.IsNullOrEmpty(maxBillNo))
+                throw new Exception(item.QsCode+"涓嬫病鏈�" + quantity + "杩欎釜鑼冨洿鐨勬娊鏍峰熀鍑�");
 
             var result = ExtractSubstring(item.FacLevel, '(', ')');
 
+            if (string.IsNullOrEmpty(result))
+                throw new Exception(item.QsCode+"缁存姢鐨勬帴鏀舵按骞充笉姝g‘锛屽簲璇ユ槸0.010---(AQL_0_0010)杩欐牱");
 
             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= '" +
@@ -402,9 +411,9 @@
                 .ExecuteCommand();
         });
 
-        if (FcheckResu.Equals("涓嶅悎鏍�"))
-            //鑷姩鐢熸垚鍏ュ簱妫�寮傚父瀵圭瓥
-            saveDetect02(detail.Gid, detail.CreateBy);
+        // if (FcheckResu.Equals("涓嶅悎鏍�"))
+        //     //鑷姩鐢熸垚鍏ュ簱妫�寮傚父瀵圭瓥
+        //     saveDetect02(detail.Gid, detail.CreateBy);
 
         return useTransactionWithOracle;
     }
@@ -454,11 +463,12 @@
     }
 
 
-    public (List<QsItemOqcReq> items, int TotalCount) getPage(XJPageResult queryObj)
+    public (List<QsItemOqcReq> items, int TotalCount) getPage(
+        XJPageResult queryObj)
     {
         var db = SqlSugarHelper.GetInstance();
-        
-        int totalCount = 0;
+
+        var totalCount = 0;
 
         var qsItemOqcReqs = db
             .Queryable<QsItemOqcReq, MesItems, MesInvItemIns, MesInvTransaction,
@@ -498,12 +508,13 @@
                 ItemName = b.ItemName,
                 ItemModel = b.ItemModel,
                 Dab001 = m.LotNo,
+                ItemInId = m.ItemInId,
                 Daa015 = da.Daa015,
                 LineNo = c.LineNo,
                 Quantity = m.Quantity
             })
             .OrderBy(a => a.CreateDate, OrderByType.Desc)
-            .ToPageList(queryObj.PageIndex, queryObj.Limit,ref totalCount);
+            .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
 
         return (qsItemOqcReqs, totalCount);
     }
@@ -568,6 +579,8 @@
 
     public int UpdateQSItemDetail(QsItemOqcItemDetail detail)
     {
+        if (isRk(detail.ItemInId)) throw new Exception("宸叉湁鏉$爜鍏ュ簱锛屼笉鍏佽淇敼妫�楠岀粨鏋�");
+
         var withOracle = SqlSugarHelper.UseTransactionWithOracle(db =>
         {
             return db.Updateable<QsItemOqcItemDetail>()
@@ -588,6 +601,14 @@
         return withOracle;
     }
 
+    //淇敼缁撴灉鍓嶉獙璇佹槸鍚﹀叆搴�
+    private bool isRk(decimal? ItemInId)
+    {
+        var db = SqlSugarHelper.GetInstance();
+        return db.Queryable<MesInvItemInCDetails>()
+            .Where(s => s.ItemInId == ItemInId).Count() > 0;
+    }
+
 
     //涓昏〃淇敼澶囨敞瀛楁
     public int saveRemarksGid(RKJDto dto)

--
Gitblit v1.9.3