zhuangpei-mesbackend/DOAN.Service/MES/mm/line/MmLineTransactionLogService.cs

109 lines
3.7 KiB
C#
Raw Normal View History

2025-03-21 11:14:59 +08:00
using System;
using System.Linq;
2025-03-31 17:14:42 +08:00
using DOAN.Model;
2025-03-21 11:23:00 +08:00
using DOAN.Model.MES.mm.line;
using DOAN.Model.MES.mm.line.Dto;
2025-03-31 17:14:42 +08:00
using DOAN.Repository;
2025-03-21 11:23:00 +08:00
using DOAN.Service.MES.mm.line.IService;
2025-03-31 17:14:42 +08:00
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using SqlSugar;
2025-03-21 11:14:59 +08:00
2025-03-21 11:23:00 +08:00
namespace DOAN.Service.MES.mm.line
2025-03-21 11:14:59 +08:00
{
/// <summary>
/// mm_line_transaction_logService业务层处理
/// </summary>
2025-03-31 17:14:42 +08:00
[AppService(
ServiceType = typeof(IMmLineTransactionLogService),
ServiceLifetime = LifeTime.Transient
)]
public class MmLineTransactionLogService
: BaseService<MmLineTransactionLog>,
IMmLineTransactionLogService
2025-03-21 11:14:59 +08:00
{
/// <summary>
/// 查询mm_line_transaction_log列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<MmLineTransactionLogDto> GetList(MmLineTransactionLogQueryDto parm)
{
2025-03-31 17:14:42 +08:00
var predicate = Expressionable
.Create<MmLineTransactionLog>()
.AndIF(!string.IsNullOrEmpty(parm.LineCode), o => o.LineCode == parm.LineCode)
.AndIF(
!string.IsNullOrEmpty(parm.MaterialName),
o => o.MaterialName.Contains(parm.MaterialName)
)
.AndIF(
!string.IsNullOrEmpty(parm.MaterialCode),
o => o.MaterialCode.Contains(parm.MaterialCode)
)
.AndIF(
parm.searchDate != null && parm.searchDate[0] > DateTime.MinValue,
it => it.Createtime >= parm.searchDate[0]
)
.AndIF(
parm.searchDate != null && parm.searchDate[1] > DateTime.MinValue,
it => it.Createtime <= parm.searchDate[1]
);
;
2025-03-21 11:14:59 +08:00
var response = Queryable()
.Where(predicate.ToExpression())
2025-03-31 17:14:42 +08:00
.OrderBy(it => it.Createtime, OrderByType.Desc)
2025-03-21 11:14:59 +08:00
.ToPage<MmLineTransactionLog, MmLineTransactionLogDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public MmLineTransactionLog GetInfo(string Id)
{
2025-03-31 17:14:42 +08:00
var response = Queryable().Where(x => x.Id == Id).First();
2025-03-21 11:14:59 +08:00
return response;
}
/// <summary>
/// 添加mm_line_transaction_log
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MmLineTransactionLog AddMmLineTransactionLog(MmLineTransactionLog model)
{
2025-03-31 17:14:42 +08:00
model.Id = XueHua;
return Context.Insertable(model).ExecuteReturnEntity();
2025-03-21 11:14:59 +08:00
}
/// <summary>
/// 修改mm_line_transaction_log
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateMmLineTransactionLog(MmLineTransactionLog model)
{
//var response = Update(w => w.Id == model.Id, it => new MmLineTransactionLog()
//{
// TransactionType = model.TransactionType,
// MaterialCode = model.MaterialCode,
// MaterialName = model.MaterialName,
// Linecode = model.Linecode,
// Quantity = model.Quantity,
// LocationCode = model.LocationCode,
// Updatetime = model.Updatetime,
// Updateby = model.Updateby,
// Createtime = model.Createtime,
// Createby = model.Createby,
//});
//return response;
return Update(model, true);
}
}
2025-03-31 17:14:42 +08:00
}