using Entity.Api.Req; using Entity.Api.Resp; using Entity.DbModel.Station; using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Entity; using Repository.Station; using SqlSugar; using System.Linq.Expressions; using Entity.Constant; using Service.Execute.Enum; namespace Service.Station; [Scope("SingleInstance")] public class SwapOrderStepService : BaseServices { SwapOrderStepRepository _swapOrderStepRepository; public SwapOrderStepService(SwapOrderStepRepository dal) { _swapOrderStepRepository = dal; BaseDal = dal; } /// /// ����������ѯ���粽����Ϣ��ҳ /// /// /// public PageResult QueryEqmFaultInfo(QuerySwapOrderStepReq swapOrderStep) { //����һ���յı��ʽ�� Expression> where = null; //// ����������ʽ ParameterExpression parameter = Expression.Parameter(typeof(SwapOrderStep), "u"); if (swapOrderStep.Id != 0) { Expression> condition1Expr = u => u.Id == swapOrderStep.Id; where = condition1Expr; } if (swapOrderStep.Step !=null) { Expression> condition2Expr = u => u.Step == swapOrderStep.Step; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } if (!string.IsNullOrEmpty(swapOrderStep.SwapOrderSn)) { Expression> condition2Expr = u => u.SwapOrderSn == swapOrderStep.SwapOrderSn; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } // ������ѯ���� if (!string.IsNullOrEmpty(swapOrderStep.StepName)) { Expression> condition2Expr = u => u.StepName == swapOrderStep.StepName; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } //��ѯ return PageResult.ConvertPage( _swapOrderStepRepository.QueryIPageByCause(swapOrderStep, where)); } /// /// 换电小步新增---换电主流程 /// public void InsertSwapStepForSwapMain(InfoEnum.BusinessSwappingStep step, int sort, String swapOrderSn) { SwapOrderStep swapOrderStep = new () { StepName = BaseEnumExtensions.GetNameByEnum(step), Step = (int)step, Sort = sort, SwapOrderSn = swapOrderSn, }; _swapOrderStepRepository.Insert(swapOrderStep); } }