|
|
@ -2263,13 +2263,20 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
HashMap<Integer, Integer> operationMap = new HashMap<Integer, Integer>(); // 存放新的operationId |
|
|
HashMap<Integer, Integer> operationMap = new HashMap<Integer, Integer>(); // 存放新的operationId |
|
|
// 存放新的routingRevision,key为"site_partNo_routingType",value为当前的routingRevision值 |
|
|
// 存放新的routingRevision,key为"site_partNo_routingType",value为当前的routingRevision值 |
|
|
HashMap<String, Integer> routingRevisionMap = new HashMap<String, Integer>(); |
|
|
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()) { |
|
|
if (!routingHeaderList.isEmpty()) { |
|
|
for (RoutingHeaderVo routingHeader : routingHeaderList) { |
|
|
for (RoutingHeaderVo routingHeader : routingHeaderList) { |
|
|
|
|
|
// 记录原来的routingRevision |
|
|
|
|
|
Integer oldRoutingRevision = routingHeader.getRoutingRevision(); |
|
|
|
|
|
String oldRoutingType = routingHeader.getRoutingType(); |
|
|
|
|
|
|
|
|
routingHeader.setSite(toPart.getSite()); |
|
|
routingHeader.setSite(toPart.getSite()); |
|
|
routingHeader.setPartNo(toPart.getPartNo()); |
|
|
routingHeader.setPartNo(toPart.getPartNo()); |
|
|
routingHeader.setCreateBy(inData.getCreateBy()); |
|
|
routingHeader.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
// 根据site、partNo、routingType生成key |
|
|
|
|
|
|
|
|
// 根据site、partNo、routingType生成key,为新物料分配新的routingRevision |
|
|
String revisionKey = toPart.getSite() + "_" + toPart.getPartNo() + "_" + routingHeader.getRoutingType(); |
|
|
String revisionKey = toPart.getSite() + "_" + toPart.getPartNo() + "_" + routingHeader.getRoutingType(); |
|
|
Integer currentRevision = routingRevisionMap.get(revisionKey); |
|
|
Integer currentRevision = routingRevisionMap.get(revisionKey); |
|
|
if (currentRevision == null) { |
|
|
if (currentRevision == null) { |
|
|
@ -2280,6 +2287,10 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
routingRevisionMap.put(revisionKey, currentRevision); |
|
|
routingRevisionMap.put(revisionKey, currentRevision); |
|
|
routingHeader.setRoutingRevision(currentRevision); |
|
|
routingHeader.setRoutingRevision(currentRevision); |
|
|
|
|
|
|
|
|
|
|
|
// 记录老版本到新版本的映射关系 |
|
|
|
|
|
String oldRevisionKey = oldRoutingType + "_" + oldRoutingRevision; |
|
|
|
|
|
oldToNewRevisionMap.put(oldRevisionKey, currentRevision); |
|
|
|
|
|
|
|
|
routingManagementMapper.saveRoutingHeader(routingHeader); |
|
|
routingManagementMapper.saveRoutingHeader(routingHeader); |
|
|
} |
|
|
} |
|
|
// routingManagementMapper.saveRoutingHeaderList(routingHeaderList); |
|
|
// routingManagementMapper.saveRoutingHeaderList(routingHeaderList); |
|
|
@ -2288,32 +2299,22 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
List<RoutingToolEntity> routingToolList = routingManagementMapper.selectRoutingToolByPartNo(fromPart.getSite(), fromPart.getPartNo()); |
|
|
List<RoutingToolEntity> routingToolList = routingManagementMapper.selectRoutingToolByPartNo(fromPart.getSite(), fromPart.getPartNo()); |
|
|
List<WorkGuidelineEntity> routingGuidelineList = routingManagementMapper.selectRoutingGuidelineByPartNo(fromPart.getSite(), fromPart.getPartNo()); |
|
|
List<WorkGuidelineEntity> routingGuidelineList = routingManagementMapper.selectRoutingGuidelineByPartNo(fromPart.getSite(), fromPart.getPartNo()); |
|
|
|
|
|
|
|
|
// 清空routingRevisionMap,为detail等表重新计数 |
|
|
|
|
|
routingRevisionMap.clear(); |
|
|
|
|
|
|
|
|
|
|
|
if (!routingDetailList.isEmpty()) { |
|
|
if (!routingDetailList.isEmpty()) { |
|
|
for (RoutingDetailVo routingDetail : routingDetailList) { |
|
|
for (RoutingDetailVo routingDetail : routingDetailList) { |
|
|
routingDetail.setSite(toPart.getSite()); |
|
|
routingDetail.setSite(toPart.getSite()); |
|
|
routingDetail.setPartNo(toPart.getPartNo()); |
|
|
routingDetail.setPartNo(toPart.getPartNo()); |
|
|
routingDetail.setCreateBy(inData.getCreateBy()); |
|
|
routingDetail.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
// 根据site、partNo、routingType生成key |
|
|
|
|
|
String revisionKey = toPart.getSite() + "_" + toPart.getPartNo() + "_" + routingDetail.getRoutingType(); |
|
|
|
|
|
Integer currentRevision = routingRevisionMap.get(revisionKey); |
|
|
|
|
|
if (currentRevision == null) { |
|
|
|
|
|
currentRevision = 1; |
|
|
|
|
|
} else { |
|
|
|
|
|
currentRevision = currentRevision + 1; |
|
|
|
|
|
|
|
|
// 根据routingType和老的routingRevision查找新的routingRevision |
|
|
|
|
|
String oldRevisionKey = routingDetail.getRoutingType() + "_" + routingDetail.getRoutingRevision(); |
|
|
|
|
|
Integer newRevision = oldToNewRevisionMap.get(oldRevisionKey); |
|
|
|
|
|
if (newRevision != null) { |
|
|
|
|
|
routingDetail.setRoutingRevision(newRevision); |
|
|
} |
|
|
} |
|
|
routingRevisionMap.put(revisionKey, currentRevision); |
|
|
|
|
|
routingDetail.setRoutingRevision(currentRevision); |
|
|
|
|
|
} |
|
|
} |
|
|
routingManagementMapper.saveRoutingDetailList(routingDetailList); |
|
|
routingManagementMapper.saveRoutingDetailList(routingDetailList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 清空routingRevisionMap,为component表重新计数 |
|
|
|
|
|
routingRevisionMap.clear(); |
|
|
|
|
|
|
|
|
|
|
|
if (!routingComponentList.isEmpty()) { |
|
|
if (!routingComponentList.isEmpty()) { |
|
|
Integer oldOperationId; |
|
|
Integer oldOperationId; |
|
|
for (RoutingComponentVo routingComponent : routingComponentList) { |
|
|
for (RoutingComponentVo routingComponent : routingComponentList) { |
|
|
@ -2322,25 +2323,18 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
routingComponent.setPartNo(toPart.getPartNo()); |
|
|
routingComponent.setPartNo(toPart.getPartNo()); |
|
|
routingComponent.setCreateBy(inData.getCreateBy()); |
|
|
routingComponent.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
// 根据site、partNo、routingType生成key |
|
|
|
|
|
String revisionKey = toPart.getSite() + "_" + toPart.getPartNo() + "_" + routingComponent.getRoutingType(); |
|
|
|
|
|
Integer currentRevision = routingRevisionMap.get(revisionKey); |
|
|
|
|
|
if (currentRevision == null) { |
|
|
|
|
|
currentRevision = 1; |
|
|
|
|
|
} else { |
|
|
|
|
|
currentRevision = currentRevision + 1; |
|
|
|
|
|
|
|
|
// 根据routingType和老的routingRevision查找新的routingRevision |
|
|
|
|
|
String oldRevisionKey = routingComponent.getRoutingType() + "_" + routingComponent.getRoutingRevision(); |
|
|
|
|
|
Integer newRevision = oldToNewRevisionMap.get(oldRevisionKey); |
|
|
|
|
|
if (newRevision != null) { |
|
|
|
|
|
routingComponent.setRoutingRevision(newRevision); |
|
|
} |
|
|
} |
|
|
routingRevisionMap.put(revisionKey, currentRevision); |
|
|
|
|
|
routingComponent.setRoutingRevision(currentRevision); |
|
|
|
|
|
|
|
|
|
|
|
routingManagementMapper.saveRoutingComponent(routingComponent); |
|
|
routingManagementMapper.saveRoutingComponent(routingComponent); |
|
|
operationMap.put(oldOperationId, routingComponent.getOperationId()); |
|
|
operationMap.put(oldOperationId, routingComponent.getOperationId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 清空routingRevisionMap,为tool表重新计数 |
|
|
|
|
|
routingRevisionMap.clear(); |
|
|
|
|
|
|
|
|
|
|
|
if (!routingToolList.isEmpty()) { |
|
|
if (!routingToolList.isEmpty()) { |
|
|
for (RoutingToolEntity routingTool : routingToolList) { |
|
|
for (RoutingToolEntity routingTool : routingToolList) { |
|
|
routingTool.setSite(toPart.getSite()); |
|
|
routingTool.setSite(toPart.getSite()); |
|
|
@ -2348,23 +2342,16 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
routingTool.setOperationId(operationMap.get(routingTool.getOperationId())); |
|
|
routingTool.setOperationId(operationMap.get(routingTool.getOperationId())); |
|
|
routingTool.setCreateBy(inData.getCreateBy()); |
|
|
routingTool.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
// 根据site、partNo、routingType生成key |
|
|
|
|
|
String revisionKey = toPart.getSite() + "_" + toPart.getPartNo() + "_" + routingTool.getRoutingType(); |
|
|
|
|
|
Integer currentRevision = routingRevisionMap.get(revisionKey); |
|
|
|
|
|
if (currentRevision == null) { |
|
|
|
|
|
currentRevision = 1; |
|
|
|
|
|
} else { |
|
|
|
|
|
currentRevision = currentRevision + 1; |
|
|
|
|
|
|
|
|
// 根据routingType和老的routingRevision查找新的routingRevision |
|
|
|
|
|
String oldRevisionKey = routingTool.getRoutingType() + "_" + routingTool.getRoutingRevision(); |
|
|
|
|
|
Integer newRevision = oldToNewRevisionMap.get(oldRevisionKey); |
|
|
|
|
|
if (newRevision != null) { |
|
|
|
|
|
routingTool.setRoutingRevision(newRevision); |
|
|
} |
|
|
} |
|
|
routingRevisionMap.put(revisionKey, currentRevision); |
|
|
|
|
|
routingTool.setRoutingRevision(currentRevision); |
|
|
|
|
|
} |
|
|
} |
|
|
routingManagementMapper.saveRoutingTool(routingToolList); |
|
|
routingManagementMapper.saveRoutingTool(routingToolList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 清空routingRevisionMap,为guideline表重新计数 |
|
|
|
|
|
routingRevisionMap.clear(); |
|
|
|
|
|
|
|
|
|
|
|
if (!routingGuidelineList.isEmpty()) { |
|
|
if (!routingGuidelineList.isEmpty()) { |
|
|
for (WorkGuidelineEntity workGuideline : routingGuidelineList) { |
|
|
for (WorkGuidelineEntity workGuideline : routingGuidelineList) { |
|
|
workGuideline.setSite(toPart.getSite()); |
|
|
workGuideline.setSite(toPart.getSite()); |
|
|
@ -2372,16 +2359,12 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
workGuideline.setOperationId(operationMap.get(workGuideline.getOperationId())); |
|
|
workGuideline.setOperationId(operationMap.get(workGuideline.getOperationId())); |
|
|
workGuideline.setCreateBy(inData.getCreateBy()); |
|
|
workGuideline.setCreateBy(inData.getCreateBy()); |
|
|
|
|
|
|
|
|
// 根据site、partNo、routingType生成key |
|
|
|
|
|
String revisionKey = toPart.getSite() + "_" + toPart.getPartNo() + "_" + workGuideline.getRoutingType(); |
|
|
|
|
|
Integer currentRevision = routingRevisionMap.get(revisionKey); |
|
|
|
|
|
if (currentRevision == null) { |
|
|
|
|
|
currentRevision = 1; |
|
|
|
|
|
} else { |
|
|
|
|
|
currentRevision = currentRevision + 1; |
|
|
|
|
|
|
|
|
// 根据routingType和老的routingRevision查找新的routingRevision |
|
|
|
|
|
String oldRevisionKey = workGuideline.getRoutingType() + "_" + workGuideline.getRoutingRevision(); |
|
|
|
|
|
Integer newRevision = oldToNewRevisionMap.get(oldRevisionKey); |
|
|
|
|
|
if (newRevision != null) { |
|
|
|
|
|
workGuideline.setRoutingRevision(newRevision); |
|
|
} |
|
|
} |
|
|
routingRevisionMap.put(revisionKey, currentRevision); |
|
|
|
|
|
workGuideline.setRoutingRevision(currentRevision); |
|
|
|
|
|
} |
|
|
} |
|
|
routingManagementMapper.saveGuideLine(routingGuidelineList); |
|
|
routingManagementMapper.saveGuideLine(routingGuidelineList); |
|
|
} |
|
|
} |
|
|
|