|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
namespace Service.Station;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>綩<EFBFBD><E7B6A9>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Scope("SingleInstance")]
|
|
|
|
|
public class SwapOrderService : BaseServices<SwapOrder>
|
|
|
|
|
{
|
|
|
|
|
SwapOrderRepository swapOrderRepository;
|
|
|
|
|
public SwapOrderService(SwapOrderRepository dal)
|
|
|
|
|
{
|
|
|
|
|
swapOrderRepository = dal;
|
|
|
|
|
BaseDal = dal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="equipAlarmLevel"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public PageResult<SwapOrderResp> QuerySwapOrder(QuerySwapOrderPageReq swapOrder)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>յı<D5B5><C4B1><EFBFBD>ʽ<EFBFBD><CABD>
|
|
|
|
|
Expression<Func<SwapOrder, bool>> where = null;
|
|
|
|
|
//// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
ParameterExpression parameter = Expression.Parameter(typeof(SwapOrder), "u");
|
|
|
|
|
|
|
|
|
|
#region <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC>ѯ<EFBFBD><D1AF>
|
|
|
|
|
if (!string.IsNullOrEmpty(swapOrder.Sn))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<SwapOrder, bool>> condition2Expr = u => u.Sn == swapOrder.Sn;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(swapOrder.VehicleNo))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<SwapOrder, bool>> condition2Expr = u => u.VehicleNo == swapOrder.VehicleNo;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(swapOrder.VehicleMac))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<SwapOrder, bool>> condition2Expr = u => u.VehicleMac == swapOrder.VehicleMac;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(swapOrder.VehicleVin))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<SwapOrder, bool>> condition2Expr = u => u.VehicleVin == swapOrder.VehicleVin;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (swapOrder.SwapBeginTime != null && swapOrder.SwapBeginTime != DateTime.MinValue)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<SwapOrder, bool>> condition2Expr = u => u.SwapBeginTime == swapOrder.SwapBeginTime;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (swapOrder.SwapEndTime != null && swapOrder.SwapEndTime != DateTime.MinValue)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<SwapOrder, bool>> condition2Expr = u => u.SwapEndTime == swapOrder.SwapEndTime;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (swapOrder.SwapResult != 0)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<SwapOrder, bool>> condition2Expr = u => u.SwapResult == swapOrder.SwapResult;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//<2F><>ѯ
|
|
|
|
|
|
|
|
|
|
//var swapOrderResp = PageResult<SwapOrderResp>.ConvertPage(swapOrderRepository.QueryIPageByCause(swapOrder, where));
|
|
|
|
|
//for (int i = 0; i < swapOrderResp.Rows.Count; i++)
|
|
|
|
|
//{
|
|
|
|
|
// swapOrderResp.Rows[0].BatteryList.AddRange()
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//List<SwapOrderBatteryResp> BatteryList = new List<SwapOrderBatteryResp>();
|
|
|
|
|
//List<SwapOrderStepResp> StepList = new List<SwapOrderStepResp>();
|
|
|
|
|
return PageResult<SwapOrderResp>.ConvertPage(swapOrderRepository.QueryIPageByCause(swapOrder, where));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|