From 2e37035392c187b26a09a2c2edcc6133e96532cc Mon Sep 17 00:00:00 2001
From: kyy <3283105747@qq.com>
Date: 星期四, 04 九月 2025 15:57:15 +0800
Subject: [PATCH] 1、收料通知单接口 2、采购订单接口加委外订单分录内码

---
 MES.Service/service/BasicData/MesUnitManager.cs |   44 ++++++++++----------------------------------
 1 files changed, 10 insertions(+), 34 deletions(-)

diff --git a/MES.Service/service/BasicData/MesUnitManager.cs b/MES.Service/service/BasicData/MesUnitManager.cs
index e966f28..7f6058d 100644
--- a/MES.Service/service/BasicData/MesUnitManager.cs
+++ b/MES.Service/service/BasicData/MesUnitManager.cs
@@ -43,39 +43,15 @@
 
     public bool SaveList(List<ErpUnit> units)
     {
-        var list = units.Select(GetMesUnit).ToList();
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
-
-        return UseTransaction(db =>
+        if (units == null || !units.Any())
         {
-            foreach (var unitGroup in groupBy)
-                switch (unitGroup.Key)
-                {
-                    case "0":
-                        if (!UpdateUnitStatusBatch(db, unitGroup.Value, "A"))
-                            throw new NotImplementedException("鍚敤澶辫触");
-                        break;
-                    case "1":
-                        if (!UpdateUnitStatusBatch(db, unitGroup.Value, "B"))
-                            throw new NotImplementedException("绂佺敤澶辫触");
-                        break;
-                    case "3":
-                        if (!DeleteUnitBatch(db, unitGroup.Value))
-                            throw new NotImplementedException("鍒犻櫎澶辫触");
-                        break;
-                    case "2":
-                    case "4":
-                        if (!InsertOrUpdateBatch(db, unitGroup.Value))
-                            throw new NotImplementedException("鍚屾澶辫触");
-                        break;
-                    default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{unitGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
-                }
+            Console.WriteLine("璀﹀憡: 浼犲叆鐨勫垪琛ㄤ负绌�");
+            return false;
+        }
 
-            return 1;
-        }) > 0;
+        // 閫愭潯澶勭悊锛屽叏閮ㄦ垚鍔熸墠杩斿洖true锛堜簨鍔″唴鎵归噺澶勭悊鏇翠紭锛屾澶勪繚鎸佸師鏈夐�昏緫锛�
+        var result = units.Select(Save).ToList();
+        return result.All(b => b);
     }
 
     private bool UpdateUnitStatus(SqlSugarScope db, decimal unitId,
@@ -124,9 +100,9 @@
 
         var entity = new MesUnit
         {
-            Id = string.IsNullOrEmpty(unit.Id)
-                ? DateTimeOffset.UtcNow.ToUnixTimeSeconds()
-                : Convert.ToDecimal(unit.Id),
+            // Id = string.IsNullOrEmpty(unit.Id)
+            //     ? DateTimeOffset.UtcNow.ToUnixTimeSeconds()
+            //     : Convert.ToDecimal(unit.Id),
             Fnumber = unit.FNumber,
             Fname = unit.FName,
             Funitgroupid = unit.FUnitGroupId,

--
Gitblit v1.9.3