|
|
|
@ -2289,17 +2289,17 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
HashMap<String, Integer> routingRevisionMap = new HashMap<String, Integer>(); |
|
|
|
// 存放老routing_revision到新routing_revision的映射,key为"routingType_oldRoutingRevision",value为新的routingRevision |
|
|
|
HashMap<String, Integer> oldToNewRevisionMap = new HashMap<String, Integer>(); |
|
|
|
|
|
|
|
|
|
|
|
if (!routingHeaderList.isEmpty()) { |
|
|
|
for (RoutingHeaderVo routingHeader : routingHeaderList) { |
|
|
|
// 记录原来的routingRevision |
|
|
|
Integer oldRoutingRevision = routingHeader.getRoutingRevision(); |
|
|
|
String oldRoutingType = routingHeader.getRoutingType(); |
|
|
|
|
|
|
|
|
|
|
|
routingHeader.setSite(toPart.getSite()); |
|
|
|
routingHeader.setPartNo(toPart.getPartNo()); |
|
|
|
routingHeader.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
|
|
|
// 根据site、partNo、routingType生成key,为新物料分配新的routingRevision |
|
|
|
String revisionKey = toPart.getSite() + "_" + toPart.getPartNo() + "_" + routingHeader.getRoutingType(); |
|
|
|
Integer currentRevision = routingRevisionMap.get(revisionKey); |
|
|
|
@ -2310,11 +2310,11 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
} |
|
|
|
routingRevisionMap.put(revisionKey, currentRevision); |
|
|
|
routingHeader.setRoutingRevision(currentRevision); |
|
|
|
|
|
|
|
|
|
|
|
// 记录老版本到新版本的映射关系 |
|
|
|
String oldRevisionKey = oldRoutingType + "_" + oldRoutingRevision; |
|
|
|
oldToNewRevisionMap.put(oldRevisionKey, currentRevision); |
|
|
|
|
|
|
|
|
|
|
|
routingManagementMapper.saveRoutingHeader(routingHeader); |
|
|
|
} |
|
|
|
// routingManagementMapper.saveRoutingHeaderList(routingHeaderList); |
|
|
|
@ -2322,13 +2322,13 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
List<RoutingComponentVo> routingComponentList = routingManagementMapper.selectRoutingComponentByPartNo(fromPart.getSite(), fromPart.getPartNo()); |
|
|
|
List<RoutingToolEntity> routingToolList = routingManagementMapper.selectRoutingToolByPartNo(fromPart.getSite(), fromPart.getPartNo()); |
|
|
|
List<WorkGuidelineEntity> routingGuidelineList = routingManagementMapper.selectRoutingGuidelineByPartNo(fromPart.getSite(), fromPart.getPartNo()); |
|
|
|
|
|
|
|
|
|
|
|
if (!routingDetailList.isEmpty()) { |
|
|
|
for (RoutingDetailVo routingDetail : routingDetailList) { |
|
|
|
routingDetail.setSite(toPart.getSite()); |
|
|
|
routingDetail.setPartNo(toPart.getPartNo()); |
|
|
|
routingDetail.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
|
|
|
// 根据routingType和老的routingRevision查找新的routingRevision |
|
|
|
String oldRevisionKey = routingDetail.getRoutingType() + "_" + routingDetail.getRoutingRevision(); |
|
|
|
Integer newRevision = oldToNewRevisionMap.get(oldRevisionKey); |
|
|
|
@ -2338,7 +2338,7 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
} |
|
|
|
routingManagementMapper.saveRoutingDetailList(routingDetailList); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!routingComponentList.isEmpty()) { |
|
|
|
Integer oldOperationId; |
|
|
|
for (RoutingComponentVo routingComponent : routingComponentList) { |
|
|
|
@ -2346,26 +2346,26 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
routingComponent.setSite(toPart.getSite()); |
|
|
|
routingComponent.setPartNo(toPart.getPartNo()); |
|
|
|
routingComponent.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
|
|
|
// 根据routingType和老的routingRevision查找新的routingRevision |
|
|
|
String oldRevisionKey = routingComponent.getRoutingType() + "_" + routingComponent.getRoutingRevision(); |
|
|
|
Integer newRevision = oldToNewRevisionMap.get(oldRevisionKey); |
|
|
|
if (newRevision != null) { |
|
|
|
routingComponent.setRoutingRevision(newRevision); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
routingManagementMapper.saveRoutingComponent(routingComponent); |
|
|
|
operationMap.put(oldOperationId, routingComponent.getOperationId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!routingToolList.isEmpty()) { |
|
|
|
for (RoutingToolEntity routingTool : routingToolList) { |
|
|
|
routingTool.setSite(toPart.getSite()); |
|
|
|
routingTool.setPartNo(toPart.getPartNo()); |
|
|
|
routingTool.setOperationId(operationMap.get(routingTool.getOperationId())); |
|
|
|
routingTool.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
|
|
|
// 根据routingType和老的routingRevision查找新的routingRevision |
|
|
|
String oldRevisionKey = routingTool.getRoutingType() + "_" + routingTool.getRoutingRevision(); |
|
|
|
Integer newRevision = oldToNewRevisionMap.get(oldRevisionKey); |
|
|
|
@ -2375,14 +2375,14 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
} |
|
|
|
routingManagementMapper.saveRoutingTool(routingToolList); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!routingGuidelineList.isEmpty()) { |
|
|
|
for (WorkGuidelineEntity workGuideline : routingGuidelineList) { |
|
|
|
workGuideline.setSite(toPart.getSite()); |
|
|
|
workGuideline.setPartNo(toPart.getPartNo()); |
|
|
|
workGuideline.setOperationId(operationMap.get(workGuideline.getOperationId())); |
|
|
|
workGuideline.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
|
|
|
// 根据routingType和老的routingRevision查找新的routingRevision |
|
|
|
String oldRevisionKey = workGuideline.getRoutingType() + "_" + workGuideline.getRoutingRevision(); |
|
|
|
Integer newRevision = oldToNewRevisionMap.get(oldRevisionKey); |
|
|
|
@ -3943,6 +3943,34 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 下载文件 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void downLoadObjectFile2(HttpServletResponse response) { |
|
|
|
File file = new File("D:\\plm-file\\template\\projectPart.xlsx"); |
|
|
|
if (!file.exists()) { |
|
|
|
throw new RuntimeException("文件不存在"); |
|
|
|
} |
|
|
|
response.reset(); |
|
|
|
response.setContentType("application/octet-stream;charset=UTF-8"); |
|
|
|
try { |
|
|
|
String fileName = java.net.URLEncoder.encode("项目物料导入模板.xlsx", "UTF-8"); |
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + fileName); |
|
|
|
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); |
|
|
|
ServletOutputStream os = response.getOutputStream()) { |
|
|
|
byte[] buffer = new byte[1024]; |
|
|
|
int len; |
|
|
|
while ((len = bis.read(buffer)) != -1) { |
|
|
|
os.write(buffer, 0, len); |
|
|
|
} |
|
|
|
os.flush(); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
throw new RuntimeException("文件下载失败", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取下一个物料revision |
|
|
|
* @param inData |
|
|
|
|