109 lines
3.7 KiB
C#
109 lines
3.7 KiB
C#
using System;
|
|
using System.Linq;
|
|
using DOAN.Model;
|
|
using DOAN.Model.MES.mm.line;
|
|
using DOAN.Model.MES.mm.line.Dto;
|
|
using DOAN.Repository;
|
|
using DOAN.Service.MES.mm.line.IService;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using SqlSugar;
|
|
|
|
namespace DOAN.Service.MES.mm.line
|
|
{
|
|
/// <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)
|
|
{
|
|
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]
|
|
);
|
|
;
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(it => it.Createtime, OrderByType.Desc)
|
|
.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)
|
|
{
|
|
model.Id = XueHua;
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <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);
|
|
}
|
|
}
|
|
}
|