From 04f06cc5578208caeebc126e74b909921ceb7789 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 29 五月 2024 18:18:16 +0800
Subject: [PATCH] 上传下载配置更新

---
 Tiger.Business/MES/SMT/Biz.SmtTool.cs |   59 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/Tiger.Business/MES/SMT/Biz.SmtTool.cs b/Tiger.Business/MES/SMT/Biz.SmtTool.cs
index 2fc34f6..9cb84fd 100644
--- a/Tiger.Business/MES/SMT/Biz.SmtTool.cs
+++ b/Tiger.Business/MES/SMT/Biz.SmtTool.cs
@@ -70,44 +70,54 @@
 
                     //DataTable dt = JsonConvert.DeserializeObject<DataTable>(paras.ToString());
                     List<smtWoTableIn> currentList = new List<smtWoTableIn>();
-                    if (paras.Count > 0)
+                    if (paras?.Count > 0)
                     {
-                        var duplicateWo = paras.GroupBy(p => p.鍏宠仈宸ュ崟鍙�)
-                                         .Where(g => g.Count() > 1)
-                                         .Select(g => g.Key)
-                                         .ToList();
-                        if (duplicateWo.Count() > 0)//瀛樺湪閲嶅鏁版嵁  
-                        {
-                            string WORK_ORDER = string.Empty;
-                            foreach (var item in duplicateWo)
-                            {
-                                WORK_ORDER += item;
-                            }
-                            WORK_ORDER = WORK_ORDER.TrimEnd(';');
-                            result.IsSuccessed = false;
-                            result.Message = $"瀵煎叆鐨勭墿鏂欎腑鏈夐噸澶嶆暟鎹細鍏宠仈宸ュ崟锛歿WORK_ORDER}";
-                        }
-                        else
+                        //var duplicateWo = paras.GroupBy(p => p.鍏宠仈宸ュ崟鍙�)
+                        //                 .Where(g => g.Count() > 1)
+                        //                 .Select(g => g.Key)
+                        //                 .ToList();
+                        //if (duplicateWo.Count() > 0)//瀛樺湪閲嶅鏁版嵁  
+                        //{
+                        //    string WORK_ORDER = string.Empty;
+                        //    foreach (var item in duplicateWo)
+                        //    {
+                        //        WORK_ORDER += item;
+                        //    }
+                        //    WORK_ORDER = WORK_ORDER.TrimEnd(';');
+                        //    result.IsSuccessed = false;
+                        //    result.Message = $"瀵煎叆鐨勭墿鏂欎腑鏈夐噸澶嶆暟鎹細鍏宠仈宸ュ崟锛歿WORK_ORDER}";
+                        //}
+                        //else
                         {
                             foreach (var item in paras)
                             {
                                 item.澶勭悊鏂瑰紡 = "鏂板";
                                 item.鍘熷洜 = null;
-                                if (item.鍏宠仈宸ュ崟鍙� == null)
+                                if (item.鍏宠仈宸ュ崟鍙� == null|| item.鍏宠仈宸ュ崟鍙� == " ")
                                 {
                                     item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
                                     item.鍘熷洜 += "宸ュ崟鍙风┖鎴栦笉瀛樺湪锛�";
                                 }
-                                if (item.浜у搧缂栫爜 == null)
+                                if (item.浜у搧缂栫爜 == null || item.浜у搧缂栫爜 == " ")
                                 {
                                     item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
                                     item.鍘熷洜 += $"浜у搧缂栫爜涓虹┖锛�";
                                 }
+                                if (item.鐗╂枡缂栫爜 == null || item.鐗╂枡缂栫爜 == " ")
+                                {
+                                    item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
+                                    item.鍘熷洜 += $"鐗╂枡缂栫爜涓虹┖锛�";
+                                }
+                                if (item.绔欎綅鍙� == null || item.绔欎綅鍙� == " ")
+                                {
+                                    item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
+                                    item.鍘熷洜 += $"绔欎綅鍙蜂负绌猴紒";
+                                }
                                 currentList.Add(item);
-                                if (await Db.Queryable<SMT_WO_TABLE>().AnyAsync(x => x.WORK_ORDER == item.鍏宠仈宸ュ崟鍙�))
+                                if (await Db.Queryable<SMT_WO_TABLE>().AnyAsync(x => x.WORK_ORDER == item.鍏宠仈宸ュ崟鍙� && x.ITEM_CODE == item.鐗╂枡缂栫爜 && x.SLOT_NO==item.绔欎綅鍙�&&x.SMT_CODE==item.璐寸墖鏈虹紪鐮�))
                                 {
                                     item.澶勭悊鏂瑰紡 = "淇敼";
-                                    item.鍘熷洜 += $"宸ュ崟{item.鍏宠仈宸ュ崟鍙穧涓庢暟鎹簱閲嶅锛�";
+                                    item.鍘熷洜 += $"宸ュ崟{item.鍏宠仈宸ュ崟鍙穧锛岀墿鏂欑紪鐮亄item.鐗╂枡缂栫爜}锛岀珯浣嶅彿{item.绔欎綅鍙穧锛岃创鐗囨満缂栫爜{item.璐寸墖鏈虹紪鐮亇涓庢暟鎹簱閲嶅锛�";
                                 }
                             }
                             //for (int i = 0; i < item..Count; i++)
@@ -116,12 +126,17 @@
 
                         }
                     }
+                    else
+                    {
+                        result.IsSuccessed = false;
+                        result.Message = $"瀵煎叆鐨勭墿鏂欎笉鑳戒负绌�";
+                    }
                     result.Data = currentList;
 
                 }
                 catch (Exception ex)
                 {
-                    result.CatchException(ex, $"楠岃瘉瀵煎叆鍙戞枡璁″垝鎺掔▼寮傚父");
+                    result.CatchException(ex, $"楠岃瘉瀵煎叆宸ュ崟鏂欑珯琛ㄥ紓甯�");
                 }
                 return result;
             }

--
Gitblit v1.9.3