zhuangpei-mesbackend/DOAN.Service/MES/dev/DevicePartsTransactionsService.cs
2024-12-30 10:13:11 +08:00

82 lines
2.6 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Model.Dto;
using DOAN.Model.MES.dev.Dto;
using DOAN.Model.MES.dev;
using DOAN.Repository;
using DOAN.Service.MES.dev.IService;
using System.Linq;
namespace DOAN.Service.MES.dev
{
/// <summary>
/// 备品备件出入库Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IDevicePartsTransactionsService), ServiceLifetime = LifeTime.Transient)]
public class DevicePartsTransactionsService : BaseService<DevicePartsTransactions>, IDevicePartsTransactionsService
{
/// <summary>
/// 查询备品备件出入库列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<DevicePartsTransactionsDto> GetList(DevicePartsTransactionsQueryDto parm)
{
var predicate = Expressionable.Create<DevicePartsTransactions>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<DevicePartsTransactions, DevicePartsTransactionsDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="TransactionId"></param>
/// <returns></returns>
public DevicePartsTransactions GetInfo(int TransactionId)
{
var response = Queryable()
.Where(x => x.TransactionId == TransactionId)
.First();
return response;
}
/// <summary>
/// 添加备品备件出入库
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DevicePartsTransactions AddDevicePartsTransactions(DevicePartsTransactions model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改备品备件出入库
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateDevicePartsTransactions(DevicePartsTransactions model)
{
//var response = Update(w => w.TransactionId == model.TransactionId, it => new DevicePartsTransactions()
//{
// TransactionType = model.TransactionType,
// Quantity = model.Quantity,
// TransactionDate = model.TransactionDate,
// Remarks = model.Remarks,
// CreatedBy = model.CreatedBy,
//});
//return response;
return Update(model, true);
}
}
}