using Microsoft.AspNetCore.Mvc; using WCS.BLL.Services.IService; using WCS.BLL.Services.Service; using WCS.Model.ApiModel.MatInventoryDetail; using WCS.Model; using WCS.Model.ApiModel.StoreInfo; using WCS.BLL.DbModels; using WCS.Model.ApiModel.MatBaseInfo; using WCS.DAL.DbModels; using WCS.DAL.Db; using WCS.Model.ApiModel.Home; using WCS.Model.ApiModel.LocationInfo; namespace WCS.WebApi.Controllers { /// /// 货架管理、模组管理、库位管理的接口 /// [ApiController] [Route("[controller]")] public class LocationInfoController : ControllerBase { public ILocationInfoService _locationInfoService { get; set; } public LocationInfoController(ILocationInfoService locationInfoService) { _locationInfoService = locationInfoService; } #region 位置管理 [Route("getLocationAreas")] [HttpPost(Name = "getLocationAreas")] public async Task getLocationAreas(RequestBase request) { try { //直接获取当前所有货架类型并返回 var locationAreaInfos = DbHelp.db.Queryable() .Select(t => new LocationAreaInfoModel() { Id = t.Id, LocationAreaName = t.LocationAreaName }) .ToList(); return new PageQueryResponse() { Code = 200, Message = "success", Data = new PageQueryResponseData { Lists = locationAreaInfos, Count = locationAreaInfos.Count } }; } catch (Exception ex) { return new PageQueryResponse() { Code = 300, Message = $"查询失败:{ex.Message}", }; } } [Route("getLocationInfos")] [HttpPost(Name = "getLocationInfos")] public async Task GetLocationInfos(GetLocationInfosRequest request) { return await _locationInfoService.GetLocationInfos(request); } [HttpPost("addOrUpdateLocationInfo")] public async Task> addOrUpdateLocationInfo(AddLocaionInfoRequest request) { return await _locationInfoService.addOrUpdateLocationInfo(request); } [HttpPost("deleteLocationInfo")] public async Task> deleteLocationInfo(DeleteInfosRequest request) { return await _locationInfoService.deleteLocationInfo(request); } #endregion } }