100 lines
3.7 KiB
C#
100 lines
3.7 KiB
C#
|
|
|
||
|
|
using Infrastructure.Attribute;
|
||
|
|
using MDM.Model;
|
||
|
|
using MDM.Model.Material;
|
||
|
|
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(IProcessRoutingService), ServiceLifetime = LifeTime.Transient)]
|
||
|
|
public class ProcessRoutingService : BaseService<ProcessRouting>, IProcessRoutingService
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 查询工艺路线列表
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="parm"></param>
|
||
|
|
/// <returns></returns>
|
||
|
|
public PagedInfo<ProcessRoutingDto> GetList(ProcessRoutingQueryDto parm)
|
||
|
|
{
|
||
|
|
var predicate = Expressionable.Create<ProcessRouting>()
|
||
|
|
.AndIF(!string.IsNullOrEmpty(parm.RoutingName), it => it.RoutingName.Contains(parm.RoutingName))
|
||
|
|
.AndIF(!string.IsNullOrEmpty(parm.RoutingCode), it => it.RoutingCode.Contains(parm.RoutingCode))
|
||
|
|
.AndIF(!string.IsNullOrEmpty(parm.FkProductMaterialCode), it => it.FkProductMaterialCode.Contains(parm.FkProductMaterialCode))
|
||
|
|
.AndIF(parm.Version != null, it => it.Version == parm.Version)
|
||
|
|
.AndIF(parm.Status != null, it => it.Status == parm.Status)
|
||
|
|
;
|
||
|
|
|
||
|
|
var response = Queryable()
|
||
|
|
.Where(predicate.ToExpression())
|
||
|
|
.ToPage<ProcessRouting, ProcessRoutingDto>(parm);
|
||
|
|
|
||
|
|
return response;
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<ProcessOperation> QueryProcess(string RoutingCode)
|
||
|
|
{
|
||
|
|
return Context.Queryable<ProcessOperation>().Where(it => it.FkRoutingCode == RoutingCode).ToList();
|
||
|
|
}
|
||
|
|
/// <summary>
|
||
|
|
/// 获取详情
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="RoutingId"></param>
|
||
|
|
/// <returns></returns>
|
||
|
|
public ProcessRouting GetInfo(int RoutingId)
|
||
|
|
{
|
||
|
|
var response = Queryable()
|
||
|
|
.Where(x => x.RoutingId == RoutingId)
|
||
|
|
.First();
|
||
|
|
|
||
|
|
return response;
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 添加工艺路线
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="model"></param>
|
||
|
|
/// <returns></returns>
|
||
|
|
public ProcessRouting AddProcessRouting(ProcessRouting model)
|
||
|
|
{
|
||
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 修改工艺路线
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="model"></param>
|
||
|
|
/// <returns></returns>
|
||
|
|
public int UpdateProcessRouting(ProcessRouting model)
|
||
|
|
{
|
||
|
|
//var response = Update(w => w.RoutingId == model.RoutingId, it => new ProcessRouting()
|
||
|
|
//{
|
||
|
|
// FkProductMaterialCode = model.FkProductMaterialCode,
|
||
|
|
// RoutingName = model.RoutingName,
|
||
|
|
// Version = model.Version,
|
||
|
|
// Description = model.Description,
|
||
|
|
// Status = model.Status,
|
||
|
|
// EffectiveDate = model.EffectiveDate,
|
||
|
|
// CreatedBy = model.CreatedBy,
|
||
|
|
// CreatedTime = model.CreatedTime,
|
||
|
|
// UpdatedBy = model.UpdatedBy,
|
||
|
|
// UpdatedTime = model.UpdatedTime,
|
||
|
|
//});
|
||
|
|
//return response;
|
||
|
|
return Update(model, true);
|
||
|
|
}
|
||
|
|
public List<MaterialList> SearchMaterialInfo(string material_info)
|
||
|
|
{
|
||
|
|
|
||
|
|
var response = Context.Queryable<MaterialList>()
|
||
|
|
.WhereIF(!string.IsNullOrEmpty(material_info), m => m.Name.Contains(material_info) || m.Code.Contains(material_info))
|
||
|
|
.ToList();
|
||
|
|
return response;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|