From f9c7f114f3eabb14532bca76671598b130f91aeb Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期三, 24 九月 2025 16:47:52 +0800
Subject: [PATCH] SJ,LLJ,RKJ修改

---
 StandardInterface/MES.Service/service/QC/LljService.cs |  323 ++++++++++++++++++++++++++++++++++++-----------------
 StandardInterface/MES.Service/service/QC/RKJService.cs |    7 
 StandardInterface/MES.Service/Modes/QsItemIpiItem.cs   |    6 
 StandardInterface/MES.Service/service/QC/SJService.cs  |    2 
 4 files changed, 222 insertions(+), 116 deletions(-)

diff --git a/StandardInterface/MES.Service/Modes/QsItemIpiItem.cs b/StandardInterface/MES.Service/Modes/QsItemIpiItem.cs
index 14193e6..047cd21 100644
--- a/StandardInterface/MES.Service/Modes/QsItemIpiItem.cs
+++ b/StandardInterface/MES.Service/Modes/QsItemIpiItem.cs
@@ -121,14 +121,12 @@
     /// <summary>
     ///     绌存暟
     /// </summary>
-    [Column("MNUM")]
-    [SugarColumn(ColumnName = "MNUM")]
+    [SugarColumn(IsIgnore = true)]
     public decimal? Mnum { get; set; }
     /// <summary>
     ///     鍫电┐鍙�
     /// </summary>
-    [Column("DNUM")]
-    [SugarColumn(ColumnName = "DNUM")]
+    [SugarColumn(IsIgnore = true)]
     public string? Dnum { get; set; }
 
     /// <summary>
diff --git a/StandardInterface/MES.Service/service/QC/LljService.cs b/StandardInterface/MES.Service/service/QC/LljService.cs
index c84c883..01b0cbb 100644
--- a/StandardInterface/MES.Service/service/QC/LljService.cs
+++ b/StandardInterface/MES.Service/service/QC/LljService.cs
@@ -26,78 +26,153 @@
         var totalCount = 0;
 
         // 浣跨敤鏁版嵁搴撳垎椤垫煡璇紝涓�娆℃煡璇�50鏉★紝鎻愬崌鎬ц兘
-        var pageList = db.Queryable<LtsLlj, V_LljUser>((a, v) =>
-                new JoinQueryInfos(JoinType.Left, a.ItemNo == v.ItemNo))
-            .WhereIF(
-                StringUtil.IsNotNullOrEmpty(queryObj.result) &&
-                "鏈畬鎴�".Equals(queryObj.result),
-                (a, v) => a.FcheckResu == null)
-            .WhereIF(
-                StringUtil.IsNotNullOrEmpty(queryObj.result) &&
-                !"鏈畬鎴�".Equals(queryObj.result),
-                (a, v) => a.FcheckResu != null)
-            .WhereIF(id > 0, (a, v) => a.Id == id)
-            // 鏉冮檺鎺у埗锛歅L017銆丠MLYY銆丠MCS 鍙互鐪嬪埌鎵�鏈夊崟鎹紝鍏朵粬鐢ㄦ埛闇�瑕佹牴鎹墿鏂欑淮鎶ゆ儏鍐靛垽鏂�
-            .WhereIF(queryObj.createUser != "PL017" && queryObj.createUser != "HMLYY" && queryObj.createUser != "HMCS" && queryObj.UserIndex == "0", 
-                (a, v) => 
-                    // 濡傛灉鐗╂枡琚淮鎶わ紝鍙湁缁存姢浜哄憳鍙互鐪嬪埌
-                    (v.Fcode != null && v.Fcode == queryObj.createUser) ||
-                    // 濡傛灉鐗╂枡鏈缁存姢锛屾墍鏈変汉閮藉彲浠ョ湅鍒�
-                    (v.Fcode == null))
-
-            //鍔犵瓫閫夋潯浠�,鏍规嵁閫夋嫨鐨勬悳绱㈠瓧娈佃繘琛岀簿纭悳绱�
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 1, // 鐗╂枡缂栧彿鎼滅储
-                (a, v) => a.ItemNo != null && a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 2, // 鐗╂枡鍚嶇О鎼滅储
-                (a, v) => a.ItemName != null && a.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
-                (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
-                (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
-                (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
-                (a, v) => a.ItemModel != null && a.ItemModel.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .Select((a, v) => new LtsLlj
-            {
-                Id = a.Id,
-                ItemNo = a.ItemNo,
-                ItemId = a.ItemId,
-                ItemName = a.ItemName,
-                ItemModel = a.ItemModel,
-                SuppName = a.SuppName,
-                LotNo = a.LotNo,
-                ReleaseNo = a.ReleaseNo,
-                FcheckResu = a.FcheckResu,
-                CreateDate = a.CreateDate,
-                FcovertQty = a.FcovertQty,
-                DEPARTMENTNAME = a.DEPARTMENTNAME,
-                FngDesc = a.FngDesc,
-                UrgentFlag = a.UrgentFlag,
-                Ftype = a.Ftype,
-                LotNo1 = a.LotNo1,
-                EMERGENCY = a.EMERGENCY,
-                Status = a.Status,
-                IqcDate = a.IqcDate,
-                // 娣诲姞缁存姢浜哄憳淇℃伅
-                Fcode = v.Fcode,
-                // 娣诲姞鐮村潖瀹為獙鏁伴噺
-                PHSY = a.PHSY,
-                // 娣诲姞涓嶈壇鍘熷洜
-                BLYY = a.BLYY,
-                // 娣诲姞鎵�灞炶溅闂�
-                SSCJ = a.SSCJ,
-                // 娣诲姞璇勫鐘舵��
-                PSZT = a.PSZT,
-                // 娣诲姞妫�楠岄」鐩淮鎶ょ姸鎬�
-                Jyxm = a.Jyxm
-            })
-            .OrderBy("CASE WHEN EMERGENCY = 1 THEN 0 ELSE 1 END")
-            .OrderBy("CASE WHEN JYXM = 0 THEN 0 ELSE 1 END")
-            .OrderBy("CASE WHEN STATUS = '宸叉彁浜�' THEN 1 ELSE 0 END")
-            .OrderBy("IQC_DATE DESC")
-            .OrderBy("CREATE_DATE")
-            .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
+        // 鍒ゆ柇鏄惁涓虹鐞嗗憳璐﹀彿
+        bool isAdmin = queryObj.createUser == "PL017" || queryObj.createUser == "HMLYY" || queryObj.createUser == "HMCS";
+        
+        List<LtsLlj> pageList;
+        
+        if (isAdmin)
+        {
+            // 绠$悊鍛樿处鍙凤細鐩存帴鏌ヨ涓昏〃锛岄伩鍏岼OIN瀵艰嚧鐨勯噸澶嶈褰�
+            pageList = db.Queryable<LtsLlj>()
+                .WhereIF(
+                    StringUtil.IsNotNullOrEmpty(queryObj.result) &&
+                    "鏈畬鎴�".Equals(queryObj.result),
+                    a => a.FcheckResu == null)
+                .WhereIF(
+                    StringUtil.IsNotNullOrEmpty(queryObj.result) &&
+                    !"鏈畬鎴�".Equals(queryObj.result),
+                    a => a.FcheckResu != null)
+                .WhereIF(id > 0, a => a.Id == id)
+                //鍔犵瓫閫夋潯浠�,鏍规嵁閫夋嫨鐨勬悳绱㈠瓧娈佃繘琛岀簿纭悳绱�
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 1, // 鐗╂枡缂栧彿鎼滅储
+                    a => a.ItemNo != null && a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 2, // 鐗╂枡鍚嶇О鎼滅储
+                    a => a.ItemName != null && a.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
+                    a => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
+                    a => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
+                    a => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
+                    a => a.ItemModel != null && a.ItemModel.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .Select(a => new LtsLlj
+                {
+                    Id = a.Id,
+                    ItemNo = a.ItemNo,
+                    ItemId = a.ItemId,
+                    ItemName = a.ItemName,
+                    ItemModel = a.ItemModel,
+                    SuppName = a.SuppName,
+                    LotNo = a.LotNo,
+                    ReleaseNo = a.ReleaseNo,
+                    FcheckResu = a.FcheckResu,
+                    CreateDate = a.CreateDate,
+                    FcovertQty = a.FcovertQty,
+                    DEPARTMENTNAME = a.DEPARTMENTNAME,
+                    FngDesc = a.FngDesc,
+                    UrgentFlag = a.UrgentFlag,
+                    Ftype = a.Ftype,
+                    LotNo1 = a.LotNo1,
+                    EMERGENCY = a.EMERGENCY,
+                    Status = a.Status,
+                    IqcDate = a.IqcDate,
+                    // 娣诲姞缁存姢浜哄憳淇℃伅锛堢鐞嗗憳涓嶉渶瑕佹瀛楁锛�
+                    Fcode = null,
+                    // 娣诲姞鐮村潖瀹為獙鏁伴噺
+                    PHSY = a.PHSY,
+                    // 娣诲姞涓嶈壇鍘熷洜
+                    BLYY = a.BLYY,
+                    // 娣诲姞鎵�灞炶溅闂�
+                    SSCJ = a.SSCJ,
+                    // 娣诲姞璇勫鐘舵��
+                    PSZT = a.PSZT,
+                    // 娣诲姞妫�楠岄」鐩淮鎶ょ姸鎬�
+                    Jyxm = a.Jyxm
+                })
+                .OrderBy("IQC_DATE DESC")
+                .OrderBy("CASE WHEN EMERGENCY = 1 THEN 0 ELSE 1 END")
+                .OrderBy("CASE WHEN JYXM = 0 THEN 0 ELSE 1 END")
+                .OrderBy("CASE WHEN STATUS = '宸叉彁浜�' THEN 1 ELSE 0 END")
+                .OrderBy("CREATE_DATE")
+                .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
+        }
+        else
+        {
+            // 鏅�氱敤鎴凤細浣跨敤JOIN鏌ヨ锛屾牴鎹淮鎶ゆ儏鍐靛垽鏂潈闄�
+            pageList = db.Queryable<LtsLlj, V_LljUser>((a, v) =>
+                    new JoinQueryInfos(JoinType.Left, a.ItemNo == v.ItemNo))
+                .WhereIF(
+                    StringUtil.IsNotNullOrEmpty(queryObj.result) &&
+                    "鏈畬鎴�".Equals(queryObj.result),
+                    (a, v) => a.FcheckResu == null)
+                .WhereIF(
+                    StringUtil.IsNotNullOrEmpty(queryObj.result) &&
+                    !"鏈畬鎴�".Equals(queryObj.result),
+                    (a, v) => a.FcheckResu != null)
+                .WhereIF(id > 0, (a, v) => a.Id == id)
+                // 鏉冮檺鎺у埗锛氭櫘閫氱敤鎴烽渶瑕佹牴鎹墿鏂欑淮鎶ゆ儏鍐靛垽鏂�
+                .WhereIF(queryObj.UserIndex == "0", 
+                    (a, v) => 
+                        // 濡傛灉鐗╂枡琚淮鎶わ紝鍙湁缁存姢浜哄憳鍙互鐪嬪埌
+                        (v.Fcode != null && v.Fcode == queryObj.createUser) ||
+                        // 濡傛灉鐗╂枡鏈缁存姢锛屾墍鏈変汉閮藉彲浠ョ湅鍒�
+                        (v.Fcode == null))
+                //鍔犵瓫閫夋潯浠�,鏍规嵁閫夋嫨鐨勬悳绱㈠瓧娈佃繘琛岀簿纭悳绱�
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 1, // 鐗╂枡缂栧彿鎼滅储
+                    (a, v) => a.ItemNo != null && a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 2, // 鐗╂枡鍚嶇О鎼滅储
+                    (a, v) => a.ItemName != null && a.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
+                    (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
+                    (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
+                    (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
+                    (a, v) => a.ItemModel != null && a.ItemModel.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .Select((a, v) => new LtsLlj
+                {
+                    Id = a.Id,
+                    ItemNo = a.ItemNo,
+                    ItemId = a.ItemId,
+                    ItemName = a.ItemName,
+                    ItemModel = a.ItemModel,
+                    SuppName = a.SuppName,
+                    LotNo = a.LotNo,
+                    ReleaseNo = a.ReleaseNo,
+                    FcheckResu = a.FcheckResu,
+                    CreateDate = a.CreateDate,
+                    FcovertQty = a.FcovertQty,
+                    DEPARTMENTNAME = a.DEPARTMENTNAME,
+                    FngDesc = a.FngDesc,
+                    UrgentFlag = a.UrgentFlag,
+                    Ftype = a.Ftype,
+                    LotNo1 = a.LotNo1,
+                    EMERGENCY = a.EMERGENCY,
+                    Status = a.Status,
+                    IqcDate = a.IqcDate,
+                    // 娣诲姞缁存姢浜哄憳淇℃伅
+                    Fcode = v.Fcode,
+                    // 娣诲姞鐮村潖瀹為獙鏁伴噺
+                    PHSY = a.PHSY,
+                    // 娣诲姞涓嶈壇鍘熷洜
+                    BLYY = a.BLYY,
+                    // 娣诲姞鎵�灞炶溅闂�
+                    SSCJ = a.SSCJ,
+                    // 娣诲姞璇勫鐘舵��
+                    PSZT = a.PSZT,
+                    // 娣诲姞妫�楠岄」鐩淮鎶ょ姸鎬�
+                    Jyxm = a.Jyxm
+                })
+                .OrderBy("IQC_DATE DESC")
+                .OrderBy("CASE WHEN EMERGENCY = 1 THEN 0 ELSE 1 END")
+                .OrderBy("CASE WHEN JYXM = 0 THEN 0 ELSE 1 END")
+                .OrderBy("CASE WHEN STATUS = '宸叉彁浜�' THEN 1 ELSE 0 END")
+                .OrderBy("CREATE_DATE")
+                .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
+        }
 
         // 鎵归噺鑾峰彇妫�楠岄」鐩暟閲忥紝閬垮厤N+1鏌ヨ闂
         if (pageList.Any())
@@ -117,40 +192,76 @@
         }
         
         // 璁$畻鎵�鏈夋暟鎹殑鍘婚噸鎬绘暟锛堜笉鏄綋鍓嶉〉鐨勫幓閲嶆暟锛�
-        var allDataQuery = db.Queryable<LtsLlj, V_LljUser>((a, v) =>
-                new JoinQueryInfos(JoinType.Left, a.ItemNo == v.ItemNo))
-            .WhereIF(
-                StringUtil.IsNotNullOrEmpty(queryObj.result) &&
-                "鏈畬鎴�".Equals(queryObj.result),
-                (a, v) => a.FcheckResu == null)
-            .WhereIF(
-                StringUtil.IsNotNullOrEmpty(queryObj.result) &&
-                !"鏈畬鎴�".Equals(queryObj.result),
-                (a, v) => a.FcheckResu != null)
-            .WhereIF(id > 0, (a, v) => a.Id == id)
-            // 鏉冮檺鎺у埗锛歅L017銆丠MLYY銆丠MCS 鍙互鐪嬪埌鎵�鏈夊崟鎹紝鍏朵粬鐢ㄦ埛闇�瑕佹牴鎹墿鏂欑淮鎶ゆ儏鍐靛垽鏂�
-            .WhereIF(queryObj.createUser != "PL017" && queryObj.createUser != "HMLYY" && queryObj.createUser != "HMCS" && queryObj.UserIndex == "0", 
-                (a, v) => 
-                    // 濡傛灉鐗╂枡琚淮鎶わ紝鍙湁缁存姢浜哄憳鍙互鐪嬪埌
-                    (v.Fcode != null && v.Fcode == queryObj.createUser) ||
-                    // 濡傛灉鐗╂枡鏈缁存姢锛屾墍鏈変汉閮藉彲浠ョ湅鍒�
-                    (v.Fcode == null))
-            //鍔犵瓫閫夋潯浠�,鏍规嵁閫夋嫨鐨勬悳绱㈠瓧娈佃繘琛岀簿纭悳绱�
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 1, // 鐗╂枡缂栧彿鎼滅储
-                (a, v) => a.ItemNo != null && a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 2, // 鐗╂枡鍚嶇О鎼滅储
-                (a, v) => a.ItemName != null && a.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
-                (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
-                (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
-                (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
-                (a, v) => a.ItemModel != null && a.ItemModel.ToLower().Contains(queryObj.SearchValue.ToLower()))
-            .Select((a, v) => a.ReleaseNo)
-            .Distinct()
-            .Count();
+        int allDataQuery;
+        
+        if (isAdmin)
+        {
+            // 绠$悊鍛樿处鍙凤細鐩存帴鏌ヨ涓昏〃
+            allDataQuery = db.Queryable<LtsLlj>()
+                .WhereIF(
+                    StringUtil.IsNotNullOrEmpty(queryObj.result) &&
+                    "鏈畬鎴�".Equals(queryObj.result),
+                    a => a.FcheckResu == null)
+                .WhereIF(
+                    StringUtil.IsNotNullOrEmpty(queryObj.result) &&
+                    !"鏈畬鎴�".Equals(queryObj.result),
+                    a => a.FcheckResu != null)
+                .WhereIF(id > 0, a => a.Id == id)
+                //鍔犵瓫閫夋潯浠�,鏍规嵁閫夋嫨鐨勬悳绱㈠瓧娈佃繘琛岀簿纭悳绱�
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 1, // 鐗╂枡缂栧彿鎼滅储
+                    a => a.ItemNo != null && a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 2, // 鐗╂枡鍚嶇О鎼滅储
+                    a => a.ItemName != null && a.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
+                    a => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
+                    a => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
+                    a => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
+                    a => a.ItemModel != null && a.ItemModel.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .Select(a => a.ReleaseNo)
+                .Distinct()
+                .Count();
+        }
+        else
+        {
+            // 鏅�氱敤鎴凤細浣跨敤JOIN鏌ヨ
+            allDataQuery = db.Queryable<LtsLlj, V_LljUser>((a, v) =>
+                    new JoinQueryInfos(JoinType.Left, a.ItemNo == v.ItemNo))
+                .WhereIF(
+                    StringUtil.IsNotNullOrEmpty(queryObj.result) &&
+                    "鏈畬鎴�".Equals(queryObj.result),
+                    (a, v) => a.FcheckResu == null)
+                .WhereIF(
+                    StringUtil.IsNotNullOrEmpty(queryObj.result) &&
+                    !"鏈畬鎴�".Equals(queryObj.result),
+                    (a, v) => a.FcheckResu != null)
+                .WhereIF(id > 0, (a, v) => a.Id == id)
+                // 鏉冮檺鎺у埗锛氭櫘閫氱敤鎴烽渶瑕佹牴鎹墿鏂欑淮鎶ゆ儏鍐靛垽鏂�
+                .WhereIF(queryObj.UserIndex == "0", 
+                    (a, v) => 
+                        // 濡傛灉鐗╂枡琚淮鎶わ紝鍙湁缁存姢浜哄憳鍙互鐪嬪埌
+                        (v.Fcode != null && v.Fcode == queryObj.createUser) ||
+                        // 濡傛灉鐗╂枡鏈缁存姢锛屾墍鏈変汉閮藉彲浠ョ湅鍒�
+                        (v.Fcode == null))
+                //鍔犵瓫閫夋潯浠�,鏍规嵁閫夋嫨鐨勬悳绱㈠瓧娈佃繘琛岀簿纭悳绱�
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 1, // 鐗╂枡缂栧彿鎼滅储
+                    (a, v) => a.ItemNo != null && a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 2, // 鐗╂枡鍚嶇О鎼滅储
+                    (a, v) => a.ItemName != null && a.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
+                    (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
+                    (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
+                    (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
+                    (a, v) => a.ItemModel != null && a.ItemModel.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                .Select((a, v) => a.ReleaseNo)
+                .Distinct()
+                .Count();
+        }
         
         var emergencyValues = pageList.Select(item => item.EMERGENCY).ToList(); 
         return (pageList, allDataQuery);
diff --git a/StandardInterface/MES.Service/service/QC/RKJService.cs b/StandardInterface/MES.Service/service/QC/RKJService.cs
index 1365909..86c7046 100644
--- a/StandardInterface/MES.Service/service/QC/RKJService.cs
+++ b/StandardInterface/MES.Service/service/QC/RKJService.cs
@@ -309,11 +309,8 @@
                 QsCode = a.QsCode,
                 QsName = a.QsName,
                 isCheck = SqlFunc.AggregateCount(b.Id),
-                Result = a.IsPass == 1 &&
-                         a.LevelNum == SqlFunc.AggregateCount(b.Id) ? "鍚堟牸"
-                    : a.IsPass == 0 &&
-                      a.LevelNum == SqlFunc.AggregateCount(b.Id) ? "涓嶅悎鏍�"
-                    : "鏈畬鎴�"
+                Result = SqlFunc.AggregateCount(b.Id) == 0 ? "鏈畬鎴�" :
+                         a.IsPass == 1 ? "鍚堟牸" : "涓嶅悎鏍�"
             }).OrderBy("result desc").ToList();
     }
 
diff --git a/StandardInterface/MES.Service/service/QC/SJService.cs b/StandardInterface/MES.Service/service/QC/SJService.cs
index 99645a7..91e8c9e 100644
--- a/StandardInterface/MES.Service/service/QC/SJService.cs
+++ b/StandardInterface/MES.Service/service/QC/SJService.cs
@@ -206,7 +206,7 @@
                 IsPass = a.IsPass,
                 ItemId = a.ItemId,
                 Mnum = b.Mnum,  // 浠庝富琛ㄨ幏鍙朚NUM
-                Dnum = b.Dnum,  // 浠庝富琛ㄨ幏鍙朌NUM
+                Dnum = b.Dnum,  // 浠庡瓙琛ㄨ幏鍙朌NUM
                 Snum = a.Snum,  // 閫佹鎵规暟
                 Remarks = a.Remarks
             }).ToList();

--
Gitblit v1.9.3