93 lines
3.1 KiB
C#
93 lines
3.1 KiB
C#
using System;
|
|
using SqlSugar;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using DOAN.Model;
|
|
using DOAN.Model.MES.base_.Dto;
|
|
using DOAN.Model.MES.base_;
|
|
using DOAN.Repository;
|
|
using DOAN.Service.MES.base_.IService;
|
|
using System.Linq;
|
|
|
|
namespace DOAN.Service.MES.base_
|
|
{
|
|
/// <summary>
|
|
/// 供应商信息Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IBaseSupplierService), ServiceLifetime = LifeTime.Transient)]
|
|
public class BaseSupplierService : BaseService<BaseSupplier>, IBaseSupplierService
|
|
{
|
|
/// <summary>
|
|
/// 查询供应商信息列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<BaseSupplierDto> GetList(BaseSupplierQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<BaseSupplier>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.SupplierNo), it => it.SupplierNo.Contains(parm.SupplierNo))
|
|
.AndIF(!string.IsNullOrEmpty(parm.SupplierName), it => it.SupplierName.Contains(parm.SupplierName))
|
|
.AndIF(parm.Type > -1, it => it.Type == parm.Type)
|
|
.AndIF(parm.Status > -1, it => it.Status == parm.Status);
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(it => it.SupplierNo)
|
|
.ToPage<BaseSupplier, BaseSupplierDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public BaseSupplier GetInfo(int Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加供应商信息
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public BaseSupplier AddBaseSupplier(BaseSupplier model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改供应商信息
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateBaseSupplier(BaseSupplier model)
|
|
{
|
|
//var response = Update(w => w.Id == model.Id, it => new BaseSupplier()
|
|
//{
|
|
// SupplierNo = model.SupplierNo,
|
|
// SupplierName = model.SupplierName,
|
|
// SupplierAddress = model.SupplierAddress,
|
|
// SupplierLiaison = model.SupplierLiaison,
|
|
// SupplierPhone = model.SupplierPhone,
|
|
// Type = model.Type,
|
|
// Status = model.Status,
|
|
// Remark = model.Remark,
|
|
// CreatedBy = model.CreatedBy,
|
|
// CreatedTime = model.CreatedTime,
|
|
// UpdatedBy = model.UpdatedBy,
|
|
// UpdatedTime = model.UpdatedTime,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
}
|
|
} |