|
|
|
@ -3,6 +3,7 @@ using System.Transactions;
|
|
|
|
|
using AutoMapper;
|
|
|
|
|
using Entity.Api.Req;
|
|
|
|
|
using Entity.Api.Resp;
|
|
|
|
|
using Entity.Constant;
|
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
|
using Entity.Dto;
|
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
@ -23,7 +24,6 @@ namespace WebStarter.Controllers;
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
public class SwapOrderController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(SwapOrderController));
|
|
|
|
|
private readonly SwapOrderService swapOrderService;
|
|
|
|
|
private readonly SwapOrderBatteryService swapOrderBatteryService;
|
|
|
|
@ -33,7 +33,8 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
private readonly BaseVehicleRepository _baseVehicleRepository;
|
|
|
|
|
|
|
|
|
|
public SwapOrderController(SwapOrderService swapOrderService, SwapOrderBatteryService swapOrderBatteryService,
|
|
|
|
|
SwapOrderStepService swapOrderStepService,SwapOrderReportCloudRepository swapOrderReportCloudRepository,BaseVehicleRepository baseVehicleRepository
|
|
|
|
|
SwapOrderStepService swapOrderStepService, SwapOrderReportCloudRepository swapOrderReportCloudRepository,
|
|
|
|
|
BaseVehicleRepository baseVehicleRepository
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
this.swapOrderService = swapOrderService;
|
|
|
|
@ -52,11 +53,12 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
Log.Info($"SwapOrderController QueryPage req={req}");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(req.DownBatteryNo)||!string.IsNullOrEmpty(req.UpBatteryNo))
|
|
|
|
|
if (!string.IsNullOrEmpty(req.DownBatteryNo) || !string.IsNullOrEmpty(req.UpBatteryNo))
|
|
|
|
|
{
|
|
|
|
|
var result = BatteryCodeList(req);
|
|
|
|
|
return Result<PageResult<SwapOrderResp>>.Success(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Log.Info($"查询换电订单 SwapOrderController start QueryPage swapOrderService.QuerySwapOrder req={req}");
|
|
|
|
|
var swapOrderResp = swapOrderService.QuerySwapOrder(req);
|
|
|
|
|
Log.Info($"查询换电订单 SwapOrderController end QueryPage swapOrderService.QuerySwapOrder req={req}");
|
|
|
|
@ -81,6 +83,7 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
swapOrder.Departments = matchingVehicle.Departments;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Result<PageResult<SwapOrderResp>>.Success(swapOrderResp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -106,16 +109,12 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
//获取所有订单号
|
|
|
|
|
var orderSns = swapOrderResp.Rows.Select(row => row.Sn).ToList();
|
|
|
|
|
Log.Info($"查询上报云平台次数 SwapOrderController start QueryPage swapOrderService.QueryReportCloudNumBySn req={orderSns}");
|
|
|
|
|
//查询上报云平台次数
|
|
|
|
|
//Dictionary<string, int?> queryReportCloudNumBySn = swapOrderService.QueryReportCloudNumBySn(orderSns);
|
|
|
|
|
|
|
|
|
|
Log.Info($"查询上报云平台次数 SwapOrderController end QueryPage swapOrderService.QueryReportCloudNumBySn req={orderSns}");
|
|
|
|
|
Log.Info($"查询订单电池数据 SwapOrderController start QueryPage swapOrderBatteryService.QueryListByClause req={orderSns}");
|
|
|
|
|
////查询订单电池数据
|
|
|
|
|
List<SwapOrderBattery> batteryList =
|
|
|
|
|
swapOrderBatteryService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
|
|
|
|
|
Log.Info($"查询订单电池数据 SwapOrderController end QueryPage swapOrderBatteryService.QueryListByClause req={orderSns}");
|
|
|
|
|
//映射
|
|
|
|
|
var config =
|
|
|
|
|
new MapperConfiguration(cfg => cfg.CreateMap<SwapOrderBatteryResp, SwapOrderBattery>().ReverseMap());
|
|
|
|
@ -123,9 +122,10 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
|
|
|
|
|
List<SwapOrderBatteryResp> swapOrderBattery = mapper.Map<List<SwapOrderBatteryResp>>(batteryList);
|
|
|
|
|
|
|
|
|
|
Log.Info($"查询公里数 SwapOrderController start QueryPage swapOrderReportCloudRepository.QueryListByClause req={orderSns}");
|
|
|
|
|
List<SwapOrderReportCloud> swapOrderReportClouds = swapOrderReportCloudRepository.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
|
|
|
|
|
Log.Info($"查询公里数 SwapOrderController end QueryPage swapOrderReportCloudRepository.QueryListByClause req={orderSns}");
|
|
|
|
|
List<SwapOrderReportCloud> swapOrderReportClouds =
|
|
|
|
|
swapOrderReportCloudRepository.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//将电池数据添加到换电订单数据中
|
|
|
|
|
foreach (var row in swapOrderResp.Rows)
|
|
|
|
|
{
|
|
|
|
@ -141,10 +141,9 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Log.Info($"查询订单步序数据 SwapOrderController start QueryPage swapOrderStepService.QueryListByClause req={orderSns}");
|
|
|
|
|
|
|
|
|
|
//查询订单步序数据
|
|
|
|
|
var stepList = swapOrderStepService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
|
|
|
|
|
Log.Info($"查询订单步序数据 SwapOrderController end QueryPage swapOrderStepService.QueryListByClause req={orderSns}");
|
|
|
|
|
stepList = stepList.OrderBy(s => s.Sort).ToList();
|
|
|
|
|
|
|
|
|
|
//映射
|
|
|
|
@ -157,8 +156,14 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
for (int i = 0; i < swapOrderResp.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
swapOrderResp.Rows[i].StepList = new List<SwapOrderStepResp>();
|
|
|
|
|
var swapOrderStepResps = swapOrderStep.Where(step => step.SwapOrderSn == swapOrderResp.Rows[i].Sn).ToList();
|
|
|
|
|
swapOrderResp.Rows[i].StepList
|
|
|
|
|
.AddRange(swapOrderStep.Where(step => step.SwapOrderSn == swapOrderResp.Rows[i].Sn).ToList());
|
|
|
|
|
.AddRange(swapOrderStepResps);
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
swapOrderResp.Rows[i].ManualStep = String.Join(",",
|
|
|
|
|
swapOrderStepResps.Where(i => i.StepType == (int)SwapConstant.StepType.MANUAL).Select(i => i.StepDesc)
|
|
|
|
|
.ToList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -174,7 +179,6 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
var orderSns = swapOrderRespList.Select(row => row.Sn).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////查询订单电池数据
|
|
|
|
|
List<SwapOrderBattery> batteryList =
|
|
|
|
|
swapOrderBatteryService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
|
|
|
|
@ -191,7 +195,8 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
|
|
|
|
|
List<SwapOrderResp> swapOrderResp = mapper.Map<List<SwapOrderResp>>(swapOrderRespList);
|
|
|
|
|
|
|
|
|
|
List<SwapOrderReportCloud> swapOrderReportClouds = swapOrderReportCloudRepository.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
|
|
|
|
|
List<SwapOrderReportCloud> swapOrderReportClouds =
|
|
|
|
|
swapOrderReportCloudRepository.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//将电池数据添加到换电订单数据中
|
|
|
|
@ -496,7 +501,6 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
// 将电池数据添加到换电订单数据中
|
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (language == "en")
|
|
|
|
|
{
|
|
|
|
|
SwapLoseOrderDto2 dto = list2[i];
|
|
|
|
@ -507,7 +511,6 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
dto.DownBatteryBinNo = swapOrderBatteryResp.DownBatteryBinNo;
|
|
|
|
|
dto.UpBatteryBinNo = swapOrderBatteryResp.UpBatteryBinNo;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -519,7 +522,6 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
dto.DownBatteryBinNo = swapOrderBatteryResp.DownBatteryBinNo;
|
|
|
|
|
dto.UpBatteryBinNo = swapOrderBatteryResp.UpBatteryBinNo;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -536,6 +538,4 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|