Commit dfbe8406 by 刘鑫

Merge branch 'develop' of https://gitlab.dituhui.com/bsh/project/project into develop

2 parents 6e0b8abd dacdcd13
......@@ -280,16 +280,20 @@ public class SolveServiceImpl implements SolveService {
// technicianList
ArrayList<Technician> technicianList = new ArrayList<>();
dispatchEngineerRepo.findByTeamIdAndBatchNo(teamId, batchNo).forEach(engineer -> {
Location location = new Location(engineer.getId(), engineer.getEngineerCode(), "中心点", StrUtil.isEmpty(engineer.getX()) ? 0 : Double.parseDouble(engineer.getX()), StrUtil.isEmpty(engineer.getY()) ? 0 : Double.parseDouble(engineer.getY()));
// Depot depot = new Depot(engineer.getId(), engineer.getEngineerCode(), location, 60 * 8, 60 * 18);
// depotList.add(depot);
// log.debug("组织问题对象, technicianList groupId:{}, batchNo:{}, engineer-code:{}", groupId, batchNo, engineer.getEngineerCode());
// 技术员时间窗
int[][] timeWindows = engineerCalendarService.timeWindows(engineer.getEngineerCode(), teamId,
LocalDateTimeUtil.parseDate(currDay, DateTimeFormatter.ofPattern("yyyy-MM-dd")));
if (null != timeWindows && timeWindows.length > 0) {
log.info("技术员时间窗, teamId:{}, batchNo:{}, engineerName:{}, timeWindows:{}", teamId, batchNo,
engineer.getEngineerName(), new Gson().toJson(timeWindows));
// 技术员技能
List<String> skillList = queryEngineerSkills(engineer.getEngineerCode());
// log.debug("组织问题对象, technicianList groupId:{}, batchNo:{}, engineer-code:{} , skills:{}", groupId, batchNo, engineer.getEngineerCode(), String.join(";", skillList));
// 距离偏好map
Location location = new Location(engineer.getId(), engineer.getEngineerCode(), "中心点",
StrUtil.isEmpty(engineer.getX()) ? 0 : Double.parseDouble(engineer.getX()),
StrUtil.isEmpty(engineer.getY()) ? 0 : Double.parseDouble(engineer.getY()));
Map<String, Long> preferedLoctionDistanceMap = new HashMap<String, Long>();
if (location.getLongitude() > 1 && location.getLatitude() > 1) {
// 设置了偏好位置
......@@ -301,12 +305,13 @@ public class SolveServiceImpl implements SolveService {
// 未设置,不参与计算
}
// 硬约束:电动车固定40km上限,其他无限制
// 最大距离,硬约束:电动车固定40km上限,其他无限制
int maxDistance = engineer.getMaxDistance() * 1000;
if (engineer.getVehicleType() != null && engineer.getVehicleType() == 2) {
maxDistance = 40 * 1000;
}
// 技术员出发地
Double x = null;
Double y = null;
if (ObjectUtil.equal(engineer.getDeparture(), DepartureEnum.WORK_ADDR.getCode())) {
......@@ -317,19 +322,19 @@ public class SolveServiceImpl implements SolveService {
y = Double.parseDouble(orgWarehouseInfoEntity.getY());
}
Location engineerLocation = new Location(engineer.getId(), engineer.getEngineerCode(), "起点", x, y);
Depot engineerDepot = new Depot(engineer.getId(), engineer.getEngineerCode(), engineerLocation, 60 * 8, 60 * 18);
// FIXME 无锡时间窗数据错误,暂时改成固定值
int[][] timeWindows = engineerCalendarService.timeWindows(engineer.getEngineerCode(), teamId, LocalDateTimeUtil.parseDate(currDay, DateTimeFormatter.ofPattern("yyyy-MM-dd")));
System.err.println(engineer.getEngineerName()+" : " + new Gson().toJson(timeWindows));
log.info(engineer.getEngineerName()+" : " + new Gson().toJson(timeWindows));
timeWindows = new int[][] { { 480, 1080 } };
Depot engineerDepot = new Depot(engineer.getId(), engineer.getEngineerCode(), engineerLocation, 60 * 8,
60 * 18);
Technician vehicle = new Technician(engineer.getId(), engineer.getEngineerCode(), engineer.getMaxNum(), engineer.getMaxMinute(), maxDistance, engineer.getVehicleType(), engineerDepot, timeWindows, Set.copyOf(skillList), preferedLoctionDistanceMap);
Technician vehicle = new Technician(engineer.getId(), engineer.getEngineerCode(), engineer.getMaxNum(),
engineer.getMaxMinute(), maxDistance, engineer.getVehicleType(), engineerDepot, timeWindows,
Set.copyOf(skillList), preferedLoctionDistanceMap);
technicianList.add(vehicle);
} else {
// 没有时间窗技术员,不参与派工
log.info("技术员时间窗, teamId:{}, batchNo:{}, engineerName:{}, no timeWindows", teamId, batchNo,
engineer.getEngineerName());
}
});
log.info("组织问题对象, depotList-list, teamId:{}, batchNo:{}", teamId, batchNo);
log.info("组织问题对象, technician-list, teamId:{}, batchNo:{}, technician-list:{}", teamId, batchNo, technicianList.size());
// locationlist 起点+订单地点
......
......@@ -143,6 +143,8 @@ public enum StatusCodeEnum {
ORDER_RESCHEDULE_BEFORE_TIME("028", "订单不能改约到当前时间以前!", false),
TEAM_UNMATCHED("029", "工程师没有匹配到工作队", false),
ORDER_FINISHED("030", "订单已结束,请勿操作", false),
;
/**
......
......@@ -64,6 +64,8 @@ public class OrderServiceDetailResp {
private String expectTimeBegin;
private String expectTimeEnd;
private String expectTimeDesc;
private String source;
......
......@@ -3,8 +3,8 @@ package com.dituhui.pea.order.enums;
public enum OrderEventEnum {
// 建单,首次指派,改派,取消,改约,放回工单池
createOrder("建单", "%s通过%s创建服务工单:%s"),
firstAssignment("首次指派", "通过PEA派工给工程师%s"),
reassignment("派", "通过PEA派工给工程师%s"),
// firstAssignment("首次指派", "通过PEA派工给工程师%s"),
reassignment("派", "通过PEA派工给工程师%s"),
cancel("取消", "%s在线指导解决"),
recontracting("改约", "工程师%s/%s已改约,改约时间%s,改约原因:%s"),
backOrderPool("放回工单池", "取消派工"),
......
......@@ -194,11 +194,24 @@ public class OrderAssignImpl implements OrderAssign {
if (order == null) {
return Result.failed("订单不存在");
}
if (order.getOrderStatus().equals(OrderStatusEnum.CANCELED.getCode()) || order.getServiceStatus().equals(ServiceStatusEnum.FINISHED.getCode())) {
return Result.failed(StatusCodeEnum.ORDER_FINISHED);
}
OrgTeamEntity orgTeam = orgTeamDao.getByTeamId(order.getOrgTeamId());
// 判断cutoff
Integer cutoff = CommonUtil.isCutoff(order.getExpectTimeBegin(), orgTeam.getWorkOff());
if (cutoff > 0) {
// cutoff更新order_request表为人工指派
order.setAppointmentStatus(AppointmentMethodEnum.MANUAL.name());
order.setServiceStatus(OrderFlowEnum.INIT.name());
order = OrderUtil.handleErrorOrder(order);
order.setIsCutoff(cutoff);
} else {
// 更新order_request表为未指派
order.setAppointmentStatus(OrderFlowEnum.INIT.name());
order.setServiceStatus(OrderFlowEnum.INIT.name());
order = OrderUtil.handleErrorOrder(order);
order = OrderUtil.handleErrorOrder2(order);
}
orderInfoDao.save(order);
commonService.addOrderEvent(orderId, "", "PEA", "PEA", OrderEventEnum.backOrderPool.getEvent(), OrderEventEnum.backOrderPool.getMsg(), "");
......
......@@ -418,7 +418,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
commonService.addOrderEvent(orderId, "", req.getSource(), "API", OrderEventEnum.createOrder.getEvent(), String.format(OrderEventEnum.createOrder.getMsg(), req.getSource(), "BEAN", req.getOrderId()), "");
if (req.getIsAppointEngineer() == 1) {
commonService.addOrderEvent(orderId, "", req.getSource(), "PEA", OrderEventEnum.firstAssignment.getEvent(), String.format(OrderEventEnum.firstAssignment.getMsg(), engineerName + "-" + byTeamId.getTeamName()), "");
commonService.addOrderEvent(orderId, "", req.getSource(), "PEA", OrderEventEnum.reassignment.getEvent(), String.format(OrderEventEnum.reassignment.getMsg(), engineerName + "-" + byTeamId.getTeamName()), "");
}
return Result.success(null);
}
......
......@@ -79,6 +79,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
res.setSkill(order.getSkill());
res.setFaultDescribe(order.getFaultDescribe());
res.setExpectTimeBegin(TimeUtils.IsoLocalDateTime2String(order.getExpectTimeBegin()));
res.setExpectTimeEnd(TimeUtils.IsoLocalDateTime2String(order.getExpectTimeEnd()));
res.setExpectTimeDesc(order.getExpectTimeDesc());
res.setSource(order.getSource());
res.setTags(order.getTags());
......
......@@ -18,4 +18,17 @@ public class OrderUtil {
return order;
}
/**
* 分单,超派,特殊时间等处理工单指派工程师,网点等数据
*
* @param order
* @return
*/
public static OrderInfoEntity handleErrorOrder2(OrderInfoEntity order) {
order.setEngineerPhone(null);
order.setEngineerName(null);
order.setEngineerCode(null);
return order;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!