From eab13f60bbdc8ea275c6dd7b6424cdfc7769f6e1 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期三, 27 八月 2025 16:53:15 +0800 Subject: [PATCH] 111111 --- MES.Service/service/BasicData/MesSupplierManager.cs | 40 +++++++--------------------------------- 1 files changed, 7 insertions(+), 33 deletions(-) diff --git a/MES.Service/service/BasicData/MesSupplierManager.cs b/MES.Service/service/BasicData/MesSupplierManager.cs index acb391c..bec3b07 100644 --- a/MES.Service/service/BasicData/MesSupplierManager.cs +++ b/MES.Service/service/BasicData/MesSupplierManager.cs @@ -43,41 +43,15 @@ public bool SaveList(List<ErpSupplier> suppliers) { - var list = suppliers.Select(GetMesSupplier).ToList(); - var groupBy = list.GroupBy(s => s.Type) - .ToDictionary(g => g.Key, g => g.ToList()); - - return UseTransaction(db => + if (suppliers == null || !suppliers.Any()) { - foreach (var supplierGroup in groupBy) - switch (supplierGroup.Key) - { - case "0": - if (!UpdateSupplierStatusBatch(db, supplierGroup.Value, - "A")) - throw new NotImplementedException("鍚敤澶辫触"); - break; - case "1": - if (!UpdateSupplierStatusBatch(db, supplierGroup.Value, - "B")) - throw new NotImplementedException("绂佺敤澶辫触"); - break; - case "3": - if (!DeleteSupplierBatch(db, supplierGroup.Value)) - throw new NotImplementedException("鍒犻櫎澶辫触"); - break; - case "2": - case "4": - if (!InsertOrUpdateBatch(db, supplierGroup.Value)) - throw new NotImplementedException("鍚屾澶辫触"); - break; - default: - throw new ArgumentNullException( - $"type娌℃湁{supplierGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); - } + Console.WriteLine("璀﹀憡: 浼犲叆鐨勫垪琛ㄤ负绌�"); + return false; + } - return 1; - }) > 0; + // 閫愭潯澶勭悊锛屽叏閮ㄦ垚鍔熸墠杩斿洖true锛堜簨鍔″唴鎵归噺澶勭悊鏇翠紭锛屾澶勪繚鎸佸師鏈夐�昏緫锛� + var result = suppliers.Select(Save).ToList(); + return result.All(b => b); } private bool UpdateSupplierStatus(SqlSugarScope db, decimal supplierId, -- Gitblit v1.9.3