From 2dd922eb3ab68c0314f5828fcae1ed7db0e17d9e Mon Sep 17 00:00:00 2001 From: hwh <332078369@qq.com> Date: 星期四, 04 七月 2024 08:06:26 +0800 Subject: [PATCH] 客户、物流、单位 --- Wms/WMS.BLL/SysServer/LogisticsInfoServer.cs | 143 ++++++++++++++++------------------------------- 1 files changed, 50 insertions(+), 93 deletions(-) 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; } } } -- Gitblit v1.8.0