guiyang-fluorescent-line-lm.../MDM/Services/Process/ProcessParameterService.cs
gcw_MV9p2JJN df44f145a9 MDM更新
2025-11-25 15:44:04 +08:00

100 lines
3.8 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 Infrastructure.Attribute;
using MDM.Model;
using MDM.Model.Process;
using MDM.Model.Process.Dto;
using MDM.Repository;
using MDM.Service;
using MDM.Services.IProcessService;
namespace MDM.Services.Process
{
/// <summary>
/// 工艺参数表如温度、压力、时间等关联工艺路线与工序Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IProcessParameterService), ServiceLifetime = LifeTime.Transient)]
public class ProcessParameterService : BaseService<ProcessParameter>, IProcessParameterService
{
/// <summary>
/// 查询工艺参数表(如温度、压力、时间等,关联工艺路线与工序)列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<ProcessParameterDto> GetList(ProcessParameterQueryDto parm)
{
var predicate = Expressionable.Create<ProcessParameter>()
.AndIF(!string.IsNullOrEmpty(parm.FkRoutingCode), it => it.FkRoutingCode.Contains(parm.FkRoutingCode))
.AndIF(!string.IsNullOrEmpty(parm.FkOperationCode), it => it.FkOperationCode.Contains(parm.FkOperationCode))
.AndIF(!string.IsNullOrEmpty(parm.ParameterCode), it => it.ParameterCode.Contains(parm.ParameterCode))
.AndIF(!string.IsNullOrEmpty(parm.ParameterName), it => it.ParameterName.Contains(parm.ParameterName))
;
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<ProcessParameter, ProcessParameterDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public ProcessParameter GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public ProcessParameter AddProcessParameter(ProcessParameter model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateProcessParameter(ProcessParameter model)
{
//var response = Update(w => w.Id == model.Id, it => new ProcessParameter()
//{
// FkRoutingCode = model.FkRoutingCode,
// FkOperationCode = model.FkOperationCode,
// ParameterCode = model.ParameterCode,
// ParameterName = model.ParameterName,
// Description = model.Description,
// DataType = model.DataType,
// Unit = model.Unit,
// StandardValue = model.StandardValue,
// MinValue = model.MinValue,
// MaxValue = model.MaxValue,
// IsControlled = model.IsControlled,
// IsMonitored = model.IsMonitored,
// ControlType = model.ControlType,
// DefaultValue = model.DefaultValue,
// IsRequired = model.IsRequired,
// Sequence = model.Sequence,
// CreatedTime = model.CreatedTime,
// CreatedBy = model.CreatedBy,
// UpdatedTime = model.UpdatedTime,
// UpdatedBy = model.UpdatedBy,
//});
//return response;
return Update(model, true);
}
}
}