2025-11-15 14:33:00 +08:00

85 lines
2.7 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Model.Dto;
using DOAN.Model.Business;
using DOAN.Repository;
using DOAN.Service.Business.IBusinessService;
using System.Linq;
namespace DOAN.Service.Business
{
/// <summary>
/// 产线/线体/工作中心Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IPlantProductlinebodyService), ServiceLifetime = LifeTime.Transient)]
public class PlantProductlinebodyService : BaseService<PlantProductlinebody>, IPlantProductlinebodyService
{
/// <summary>
/// 查询产线/线体/工作中心列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<PlantProductlinebodyDto> GetList(PlantProductlinebodyQueryDto parm)
{
var predicate = Expressionable.Create<PlantProductlinebody>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<PlantProductlinebody, PlantProductlinebodyDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="LineId"></param>
/// <returns></returns>
public PlantProductlinebody GetInfo(int LineId)
{
var response = Queryable()
.Where(x => x.LineId == LineId)
.First();
return response;
}
/// <summary>
/// 添加产线/线体/工作中心
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public PlantProductlinebody AddPlantProductlinebody(PlantProductlinebody model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改产线/线体/工作中心
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdatePlantProductlinebody(PlantProductlinebody model)
{
//var response = Update(w => w.LineId == model.LineId, it => new PlantProductlinebody()
//{
// FkFactorySiteCode = model.FkFactorySiteCode,
// FkWorkshopCode = model.FkWorkshopCode,
// LineName = model.LineName,
// LineType = model.LineType,
// Description = model.Description,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}