Commit 5d9fd8e3 by chamberone

fix: 更新排班结果模板

1 parent 8c12b2ea
package com.dituhui.pea.dispatch.pojo;
import java.util.ArrayList;
import java.util.List;
import org.optaplanner.core.api.domain.solution.PlanningEntityCollectionProperty;
......@@ -20,7 +21,6 @@ public class DispatchSolution {
private String batchNo;
private String name;
@ProblemFactCollectionProperty
......@@ -40,6 +40,11 @@ public class DispatchSolution {
@PlanningScore
private HardSoftLongScore score;
/**
* 未分配订单
*/
private List<Customer> unDispatchedCustomers = new ArrayList<>();
public DispatchSolution() {
}
......
......@@ -152,6 +152,11 @@ public class DispatchSolutionUtils {
.map(c -> c.getPreferredlocation().getX() + "," + c.getPreferredlocation().getY())
.reduce((a, b) -> a + ";" + b).get() + "\"";
// 技术员名称
String names = "\"" + solution.getTechnicianList().stream()
.map(c -> c.getPreferredlocation().getX() + "," + c.getPreferredlocation().getY()+ "," + c.getCode())
.reduce((a, b) -> a + ";" + b).get() + "\"";
List<String> dispatchMapLines = IOUtils.readLines(new FileInputStream("data/dispatchMap.html"), "GBK");
dispatchMapLines = dispatchMapLines.stream().map(line -> {
if (StringUtils.startsWith(line, " var depot = ")) {
......@@ -160,7 +165,9 @@ public class DispatchSolutionUtils {
return " var preferredlocation = " + preferredlocation;
} else if (StringUtils.startsWith(line, " var lines = ")) {
return " var lines = " + lines;
} else {
} else if (StringUtils.startsWith(line, " var names = ")) {
return " var names = " + names;
} else{
return line;
}
}).collect(Collectors.toList());
......@@ -374,6 +381,8 @@ public class DispatchSolutionUtils {
// 移除技术员
customer.getTechnician().getCustomerList().remove(customer);
solution.getUnDispatchedCustomers().add(customer);
}
}
break;
......
......@@ -118,6 +118,11 @@
preferredlocation.split(';').forEach(function(xy,index){
addCircle(xy,colors[index]);
});
// 技术员
var names = "120.753876,31.312792;120.60937,31.37701;120.59335,31.314192;120.6781,31.312456;120.694275,31.230944;120.68786,31.631952;120.62794,31.25647;120.630035,31.153814;120.53737,31.36919;120.597626,31.18977;120.62713,31.29919;120.69743,31.234127;120.634636,31.298191;120.72335,31.296595;120.39913,31.233416;120.72677,31.3044;120.66996,31.272655;120.6085,31.126905;120.385025,31.351074;120.736176,31.337831";
names.split(';').forEach(function(xy,index){
addText(xy,colors[index]);
});
}
......@@ -142,6 +147,8 @@
showDir: true, //白色方向箭头
});
mapObj.add(polygon);
polygon.on('mouseover', showInfoOver);
polygon.on('mouseout', showInfoOut);
}
// 实例化点标记
......@@ -217,11 +224,59 @@
fillColor: "#"+color, //填充颜色
fillOpacity: 0.8 //填充透明度
});
mapObj.add(circle);
return new AMap.LngLat(segs[0], segs[1]);
});
}
function showInfoOver(e){
e.target.setOptions({
strokeWeight: 10
});
}
function showInfoOut(e){
e.target.setOptions({
strokeWeight: 5
});
}
// 实例化文字标记
function addText(bounds,color) {
if ('' == bounds) {
alert("请输入坐标串");
return;
}
bounds.split(';').map(xy => {
var segs = xy.split(',');
var name = segs[2];
// 创建纯文本标记
var text = new AMap.Text({
text:name,
anchor:'center',
draggable:false,
cursor:'pointer',
style:{
'padding': '.75rem 1.25rem',
'margin-bottom': '1rem',
'border-radius': '.25rem',
'background-color': 'rgba(0, 0, 0, 0)',
'width': '15rem',
'border-width': 0,
'text-align': 'center',
'font-size': '12px',
'color': 'black'
},
position: [segs[0], segs[1]]
});
mapObj.add(text);
return new AMap.LngLat(segs[0], segs[1]);
});
}
//设置地图显示要素
function setMapFeatures() {
var features = [];
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!