| | |
| | | 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, |
| | |
| | | // 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, |
| | |
| | | }, |
| | | }); |
| | | } |
| | | 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") { |
| | |
| | | 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 = "{}"; |
| | |
| | | } |
| | | |
| | | |
| | | 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 |
| | | { |
| | |
| | | .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() |
| | |
| | | } |
| | | } |
| | | |
| | | 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) |
| | |
| | | } |
| | | } |
| | | |
| | | 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) |
| | |
| | | } |
| | | } |
| | | |
| | | 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, |
| | |
| | | } |
| | | } |
| | | |
| | | 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("未查询到客户信息"); |
| | |
| | | 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) |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | 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) |
| | |
| | | .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) |
| | |
| | | _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; |
| | | } |
| | | } |
| | | } |
| | |
| | | .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; |
| | |
| | | { |
| | | 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("包装名称已存在!"); |
| | |
| | | { |
| | | 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("包装名称已存在!"); |
| | |
| | | .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; |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | .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) |
| | |
| | | { |
| | | try |
| | | { |
| | | var data = AreaRst.GetAllAsync().ToList(); |
| | | var data = AreaRst.GetAll().ToList(); |
| | | if (!string.IsNullOrWhiteSpace(wareHouseNo)) |
| | | { |
| | | data = data.Where(m => m.WareHouseNo == wareHouseNo).ToList(); |
| | |
| | | try |
| | | { |
| | | //判断除当前id信息以外是否含有编号和名称 |
| | | var bol = AreaRst.GetAllAsync() |
| | | var bol = AreaRst.GetAll() |
| | | .Any(m => m.Id != id && m.AreaName == name.Trim()); |
| | | if (bol) |
| | | { |
| | |
| | | .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) |
| | |
| | | .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) |
| | |
| | | { |
| | | try |
| | | { |
| | | var data = RoadwayRst.GetAllAsync().ToList(); |
| | | var data = RoadwayRst.GetAll().ToList(); |
| | | if (!string.IsNullOrWhiteSpace(wareHouseNo)) |
| | | { |
| | | data = data.Where(m => m.WareHouseNo == wareHouseNo).ToList(); |
| | |
| | | throw new Exception("为查询到当前巷道信息"); |
| | | } |
| | | //判断除当前id信息以外是否含有编号和名称 |
| | | 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("当前巷道号或巷道名称已存在"); |
| | |
| | | /// <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> |
| | | /// 添加单位信息 |
| | |
| | | /// <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("单位名称重复"); |
| | |
| | | } |
| | | 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("单位名称或英文缩写重复"); |
| | |
| | | } |
| | | |
| | | //自动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); |
| | |
| | | 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, |
| | |
| | | }); |
| | | if (num > 0) |
| | | { |
| | | _operation.InsertOperation("基础信息", "计量单位", code, "添加", "添加计量单位 单位号:" + code, Convert.ToInt32(userId)); |
| | | await _operation.InsertOperation("基础信息", "计量单位", code, "添加", "添加计量单位 单位号:" + code, Convert.ToInt32(userId)); |
| | | } |
| | | return num > 0; |
| | | } |
| | |
| | | /// <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) |
| | |
| | | .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) |
| | |
| | | try |
| | | { |
| | | //判断除当前id信息以外是否含有编号和名称 |
| | | 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) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | var list = await WareHouseRst.GetAllAsync().ToListAsync(); |
| | | var list = await WareHouseRst.GetAll().ToListAsync(); |
| | | return list; |
| | | } |
| | | catch (Exception e) |
| | |
| | | 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); |
| | | |
| | |
| | | { |
| | | 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}的储位信息"); |
| | |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | |
| | | /// <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> |
| | |
| | | /// <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> |
| | | /// 编辑客户信息 |
| | |
| | | /// <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); |
| | | } |
| | | } |
| | |
| | | using Model.ModelDto.SysDto; |
| | | using Model.ModelVm.SysVm; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | |
| | | /// <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> |
| | | /// 删除物流信息(多条信息) |
| | |
| | | /// <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); |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using WMS.Entity.SysEntity; |
| | | |
| | | namespace WMS.IBLL.ISysServer |
| | |
| | | /// <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> |
| | |
| | | /// <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> |
| | |
| | | /// <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); |
| | | } |
| | | } |
| | |
| | | Task SaveAsync(); |
| | | |
| | | |
| | | ISugarQueryable<T> GetAllAsync(); |
| | | |
| | | ISugarQueryable<T> GetAll(); |
| | | Task<List<T>> GetAllAsync(); |
| | | T GetOneById(int id); |
| | | Task<T> GetOneByIdAsync(int id); |
| | | |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | /// <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 }); |
| | | } |
| | |
| | | /// <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 }); |
| | | } |
| | |
| | | /// </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 }); |
| | | } |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AddCustomer(AddCustomerVm model) |
| | | public async Task<IActionResult> AddCustomer(AddCustomerVm model) |
| | | { |
| | | try |
| | | { |
| | |
| | | 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 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult EditCustomer(EditCustomerVm model) |
| | | public async Task<IActionResult> EditCustomer(EditCustomerVm model) |
| | | { |
| | | try |
| | | { |
| | |
| | | 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 |
| | |
| | | /// <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); |
| | | //获取当前登录的用户ID |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | |
| | | 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 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelsCustomer(IdVm model) |
| | | public async Task<IActionResult> DelsCustomer(IdVm model) |
| | | { |
| | | try |
| | | { |
| | |
| | | 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 = "删除成功" }); |
| | |
| | | /// <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 }); |
| | | } |
| | |
| | | /// <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 }); |
| | | } |
| | |
| | | /// </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 }); |
| | | } |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AddLogisticsInfo(AddLogisticsInfoVm model) |
| | | public async Task<IActionResult> AddLogisticsInfo(AddLogisticsInfoVm model) |
| | | { |
| | | try |
| | | { |
| | |
| | | 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 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult EditLogisticsInfo(EditLogisticsInfoVm model) |
| | | public async Task<IActionResult> EditLogisticsInfo(EditLogisticsInfoVm model) |
| | | { |
| | | try |
| | | { |
| | |
| | | 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 |
| | |
| | | /// <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); |
| | | //获取当前登录的用户ID |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | |
| | | 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 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelsLogisticsInfo(IdVm model) |
| | | public async Task<IActionResult> DelsLogisticsInfo(IdVm model) |
| | | { |
| | | try |
| | | { |
| | |
| | | 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 = "删除成功" }); |
| | |
| | | /// <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 }); |
| | | } |
| | |
| | | /// <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 }); |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AddUnit(AddEditUnitVm model) |
| | | public async Task<IActionResult> AddUnit(AddEditUnitVm model) |
| | | { |
| | | if (ModelState.IsValid) |
| | | { |
| | |
| | | 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) |
| | | { |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult EditUnit(AddEditUnitVm model) |
| | | public async Task<IActionResult> EditUnit(AddEditUnitVm model) |
| | | { |
| | | if (ModelState.IsValid) |
| | | { |
| | |
| | | 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 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelUnit(IdVm model) |
| | | public async Task<IActionResult> DelUnit(IdVm model) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | 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 = "删除成功" }); |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelsUnit(IdVm model) |
| | | public async Task<IActionResult> DelsUnit(IdVm model) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | 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 = "删除成功" }); |