| using System; | 
| using System.Collections.Generic; | 
| using System.Linq; | 
| using System.Text; | 
| using System.Threading.Tasks; | 
| using WIDESEA_Core; | 
| using WIDESEA_Core.BaseServices; | 
| using WIDESEA_Core.Enums; | 
| using WIDESEA_IBasicRepository; | 
| using WIDESEA_IBasicService; | 
| using WIDESEA_Model.Models; | 
| using WIDESEA_Core.Helper; | 
| using WIDESEA_Common.CommonEnum; | 
| using WIDESEA_Core.Caches; | 
|   | 
| namespace WIDESEA_BasicService | 
| { | 
|     public partial class WarehouseService : ServiceBase<Dt_Warehouse, IWarehouseRepository>, IWarehouseService | 
|     { | 
|         private readonly ICacheService _cacheService; | 
|         private readonly IPalletTypeInfoRepository _palletTypeInfoRepository; | 
|   | 
|         public WarehouseService(IWarehouseRepository BaseDal,ICacheService cacheService, IPalletTypeInfoRepository palletTypeInfoRepository) : base(BaseDal) | 
|         { | 
|             _cacheService = cacheService; | 
|             _palletTypeInfoRepository = palletTypeInfoRepository; | 
|         } | 
|   | 
|         public IWarehouseRepository Repository => BaseDal; | 
|   | 
|         /// <summary> | 
|         /// 批量启用仓库 | 
|         /// </summary> | 
|         /// <param name="keys">仓库主键数组</param> | 
|         /// <returns></returns> | 
|         public WebResponseContent WarehouseEnableStatus(int[] keys) | 
|         { | 
|             List<Dt_Warehouse> warehouses = Repository.QueryData(x => keys.Contains(x.WarehouseId)); | 
|             warehouses.ForEach(x => | 
|             { | 
|                 x.WarehouseStatus = EnableEnum.Enable.ObjToInt(); | 
|             }); | 
|             Repository.UpdateData(warehouses); | 
|   | 
|             return WebResponseContent.Instance.OK(); | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 批量禁用仓库 | 
|         /// </summary> | 
|         /// <param name="keys">仓库主键数组</param> | 
|         /// <returns></returns> | 
|         public WebResponseContent WarehouseDisableStatus(int[] keys) | 
|         { | 
|             List<Dt_Warehouse> warehouses = Repository.QueryData(x => keys.Contains(x.WarehouseId)); | 
|             warehouses.ForEach(x => | 
|             { | 
|                 x.WarehouseStatus = EnableEnum.Disable.ObjToInt(); | 
|             }); | 
|             Repository.UpdateData(warehouses); | 
|   | 
|             return WebResponseContent.Instance.OK(); | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 单个启用仓库 | 
|         /// </summary> | 
|         /// <param name="key">仓库主键</param> | 
|         /// <returns></returns> | 
|         public WebResponseContent WarehouseEnableStatus(int key) | 
|         { | 
|             return WarehouseEnableStatus(new int[] { key }); | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 单个禁用仓库 | 
|         /// </summary> | 
|         /// <param name="key">仓库主键</param> | 
|         /// <returns></returns> | 
|         public WebResponseContent WarehouseDisableStatus(int key) | 
|         { | 
|             return WarehouseDisableStatus(new int[] { key }); | 
|         } | 
|   | 
|   | 
|     } | 
| } |