103 lines
3.8 KiB
C#
103 lines
3.8 KiB
C#
using DOAN.Model;
|
|
using DOAN.Model.MES.quality.IQC;
|
|
using DOAN.Model.MES.quality.IQC.Dto;
|
|
using DOAN.Repository;
|
|
using DOAN.Service.MES.quality.FQC.IService;
|
|
using Infrastructure.Attribute;
|
|
using Mapster;
|
|
|
|
namespace DOAN.Service.MES.quality.FQC
|
|
{
|
|
/// <summary>
|
|
/// 缺陷类别Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IQcDefectConfigService), ServiceLifetime = LifeTime.Transient)]
|
|
public class QcDefectConfigService : BaseService<QcDefectConfig>, IQcDefectConfigService
|
|
{
|
|
/// <summary>
|
|
/// 查询缺陷类别列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<QcDefectConfigDto> GetList(QcDefectConfigQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<QcDefectConfig>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name.Contains(parm.Name))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Code), it => it.Code.Contains(parm.Code))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Group), it => it.Group.Contains(parm.Group))
|
|
.AndIF(!string.IsNullOrEmpty(parm.QcType), it => it.QcType.Contains(parm.QcType))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Status), it => it.Status == parm.Status);
|
|
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<QcDefectConfig, QcDefectConfigDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
public List<QcDefectConfigDto> GetListNoPage(QcDefectConfigQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<QcDefectConfig>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name.Contains(parm.Name))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Code), it => it.Code.Contains(parm.Code))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Group), it => it.Group.Contains(parm.Group))
|
|
.AndIF(!string.IsNullOrEmpty(parm.QcType), it => it.QcType.Contains(parm.QcType))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Status), it => it.Status == parm.Status);
|
|
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression()).ToList().Adapt<List<QcDefectConfig>, List<QcDefectConfigDto>>();
|
|
|
|
return response;
|
|
|
|
}
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public QcDefectConfig GetInfo(int Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加缺陷类别
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public QcDefectConfig AddQcDefectConfig(QcDefectConfig model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改缺陷类别
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateQcDefectConfig(QcDefectConfig model)
|
|
{
|
|
//var response = Update(w => w.Id == model.Id, it => new QcDefectConfig()
|
|
//{
|
|
// Name = model.Name,
|
|
// Code = model.Code,
|
|
// Group = model.Group,
|
|
// QcType = model.QcType,
|
|
// Status = model.Status,
|
|
// CreatedBy = model.CreatedBy,
|
|
// CreatedTime = model.CreatedTime,
|
|
// UpdatedBy = model.UpdatedBy,
|
|
// UpdatedTime = model.UpdatedTime,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
}
|
|
} |