115 lines
3.4 KiB
C#
115 lines
3.4 KiB
C#
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;
|
||
}
|
||
}
|
||
} |