using WIDESEA_Common.CommonEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Caches; using WIDESEA_Core.Enums; using WIDESEA_Core.Helper; using WIDESEA_IBasicService; using WIDESEA_Model.Models; namespace WIDESEA_BasicService { /// /// 仓库信息服务实现类 /// public partial class WarehouseService : ServiceBase>, IWarehouseService { private readonly ICacheService _cacheService; /// /// 构造函数 /// /// 基础数据访问对象 /// 缓存服务 public WarehouseService(IRepository baseDal, ICacheService cacheService) : base(baseDal) { _cacheService = cacheService; } /// /// 获取仓库信息仓储 /// public IRepository Repository => BaseDal; /// /// 批量启用仓库 /// /// 仓库主键数组 /// 操作结果 public WebResponseContent WarehouseEnableStatus(int[] keys) { var warehouses = Repository.QueryData(x => keys.Contains(x.WarehouseId)); warehouses.ForEach(x => { x.WarehouseStatus = EnableEnum.Enable.ObjToInt(); }); Repository.UpdateData(warehouses); return WebResponseContent.Instance.OK(); } /// /// 批量禁用仓库 /// /// 仓库主键数组 /// 操作结果 public WebResponseContent WarehouseDisableStatus(int[] keys) { var warehouses = Repository.QueryData(x => keys.Contains(x.WarehouseId)); warehouses.ForEach(x => { x.WarehouseStatus = EnableEnum.Disable.ObjToInt(); }); Repository.UpdateData(warehouses); return WebResponseContent.Instance.OK(); } /// /// 单个启用仓库 /// /// 仓库主键 /// 操作结果 public WebResponseContent WarehouseEnableStatus(int key) { return WarehouseEnableStatus(new int[] { key }); } /// /// 单个禁用仓库 /// /// 仓库主键 /// 操作结果 public WebResponseContent WarehouseDisableStatus(int key) { return WarehouseDisableStatus(new int[] { key }); } } }