98 lines
3.5 KiB
C#
98 lines
3.5 KiB
C#
|
|
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(IProcessOperationService), ServiceLifetime = LifeTime.Transient)]
|
|
public class ProcessOperationService : BaseService<ProcessOperation>, IProcessOperationService
|
|
{
|
|
/// <summary>
|
|
/// 查询工序列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<ProcessOperationDto> GetList(ProcessOperationQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<ProcessOperation>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.FkRoutingCode), m => m.FkRoutingCode.Contains(parm.FkRoutingCode))
|
|
.AndIF(!string.IsNullOrEmpty(parm.OperationCode), m => m.OperationCode.Contains(parm.OperationCode))
|
|
.AndIF(!string.IsNullOrEmpty(parm.OperationName), m => m.OperationName.Contains(parm.OperationName))
|
|
.AndIF(!string.IsNullOrEmpty(parm.ParallelGroupCode), m => m.ParallelGroupCode.Contains(parm.ParallelGroupCode))
|
|
|
|
;
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<ProcessOperation, ProcessOperationDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="OperationId"></param>
|
|
/// <returns></returns>
|
|
public ProcessOperation GetInfo(int OperationId)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.OperationId == OperationId)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加工序
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public ProcessOperation AddProcessOperation(ProcessOperation model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改工序
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateProcessOperation(ProcessOperation model)
|
|
{
|
|
//var response = Update(w => w.OperationId == model.OperationId, it => new ProcessOperation()
|
|
//{
|
|
// FkRoutingCode = model.FkRoutingCode,
|
|
// OperationName = model.OperationName,
|
|
// OperationSeq = model.OperationSeq,
|
|
// OperationType = model.OperationType,
|
|
// Description = model.Description,
|
|
// StandardTime = model.StandardTime,
|
|
// ControlStrategy = model.ControlStrategy,
|
|
// IsSkippable = model.IsSkippable,
|
|
// IsReworkable = model.IsReworkable,
|
|
// IsParallel = model.IsParallel,
|
|
// ParallelGroupCode = model.ParallelGroupCode,
|
|
// DefaultNextOperationCode = model.DefaultNextOperationCode,
|
|
// Status = model.Status,
|
|
// CreatedBy = model.CreatedBy,
|
|
// CreatedTime = model.CreatedTime,
|
|
// UpdatedBy = model.UpdatedBy,
|
|
// UpdatedTime = model.UpdatedTime,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
}
|
|
} |