2025-11-11 15:37:11 +08:00

115 lines
3.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Aliyun.OSS;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using Mapster;
using RIZO.Model.Mes.Dto.MasterData;
using RIZO.Model.Mes.MasterData;
using RIZO.Repository;
using RIZO.Service.Mes.IMesService.MasterData;
using System;
using ZstdSharp.Unsafe;
namespace RIZO.Service.Mes.MasterData
{
/// <summary>
/// 产线管理基础信息表Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IProductionLineService), ServiceLifetime = LifeTime.Transient)]
public class ProductionLineService : BaseService<ProductionLine>, IProductionLineService
{
/// <summary>
/// 查询产线管理基础信息表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<ProductionLineDto> GetList(ProductionLineQueryDto parm)
{
var predicate = QueryExp(parm);
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<ProductionLine, ProductionLineDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public ProductionLine GetInfo(long Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加产线管理基础信息表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public ProductionLine AddProductionLine(ProductionLine model)
{
return Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改产线管理基础信息表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateProductionLine(ProductionLine model)
{
return Update(model, true);
}
/// <summary>
/// 查询导出表达式
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
private static Expressionable<ProductionLine> QueryExp(ProductionLineQueryDto parm)
{
var predicate = Expressionable.Create<ProductionLine>();
predicate.And(it => it.LineStatus == 0);
if (!string.IsNullOrWhiteSpace(parm.LineCode))
{
predicate.And(it => it.LineCode.Contains(parm.LineCode));
}
if (!string.IsNullOrWhiteSpace(parm.LineName))
{
predicate.And(it => it.LineName.Contains(parm.LineName));
}
return predicate;
}
public List<ProductionLinePullDownDto> GetAllLine()
{
var lineOptions = Queryable()
.Where(it => it.LineStatus == 0)
.Select(it => new ProductionLinePullDownDto
{
value = it.LineCode, // value绑定产线编码唯一标识
label = it.LineName // label显示产线名称
})
.ToList(); // 执行查询并转换为列表
return lineOptions;
}
//停用产线
public int Stop(object id)
{
int iResult = 0;
if (id != null)
{
}
return iResult;
}
}
}