shgx_tz_mom/ZR.Service/mes/wms/WmCustomService.cs

85 lines
2.5 KiB
C#

using Infrastructure.Attribute;
using SqlSugar;
using ZR.Model;
using ZR.Model.MES.wms;
using ZR.Model.MES.wms.Dto;
using ZR.Repository;
using ZR.Service.mes.wms.IService;
namespace ZR.Service.mes.wms
{
/// <summary>
/// 客户信息Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IWmCustomService), ServiceLifetime = LifeTime.Transient)]
public class WmCustomService : BaseService<WmCustom>, IWmCustomService
{
/// <summary>
/// 查询客户信息列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<WmCustomDto> GetList(WmCustomQueryDto parm)
{
var predicate = Expressionable.Create<WmCustom>()
.AndIF(!string.IsNullOrEmpty(parm.CustomNo), it => it.CustomNo.Contains(parm.CustomNo))
.AndIF(!string.IsNullOrEmpty(parm.CustomName), it => it.CustomName.Contains(parm.CustomName));
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<WmCustom, WmCustomDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public WmCustom GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加客户信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public WmCustom AddWmCustom(WmCustom model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改客户信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateWmCustom(WmCustom model)
{
//var response = Update(w => w.Id == model.Id, it => new WmCustom()
//{
// CustomNo = model.CustomNo,
// CustomName = model.CustomName,
// CustomAddress = model.CustomAddress,
// Remark = model.Remark,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}