Files
wcs/WCS.WebApi/Controllers/LocationInfoController.cs
2025-01-13 14:10:32 +08:00

86 lines
3.0 KiB
C#

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
{
/// <summary>
/// 货架管理、模组管理、库位管理的接口
/// </summary>
[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<ResponseBase> getLocationAreas(RequestBase request)
{
try
{
//直接获取当前所有货架类型并返回
var locationAreaInfos = DbHelp.db.Queryable<LocationAreaInfo>()
.Select(t => new LocationAreaInfoModel()
{
Id = t.Id,
LocationAreaName = t.LocationAreaName
})
.ToList();
return new PageQueryResponse<LocationAreaInfoModel>()
{
Code = 200,
Message = "success",
Data = new PageQueryResponseData<LocationAreaInfoModel>
{
Lists = locationAreaInfos,
Count = locationAreaInfos.Count
}
};
}
catch (Exception ex)
{
return new PageQueryResponse<LocationAreaInfoModel>()
{
Code = 300,
Message = $"查询失败:{ex.Message}",
};
}
}
[Route("getLocationInfos")]
[HttpPost(Name = "getLocationInfos")]
public async Task<ResponseBase> GetLocationInfos(GetLocationInfosRequest request)
{
return await _locationInfoService.GetLocationInfos(request);
}
[HttpPost("addOrUpdateLocationInfo")]
public async Task<ResponseCommon<object>> addOrUpdateLocationInfo(AddLocaionInfoRequest<LocationInfo> request)
{
return await _locationInfoService.addOrUpdateLocationInfo(request);
}
[HttpPost("deleteLocationInfo")]
public async Task<ResponseCommon<object>> deleteLocationInfo(DeleteInfosRequest request)
{
return await _locationInfoService.deleteLocationInfo(request);
}
#endregion
}
}