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

94 lines
3.3 KiB
C#
Raw Normal View History

2025-03-21 11:14:59 +08:00
using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Repository;
using System.Linq;
2025-03-21 11:23:00 +08:00
using DOAN.Model.MES.mm.line;
using DOAN.Model.MES.mm.line.Dto;
using DOAN.Service.MES.mm.line.IService;
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>
[AppService(ServiceType = typeof(IMmLineTransactionLogService), ServiceLifetime = LifeTime.Transient)]
public class MmLineTransactionLogService : BaseService<MmLineTransactionLog>, IMmLineTransactionLogService
{
/// <summary>
/// 查询mm_line_transaction_log列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<MmLineTransactionLogDto> GetList(MmLineTransactionLogQueryDto parm)
{
2025-03-21 13:02:20 +08:00
var predicate = Expressionable.Create<MmLineTransactionLog>()
2025-03-21 13:34:57 +08:00
.AndIF(!string.IsNullOrEmpty(parm.LineCode), o => o.LineCode == parm.LineCode)
2025-03-21 13:02:20 +08:00
.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())
.ToPage<MmLineTransactionLog, MmLineTransactionLogDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public MmLineTransactionLog GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加mm_line_transaction_log
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MmLineTransactionLog AddMmLineTransactionLog(MmLineTransactionLog model)
{
2025-03-21 13:02:20 +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);
}
}
}