From 4f0cb973a7db26a9e65247033a95d9a8b3380d4b Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期二, 29 十月 2024 17:26:37 +0800
Subject: [PATCH] 基础信息和采购订单接口更新

---
 MES.Service/service/BasicData/MesSupplierManager.cs |   38 +++++++++++++-------------------------
 1 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/MES.Service/service/BasicData/MesSupplierManager.cs b/MES.Service/service/BasicData/MesSupplierManager.cs
index 71a9cbf..c1c416e 100644
--- a/MES.Service/service/BasicData/MesSupplierManager.cs
+++ b/MES.Service/service/BasicData/MesSupplierManager.cs
@@ -1,5 +1,4 @@
-锘縰sing Castle.Core.Resource;
-using MES.Service.DB;
+锘縰sing MES.Service.DB;
 using MES.Service.Dto.webApi;
 using MES.Service.Modes;
 using SqlSugar;
@@ -124,12 +123,11 @@
             SuppNo = supplier.FNumber,
             SuppSname = supplier.FShortName,
             SuppName = supplier.FName,
-            Lxr = supplier.FContact,
-            Telf1 = supplier.FTel,
+            Lxr = supplier.FTContact,
+            Telf1 = supplier.Fmobilephone,
             Fstaffid = supplier.FStaffId,
             Fforbidstatus = supplier.FForbidStatus,
-            type = supplier.Type,
-            Remarks = supplier.FDescription,
+            Type = supplier.Type,
             FSubsidiary = supplier.FUseOrgId,
             Fumbrella = supplier.FCreateOrgId,
             CreateDate = DateTime.Now,
@@ -167,7 +165,8 @@
         List<MesSupplier> supplierList)
     {
         var ids = supplierList.Select(it => it.Id).ToArray();
-        var deleteByIds = db.Deleteable<MesSupplier>().In(ids).ExecuteCommand();
+        var deleteByIds = db.Deleteable<MesSupplier>()
+            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
         if (deleteByIds > 0)
             return true;
 
@@ -176,19 +175,12 @@
 
     private bool InsertOrUpdate(SqlSugarScope db, MesSupplier entity)
     {
-        var exists = db.Queryable<MesSupplier>().Any(e => e.Id == entity.Id);
-        if (exists)
-        {
-            var update = db.Updateable(entity).ExecuteCommand();
-            if (update > 0)
-                return true;
-        }
-        else
-        {
-            var insert = db.Insertable(entity).ExecuteCommand();
-            if (insert > 0)
-                return true;
-        }
+        db.Deleteable<MesSupplier>().Where(s => s.Id == entity.Id)
+            .ExecuteCommand();
+
+        var insert = db.Insertable(entity).ExecuteCommand();
+        if (insert > 0)
+            return true;
 
         return false;
     }
@@ -196,10 +188,6 @@
     private bool InsertOrUpdateBatch(SqlSugarScope db,
         List<MesSupplier> supplierList)
     {
-        foreach (var entity in supplierList)
-            if (!InsertOrUpdate(db, entity))
-                return false;
-
-        return true;
+        return supplierList.All(entity => InsertOrUpdate(db, entity));
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3