From bdd84cc48ba7b2527584c44d174da8e7d20c5375 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期三, 18 九月 2024 16:37:13 +0800
Subject: [PATCH] 增加对申请入库时对平库库位的校验

---
 Wms/WMS.BLL/SysServer/CustomerServer.cs |   58 ++++++++++++++++++++++------------------------------------
 1 files changed, 22 insertions(+), 36 deletions(-)

diff --git a/Wms/WMS.BLL/SysServer/CustomerServer.cs b/Wms/WMS.BLL/SysServer/CustomerServer.cs
index 0af5d65..4105f4b 100644
--- a/Wms/WMS.BLL/SysServer/CustomerServer.cs
+++ b/Wms/WMS.BLL/SysServer/CustomerServer.cs
@@ -25,7 +25,7 @@
         }
 
 
-        public List<CustomerDto> GetCustomerList(string no,string name, int? type, string linkMan, string phone, int page, int limit, out int count)
+        public async Task<List<CustomerDto>> GetCustomerList(string no, string name, int? type, string linkMan, string phone, int page, int limit, RefAsync<int> count)
         {
             try
             {
@@ -37,10 +37,10 @@
                     .AndIF(!string.IsNullOrWhiteSpace(phone), it => it.Phone.Contains(phone.Trim()))
                     .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
 
-                var data = CustomerRst.GetAllByOrderPageAsync(item, limit, page, out int counts)
+                var data = await CustomerRst.GetAllByOrderPage(item, limit, page, out int counts)
                     .Includes(x => x.CreateUserInfo)
                     .Includes(x => x.UpdateUserInfo)
-                    .ToList();
+                    .ToListAsync();
                 count = counts;
 
                 return data.Select(m => new CustomerDto()
@@ -68,11 +68,11 @@
             }
         }
 
-        public SysCustomer GetCustomer(int id)
+        public async Task<SysCustomer> GetCustomer(int id)
         {
             try
             {
-                var data = CustomerRst.GetOneById(id);
+                var data = await CustomerRst.GetOneByIdAsync(id);
                 return data;
             }
             catch (Exception e)
@@ -81,11 +81,11 @@
             }
         }
 
-        public List<SysCustomer> GetCustomerSelect()
+        public async Task<List<SysCustomer>> GetCustomerSelect()
         {
             try
             {
-                var data = CustomerRst.GetAllAsync().ToList();
+                var data = await CustomerRst.GetAllAsync();
                 return data;
             }
             catch (Exception e)
@@ -94,17 +94,17 @@
             }
         }
 
-        public bool AddCustomer(string no, string name, int type, string address, string linkMan, string phone, string bankAccount, string creditRating, string demo, int userId)
+        public async Task<bool> AddCustomer(string no, string name, int type, string address, string linkMan, string phone, string bankAccount, string creditRating, string demo, int userId)
         {
             try
             {
                 //鍒ゆ柇鏄惁閲嶅
-                var customer = CustomerRst.GetAllWhereAsync(m => m.CustomerNo == no && m.IsDel == "0").First();
+                var customer = CustomerRst.GetAllWhere(m => m.CustomerNo == no && m.IsDel == "0").First();
                 if (customer != null)
                 {
                     throw new Exception("鐩稿悓缂栫爜鐨勫鎴峰凡瀛樺湪锛岃鍕块噸澶嶆坊鍔�");
                 }
-                var num = CustomerRst.Add(new SysCustomer()
+                var num = await CustomerRst.AddAsync(new SysCustomer()
                 {
                     CustomerNo = no,
                     CustomerName = name,
@@ -125,12 +125,12 @@
             }
         }
 
-        public bool EditCustomer(int id, string no, string name, int type, string address, string linkMan, string phone,
+        public async Task<bool> EditCustomer(int id, string no, string name, int type, string address, string linkMan, string phone,
             string bankAccount, string creditRating, string demo, int userId)
         {
             try
             {
-                var customer = CustomerRst.GetOneById(id);
+                var customer = await CustomerRst.GetOneByIdAsync(id);
                 if (customer == null)
                 {
                     throw new Exception("鏈煡璇㈠埌瀹㈡埛淇℃伅");
@@ -147,7 +147,7 @@
                 customer.Demo = demo;
                 customer.UpdateUser = userId;
                 customer.UpdateTime = DateTime.Now;
-                var num = CustomerRst.Edit(customer);
+                var num = await CustomerRst.EditAsync(customer);
                 return num > 0;
             }
             catch (Exception e)
@@ -156,35 +156,21 @@
             }
         }
 
-        public bool DelCustomer(int id, int userId)
+        public async Task<bool> DelCustomer(int id, int userId)
         {
-            try
-            {
-                var num = CustomerRst.Remove(id, userId);
-                return num > 0;
-            }
-            catch (Exception e)
-            {
-                throw new Exception(e.Message);
-            }
+            var num = await CustomerRst.RemoveAsync(id, userId);
+            return num > 0;
         }
 
-        public bool DelsCustomer(List<int> ids, int userId)
+        public async Task<bool> DelsCustomer(List<int> ids, int userId)
         {
-            try
+            var list = await CustomerRst.GetAllWhere(m => ids.Contains(m.Id)).ToListAsync();
+            for (int i = 0; i < list.Count; i++)
             {
-                var list = CustomerRst.GetAllWhereAsync(m => ids.Contains(m.Id)).ToList();
-                for (int i = 0; i < list.Count; i++)
-                {
-                    _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", list[i].CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + list[i].CustomerNo, userId);
-                }
-                var num = CustomerRst.RemoveAll(list, userId);
-                return num > 0;
+                await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", list[i].CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + list[i].CustomerNo, userId);
             }
-            catch (Exception e)
-            {
-                throw new Exception(e.Message);
-            }
+            var num = await CustomerRst.RemoveAllAsync(list, userId);
+            return num > 0;
         }
     }
 }

--
Gitblit v1.8.0