2024-11-15 11:37:55 +08:00
|
|
|
|
using WcsMain.ApiServe.Dto;
|
|
|
|
|
|
using WcsMain.ApiServe.Dto.WcsDto.Location;
|
2024-10-07 09:51:55 +08:00
|
|
|
|
using WcsMain.ApiServe.Factory;
|
|
|
|
|
|
using WcsMain.DataBase.Dao;
|
|
|
|
|
|
using WcsMain.DataBase.TableEntity;
|
2024-11-15 11:37:55 +08:00
|
|
|
|
using WcsMain.Constant.WcsAttribute.AutoFacAttribute;
|
2024-10-07 09:51:55 +08:00
|
|
|
|
|
|
|
|
|
|
namespace WcsMain.ApiServe.Service.WcsService;
|
|
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
|
public class LocationService(AppLocationDao locationDao)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询所有的点位状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public WcsApiResponse<List<AppLocation>> GetLocation()
|
|
|
|
|
|
{
|
|
|
|
|
|
List<AppLocation>? locations = locationDao.Select();
|
|
|
|
|
|
if (locations == default)
|
|
|
|
|
|
{
|
|
|
|
|
|
return WcsApiResponseFactory.DataBaseErr<List<AppLocation>>();
|
|
|
|
|
|
}
|
|
|
|
|
|
return WcsApiResponseFactory.Success(locations, "查询成功");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 分页查询点位的状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public WcsApiResponse<List<AppLocation>> GetLocationWithPage(GetLocationWithPageRequest request)
|
|
|
|
|
|
{
|
|
|
|
|
|
(List<AppLocation>? locations, int totalRows) = locationDao.SelectPage(request);
|
|
|
|
|
|
if(locations == default)
|
|
|
|
|
|
{
|
|
|
|
|
|
return WcsApiResponseFactory.DataBaseErr<List<AppLocation>>();
|
|
|
|
|
|
}
|
|
|
|
|
|
return WcsApiResponseFactory.Success(locations, totalRows.ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新点位状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public WcsApiResponse UpdateLocation(UpdateLocationRequest request)
|
|
|
|
|
|
{
|
|
|
|
|
|
AppLocation updateEntity = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
WcsLocation = request.WcsLocation,
|
|
|
|
|
|
WmsLocation = request.WmsLocation,
|
|
|
|
|
|
TunnelNo = request.TunnelNo,
|
|
|
|
|
|
EquipmentId = request.EquipmentId,
|
|
|
|
|
|
LocationStatus = request.LocationStatus,
|
|
|
|
|
|
Queue = request.Queue,
|
|
|
|
|
|
Line = request.Line,
|
|
|
|
|
|
Layer = request.Layer,
|
|
|
|
|
|
Depth = request.Depth,
|
|
|
|
|
|
LocationType = request.LocationType,
|
|
|
|
|
|
VehicleNo = request.VehicleNo,
|
|
|
|
|
|
ModifyTime = DateTime.Now,
|
|
|
|
|
|
Explain = request.Explain,
|
|
|
|
|
|
Remark = request.Remark
|
|
|
|
|
|
};
|
|
|
|
|
|
var result = locationDao.Update(updateEntity);
|
|
|
|
|
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|