|
|
|
@ -159,8 +159,7 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
var swapOrderStepResps = swapOrderStep.Where(step => step.SwapOrderSn == swapOrderResp.Rows[i].Sn).ToList();
|
|
|
|
|
swapOrderResp.Rows[i].StepList
|
|
|
|
|
.AddRange(swapOrderStepResps);
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
swapOrderResp.Rows[i].ManualStep = String.Join(",",
|
|
|
|
|
swapOrderStepResps.Where(i => i.StepType == (int)SwapConstant.StepType.MANUAL).Select(i => i.StepDesc)
|
|
|
|
|
.ToList());
|
|
|
|
@ -394,6 +393,7 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
cfg.CreateMap<SwapOrderDto2, SwapOrderResp>().ReverseMap();
|
|
|
|
|
cfg.CreateMap<SwapLoseOrderDto, SwapOrderResp>().ReverseMap();
|
|
|
|
|
cfg.CreateMap<SwapLoseOrderDto2, SwapOrderResp>().ReverseMap();
|
|
|
|
|
cfg.CreateMap<SwapOrderStep, SwapOrderStepResp>().ReverseMap();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
IMapper mapper = config.CreateMapper();
|
|
|
|
@ -427,19 +427,38 @@ public class SwapOrderController : ControllerBase
|
|
|
|
|
.Queryable()
|
|
|
|
|
.In(vehicle => vehicle.VehicleNo, vehicleNoList)
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var stepList = swapOrderStepService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
|
|
|
|
|
stepList = stepList.OrderBy(s => s.Sort).ToList();
|
|
|
|
|
List<SwapOrderStepResp> swapOrderStep = mapper.Map<List<SwapOrderStepResp>>(stepList);
|
|
|
|
|
|
|
|
|
|
//将步序数据添加到换电订单数据中
|
|
|
|
|
// 给换电订单赋值车的公司和部门
|
|
|
|
|
foreach (var swapOrder in swapOrderResp)
|
|
|
|
|
for (int i = 0; i < swapOrderResp.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var matchingVehicle = vehicleList.FirstOrDefault(v => v.VehicleNo == swapOrder.VehicleNo);
|
|
|
|
|
|
|
|
|
|
// 初始化 StepList
|
|
|
|
|
swapOrderResp[i].StepList = new List<SwapOrderStepResp>();
|
|
|
|
|
|
|
|
|
|
// 获取与当前订单匹配的步骤信息
|
|
|
|
|
var swapOrderStepResps = swapOrderStep.Where(step => step.SwapOrderSn == swapOrderResp[i].Sn).ToList();
|
|
|
|
|
swapOrderResp[i].StepList.AddRange(swapOrderStepResps);
|
|
|
|
|
|
|
|
|
|
// 设置 ManualStep 字段
|
|
|
|
|
swapOrderResp[i].ManualStep = string.Join(",",
|
|
|
|
|
swapOrderStepResps.Where(step => step.StepType == (int)SwapConstant.StepType.MANUAL)
|
|
|
|
|
.Select(step => step.StepDesc)
|
|
|
|
|
.ToList());
|
|
|
|
|
|
|
|
|
|
// 查找匹配的车辆信息并赋值公司和部门字段
|
|
|
|
|
var matchingVehicle = vehicleList.FirstOrDefault(v => v.VehicleNo == swapOrderResp[i].VehicleNo);
|
|
|
|
|
if (matchingVehicle != null)
|
|
|
|
|
{
|
|
|
|
|
swapOrder.Company = matchingVehicle.Company;
|
|
|
|
|
swapOrder.Departments = matchingVehicle.Departments;
|
|
|
|
|
swapOrderResp[i].Company = matchingVehicle.Company;
|
|
|
|
|
swapOrderResp[i].Departments = matchingVehicle.Departments;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (req.SwapResult == 0 || req.SwapResult == 1)
|
|
|
|
|
{
|
|
|
|
|
List<SwapOrderDto> list = mapper.Map<List<SwapOrderDto>>(swapOrderResp);
|
|
|
|
|