Valeo_Line_MES_backend/MDM/Services/Recipe/EffectiveRecipeService.cs
2026-01-10 13:47:54 +08:00

44 lines
1.7 KiB
C#

using RIZO.Model.MES.recipe;
using RIZO.Model.MES.recipe.Dto;
using RIZO.Service.MES.recipe.IService;
using Infrastructure.Attribute;
using MDM.Models.Recipe.Dto;
using MDM.Service;
using MDM.Services.Recipe.IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MDM.Services.Recipe
{
[AppService(ServiceType = typeof(IEffectiveRecipeService), ServiceLifetime = LifeTime.Transient)]
public class EffectiveRecipeService : BaseService<PfRefProductRecipe>, IEffectiveRecipeService
{
public List<EffectiveRecipeDto> GetList(PfRefProductRecipeQueryDto parm)
{
return Context.Queryable<PfRefProductRecipe>().LeftJoin<PfRecipeVersion>((r, v) => r.RecipeCode == v.RecipeCode)
.Where((r, v) => v.Status == 1)
.WhereIF(!string.IsNullOrEmpty(parm.RecipeCode), (r, v) => r.RecipeCode.Contains(parm.RecipeCode))
.WhereIF(!string.IsNullOrEmpty(parm.FkRoutingCode), (r, v) => r.FkRoutingCode.Contains(parm.FkRoutingCode))
.WhereIF(!string.IsNullOrEmpty(parm.FkOperationCode), (r, v) => r.FkOperationCode.Contains(parm.FkOperationCode))
.Select((r, v) => new EffectiveRecipeDto
{
FkRoutingCode = r.FkRoutingCode,
FkOperationCode =r.FkOperationCode,
Productcode =r.Productcode,
ProductName = r.ProductName,
RecipeCode = r.RecipeCode,
Version = v.Version,
Status = v.Status
})
.ToList();
}
}
}