hwh
2024-07-04 2dd922eb3ab68c0314f5828fcae1ed7db0e17d9e
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,38 +64,21 @@
            }
        }
        public SysLogisticsInfo GetLogisticsInfo(int id)
        public async Task<SysLogisticsInfo> GetLogisticsInfo(int id)
        {
            try
            {
                var data = LogisticsInfoRst.GetOneById(id);
            var data = await LogisticsInfoRst.GetOneByIdAsync(id);
                return data;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        public List<SysLogisticsInfo> GetLogisticsInfoSelect()
        public async Task<List<SysLogisticsInfo>> GetLogisticsInfoSelect()
        {
            try
            {
                var data = LogisticsInfoRst.GetAllAsync().ToList();
            var data = await LogisticsInfoRst.GetAllAsync();
                return data;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        public bool AddLogisticsInfo(AddLogisticsInfoVm model, int userId)
        public async Task<bool> AddLogisticsInfo(AddLogisticsInfoVm model, int userId)
        {
            try
            {
                var num = LogisticsInfoRst.Add(new SysLogisticsInfo()
            var num = await LogisticsInfoRst.AddAsync(new SysLogisticsInfo()
                {
                    CarrierName = model.CarrierName,
                    Address = model.Address,
@@ -110,17 +93,10 @@
                });
                return num > 0;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        public bool EditLogisticsInfo(EditLogisticsInfoVm model, int userId)
        public async Task<bool> EditLogisticsInfo(EditLogisticsInfoVm model, int userId)
        {
            try
            {
                var logistics = LogisticsInfoRst.GetOneById(model.Id);
            var logistics = await LogisticsInfoRst.GetOneByIdAsync(model.Id);
                if (logistics == null)
                {
                    throw new Exception("未查询到物流信息");
@@ -137,44 +113,25 @@
                logistics.Demo = model.Demo;
                logistics.UpdateUser = userId;
                logistics.UpdateTime = DateTime.Now;
                var num = LogisticsInfoRst.Edit(logistics);
            var num = await LogisticsInfoRst.EditAsync(logistics);
                return num > 0;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        public bool DelLogisticsInfo(int id, int userId)
        public async Task<bool> DelLogisticsInfo(int id, int userId)
        {
            try
            {
                var num = LogisticsInfoRst.Remove(id, userId);
            var num = await LogisticsInfoRst.RemoveAsync(id, userId);
                return num > 0;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        public bool DelsLogisticsInfo(List<int> ids, int userId)
        public async Task<bool> DelsLogisticsInfo(List<int> ids, int userId)
        {
            try
            {
                var list = LogisticsInfoRst.GetAllWhereAsync(m => ids.Contains(m.Id)).ToList();
            var list = await LogisticsInfoRst.GetAllWhere(m => ids.Contains(m.Id)).ToListAsync();
                for (int i = 0; i < list.Count; i++)
                {
                    _operation.InsertOperation("基础信息", "物流管理", list[i].CarrierName, "删除", "删除物流信息 公司名称:" + list[i].CarrierName, Convert.ToInt32(userId));
                await _operation.InsertOperation("基础信息", "物流管理", list[i].CarrierName, "删除", "删除物流信息 公司名称:" + list[i].CarrierName, Convert.ToInt32(userId));
                }
                var num = LogisticsInfoRst.RemoveAll(list, userId);
                return num > 0;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
    }
}