From 2dd922eb3ab68c0314f5828fcae1ed7db0e17d9e Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期四, 04 七月 2024 08:06:26 +0800
Subject: [PATCH] 客户、物流、单位
---
HTML/js/public.js | 30 ++
Wms/WMS.BLL/SysServer/ExceptionServer.cs | 2
Wms/WMS.IBLL/ISysServer/ILogisticsInfoServer.cs | 15
Wms/WMS.DAL/SysInfrastructure/StorageLocatRepository.cs | 2
Wms/WMS.BLL/SysServer/CustomerServer.cs | 58 ++---
Wms/WMS.IBLL/ISysServer/IUnitServer.cs | 13
Wms/WMS.BLL/SysServer/DictionaryServer.cs | 2
Wms/WMS.BLL/SysServer/UnitServer.cs | 172 ++++++---------
Wms/WMS.BLL/SysServer/StorageRoadwayServer.cs | 6
Wms/Utility/Extension/ApplicationBuilderExtensions.cs | 27 +
Wms/WMS.DAL/BaseRepository.cs | 22 +
Wms/WMS.IDAL/IBaseRepository.cs | 12
Wms/WMS.BLL/SysServer/WareHouseServer.cs | 6
Wms/WMS.IBLL/ISysServer/ICustomerServer.cs | 15
Wms/WMS.BLL/SysServer/PackagServer.cs | 8
Wms/WMS.BLL/SysServer/StorageAreaServer.cs | 6
Wms/WMS.BLL/SysServer/LogisticsInfoServer.cs | 143 ++++--------
Wms/WMS.BLL/SysServer/StorageLocatServer.cs | 2
Wms/WMS.BLL/SysServer/PalletsServer.cs | 6
Wms/Wms/Controllers/BasisController.cs | 103 ++++----
20 files changed, 302 insertions(+), 348 deletions(-)
diff --git a/HTML/js/public.js b/HTML/js/public.js
index b1ca696..879c061 100644
--- a/HTML/js/public.js
+++ b/HTML/js/public.js
@@ -39,6 +39,15 @@
if (!$.cookie('token')) {
callbackFun("鐧诲綍浜轰俊鎭凡澶辨晥");
}
+ if(isExpired = isTokenExpired($.cookie('token'))){
+ try{
+ parent.window.location.href = '/views/Login.html';
+ }
+ catch(error){
+ window.location.href = '/views/Login.html';
+ }
+ return;
+ }
}
$.ajax({
url: url,
@@ -57,9 +66,7 @@
// console.log(status);
callbackFun(res);
},
- error: function (res, status, error) {
- // console.log(res);
- // console.log(status);
+ error: function (res, status, error) {
callbackFun(res.responseJSON, status, error);
// layer.msg(res.statusText, {
// icon: 2,
@@ -68,6 +75,23 @@
},
});
}
+function isTokenExpired(token) {
+ const tokenParts = token.split('.');
+ if (tokenParts.length !== 3) {
+ return true; // JWT 鏍煎紡涓嶆纭�
+ }
+ const payloadBase64 = tokenParts[1];
+ const payload = JSON.parse(atob(payloadBase64));
+
+ if (!payload || !payload.exp) {
+ return true; // 娌℃湁鏈夋晥杞借嵎鎴栬�呮病鏈夎繃鏈熸椂闂�
+ }
+
+ const now = Date.now() / 1000; // 褰撳墠鏃堕棿鎴筹紙绉掞級
+ const expiration = payload.exp;
+
+ return now >= expiration;
+}
function synData(url, data, type, callbackFun) {
var deferred = $.Deferred();
if (type != "get") {
diff --git a/Wms/Utility/Extension/ApplicationBuilderExtensions.cs b/Wms/Utility/Extension/ApplicationBuilderExtensions.cs
index 5c72390..d8835b2 100644
--- a/Wms/Utility/Extension/ApplicationBuilderExtensions.cs
+++ b/Wms/Utility/Extension/ApplicationBuilderExtensions.cs
@@ -53,16 +53,23 @@
if (!string.IsNullOrEmpty(token))
{
var handler = new JwtSecurityTokenHandler();
- var jwtToken = handler.ReadJwtToken(token);
- var claim = jwtToken.Payload.Claims.FirstOrDefault(s => s.Type == "LoginName");
- //foreach (var claim in jwtToken.Payload.Claims)
- //{
- // Console.WriteLine($"{claim.Type}: {claim.Value}");
- //}
- if (claim != null)
- diagnosticContext.Set("_UserName", claim.Value);
- else
- diagnosticContext.Set("_UserName", "");
+ try
+ {
+ var jwtToken = handler.ReadJwtToken(token);
+ var claim = jwtToken.Payload.Claims.FirstOrDefault(s => s.Type == "LoginName");
+ //foreach (var claim in jwtToken.Payload.Claims)
+ //{
+ // Console.WriteLine($"{claim.Type}: {claim.Value}");
+ //}
+ if (claim != null)
+ diagnosticContext.Set("_UserName", claim.Value);
+ else
+ diagnosticContext.Set("_UserName", "");
+ }
+ catch (Exception)
+ {
+
+ }
}
//璇锋眰body
var requestContent = "{}";
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;
}
}
}
diff --git a/Wms/WMS.BLL/SysServer/DictionaryServer.cs b/Wms/WMS.BLL/SysServer/DictionaryServer.cs
index 1103cad..101813b 100644
--- a/Wms/WMS.BLL/SysServer/DictionaryServer.cs
+++ b/Wms/WMS.BLL/SysServer/DictionaryServer.cs
@@ -31,7 +31,7 @@
{
try
{
- var data = _dic.GetAllWhereAsync(m => m.ParentNo == parentNo && m.Level == "1").OrderBy(m => m.Ord).ToList();
+ var data = _dic.GetAllWhere(m => m.ParentNo == parentNo && m.Level == "1").OrderBy(m => m.Ord).ToList();
return data;
}
catch (Exception e)
diff --git a/Wms/WMS.BLL/SysServer/ExceptionServer.cs b/Wms/WMS.BLL/SysServer/ExceptionServer.cs
index 901b136..e14c80e 100644
--- a/Wms/WMS.BLL/SysServer/ExceptionServer.cs
+++ b/Wms/WMS.BLL/SysServer/ExceptionServer.cs
@@ -57,7 +57,7 @@
.AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type)
.ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
- var data = await ExceptionRst.GetAllByOrderPageAsync(item, limit, page, out int counts).ToListAsync();
+ var data = await ExceptionRst.GetAllByOrderPage(item, limit, page, out int counts).ToListAsync();
return data;
}
catch (Exception e)
diff --git a/Wms/WMS.BLL/SysServer/LogisticsInfoServer.cs b/Wms/WMS.BLL/SysServer/LogisticsInfoServer.cs
index 59815d9..cb334f7 100644
--- a/Wms/WMS.BLL/SysServer/LogisticsInfoServer.cs
+++ b/Wms/WMS.BLL/SysServer/LogisticsInfoServer.cs
@@ -24,7 +24,7 @@
_operation = operation;
}
- public List<LogisticsInfoDto> GetLogisticsInfoList(string name, string linkMan, string phone, string licensePlate, string type, int page, int limit, out int count)
+ public async Task<List<LogisticsInfoDto>> GetLogisticsInfoList(string name, string linkMan, string phone, string licensePlate, string type, int page, int limit, RefAsync<int> count)
{
try
{
@@ -36,9 +36,9 @@
.AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type)
.ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
- var data = LogisticsInfoRst.GetAllByOrderPageAsync(item, limit, page, out int counts)
+ var data = await LogisticsInfoRst.GetAllByOrderPage(item, limit, page, out int counts)
.Includes(x => x.CreateUserInfo)
- .Includes(x => x.UpdateUserInfo).ToList();
+ .Includes(x => x.UpdateUserInfo).ToListAsync();
count = counts;
return data.Select(m => new LogisticsInfoDto()
{
@@ -64,117 +64,74 @@
}
}
- public SysLogisticsInfo GetLogisticsInfo(int id)
+ public async Task<SysLogisticsInfo> GetLogisticsInfo(int id)
{
- try
- {
- var data = LogisticsInfoRst.GetOneById(id);
- return data;
- }
- catch (Exception e)
- {
- throw new Exception(e.Message);
- }
+ var data = await LogisticsInfoRst.GetOneByIdAsync(id);
+ return data;
}
- public List<SysLogisticsInfo> GetLogisticsInfoSelect()
+ public async Task<List<SysLogisticsInfo>> GetLogisticsInfoSelect()
{
- try
- {
- var data = LogisticsInfoRst.GetAllAsync().ToList();
- return data;
- }
- catch (Exception e)
- {
- throw new Exception(e.Message);
- }
+ var data = await LogisticsInfoRst.GetAllAsync();
+ return data;
}
- public bool AddLogisticsInfo(AddLogisticsInfoVm model, int userId)
+ public async Task<bool> AddLogisticsInfo(AddLogisticsInfoVm model, int userId)
{
- try
+ var num = await LogisticsInfoRst.AddAsync(new SysLogisticsInfo()
{
-
- var num = LogisticsInfoRst.Add(new SysLogisticsInfo()
- {
- CarrierName = model.CarrierName,
- Address = model.Address,
- LinkMan = model.LinkMan,
- Phone = model.Phone,
- BankAccount = model.BankAccount,
- CreditRating = model.CreditRating,
- LicensePlate = model.LicensePlate,
- Type = model.Type,
- Demo = model.Demo,
- CreateUser = userId
- });
- return num > 0;
- }
- catch (Exception e)
- {
- throw new Exception(e.Message);
- }
+ CarrierName = model.CarrierName,
+ Address = model.Address,
+ LinkMan = model.LinkMan,
+ Phone = model.Phone,
+ BankAccount = model.BankAccount,
+ CreditRating = model.CreditRating,
+ LicensePlate = model.LicensePlate,
+ Type = model.Type,
+ Demo = model.Demo,
+ CreateUser = userId
+ });
+ return num > 0;
}
- public bool EditLogisticsInfo(EditLogisticsInfoVm model, int userId)
+ public async Task<bool> EditLogisticsInfo(EditLogisticsInfoVm model, int userId)
{
- try
+ var logistics = await LogisticsInfoRst.GetOneByIdAsync(model.Id);
+ if (logistics == null)
{
- var logistics = LogisticsInfoRst.GetOneById(model.Id);
- if (logistics == null)
- {
- throw new Exception("鏈煡璇㈠埌鐗╂祦淇℃伅");
- }
+ throw new Exception("鏈煡璇㈠埌鐗╂祦淇℃伅");
+ }
- logistics.CarrierName = model.CarrierName;
- logistics.Address = model.Address;
- logistics.LinkMan = model.LinkMan;
- logistics.Phone = model.Phone;
- logistics.BankAccount = model.BankAccount;
- logistics.CreditRating = model.CreditRating;
- logistics.LicensePlate = model.LicensePlate;
- logistics.Type = model.Type;
- logistics.Demo = model.Demo;
- logistics.UpdateUser = userId;
- logistics.UpdateTime = DateTime.Now;
- var num = LogisticsInfoRst.Edit(logistics);
- return num > 0;
- }
- catch (Exception e)
- {
- throw new Exception(e.Message);
- }
+ logistics.CarrierName = model.CarrierName;
+ logistics.Address = model.Address;
+ logistics.LinkMan = model.LinkMan;
+ logistics.Phone = model.Phone;
+ logistics.BankAccount = model.BankAccount;
+ logistics.CreditRating = model.CreditRating;
+ logistics.LicensePlate = model.LicensePlate;
+ logistics.Type = model.Type;
+ logistics.Demo = model.Demo;
+ logistics.UpdateUser = userId;
+ logistics.UpdateTime = DateTime.Now;
+ var num = await LogisticsInfoRst.EditAsync(logistics);
+ return num > 0;
}
- public bool DelLogisticsInfo(int id, int userId)
+ public async Task<bool> DelLogisticsInfo(int id, int userId)
{
- try
- {
- var num = LogisticsInfoRst.Remove(id, userId);
- return num > 0;
- }
- catch (Exception e)
- {
- throw new Exception(e.Message);
- }
+ var num = await LogisticsInfoRst.RemoveAsync(id, userId);
+ return num > 0;
}
- public bool DelsLogisticsInfo(List<int> ids, int userId)
+ public async Task<bool> DelsLogisticsInfo(List<int> ids, int userId)
{
- try
+ var list = await LogisticsInfoRst.GetAllWhere(m => ids.Contains(m.Id)).ToListAsync();
+ for (int i = 0; i < list.Count; i++)
{
- var list = LogisticsInfoRst.GetAllWhereAsync(m => ids.Contains(m.Id)).ToList();
- for (int i = 0; i < list.Count; i++)
- {
- _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", list[i].CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + list[i].CarrierName, Convert.ToInt32(userId));
- }
- var num = LogisticsInfoRst.RemoveAll(list, userId);
- return num > 0;
+ await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", list[i].CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + list[i].CarrierName, Convert.ToInt32(userId));
}
- catch (Exception e)
- {
- throw new Exception(e.Message);
- }
+ var num = LogisticsInfoRst.RemoveAll(list, userId);
+ return num > 0;
}
}
}
diff --git a/Wms/WMS.BLL/SysServer/PackagServer.cs b/Wms/WMS.BLL/SysServer/PackagServer.cs
index 394029a..8da9fd8 100644
--- a/Wms/WMS.BLL/SysServer/PackagServer.cs
+++ b/Wms/WMS.BLL/SysServer/PackagServer.cs
@@ -39,7 +39,7 @@
.AndIF(level != null, it => it.Level.Equals(level))
.ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
- var data = PackagRst.GetAllByOrderPageAsync(item, limit, page, out int counts)
+ var data = PackagRst.GetAllByOrderPage(item, limit, page, out int counts)
.Includes(x => x.CreateUserInfo)
.Includes(x => x.UpdateUserInfo).ToList();
count = counts;
@@ -98,13 +98,13 @@
{
try
{
- var rowCount = PackagRst.GetAllWhereAsync(m => m.PackagNo == model.PackagNo).Count();
+ var rowCount = PackagRst.GetAllWhere(m => m.PackagNo == model.PackagNo).Count();
if (rowCount > 0)
{
throw new Exception("鍖呰缂栧彿宸插瓨鍦�!");
}
- rowCount = PackagRst.GetAllWhereAsync(m => m.PackagName == model.PackagName).Count();
+ rowCount = PackagRst.GetAllWhere(m => m.PackagName == model.PackagName).Count();
if (rowCount > 0)
{
throw new Exception("鍖呰鍚嶇О宸插瓨鍦�!");
@@ -202,7 +202,7 @@
{
if (string.IsNullOrEmpty(model.PackagName))
{
- var date = PackagRst.GetAllWhereAsync(m => m.Id != model.Id && (m.PackagName == model.PackagName)).Count();
+ var date = PackagRst.GetAllWhere(m => m.Id != model.Id && (m.PackagName == model.PackagName)).Count();
if (date > 0)
{
throw new Exception("鍖呰鍚嶇О宸插瓨鍦�!");
diff --git a/Wms/WMS.BLL/SysServer/PalletsServer.cs b/Wms/WMS.BLL/SysServer/PalletsServer.cs
index adbdd82..8a7c445 100644
--- a/Wms/WMS.BLL/SysServer/PalletsServer.cs
+++ b/Wms/WMS.BLL/SysServer/PalletsServer.cs
@@ -46,7 +46,7 @@
.ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
- var data = PalletsRst.GetAllByOrderPageAsync(item, limit, page, out int counts)
+ var data = PalletsRst.GetAllByOrderPage(item, limit, page, out int counts)
.Includes(x => x.CreateUserInfo)
.ToList();
count = counts;
@@ -77,12 +77,12 @@
if (!string.IsNullOrWhiteSpace(palletNo))
{
- var code = PalletsRst.GetAllWhereAsync(m => m.PalletNo == palletNo).First();
+ var code = PalletsRst.GetAllWhere(m => m.PalletNo == palletNo).First();
return code.PalletNo;
}
else
{
- var code = PalletsRst.GetAllAsync().OrderByDescending(m => m.PalletNo).First();
+ var code = PalletsRst.GetAll().OrderByDescending(m => m.PalletNo).First();
if (code != null)
{
diff --git a/Wms/WMS.BLL/SysServer/StorageAreaServer.cs b/Wms/WMS.BLL/SysServer/StorageAreaServer.cs
index 1dc557a..d81dd61 100644
--- a/Wms/WMS.BLL/SysServer/StorageAreaServer.cs
+++ b/Wms/WMS.BLL/SysServer/StorageAreaServer.cs
@@ -49,7 +49,7 @@
.ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
- var data = AreaRst.GetAllByOrderPageAsync(item, limit, page, out int counts)
+ var data = AreaRst.GetAllByOrderPage(item, limit, page, out int counts)
.Includes(x => x.WareHouseInfo)
.Includes(x => x.TemperatureInfo)
.Includes(x => x.CreateUserInfo)
@@ -125,7 +125,7 @@
{
try
{
- var data = AreaRst.GetAllAsync().ToList();
+ var data = AreaRst.GetAll().ToList();
if (!string.IsNullOrWhiteSpace(wareHouseNo))
{
data = data.Where(m => m.WareHouseNo == wareHouseNo).ToList();
@@ -225,7 +225,7 @@
try
{
//鍒ゆ柇闄ゅ綋鍓峣d淇℃伅浠ュ鏄惁鍚湁缂栧彿鍜屽悕绉�
- var bol = AreaRst.GetAllAsync()
+ var bol = AreaRst.GetAll()
.Any(m => m.Id != id && m.AreaName == name.Trim());
if (bol)
{
diff --git a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
index fbbdd73..529db77 100644
--- a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
+++ b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
@@ -59,7 +59,7 @@
.ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
- var data = LocatRst.GetAllByOrderPageAsync(item, limit, page, out int counts)
+ var data = LocatRst.GetAllByOrderPage(item, limit, page, out int counts)
.Includes(x => x.WareHouseInfo)
.Includes(x => x.AreaInfo)
.Includes(x => x.RoadwayInfo)
diff --git a/Wms/WMS.BLL/SysServer/StorageRoadwayServer.cs b/Wms/WMS.BLL/SysServer/StorageRoadwayServer.cs
index 323cb58..e05062c 100644
--- a/Wms/WMS.BLL/SysServer/StorageRoadwayServer.cs
+++ b/Wms/WMS.BLL/SysServer/StorageRoadwayServer.cs
@@ -42,7 +42,7 @@
.AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type)
.ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
- var data = RoadwayRst.GetAllByOrderPageAsync(item, limit, page,out int counts)
+ var data = RoadwayRst.GetAllByOrderPage(item, limit, page,out int counts)
.Includes(x => x.WareHouseInfo)
.Includes(x => x.TemperatureInfo)
.Includes(x => x.CreateUserInfo)
@@ -99,7 +99,7 @@
{
try
{
- var data = RoadwayRst.GetAllAsync().ToList();
+ var data = RoadwayRst.GetAll().ToList();
if (!string.IsNullOrWhiteSpace(wareHouseNo))
{
data = data.Where(m => m.WareHouseNo == wareHouseNo).ToList();
@@ -137,7 +137,7 @@
throw new Exception("涓烘煡璇㈠埌褰撳墠宸烽亾淇℃伅");
}
//鍒ゆ柇闄ゅ綋鍓峣d淇℃伅浠ュ鏄惁鍚湁缂栧彿鍜屽悕绉�
- var bol = RoadwayRst.GetAllAsync().Any(m => m.Id != id && m.RoadwayNo== roadway.RoadwayNo && m.RoadwayName == roadwayName.Trim());
+ var bol = RoadwayRst.GetAll().Any(m => m.Id != id && m.RoadwayNo== roadway.RoadwayNo && m.RoadwayName == roadwayName.Trim());
if (bol)
{
throw new Exception("褰撳墠宸烽亾鍙锋垨宸烽亾鍚嶇О宸插瓨鍦�");
diff --git a/Wms/WMS.BLL/SysServer/UnitServer.cs b/Wms/WMS.BLL/SysServer/UnitServer.cs
index a406675..47838d7 100644
--- a/Wms/WMS.BLL/SysServer/UnitServer.cs
+++ b/Wms/WMS.BLL/SysServer/UnitServer.cs
@@ -33,55 +33,39 @@
/// <param name="limit"></param>
/// <param name="count"></param>
/// <returns></returns>
- public List<UnitDto> GetUnitList(string unitNo, string unitName, int page, int limit, out int count)
+ public async Task<List<UnitDto>> GetUnitList(string unitNo, string unitName, int page, int limit, RefAsync<int> count)
{
- try
+ Expression<Func<SysUnit, bool>> item = Expressionable.Create<SysUnit>() //鍒涘缓琛ㄨ揪寮�
+ .AndIF(!string.IsNullOrWhiteSpace(unitNo), it => it.UnitNo.Contains(unitNo.Trim()))
+ .AndIF(!string.IsNullOrWhiteSpace(unitName), it => it.UnitName.Contains(unitName.Trim()))
+ .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
+
+
+ var data = await UnitRst.GetAllByOrderPage(item, limit, page, out int counts)
+ .Includes(x => x.CreateUserInfo)
+ .Includes(x => x.UpdateUserInfo).ToListAsync();
+ count = counts;
+ return data.Select(m => new UnitDto()
{
- Expression<Func<SysUnit, bool>> item = Expressionable.Create<SysUnit>() //鍒涘缓琛ㄨ揪寮�
- .AndIF(!string.IsNullOrWhiteSpace(unitNo), it => it.UnitNo.Contains(unitNo.Trim()))
- .AndIF(!string.IsNullOrWhiteSpace(unitName), it => it.UnitName.Contains(unitName.Trim()))
- .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
-
-
- var data = UnitRst.GetAllByOrderPageAsync(item, limit, page, out int counts)
- .Includes(x => x.CreateUserInfo)
- .Includes(x => x.UpdateUserInfo).ToList();
- count = counts;
- return data.Select(m => new UnitDto()
- {
- Id = m.Id,
- UnitNo = m.UnitNo,
- UnitName = m.UnitName,
- Abbrev = m.Abbrev,
- CreateTime = m.CreateTime,
- CreateUserName = m.CreateUserInfo == null ? "" : m.CreateUserInfo.RealName,
- UpdateTime = m.UpdateTime,
- UpdateUserName = m.UpdateUserInfo == null ? "" : m.UpdateUserInfo.RealName
- }).ToList();
-
-
- }
- catch (Exception e)
- {
- throw new Exception(e.Message);
- }
+ Id = m.Id,
+ UnitNo = m.UnitNo,
+ UnitName = m.UnitName,
+ Abbrev = m.Abbrev,
+ CreateTime = m.CreateTime,
+ CreateUserName = m.CreateUserInfo == null ? "" : m.CreateUserInfo.RealName,
+ UpdateTime = m.UpdateTime,
+ UpdateUserName = m.UpdateUserInfo == null ? "" : m.UpdateUserInfo.RealName
+ }).ToList();
}
/// <summary>
/// 鑾峰彇鍗曟潯鍗曚綅淇℃伅
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
- public SysUnit GetUnit(int id)
+ public async Task<SysUnit> GetUnit(int id)
{
- try
- {
- var data = UnitRst.GetOneById(id);
- return data;
- }
- catch (Exception e)
- {
- throw new Exception(e.Message);
- }
+ var data = await UnitRst.GetOneByIdAsync(id);
+ return data;
}
/// <summary>
/// 娣诲姞鍗曚綅淇℃伅
@@ -90,13 +74,13 @@
/// <param name="abbrev">缂╁啓</param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- public bool AddUnit(string unitName, string abbrev, int userId)
+ public async Task<bool> AddUnit(string unitName, string abbrev, int userId)
{
try
{
if (string.IsNullOrEmpty(abbrev))
{
- var date = UnitRst.GetAllWhereAsync(m => m.UnitName == unitName).Count();
+ var date = await UnitRst.GetAllWhere(m => m.UnitName == unitName).CountAsync();
if (date > 0)
{
throw new Exception("鍗曚綅鍚嶇О閲嶅");
@@ -104,7 +88,7 @@
}
else
{
- var date = UnitRst.GetAllWhereAsync(m => m.UnitName == unitName || m.Abbrev == abbrev).Count();
+ var date = await UnitRst.GetAllWhere(m => m.UnitName == unitName || m.Abbrev == abbrev).CountAsync();
if (date > 0)
{
throw new Exception("鍗曚綅鍚嶇О鎴栬嫳鏂囩缉鍐欓噸澶�");
@@ -112,9 +96,9 @@
}
//鑷姩UnitCode澶勭悊
- var unitList = UnitRst.GetAllAsync().OrderByDescending(m => m.UnitNo);
+ var unitList = UnitRst.GetAll().OrderByDescending(m => m.UnitNo);
var code = "01";
- if (unitList != null && unitList.Count()>0)
+ if (unitList != null && unitList.Count() > 0)
{
var unitCode = unitList.First().UnitNo;
var str = unitCode.Substring(0, 1);
@@ -122,7 +106,7 @@
code = str == "0" ? (str2 == "9" ? (int.Parse(str2) + 1).ToString() : "0" + (int.Parse(str2) + 1)) : (int.Parse(unitCode) + 1).ToString();
}
- var num = UnitRst.Add(new SysUnit()
+ var num = await UnitRst.AddAsync(new SysUnit()
{
UnitNo = code,
UnitName = unitName,
@@ -131,7 +115,7 @@
});
if (num > 0)
{
- _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", code, "娣诲姞", "娣诲姞璁¢噺鍗曚綅 鍗曚綅鍙凤細" + code, Convert.ToInt32(userId));
+ await _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", code, "娣诲姞", "娣诲姞璁¢噺鍗曚綅 鍗曚綅鍙凤細" + code, Convert.ToInt32(userId));
}
return num > 0;
}
@@ -148,83 +132,69 @@
/// <param name="abbrev">缂╁啓</param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- public bool EditUnit(int id, string unitName, string abbrev, int userId)
+ public async Task<bool> EditUnit(int id, string unitName, string abbrev, int userId)
{
- try
+ if (string.IsNullOrEmpty(abbrev))
{
- if (string.IsNullOrEmpty(abbrev))
+ var date = await UnitRst.GetAllWhere(m => m.Id != id && m.UnitName == unitName).CountAsync();
+ if (date > 0)
{
- var date = UnitRst.GetAllWhereAsync(m => m.Id != id && m.UnitName == unitName).Count();
- if (date > 0)
- {
- throw new Exception("鍗曚綅鍚嶇О閲嶅");
- }
+ throw new Exception("鍗曚綅鍚嶇О閲嶅");
}
- else
- {
- var date = UnitRst.GetAllWhereAsync(m => m.Id != id && (m.UnitName == unitName || m.Abbrev == abbrev)).Count();
- if (date > 0)
- {
- throw new Exception("鍗曚綅鍚嶇О鎴栬嫳鏂囩缉鍐欓噸澶�");
- }
- }
-
- //鑷姩UnitCode澶勭悊
- var unit = UnitRst.GetOneById(id);
- if (unit == null)
- {
- throw new Exception("鏈煡璇㈠埌鍗曚綅淇℃伅");
- }
- unit.UnitName = unitName;
- unit.Abbrev = abbrev;
- unit.UpdateUser = userId;
- unit.UpdateTime = DateTime.Now;
-
- var num = UnitRst.Edit(unit);
- return num > 0;
}
- catch (Exception e)
+ else
{
- throw new Exception(e.Message);
+ var date = await UnitRst.GetAllWhere(m => m.Id != id && (m.UnitName == unitName || m.Abbrev == abbrev)).CountAsync();
+ if (date > 0)
+ {
+ throw new Exception("鍗曚綅鍚嶇О鎴栬嫳鏂囩缉鍐欓噸澶�");
+ }
}
+
+ //鑷姩UnitCode澶勭悊
+ var unit = UnitRst.GetOneById(id);
+ if (unit == null)
+ {
+ throw new Exception("鏈煡璇㈠埌鍗曚綅淇℃伅");
+ }
+ unit.UnitName = unitName;
+ unit.Abbrev = abbrev;
+ unit.UpdateUser = userId;
+ unit.UpdateTime = DateTime.Now;
+
+ var num = await UnitRst.EditAsync(unit);
+ return num > 0;
}
- public bool DelUnit(int id, int userId)
+ public async Task<bool> DelUnit(int id, int userId)
{
- try
+ var unit = UnitRst.GetOneById(id);
+ if (unit == null)
{
- var unit = UnitRst.GetOneById(id);
- if (unit == null)
- {
- throw new Exception("鏈煡璇㈠埌鍗曚綅淇℃伅");
- }
- int num = UnitRst.Remove(id, userId);
- if (num > 0)
- {
- _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", unit.UnitNo, "鍒犻櫎", "鍒犻櫎璁¢噺鍗曚綅 鍗曚綅鍙凤細" + unit.UnitNo, Convert.ToInt32(userId));
- }
+ throw new Exception("鏈煡璇㈠埌鍗曚綅淇℃伅");
+ }
+ int num = await UnitRst.RemoveAsync(id, userId);
+ if (num > 0)
+ {
+ await _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", unit.UnitNo, "鍒犻櫎", "鍒犻櫎璁¢噺鍗曚綅 鍗曚綅鍙凤細" + unit.UnitNo, Convert.ToInt32(userId));
+ }
- return num > 0;
- }
- catch (Exception e)
- {
- throw new Exception(e.Message);
- }
+ return num > 0;
}
- public bool DelsUnit(List<int> ids, int userId)
+ public async Task<bool> DelsUnit(List<int> ids, int userId)
{
try
{
- var list = UnitRst.GetAllWhereAsync(m => ids.Contains(m.Id)).ToList();
+ var list = await UnitRst.GetAllWhere(m => ids.Contains(m.Id)).ToListAsync();
if (list.Count > 0)
{
for (int i = 0; i < list.Count; i++)
{
- _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", list[i].UnitNo, "鍒犻櫎", "鍒犻櫎璁¢噺鍗曚綅 鍗曚綅鍙凤細" + list[i].UnitNo, Convert.ToInt32(userId));
+ await _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", list[i].UnitNo, "鍒犻櫎", "鍒犻櫎璁¢噺鍗曚綅 鍗曚綅鍙凤細" + list[i].UnitNo, Convert.ToInt32(userId));
}
}
- var num = UnitRst.RemoveAll(list, userId);
+ var num = await UnitRst.RemoveAllAsync(list, userId);
return num > 0;
}
catch (Exception e)
diff --git a/Wms/WMS.BLL/SysServer/WareHouseServer.cs b/Wms/WMS.BLL/SysServer/WareHouseServer.cs
index 515515b..1bee3e8 100644
--- a/Wms/WMS.BLL/SysServer/WareHouseServer.cs
+++ b/Wms/WMS.BLL/SysServer/WareHouseServer.cs
@@ -42,7 +42,7 @@
.ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
- var data = WareHouseRst.GetAllByOrderPageAsync(item, limit, page,out int counts)
+ var data = WareHouseRst.GetAllByOrderPage(item, limit, page,out int counts)
.Includes(x => x.TypeInfo)
.Includes(x => x.TemperatureInfo)
.Includes(x => x.CreateUserInfo)
@@ -108,7 +108,7 @@
try
{
//鍒ゆ柇闄ゅ綋鍓峣d淇℃伅浠ュ鏄惁鍚湁缂栧彿鍜屽悕绉�
- var bol = await WareHouseRst.GetAllAsync()
+ var bol = await WareHouseRst.GetAll()
.AnyAsync(m => m.Id != id && (m.WareHouseNo == no.Trim() || m.WareHouseName == name.Trim()));
if (bol)
{
@@ -155,7 +155,7 @@
{
try
{
- var list = await WareHouseRst.GetAllAsync().ToListAsync();
+ var list = await WareHouseRst.GetAll().ToListAsync();
return list;
}
catch (Exception e)
diff --git a/Wms/WMS.DAL/BaseRepository.cs b/Wms/WMS.DAL/BaseRepository.cs
index b72953c..1547c2a 100644
--- a/Wms/WMS.DAL/BaseRepository.cs
+++ b/Wms/WMS.DAL/BaseRepository.cs
@@ -120,37 +120,41 @@
return model.FirstOrDefault();
}
- public SqlSugar.ISugarQueryable<T> GetAllAsync()
+ public SqlSugar.ISugarQueryable<T> GetAll()
{
var data =_db.Queryable<T>().Where(m=>m.IsDel =="0");
return data;
}
- public SqlSugar.ISugarQueryable<T> GetAllWhereAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate)
+ public async Task<List<T>> GetAllAsync()
{
- var data = GetAllAsync().Where(predicate);
+ return await _db.Queryable<T>().Where(m => m.IsDel == "0").ToListAsync();
+ }
+ public SqlSugar.ISugarQueryable<T> GetAllWhere(System.Linq.Expressions.Expression<Func<T, bool>> predicate)
+ {
+ var data = GetAll().Where(predicate);
return data;
}
- public SqlSugar.ISugarQueryable<T> GetAllByOrderAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate, bool asc = true)
+ public SqlSugar.ISugarQueryable<T> GetAllByOrder(System.Linq.Expressions.Expression<Func<T, bool>> predicate, bool asc = true)
{
var type = OrderByType.Asc;
if (!asc)
{
type = OrderByType.Desc;
}
- var data = GetAllWhereAsync(predicate).OrderBy(m => m.CreateTime, type);
+ var data = GetAllWhere(predicate).OrderBy(m => m.CreateTime, type);
return data;
}
- public SqlSugar.ISugarQueryable<T> GeTAllByPageAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate, int pageSize, int pageIndex,out int count )
+ public SqlSugar.ISugarQueryable<T> GeTAllByPage(System.Linq.Expressions.Expression<Func<T, bool>> predicate, int pageSize, int pageIndex,out int count )
{
- var list = GetAllWhereAsync(predicate);
+ var list = GetAllWhere(predicate);
count = list.Count();
var data = list.Skip(pageSize * (pageIndex - 1)).Take(pageSize);
return data;
}
- public SqlSugar.ISugarQueryable<T> GetAllByOrderPageAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate, int pageSize, int pageIndex, out int count , bool asc = true)
+ public SqlSugar.ISugarQueryable<T> GetAllByOrderPage(System.Linq.Expressions.Expression<Func<T, bool>> predicate, int pageSize, int pageIndex, out int count , bool asc = true)
{
- var list = GetAllByOrderAsync(predicate, asc);
+ var list = GetAllByOrder(predicate, asc);
count = list.Count();
var data = list.Skip(pageSize * (pageIndex-1)).Take(pageSize);
diff --git a/Wms/WMS.DAL/SysInfrastructure/StorageLocatRepository.cs b/Wms/WMS.DAL/SysInfrastructure/StorageLocatRepository.cs
index 509133c..54503c3 100644
--- a/Wms/WMS.DAL/SysInfrastructure/StorageLocatRepository.cs
+++ b/Wms/WMS.DAL/SysInfrastructure/StorageLocatRepository.cs
@@ -133,7 +133,7 @@
{
try
{
- var locateList = GetAllWhereAsync(m => id.Contains(m.Id)).ToList();
+ var locateList = GetAllWhere(m => id.Contains(m.Id)).ToList();
if (locateList.Count == 0)
{
throw new Exception($"涓烘煡璇㈠埌id涓簕id}鐨勫偍浣嶄俊鎭�");
diff --git a/Wms/WMS.IBLL/ISysServer/ICustomerServer.cs b/Wms/WMS.IBLL/ISysServer/ICustomerServer.cs
index 43feedd..1c818ba 100644
--- a/Wms/WMS.IBLL/ISysServer/ICustomerServer.cs
+++ b/Wms/WMS.IBLL/ISysServer/ICustomerServer.cs
@@ -1,4 +1,5 @@
锘縰sing Model.ModelDto.SysDto;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
@@ -21,19 +22,19 @@
/// <param name="limit"></param>
/// <param name="count"></param>
/// <returns></returns>
- List<CustomerDto> GetCustomerList(string no, string name,int? type,string linkMan,string phone ,int page,int limit,out int count);
+ Task<List<CustomerDto>> GetCustomerList(string no, string name,int? type,string linkMan,string phone ,int page,int limit,RefAsync<int> count);
/// <summary>
/// 鏌ヨ鍗曟潯瀹㈡埛淇℃伅
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
- SysCustomer GetCustomer(int id);
+ Task<SysCustomer> GetCustomer(int id);
/// <summary>
/// 鏌ヨ鍏ㄩ儴瀹㈡埛淇℃伅
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
- List<SysCustomer> GetCustomerSelect();
+ Task<List<SysCustomer>> GetCustomerSelect();
/// <summary>
/// 娣诲姞瀹㈡埛淇℃伅
/// </summary>
@@ -47,7 +48,7 @@
/// <param name="creditRating">淇$敤绛夌骇</param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- bool AddCustomer(string no,string name, int type,string address, string linkMan, string phone,string bankAccount,string creditRating, string demo,int userId);
+ Task<bool> AddCustomer(string no,string name, int type,string address, string linkMan, string phone,string bankAccount,string creditRating, string demo,int userId);
/// <summary>
/// 缂栬緫瀹㈡埛淇℃伅
@@ -63,20 +64,20 @@
/// <param name="creditRating">淇$敤绛夌骇</param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- bool EditCustomer(int id,string no,string name, int type, string address, string linkMan, string phone, string bankAccount, string creditRating, string demo, int userId);
+ 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);
/// <summary>
/// 鍒犻櫎鍗曟潯瀹㈡埛淇℃伅
/// </summary>
/// <param name="id"></param>
/// <param name="userId"></param>
/// <returns></returns>
- bool DelCustomer(int id,int userId);
+ Task<bool> DelCustomer(int id,int userId);
/// <summary>
/// 鍒犻櫎鍗曟潯瀹㈡埛淇℃伅
/// </summary>
/// <param name="ids"></param>
/// <param name="userId"></param>
/// <returns></returns>
- bool DelsCustomer(List<int> ids, int userId);
+ Task<bool> DelsCustomer(List<int> ids, int userId);
}
}
diff --git a/Wms/WMS.IBLL/ISysServer/ILogisticsInfoServer.cs b/Wms/WMS.IBLL/ISysServer/ILogisticsInfoServer.cs
index 08bcae1..fd9bf63 100644
--- a/Wms/WMS.IBLL/ISysServer/ILogisticsInfoServer.cs
+++ b/Wms/WMS.IBLL/ISysServer/ILogisticsInfoServer.cs
@@ -1,5 +1,6 @@
锘縰sing Model.ModelDto.SysDto;
using Model.ModelVm.SysVm;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
@@ -22,39 +23,39 @@
/// <param name="limit"></param>
/// <param name="count"></param>
/// <returns></returns>
- List<LogisticsInfoDto> GetLogisticsInfoList(string name,string linkMan,string phone,string licensePlate,string type,int page,int limit,out int count);
+ Task<List<LogisticsInfoDto>> GetLogisticsInfoList(string name, string linkMan, string phone, string licensePlate, string type, int page, int limit, RefAsync<int> count);
/// <summary>
/// 鏌ヨ鍗曟潯鐗╂祦淇℃伅
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
- SysLogisticsInfo GetLogisticsInfo(int id);
+ Task<SysLogisticsInfo> GetLogisticsInfo(int id);
/// <summary>
/// 鏌ヨ鍏ㄩ儴鐗╂祦淇℃伅
/// </summary>
/// <returns></returns>
- List<SysLogisticsInfo> GetLogisticsInfoSelect();
+ Task<List<SysLogisticsInfo>> GetLogisticsInfoSelect();
/// <summary>
/// 娣诲姞鐗╂祦淇℃伅
/// </summary>
/// <param name="model"></param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- bool AddLogisticsInfo(AddLogisticsInfoVm model, int userId);
+ Task<bool> AddLogisticsInfo(AddLogisticsInfoVm model, int userId);
/// <summary>
/// 缂栬緫鐗╂祦淇℃伅
/// </summary>
/// <param name="model"></param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- bool EditLogisticsInfo(EditLogisticsInfoVm model, int userId);
+ Task<bool> EditLogisticsInfo(EditLogisticsInfoVm model, int userId);
/// <summary>
/// 鍒犻櫎鍗曟潯鐗╂祦淇℃伅
/// </summary>
/// <param name="id"></param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- bool DelLogisticsInfo(int id,int userId);
+ Task<bool> DelLogisticsInfo(int id, int userId);
/// <summary>
/// 鍒犻櫎鐗╂祦淇℃伅(澶氭潯淇℃伅)
@@ -62,6 +63,6 @@
/// <param name="ids"></param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- bool DelsLogisticsInfo(List<int> ids,int userId);
+ Task<bool> DelsLogisticsInfo(List<int> ids, int userId);
}
}
diff --git a/Wms/WMS.IBLL/ISysServer/IUnitServer.cs b/Wms/WMS.IBLL/ISysServer/IUnitServer.cs
index ac09c61..b68f660 100644
--- a/Wms/WMS.IBLL/ISysServer/IUnitServer.cs
+++ b/Wms/WMS.IBLL/ISysServer/IUnitServer.cs
@@ -3,6 +3,7 @@
using System.Text;
using System.Threading.Tasks;
using Model.ModelDto.SysDto;
+using SqlSugar;
using WMS.Entity.SysEntity;
namespace WMS.IBLL.ISysServer
@@ -18,13 +19,13 @@
/// <param name="limit"></param>
/// <param name="count"></param>
/// <returns></returns>
- List<UnitDto> GetUnitList(string unitNo,string unitName,int page,int limit,out int count);
+ Task<List<UnitDto>> GetUnitList(string unitNo,string unitName,int page,int limit, RefAsync<int> count);
/// <summary>
/// 鑾峰彇鍗曟潯鍗曚綅淇℃伅
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
- SysUnit GetUnit(int id);
+ Task<SysUnit> GetUnit(int id);
/// <summary>
/// 娣诲姞鍗曚綅淇℃伅
/// </summary>
@@ -32,7 +33,7 @@
/// <param name="abbrev">缂╁啓</param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- bool AddUnit(string unitName,string abbrev,int userId);
+ Task<bool> AddUnit(string unitName,string abbrev,int userId);
/// <summary>
/// 缂栬緫鍗曚綅淇℃伅
/// </summary>
@@ -41,20 +42,20 @@
/// <param name="abbrev">缂╁啓</param>
/// <param name="userId">鎿嶄綔浜�</param>
/// <returns></returns>
- bool EditUnit(int id, string unitName, string abbrev, int userId);
+ Task<bool> EditUnit(int id, string unitName, string abbrev, int userId);
/// <summary>
/// 鍒犻櫎鍗曚綅淇℃伅
/// </summary>
/// <param name="id"></param>
/// <param name="userId"></param>
/// <returns></returns>
- bool DelUnit(int id,int userId);
+ Task<bool> DelUnit(int id,int userId);
/// <summary>
/// 鍒犻櫎鍗曚綅淇℃伅锛堝鍒犻櫎锛�
/// </summary>
/// <param name="ids">id闆嗗悎</param>
/// <param name="userId"></param>
/// <returns></returns>
- bool DelsUnit(List<int> ids, int userId);
+ Task<bool> DelsUnit(List<int> ids, int userId);
}
}
diff --git a/Wms/WMS.IDAL/IBaseRepository.cs b/Wms/WMS.IDAL/IBaseRepository.cs
index e144ee5..c423e3f 100644
--- a/Wms/WMS.IDAL/IBaseRepository.cs
+++ b/Wms/WMS.IDAL/IBaseRepository.cs
@@ -28,8 +28,8 @@
Task SaveAsync();
- ISugarQueryable<T> GetAllAsync();
-
+ ISugarQueryable<T> GetAll();
+ Task<List<T>> GetAllAsync();
T GetOneById(int id);
Task<T> GetOneByIdAsync(int id);
@@ -37,9 +37,9 @@
T GetModel(string sqlString);
- ISugarQueryable<T> GetAllWhereAsync(Expression<Func<T, bool>> predicate);
- ISugarQueryable<T> GeTAllByPageAsync(Expression<Func<T, bool>> predicate,int pageSize,int pageIndex, out int count);
- ISugarQueryable<T> GetAllByOrderAsync(Expression<Func<T, bool>> predicate, bool asc = true);
- ISugarQueryable<T> GetAllByOrderPageAsync(Expression<Func<T, bool>> predicate, int pageSize , int pageIndex , out int count,bool asc = true);
+ ISugarQueryable<T> GetAllWhere(Expression<Func<T, bool>> predicate);
+ ISugarQueryable<T> GeTAllByPage(Expression<Func<T, bool>> predicate,int pageSize,int pageIndex, out int count);
+ ISugarQueryable<T> GetAllByOrder(Expression<Func<T, bool>> predicate, bool asc = true);
+ ISugarQueryable<T> GetAllByOrderPage(Expression<Func<T, bool>> predicate, int pageSize , int pageIndex , out int count,bool asc = true);
}
}
diff --git a/Wms/Wms/Controllers/BasisController.cs b/Wms/Wms/Controllers/BasisController.cs
index c832558..1c2411a 100644
--- a/Wms/Wms/Controllers/BasisController.cs
+++ b/Wms/Wms/Controllers/BasisController.cs
@@ -926,11 +926,12 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetCustomerList(GetCustomerVm model)
+ public async Task<IActionResult> GetCustomerList(GetCustomerVm model)
{
try
{
- var bolls = _customerSvc.GetCustomerList(model.CustomerNo, model.CustomerName, model.Type, model.LinkMan, model.Phone, model.Page, model.Limit, out int count);
+ RefAsync<int> count = new RefAsync<int>();
+ var bolls = await _customerSvc.GetCustomerList(model.CustomerNo, model.CustomerName, model.Type, model.LinkMan, model.Phone, model.Page, model.Limit, count);
return Ok(new { code = 0, count, msg = "瀹㈡埛淇℃伅", data = bolls });
}
@@ -945,11 +946,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetCustomer(IdVm model)
+ public async Task<IActionResult> GetCustomer(IdVm model)
{
try
{
- var bolls = _customerSvc.GetCustomer(model.Id);
+ var bolls = await _customerSvc.GetCustomer(model.Id);
return Ok(new { code = 0, count = 0, msg = "瀹㈡埛淇℃伅", data = bolls });
}
@@ -963,11 +964,11 @@
/// </summary>
/// <returns></returns>
[HttpGet]
- public IActionResult GetCustomerSelect()
+ public async Task<IActionResult> GetCustomerSelect()
{
try
{
- var bolls = _customerSvc.GetCustomerSelect();
+ var bolls = await _customerSvc.GetCustomerSelect();
return Ok(new { code = 0, count = 0, msg = "瀹㈡埛淇℃伅", data = bolls });
}
@@ -982,7 +983,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult AddCustomer(AddCustomerVm model)
+ public async Task<IActionResult> AddCustomer(AddCustomerVm model)
{
try
{
@@ -998,11 +999,11 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _customerSvc.AddCustomer(model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
+ var bolls = await _customerSvc.AddCustomer(model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
if (bolls)
{
- _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "娣诲姞", "娣诲姞瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
+ await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "娣诲姞", "娣诲姞瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
}
else
@@ -1021,7 +1022,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult EditCustomer(EditCustomerVm model)
+ public async Task<IActionResult> EditCustomer(EditCustomerVm model)
{
try
{
@@ -1037,11 +1038,11 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _customerSvc.EditCustomer(model.Id, model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
+ var bolls = await _customerSvc.EditCustomer(model.Id, model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
if (bolls)
{
- _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "缂栬緫", "缂栬緫瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
+ await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "缂栬緫", "缂栬緫瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
}
else
@@ -1060,11 +1061,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelCustomer(IdVm model)
+ public async Task<IActionResult> DelCustomer(IdVm model)
{
try
{
- SysCustomer customer = _customerSvc.GetCustomer(model.Id);
+ SysCustomer customer = await _customerSvc.GetCustomer(model.Id);
//鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
var claimsIdentity = this.User.Identity as ClaimsIdentity;
if (claimsIdentity == null)
@@ -1077,10 +1078,10 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _customerSvc.DelCustomer(model.Id, int.Parse(userId));
+ var bolls = await _customerSvc.DelCustomer(model.Id, int.Parse(userId));
if (bolls)
{
- _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", customer.CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + customer.CustomerNo, Convert.ToInt32(userId));
+ await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", customer.CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + customer.CustomerNo, Convert.ToInt32(userId));
return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
}
else
@@ -1099,7 +1100,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelsCustomer(IdVm model)
+ public async Task<IActionResult> DelsCustomer(IdVm model)
{
try
{
@@ -1115,7 +1116,7 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _customerSvc.DelsCustomer(model.Ids, int.Parse(userId));
+ var bolls = await _customerSvc.DelsCustomer(model.Ids, int.Parse(userId));
if (bolls)
{
return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
@@ -1139,11 +1140,12 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetLogisticsInfoList(GetLogisticsInfoVm model)
+ public async Task<IActionResult> GetLogisticsInfoList(GetLogisticsInfoVm model)
{
try
{
- var bolls = _logisticsSvc.GetLogisticsInfoList(model.CarrierName, model.LinkMan, model.Phone, model.LicensePlate, model.Type, model.Page, model.Limit, out int count);
+ RefAsync<int> count = new RefAsync<int>();
+ var bolls = await _logisticsSvc.GetLogisticsInfoList(model.CarrierName, model.LinkMan, model.Phone, model.LicensePlate, model.Type, model.Page, model.Limit, count);
return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = bolls });
}
@@ -1158,11 +1160,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetLogisticsInfo(IdVm model)
+ public async Task<IActionResult> GetLogisticsInfo(IdVm model)
{
try
{
- var bolls = _logisticsSvc.GetLogisticsInfo(model.Id);
+ var bolls = await _logisticsSvc.GetLogisticsInfo(model.Id);
return Ok(new { code = 0, data = bolls });
}
@@ -1176,11 +1178,11 @@
/// </summary>
/// <returns></returns>
[HttpGet]
- public IActionResult GetLogisticsInfoSelect()
+ public async Task<IActionResult> GetLogisticsInfoSelect()
{
try
{
- var bolls = _logisticsSvc.GetLogisticsInfoSelect();
+ var bolls = await _logisticsSvc.GetLogisticsInfoSelect();
return Ok(new { code = 0, data = bolls });
}
@@ -1196,7 +1198,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult AddLogisticsInfo(AddLogisticsInfoVm model)
+ public async Task<IActionResult> AddLogisticsInfo(AddLogisticsInfoVm model)
{
try
{
@@ -1212,11 +1214,11 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _logisticsSvc.AddLogisticsInfo(model, int.Parse(userId));
+ var bolls = await _logisticsSvc.AddLogisticsInfo(model, int.Parse(userId));
if (bolls)
{
- _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "娣诲姞", "娣诲姞鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
+ await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "娣诲姞", "娣诲姞鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
}
else
@@ -1235,7 +1237,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult EditLogisticsInfo(EditLogisticsInfoVm model)
+ public async Task<IActionResult> EditLogisticsInfo(EditLogisticsInfoVm model)
{
try
{
@@ -1251,11 +1253,11 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _logisticsSvc.EditLogisticsInfo(model, int.Parse(userId));
+ var bolls = await _logisticsSvc.EditLogisticsInfo(model, int.Parse(userId));
if (bolls)
{
- _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "缂栬緫", "缂栬緫鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
+ await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "缂栬緫", "缂栬緫鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
}
else
@@ -1274,11 +1276,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelLogisticsInfo(IdVm model)
+ public async Task<IActionResult> DelLogisticsInfo(IdVm model)
{
try
{
- SysLogisticsInfo logisit = _logisticsSvc.GetLogisticsInfo(model.Id);
+ SysLogisticsInfo logisit = await _logisticsSvc.GetLogisticsInfo(model.Id);
//鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
var claimsIdentity = this.User.Identity as ClaimsIdentity;
if (claimsIdentity == null)
@@ -1291,11 +1293,11 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _logisticsSvc.DelLogisticsInfo(model.Id, int.Parse(userId));
+ var bolls = await _logisticsSvc.DelLogisticsInfo(model.Id, int.Parse(userId));
if (bolls)
{
- _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", logisit.CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + logisit.CarrierName, Convert.ToInt32(userId));
+ await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", logisit.CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + logisit.CarrierName, Convert.ToInt32(userId));
return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
}
else
@@ -1314,7 +1316,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelsLogisticsInfo(IdVm model)
+ public async Task<IActionResult> DelsLogisticsInfo(IdVm model)
{
try
{
@@ -1330,7 +1332,7 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _logisticsSvc.DelsLogisticsInfo(model.Ids, int.Parse(userId));
+ var bolls = await _logisticsSvc.DelsLogisticsInfo(model.Ids, int.Parse(userId));
if (bolls)
{
return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
@@ -1355,11 +1357,12 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetUnitList(GetUnitVm model)
+ public async Task<IActionResult> GetUnitList(GetUnitVm model)
{
try
{
- var list = _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, out int count);
+ RefAsync<int> count = new RefAsync<int>();
+ var list = await _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, count);
return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = list });
}
@@ -1374,11 +1377,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetUnit(IdVm model)
+ public async Task<IActionResult> GetUnit(IdVm model)
{
try
{
- var data = _unitSvc.GetUnit(model.Id);
+ var data = await _unitSvc.GetUnit(model.Id);
if (data != null)
{
return Ok(new { code = 0, data });
@@ -1399,7 +1402,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult AddUnit(AddEditUnitVm model)
+ public async Task<IActionResult> AddUnit(AddEditUnitVm model)
{
if (ModelState.IsValid)
{
@@ -1417,7 +1420,7 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _unitSvc.AddUnit(model.UnitName, model.Abbrev, int.Parse(userId));
+ var bolls = await _unitSvc.AddUnit(model.UnitName, model.Abbrev, int.Parse(userId));
if (bolls)
{
@@ -1445,7 +1448,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult EditUnit(AddEditUnitVm model)
+ public async Task<IActionResult> EditUnit(AddEditUnitVm model)
{
if (ModelState.IsValid)
{
@@ -1463,12 +1466,12 @@
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, int.Parse(userId));
+ var bolls = await _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, int.Parse(userId));
if (bolls)
{
- SysUnit unit = _unitSvc.GetUnit(model.Id);
- _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", unit.UnitNo, "缂栬緫", "缂栬緫璁¢噺鍗曚綅 鍗曚綅鍚嶇О锛�" + unit.UnitNo, Convert.ToInt32(userId));
+ SysUnit unit = await _unitSvc.GetUnit(model.Id);
+ await _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", unit.UnitNo, "缂栬緫", "缂栬緫璁¢噺鍗曚綅 鍗曚綅鍚嶇О锛�" + unit.UnitNo, Convert.ToInt32(userId));
return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
}
else
@@ -1493,7 +1496,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelUnit(IdVm model)
+ public async Task<IActionResult> DelUnit(IdVm model)
{
try
{
@@ -1508,7 +1511,7 @@
{
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _unitSvc.DelUnit(model.Id, int.Parse(userId));
+ var bolls = await _unitSvc.DelUnit(model.Id, int.Parse(userId));
if (bolls)
{
return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
@@ -1529,7 +1532,7 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelsUnit(IdVm model)
+ public async Task<IActionResult> DelsUnit(IdVm model)
{
try
{
@@ -1544,7 +1547,7 @@
{
return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- var bolls = _unitSvc.DelsUnit(model.Ids, int.Parse(userId));
+ var bolls = await _unitSvc.DelsUnit(model.Ids, int.Parse(userId));
if (bolls)
{
return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
--
Gitblit v1.8.0