From c701f4c3a21a159e9b1efcfc6e9c4769e87b1e6f Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 18 四月 2024 20:15:56 +0800
Subject: [PATCH] 盟祺-按出货单出货和退回更新

---
 Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs |   72 +++++++++++++++++++++++++++++++++++-
 1 files changed, 70 insertions(+), 2 deletions(-)

diff --git a/Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs b/Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs
index b842687..550738b 100644
--- a/Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs
+++ b/Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs
@@ -1,4 +1,5 @@
 锘縰sing Rhea.Common;
+using SqlSugar;
 using System;
 using System.Collections.Generic;
 using System.Data;
@@ -18,6 +19,28 @@
         public partial class MqCustomer : ICustomer
         {
             /// <summary>
+            /// 鑾峰彇鍒嗛〉
+            /// </summary>
+            /// <param name="pageList"></param>
+            /// <returns></returns>
+            public async Task<ApiAction<PageAble<Customer>>> GetCustomers(PageAble<Customer> pageList)
+            {
+                var res = new ApiAction<PageAble<Customer>>();
+                try
+                {
+                    RefAsync<int> total = 0;
+                    pageList.data = await Db.Queryable<Customer>().WhereIF(!string.IsNullOrEmpty(pageList.sqlcmd), x => x.CustomerCode.Contains(pageList.sqlcmd)).OrderBy(x=>x.CustomerCode).ToPageListAsync(pageList.pageIndex, pageList.pageSize, total);
+                    pageList.totals = total;
+                }
+                catch (Exception ex)
+                {
+                    res.CatchExceptionWithLog(ex, "鑾峰彇瀹㈡埛淇℃伅寮傚父");
+                }
+                res.Data = pageList;
+                return res;
+            }
+
+            /// <summary>
             /// 鑾峰彇瀹㈡埛淇℃伅
             /// </summary>
             /// <returns></returns>
@@ -36,9 +59,54 @@
                 return res;
             }
 
-            public async Task<Result> SaveImportCustomerInfo(DataTable dt)
+            public async Task<ApiAction> SaveImportCustomerInfo(List<Customer> list)
             {
-                throw new NotImplementedException();
+                var res = new ApiAction();
+                //鏇存柊瀹㈡埛璁板綍
+                var db = Db;
+                var dbTran = await db.UseTranAsync(async () =>
+                {
+                    await db.Saveable(list).ExecuteCommandAsync();
+                });
+                if (!dbTran.IsSuccess)
+                {
+                    res.IsSuccessed = false;
+                    res.Message = $"瀵煎叆寮傚父";
+                }
+                return res;
+            }
+
+            /// <summary>
+            /// 淇濆瓨瀹㈡埛
+            /// </summary>
+            /// <param name="user"></param>
+            /// <returns></returns>
+            public async Task<ApiAction> SaveCustomer(Customer customer)
+            {
+                var result = new ApiAction();
+                try
+                {
+
+                    var db = Db;
+                    var dbTran = db.UseTran(() =>
+                    {
+                        var y = db.Storageable(customer)
+                           .WhereColumns(t => new { t.CustomerCode })
+                           .ToStorage();
+                        y.AsInsertable.ExecuteCommand();
+                        y.AsUpdateable.ExecuteCommand();
+                    });
+                    if (!dbTran.IsSuccess)
+                    {
+                        result.IsSuccessed = false;
+                        result.Message = $"瀵煎叆寮傚父";
+                    }
+                }
+                catch (Exception ex)
+                {
+                    result.CatchExceptionWithLog(ex, "淇濆瓨瀹㈡埛寮傚父");
+                }
+                return result;
             }
         }
     }

--
Gitblit v1.9.3