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; namespace WIDESEA_BasicService { public partial class WarehouseService : ServiceBase, IWarehouseService { public WarehouseService(IWarehouseRepository BaseDal) : base(BaseDal) { } public IWarehouseRepository Repository => BaseDal; /// /// 批量启用仓库 /// /// 仓库主键数组 /// public WebResponseContent WarehouseEnableStatus(int[] keys) { List 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) { List 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 }); } } }