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 { /// /// mm_line_transaction_logService业务层处理 /// [AppService( ServiceType = typeof(IMmLineTransactionLogService), ServiceLifetime = LifeTime.Transient )] public class MmLineTransactionLogService : BaseService, IMmLineTransactionLogService { /// /// 查询mm_line_transaction_log列表 /// /// /// public PagedInfo GetList(MmLineTransactionLogQueryDto parm) { var predicate = Expressionable .Create() .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(parm); return response; } /// /// 获取详情 /// /// /// public MmLineTransactionLog GetInfo(string Id) { var response = Queryable().Where(x => x.Id == Id).First(); return response; } /// /// 添加mm_line_transaction_log /// /// /// public MmLineTransactionLog AddMmLineTransactionLog(MmLineTransactionLog model) { model.Id = XueHua; return Context.Insertable(model).ExecuteReturnEntity(); } /// /// 修改mm_line_transaction_log /// /// /// 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); } } }