132 lines
4.8 KiB
C#
132 lines
4.8 KiB
C#
using System;
|
|
using SqlSugar;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using DOAN.Model;
|
|
using DOAN.Model.Dto;
|
|
|
|
using DOAN.Repository;
|
|
|
|
using System.Linq;
|
|
using DOAN.Model.MES.process.Dto;
|
|
using DOAN.Service.MES.process.IService;
|
|
using DOAN.Model.MES.process;
|
|
|
|
namespace DOAN.Service.Business
|
|
{
|
|
/// <summary>工序表Service业务层处理
|
|
///
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IProcessmodelOperationService), ServiceLifetime = LifeTime.Transient)]
|
|
public class ProcessmodelOperationService : BaseService<ProcessmodelOperation>, IProcessmodelOperationService
|
|
{
|
|
|
|
public List<ProcessmodelRouteParentDto> GetList(ProcessmodelRoutingQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<ProcessmodelRouting>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.RoutingCode), p => parm.RoutingCode.Contains(p.RoutingCode))
|
|
.AndIF(!string.IsNullOrEmpty(parm.RoutingName), p => parm.RoutingName.Contains(p.RoutingName))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Version), p => parm.Version.Contains(p.Version));
|
|
|
|
var response = Context.Queryable<ProcessmodelRouting>()
|
|
.Where(predicate.ToExpression())
|
|
.Select(p => new ProcessmodelRouteParentDto()
|
|
{
|
|
RoutingCode = p.RoutingCode,
|
|
RoutingName = p.RoutingName,
|
|
Version = p.Version,
|
|
ProductCode = p.ProductCode,
|
|
Description = p.Description,
|
|
parentId = 0,
|
|
children= null
|
|
|
|
});
|
|
return response.ToList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 查询工序表列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<ProcessmodelOperationDto> GetList(ProcessmodelOperationQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<ProcessmodelOperation>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.RoutingCode), p => parm.RoutingCode.Contains(p.RoutingCode))
|
|
.AndIF(!string.IsNullOrEmpty(parm.OperationCode), p => parm.OperationCode.Contains(p.OperationCode))
|
|
.AndIF(!string.IsNullOrEmpty(parm.OperationName), p => parm.OperationName.Contains(p.OperationName));
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<ProcessmodelOperation, ProcessmodelOperationDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public ProcessmodelOperation GetInfo(int Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加工序表
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public ProcessmodelOperation AddProcessmodelOperation(ProcessmodelOperation model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改工序表
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateProcessmodelOperation(ProcessmodelOperation model)
|
|
{
|
|
//var response = Update(w => w.Id == model.Id, it => new ProcessmodelOperation()
|
|
//{
|
|
// OperationCode = model.OperationCode,
|
|
// OperationName = model.OperationName,
|
|
// OperationSeq = model.OperationSeq,
|
|
// WorkCenter = model.WorkCenter,
|
|
// StandardTime = model.StandardTime,
|
|
// Description = model.Description,
|
|
// UpdateTime = model.UpdateTime,
|
|
// IsActive = model.IsActive,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取工艺路线表
|
|
/// </summary>
|
|
public List<ProcessmodelRoutingDto> GetModelRoutingList()
|
|
{
|
|
var response = Context.Queryable<ProcessmodelRouting>()
|
|
.Select(p => new ProcessmodelRoutingDto
|
|
{
|
|
RoutingCode = p.RoutingCode,
|
|
RoutingName = p.RoutingName,
|
|
})
|
|
.ToList();
|
|
return response;
|
|
}
|
|
}
|
|
} |