|
|
|
|
@ -1551,6 +1551,24 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
return failCount.get() == 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean syncPart(String startTime, String endTime) { |
|
|
|
|
//查询所有老mes零件
|
|
|
|
|
List<DsPartEntity> dsPartEntityList = taskingMapper.getOldMesAllPart(startTime,endTime); |
|
|
|
|
for (DsPartEntity partEntity : dsPartEntityList) { |
|
|
|
|
|
|
|
|
|
// 2. 递归处理零件及其子件
|
|
|
|
|
DsPartEntity newPart = processPartRecursively(partEntity); |
|
|
|
|
if (newPart == null) { |
|
|
|
|
log.error("零件处理失败:{}", partEntity.getPartCode()); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 单个任务独立事务处理 |
|
|
|
|
*/ |
|
|
|
|
@ -1742,6 +1760,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
log.info("零件 {} 有 {} 个工艺待同步", newPart.getPartCode(), oldCraftList.size()); |
|
|
|
|
|
|
|
|
|
for (DsCraftEntity oldCraft : oldCraftList) { |
|
|
|
|
Long oldMesCraftId = oldCraft.getId(); |
|
|
|
|
// 重置工艺ID 不使用老mesID
|
|
|
|
|
oldCraft.setId(null); |
|
|
|
|
oldCraft.setPartId(newPart.getId()); |
|
|
|
|
@ -1757,6 +1776,66 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.info("工艺同步成功,oldCraftId:{} -> newCraftId:{}", oldMesPartId, oldCraft.getId()); |
|
|
|
|
|
|
|
|
|
//同步工序
|
|
|
|
|
List<DsProcessEntity> oldMesProcessList = processService.selectOldMesProcessByOldMesCraftId(oldMesCraftId); |
|
|
|
|
if (CollectionUtils.isEmpty(oldMesProcessList)) { |
|
|
|
|
log.info("零件 {} 没有工序数据", newPart.getPartCode()); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (DsProcessEntity dsProcessEntity : oldMesProcessList) { |
|
|
|
|
Long oldMesProcessId = dsProcessEntity.getId(); |
|
|
|
|
dsProcessEntity.setId(null); |
|
|
|
|
boolean processSave = processService.save(dsProcessEntity); |
|
|
|
|
if (!processSave) { |
|
|
|
|
log.error("工序同步失败,oldMesProcessId:{}", oldMesProcessId); |
|
|
|
|
// 继续处理下一个工艺,不中断
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// 处理项目尺寸量具
|
|
|
|
|
//项目
|
|
|
|
|
List<DsProcessProjectEntity> processProjectList = processProjectService.selectOldMesByPid(oldMesProcessId); |
|
|
|
|
processProjectList.forEach(item -> item.setId(null)); |
|
|
|
|
if(CollectionUtils.isEmpty(processProjectList)){ |
|
|
|
|
log.info("零件 {} 没有检验项目数据", newPart.getPartCode()); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
boolean processProjectSaveBatch = processProjectService.saveBatch(processProjectList); |
|
|
|
|
if (!processProjectSaveBatch) { |
|
|
|
|
log.error("项目同步失败,oldMesProcessId:{}", oldMesProcessId); |
|
|
|
|
// 继续处理下一个工艺,不中断
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//尺寸量具
|
|
|
|
|
List<DsProcessMeasuringToolEntity> processMeasuringToolList = processMeasuringToolService.selectOldMesByPid(oldMesProcessId); |
|
|
|
|
processMeasuringToolList.forEach(item -> item.setId(null)); |
|
|
|
|
if(CollectionUtils.isEmpty(processMeasuringToolList)){ |
|
|
|
|
log.info("零件 {} 没有尺寸量具数据", newPart.getPartCode()); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
boolean measuringToolSaveBatch = processMeasuringToolService.saveBatch(processMeasuringToolList); |
|
|
|
|
if (!measuringToolSaveBatch) { |
|
|
|
|
log.error("尺寸量具同步失败,oldMesProcessId:{}", oldMesProcessId); |
|
|
|
|
// 继续处理下一个工艺,不中断
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//工装
|
|
|
|
|
List<DsProcessMoldToolEntity> processMoldToolEntityList = processMoldToolService.selectOldMesByPid(oldMesProcessId); |
|
|
|
|
processMoldToolEntityList.forEach(item -> item.setId(null)); |
|
|
|
|
if(CollectionUtils.isEmpty(processMoldToolEntityList)){ |
|
|
|
|
log.info("零件 {} 没有工装数据", newPart.getPartCode()); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
boolean processMoldToolSaveBatch = processMoldToolService.saveBatch(processMoldToolEntityList); |
|
|
|
|
if(!processMoldToolSaveBatch){ |
|
|
|
|
log.error("工装同步失败,oldMesProcessId:{}", oldMesProcessId); |
|
|
|
|
// 继续处理下一个工艺,不中断
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|