Files
kunshan-bzfm-mes-backend/DOAN.Service/MES/Material/MaterialPartsStorageLocationsService.cs
qianhao.xu e14f34a107 线边库
2025-03-18 15:23:00 +08:00

89 lines
2.9 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Model.Dto;
using DOAN.Model.MES.material.Dto;
using DOAN.Model.MES.material;
using DOAN.Repository;
using DOAN.Service.MES.material.IService;
using System.Linq;
namespace DOAN.Service.MES.material
{
/// <summary>
/// 北泽线边库库位Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IMaterialPartsStorageLocationsService), ServiceLifetime = LifeTime.Transient)]
public class MaterialPartsStorageLocationsService : BaseService<MaterialPartsStorageLocations>, IMaterialPartsStorageLocationsService
{
/// <summary>
/// 查询北泽线边库库位列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<MaterialPartsStorageLocationsDto> GetList(MaterialPartsStorageLocationsQueryDto parm)
{
var predicate = Expressionable.Create<MaterialPartsStorageLocations>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<MaterialPartsStorageLocations, MaterialPartsStorageLocationsDto>(parm);
return response;
}
public string[] QueryMaterialPartsStorageLocationsLocationCode(string query)
{
return Queryable()
.WhereIF(!string.IsNullOrEmpty(query),x => x.LocationCode.Contains(query))
.Select(x => x.LocationCode)
.ToArray();
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="LocationId"></param>
/// <returns></returns>
public MaterialPartsStorageLocations GetInfo(int LocationId)
{
var response = Queryable()
.Where(x => x.LocationId == LocationId)
.First();
return response;
}
/// <summary>
/// 添加北泽线边库库位
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MaterialPartsStorageLocations AddMaterialPartsStorageLocations(MaterialPartsStorageLocations model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改北泽线边库库位
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateMaterialPartsStorageLocations(MaterialPartsStorageLocations model)
{
//var response = Update(w => w.LocationId == model.LocationId, it => new MaterialPartsStorageLocations()
//{
// LocationCode = model.LocationCode,
// Description = model.Description,
// CreatedAt = model.CreatedAt,
// UpdatedAt = model.UpdatedAt,
//});
//return response;
return Update(model, true);
}
}
}