Compare commits
7 Commits
6519c24135
...
50630eae22
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50630eae22 | ||
|
|
28dae80058 | ||
|
|
db04195e7b | ||
|
|
595ebfb395 | ||
|
|
16538a7883 | ||
|
|
8294672ce6 | ||
|
|
775aa67674 |
5
.idea/.gitignore
vendored
Normal file
5
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
@ -138,6 +138,12 @@
|
|||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-core</artifactId>
|
<artifactId>spring-security-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.dev33</groupId>
|
||||||
|
<artifactId>sa-token-core</artifactId>
|
||||||
|
<version>1.39.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.ortools/ortools-java -->
|
<!-- https://mvnrepository.com/artifact/com.google.ortools/ortools-java -->
|
||||||
|
|||||||
@ -1453,12 +1453,17 @@ public class ProcessOrderProController extends BaseController {
|
|||||||
}
|
}
|
||||||
if (!kingdeeBomRows.isEmpty()) {
|
if (!kingdeeBomRows.isEmpty()) {
|
||||||
List<Map<String, Object>> bomDataList2 = convertKingdeeBomToMapList(kingdeeBomRows);
|
List<Map<String, Object>> bomDataList2 = convertKingdeeBomToMapList(kingdeeBomRows);
|
||||||
dynamicDataMappingList.addAll(DynamicDataMapping.createOneDataList("KingdeeBomData", bomDataList2));
|
// 合并到 RouteBomData 中统一按物料分组导出(方案A)
|
||||||
}
|
}
|
||||||
// 添加伊特产品数据
|
// 添加伊特产品数据
|
||||||
if (!routeList.isEmpty()) {
|
if (!routeList.isEmpty()) {
|
||||||
List<Map<String, Object>> evoRouteDataList = convertRouteDataToMapList(routeList);
|
// 合并到 RouteBomData 中统一按物料分组导出(方案A)
|
||||||
dynamicDataMappingList.addAll(DynamicDataMapping.createOneDataList("ProcessRouteExcelDTO", evoRouteDataList));
|
}
|
||||||
|
|
||||||
|
// 方案A:合并工艺与BOM为单一数据集并按物料分组
|
||||||
|
if (!routeList.isEmpty() || !kingdeeBomRows.isEmpty()) {
|
||||||
|
List<Map<String, Object>> routeBomDataList = convertRouteBomToMapList(routeList, kingdeeBomRows);
|
||||||
|
dynamicDataMappingList.addAll(DynamicDataMapping.createOneDataList("RouteBomData", routeBomDataList));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用模板导出Excel
|
// 使用模板导出Excel
|
||||||
@ -1493,6 +1498,105 @@ public class ProcessOrderProController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并工艺路线与金蝶BOM行,按物料编码分组生成统一的 RouteBomData 列表
|
||||||
|
* 每条记录包含两类:rowType=route(工艺行)或 rowType=bom(BOM行),以便模板在同一块中连续展示
|
||||||
|
*/
|
||||||
|
private List<Map<String, Object>> convertRouteBomToMapList(List<ProcessRoute> routeDataList,
|
||||||
|
List<Map<String, Object>> kingdeeBomRows) {
|
||||||
|
Map<String, List<Map<String, Object>>> grouped = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
// 先按工艺数据建立分组与顺序
|
||||||
|
for (ProcessRoute item : routeDataList) {
|
||||||
|
String mcode = item.getMaterialCode();
|
||||||
|
if (mcode == null) mcode = "";
|
||||||
|
grouped.computeIfAbsent(mcode, k -> new ArrayList<>());
|
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("rowType", "route");
|
||||||
|
map.put("routeDescription", item.getRouteDescription());
|
||||||
|
map.put("materialCode", item.getMaterialCode());
|
||||||
|
map.put("materialName", item.getMaterialName());
|
||||||
|
map.put("material", item.getMaterial());
|
||||||
|
map.put("discWeight", item.getDiscWeight());
|
||||||
|
map.put("processNo", item.getProcessNo());
|
||||||
|
map.put("workCenter", item.getWorkCenter());
|
||||||
|
map.put("processName", item.getProcessName());
|
||||||
|
map.put("processDescription", item.getProcessDescription());
|
||||||
|
map.put("processControl", item.getProcessControl());
|
||||||
|
map.put("activityDuration", item.getActivityDuration());
|
||||||
|
map.put("activityUnit", item.getActivityUnit());
|
||||||
|
map.put("unitQuantity", item.getUnitQuantity());
|
||||||
|
map.put("batchQuantity", item.getBatchQuantity());
|
||||||
|
map.put("firstBatchQuantity", item.getFirstBatchQuantity());
|
||||||
|
map.put("planStartTime", formatDate(item.getPlanStartTime()));
|
||||||
|
map.put("planEndTime", formatDate(item.getPlanEndTime()));
|
||||||
|
map.put("xuStartTime", formatDate(item.getXuStartTime()));
|
||||||
|
map.put("xuEndTime", formatDate(item.getXuEndTime()));
|
||||||
|
|
||||||
|
// BOM占位(当前行类型为工艺,BOM字段置空)
|
||||||
|
map.put("rawMaterialCode", "");
|
||||||
|
map.put("rawMaterialName", "");
|
||||||
|
map.put("bomMaterial", "");
|
||||||
|
map.put("bomDanZhong", "");
|
||||||
|
map.put("discUsage", "");
|
||||||
|
map.put("bomUnit", "");
|
||||||
|
|
||||||
|
grouped.get(mcode).add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 追加BOM数据到对应物料分组;若该物料此前未出现,则在最后新增一个分组
|
||||||
|
for (Map<String, Object> row : kingdeeBomRows) {
|
||||||
|
String mcode = Objects.toString(row.get("materialCode"), "");
|
||||||
|
grouped.computeIfAbsent(mcode, k -> new ArrayList<>());
|
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("rowType", "bom");
|
||||||
|
map.put("routeDescription", row.get("routeDescription"));
|
||||||
|
map.put("materialCode", row.get("materialCode"));
|
||||||
|
map.put("materialName", row.get("materialName"));
|
||||||
|
map.put("material", row.get("material"));
|
||||||
|
map.put("discWeight", row.get("discWeight"));
|
||||||
|
|
||||||
|
// 工艺占位(当前行类型为BOM,工艺字段置空)
|
||||||
|
map.put("processNo", "");
|
||||||
|
map.put("workCenter", "");
|
||||||
|
map.put("processName", "");
|
||||||
|
map.put("processDescription", "");
|
||||||
|
map.put("processControl", "");
|
||||||
|
map.put("activityDuration", "");
|
||||||
|
map.put("activityUnit", "");
|
||||||
|
map.put("unitQuantity", "");
|
||||||
|
map.put("batchQuantity", "");
|
||||||
|
map.put("firstBatchQuantity", "");
|
||||||
|
map.put("planStartTime", "");
|
||||||
|
map.put("planEndTime", "");
|
||||||
|
map.put("xuStartTime", "");
|
||||||
|
map.put("xuEndTime", "");
|
||||||
|
|
||||||
|
// BOM具体字段
|
||||||
|
map.put("rawMaterialCode", row.get("rawMaterialCode"));
|
||||||
|
map.put("rawMaterialName", row.get("rawMaterialName"));
|
||||||
|
map.put("bomMaterial", row.get("bomMaterial"));
|
||||||
|
map.put("bomDanZhong", row.get("bomDanZhong"));
|
||||||
|
map.put("discUsage", row.get("discUsage"));
|
||||||
|
map.put("bomUnit", row.get("bomUnit"));
|
||||||
|
|
||||||
|
grouped.get(mcode).add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 展平为顺序列表并补齐序号
|
||||||
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
int index = 1;
|
||||||
|
for (Map.Entry<String, List<Map<String, Object>>> entry : grouped.entrySet()) {
|
||||||
|
for (Map<String, Object> m : entry.getValue()) {
|
||||||
|
m.put("index", index++);
|
||||||
|
result.add(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private List<Map<String, Object>> convertKingdeeBomToMapList(List<Map<String, Object>> kingdeeBomRows) {
|
private List<Map<String, Object>> convertKingdeeBomToMapList(List<Map<String, Object>> kingdeeBomRows) {
|
||||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||||
int index = 1;
|
int index = 1;
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user