From b2f0199d41ef80ba835bf58d6787df7f4accf7be Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期五, 13 十二月 2024 17:40:15 +0800
Subject: [PATCH] 11

---
 service/Warehouse/MesDepotSectionsManager.cs |  153 +++++++++++++++++++++++++-------------------------
 1 files changed, 76 insertions(+), 77 deletions(-)

diff --git a/service/Warehouse/MesDepotSectionsManager.cs b/service/Warehouse/MesDepotSectionsManager.cs
index 9d39c4b..ec846e0 100644
--- a/service/Warehouse/MesDepotSectionsManager.cs
+++ b/service/Warehouse/MesDepotSectionsManager.cs
@@ -3,86 +3,85 @@
 using NewPdaSqlServer.entity;
 using SqlSugar;
 
-namespace NewPdaSqlServer.service.Warehouse
+namespace NewPdaSqlServer.service.Warehouse;
+
+public class MesDepotSectionsManager : Repository<MesDepotSections>
 {
-    public class MesDepotSectionsManager : Repository<MesDepotSections>
+    public string GetSectionName(WarehouseQuery query)
     {
-        public string GetSectionName(WarehouseQuery query)
-        {
-            var sectionName = Db.Queryable<MesDepotSections, MesDepots>(
-                    (a, b) =>
-                        new JoinQueryInfos(JoinType.Inner,
-                            a.DepotGuid == b.Guid))
-                .Where((a, b) => a.DepotSectionCode == query.sectionCode)
-                .Select((a, b) => a.DepotSectionName).Single();
+        var sectionName = Db.Queryable<MesDepotSections, MesDepots>(
+                (a, b) =>
+                    new JoinQueryInfos(JoinType.Inner,
+                        a.DepotGuid == b.Guid))
+            .Where((a, b) => a.DepotSectionCode == query.sectionCode)
+            .Select((a, b) => a.DepotSectionName).Single();
 
-            if (sectionName == null)
-                throw new Exception("搴撲綅缂栫爜 " + query.sectionCode + " 涓嶅瓨鍦紝璇风‘璁わ紒");
+        if (sectionName == null)
+            throw new Exception("搴撲綅缂栫爜 " + query.sectionCode + " 涓嶅瓨鍦紝璇风‘璁わ紒");
 
-            return sectionName;
-        }
-
-        //搴撲綅鍙樻洿
-        public MesDepotSections ScanInDepotSectionsName(WarehouseQuery query)
-        {
-            if (string.IsNullOrEmpty(query.sectionCode))
-                throw new Exception("璇锋壂搴撲綅鏉$爜!");
-
-            var mesDepotSections = Db.Queryable<MesDepotSections, MesDepots>(
-                    (a, b) =>
-                        new JoinQueryInfos(JoinType.Inner,
-                            a.DepotGuid == b.Guid))
-                .Where((a, b) => a.DepotSectionCode == query.sectionCode)
-                .Select((a, b) => new MesDepotSections
-                {
-                    DepotSectionName = a.DepotSectionName,
-                    DepotCode = b.DepotCode,
-                    DepotName = b.DepotName
-                }).First();
-
-            if (mesDepotSections == null)
-                throw new Exception("搴撲綅缂栫爜" + query.sectionCode + " 涓嶅瓨鍦紝璇风‘璁�!");
-
-            return mesDepotSections;
-        }
-
-        //搴撲綅鍙樻洿
-        public MesInvItemStocks ScanEditBarcode(WarehouseQuery entity)
-        {
-            if (string.IsNullOrEmpty(entity.sectionCode))
-                throw new Exception("璇锋壂搴撲綅鏉$爜!");
-
-            var mesDepotSections = Db.Queryable<MesDepotSections, MesDepots>(
-                    (a, b) =>
-                        new JoinQueryInfos(JoinType.Inner,
-                            a.Zuid.ToString() == b.Zuid))
-                .Where((a, b) => a.DepotSectionCode == entity.sectionCode)
-                .First();
-            if (mesDepotSections == null)
-                throw new Exception("搴撲綅缂栫爜" + entity.sectionCode + " 涓嶅瓨鍦紝璇风‘璁わ紒");
-
-            var mesInvItemStocks = Db.Queryable<MesInvItemStocks>()
-                .Where(s => s.ItemBarcode == entity.barcode).First();
-
-            if (mesInvItemStocks == null) throw new Exception("鏉$爜鍦ㄤ粨搴撲腑涓嶅瓨鍦紝璇锋牳瀵癸紒");
-
-            if (mesInvItemStocks.DepotsCode != mesDepotSections.DepotCode)
-                throw new Exception(
-                    "鏉$爜鍘熶粨搴擄細" + mesInvItemStocks.DepotsCode + " 涓庣洰鏍囦粨搴擄細" +
-                    mesDepotSections.DepotCode + " 涓嶄竴鑷达紝搴撲綅鍙樻洿澶辫触锛�");
-
-            UseTransaction(db =>
-            {
-                return db.Updateable<MesInvItemStocks>()
-                    .SetColumns(s => s.DepotsCode == mesDepotSections.DepotCode)
-                    .SetColumns(s => s.DepotSectionsCode == entity.sectionCode)
-                    .Where(s => s.ItemBarcode == entity.barcode)
-                    .ExecuteCommand();
-            });
-
-            return mesInvItemStocks;
-        }
-
-        //璋冩嫧鍏ュ簱
+        return sectionName;
     }
+
+    //搴撲綅鍙樻洿
+    public MesDepotSections ScanInDepotSectionsName(WarehouseQuery query)
+    {
+        if (string.IsNullOrEmpty(query.sectionCode))
+            throw new Exception("璇锋壂搴撲綅鏉$爜!");
+
+        var mesDepotSections = Db.Queryable<MesDepotSections, MesDepots>(
+                (a, b) =>
+                    new JoinQueryInfos(JoinType.Inner,
+                        a.DepotGuid == b.Guid))
+            .Where((a, b) => a.DepotSectionCode == query.sectionCode)
+            .Select((a, b) => new MesDepotSections
+            {
+                DepotSectionName = a.DepotSectionName,
+                DepotCode = b.DepotCode,
+                DepotName = b.DepotName
+            }).First();
+
+        if (mesDepotSections == null)
+            throw new Exception("搴撲綅缂栫爜" + query.sectionCode + " 涓嶅瓨鍦紝璇风‘璁�!");
+
+        return mesDepotSections;
+    }
+
+    //搴撲綅鍙樻洿
+    public MesInvItemStocks ScanEditBarcode(WarehouseQuery entity)
+    {
+        if (string.IsNullOrEmpty(entity.sectionCode))
+            throw new Exception("璇锋壂搴撲綅鏉$爜!");
+
+        var mesDepotSections = Db.Queryable<MesDepotSections, MesDepots>(
+                (a, b) =>
+                    new JoinQueryInfos(JoinType.Inner,
+                        a.Zuid.ToString() == b.Zuid))
+            .Where((a, b) => a.DepotSectionCode == entity.sectionCode)
+            .First();
+        if (mesDepotSections == null)
+            throw new Exception("搴撲綅缂栫爜" + entity.sectionCode + " 涓嶅瓨鍦紝璇风‘璁わ紒");
+
+        var mesInvItemStocks = Db.Queryable<MesInvItemStocks>()
+            .Where(s => s.ItemBarcode == entity.barcode).First();
+
+        if (mesInvItemStocks == null) throw new Exception("鏉$爜鍦ㄤ粨搴撲腑涓嶅瓨鍦紝璇锋牳瀵癸紒");
+
+        if (mesInvItemStocks.DepotsCode != mesDepotSections.DepotCode)
+            throw new Exception(
+                "鏉$爜鍘熶粨搴擄細" + mesInvItemStocks.DepotsCode + " 涓庣洰鏍囦粨搴擄細" +
+                mesDepotSections.DepotCode + " 涓嶄竴鑷达紝搴撲綅鍙樻洿澶辫触锛�");
+
+        UseTransaction(db =>
+        {
+            return db.Updateable<MesInvItemStocks>()
+                .SetColumns(s => s.DepotsCode == mesDepotSections.DepotCode)
+                .SetColumns(s => s.DepotSectionsCode == entity.sectionCode)
+                .Where(s => s.ItemBarcode == entity.barcode)
+                .ExecuteCommand();
+        });
+
+        return mesInvItemStocks;
+    }
+
+    //璋冩嫧鍏ュ簱
 }
\ No newline at end of file

--
Gitblit v1.9.3