96 lines
3.1 KiB
C#
96 lines
3.1 KiB
C#
using System;
|
|
using SqlSugar;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using DOAN.Model;
|
|
using DOAN.Model.Dto;
|
|
using DOAN.Model.MES.material.Dto;
|
|
using DOAN.Model.MES.material;
|
|
using DOAN.Repository;
|
|
using DOAN.Service.MES.material.IService;
|
|
using System.Linq;
|
|
|
|
namespace DOAN.Service.MES.material
|
|
{
|
|
/// <summary>
|
|
/// 北泽线边库供应商Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IMaterialPartsSuppliersService), ServiceLifetime = LifeTime.Transient)]
|
|
public class MaterialPartsSuppliersService : BaseService<MaterialPartsSuppliers>, IMaterialPartsSuppliersService
|
|
{
|
|
/// <summary>
|
|
/// 查询北泽线边库供应商列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<MaterialPartsSuppliersDto> GetList(MaterialPartsSuppliersQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<MaterialPartsSuppliers>();
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<MaterialPartsSuppliers, MaterialPartsSuppliersDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
public List<MaterialPartsSuppliersDto> GetListSupplier(string query)
|
|
{
|
|
return Queryable()
|
|
.WhereIF(!string.IsNullOrEmpty(query),x => x.SupplierName.Contains(query))
|
|
.Select(x => new MaterialPartsSuppliersDto()
|
|
{
|
|
SupplierId = x.SupplierId,
|
|
SupplierName = x.SupplierName
|
|
})
|
|
.ToList();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="SupplierId"></param>
|
|
/// <returns></returns>
|
|
public MaterialPartsSuppliers GetInfo(int SupplierId)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.SupplierId == SupplierId)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加北泽线边库供应商
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public MaterialPartsSuppliers AddMaterialPartsSuppliers(MaterialPartsSuppliers model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改北泽线边库供应商
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateMaterialPartsSuppliers(MaterialPartsSuppliers model)
|
|
{
|
|
//var response = Update(w => w.SupplierId == model.SupplierId, it => new MaterialPartsSuppliers()
|
|
//{
|
|
// SupplierName = model.SupplierName,
|
|
// ContactPerson = model.ContactPerson,
|
|
// Phone = model.Phone,
|
|
// Email = model.Email,
|
|
// Address = model.Address,
|
|
// CreatedAt = model.CreatedAt,
|
|
// UpdatedAt = model.UpdatedAt,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
}
|
|
} |