| | |
| | | _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 |
| | | { |
| | |
| | | .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() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | } |