|
|
|
|
@ -160,62 +160,62 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
@Override |
|
|
|
|
public IPage<DsTaskingVO> selectAssignList(IPage<DsTaskingVO> page, DsTaskingVO dsTasking) { |
|
|
|
|
List<DsTaskingVO> dsTaskingVOS = baseMapper.selectDsTaskingPage(page, dsTasking); |
|
|
|
|
if(!CollectionUtils.isEmpty(dsTaskingVOS)){ |
|
|
|
|
for (DsTaskingVO dsTaskingVO : dsTaskingVOS) { |
|
|
|
|
String partCode = dsTaskingVO.getPartCode(); |
|
|
|
|
String version = dsTaskingVO.getVersion(); |
|
|
|
|
DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(partCode,version); |
|
|
|
|
// if(TaskingConstant.IS_SINTERING.equals(partEntity.getIsSintering())){
|
|
|
|
|
// //查询子件信息
|
|
|
|
|
// if(!CollectionUtils.isEmpty(dsTaskingVOS)){
|
|
|
|
|
// for (DsTaskingVO dsTaskingVO : dsTaskingVOS) {
|
|
|
|
|
// String partCode = dsTaskingVO.getPartCode();
|
|
|
|
|
// String version = dsTaskingVO.getVersion();
|
|
|
|
|
// DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(partCode,version);
|
|
|
|
|
//// if(TaskingConstant.IS_SINTERING.equals(partEntity.getIsSintering())){
|
|
|
|
|
//// //查询子件信息
|
|
|
|
|
//// List<DsPartRelationEntity> partRelationEntityList = partRelationService.selectDsPartRelationByPartId(partEntity.getId());
|
|
|
|
|
//// //获取所有子件ID
|
|
|
|
|
//// List<Long> idList = partRelationEntityList.stream().map(DsPartRelationEntity::getChildPartId).collect(Collectors.toList());
|
|
|
|
|
//// if(CollectionUtils.isEmpty(idList)){
|
|
|
|
|
//// continue;
|
|
|
|
|
//// }
|
|
|
|
|
//// //获取版本号 根据子件ID
|
|
|
|
|
//// List<DsPartVersionEntity> partVersionList = partVersionService.selectByPartIds(idList);
|
|
|
|
|
//// List<DsTaskingIsCompletedVO> list = new ArrayList<>();
|
|
|
|
|
//// for (DsPartVersionEntity dsPartVersionEntity : partVersionList) {
|
|
|
|
|
//// //根据零件编码 和 版本号查询数据
|
|
|
|
|
//// List<Integer> taskStatusList = new ArrayList<>(Arrays.asList(
|
|
|
|
|
//// TaskingConstant.TASK_STATUS_WAIT,
|
|
|
|
|
//// TaskingConstant.TASK_STATUS_ALREADY,
|
|
|
|
|
//// TaskingConstant.TASK_STATUS_UNDERWAY
|
|
|
|
|
//// ));
|
|
|
|
|
//// List<DsTaskingEntity> dsTaskingEntityList = taskingMapper.selectDsTaskingByPartCodeAndVersion(dsPartVersionEntity.getPartCode(), dsPartVersionEntity.getPartVersion(), taskStatusList);
|
|
|
|
|
////
|
|
|
|
|
//// List<DsTaskingIsCompletedVO> collect = dsTaskingEntityList.stream()
|
|
|
|
|
//// .map(entity -> {
|
|
|
|
|
//// DsTaskingIsCompletedVO vo = new DsTaskingIsCompletedVO();
|
|
|
|
|
//// BeanUtils.copyProperties(entity, vo);
|
|
|
|
|
//// return vo;
|
|
|
|
|
//// })
|
|
|
|
|
//// .collect(Collectors.toList());
|
|
|
|
|
////
|
|
|
|
|
//// list.addAll(collect);
|
|
|
|
|
//// }
|
|
|
|
|
////
|
|
|
|
|
//// if(!CollectionUtils.isEmpty(list)){
|
|
|
|
|
//// dsTaskingVO.setChildren(list);
|
|
|
|
|
//// }
|
|
|
|
|
//// }
|
|
|
|
|
//
|
|
|
|
|
// //查询子件信息
|
|
|
|
|
// if(null != partEntity){
|
|
|
|
|
// List<DsPartRelationEntity> partRelationEntityList = partRelationService.selectDsPartRelationByPartId(partEntity.getId());
|
|
|
|
|
// //获取所有子件ID
|
|
|
|
|
// List<Long> idList = partRelationEntityList.stream().map(DsPartRelationEntity::getChildPartId).collect(Collectors.toList());
|
|
|
|
|
// if(CollectionUtils.isEmpty(idList)){
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// //获取版本号 根据子件ID
|
|
|
|
|
// List<DsPartVersionEntity> partVersionList = partVersionService.selectByPartIds(idList);
|
|
|
|
|
// List<DsTaskingIsCompletedVO> list = new ArrayList<>();
|
|
|
|
|
// for (DsPartVersionEntity dsPartVersionEntity : partVersionList) {
|
|
|
|
|
// //根据零件编码 和 版本号查询数据
|
|
|
|
|
// List<Integer> taskStatusList = new ArrayList<>(Arrays.asList(
|
|
|
|
|
// TaskingConstant.TASK_STATUS_WAIT,
|
|
|
|
|
// TaskingConstant.TASK_STATUS_ALREADY,
|
|
|
|
|
// TaskingConstant.TASK_STATUS_UNDERWAY
|
|
|
|
|
// ));
|
|
|
|
|
// List<DsTaskingEntity> dsTaskingEntityList = taskingMapper.selectDsTaskingByPartCodeAndVersion(dsPartVersionEntity.getPartCode(), dsPartVersionEntity.getPartVersion(), taskStatusList);
|
|
|
|
|
//
|
|
|
|
|
// List<DsTaskingIsCompletedVO> collect = dsTaskingEntityList.stream()
|
|
|
|
|
// .map(entity -> {
|
|
|
|
|
// DsTaskingIsCompletedVO vo = new DsTaskingIsCompletedVO();
|
|
|
|
|
// BeanUtils.copyProperties(entity, vo);
|
|
|
|
|
// return vo;
|
|
|
|
|
// })
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
//
|
|
|
|
|
// list.addAll(collect);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if(!CollectionUtils.isEmpty(list)){
|
|
|
|
|
// dsTaskingVO.setChildren(list);
|
|
|
|
|
// if (!CollectionUtils.isEmpty(idList)) {
|
|
|
|
|
// List<DsPartVersionVO> dsPartEntityList = partService.selectDsPartVersionByIds(idList);
|
|
|
|
|
//// for (DsPartVersionVO dsPartVersionVO : dsPartEntityList) {
|
|
|
|
|
//// dsPartVersionVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVersionVO.getUpdateUser())).getData().getUser().getName());
|
|
|
|
|
//// }
|
|
|
|
|
// dsTaskingVO.setChildren(dsPartEntityList);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//查询子件信息
|
|
|
|
|
if(null != partEntity){ |
|
|
|
|
List<DsPartRelationEntity> partRelationEntityList = partRelationService.selectDsPartRelationByPartId(partEntity.getId()); |
|
|
|
|
//获取所有子件ID
|
|
|
|
|
List<Long> idList = partRelationEntityList.stream().map(DsPartRelationEntity::getChildPartId).collect(Collectors.toList()); |
|
|
|
|
if (!CollectionUtils.isEmpty(idList)) { |
|
|
|
|
List<DsPartVersionVO> dsPartEntityList = partService.selectDsPartVersionByIds(idList); |
|
|
|
|
// for (DsPartVersionVO dsPartVersionVO : dsPartEntityList) {
|
|
|
|
|
// dsPartVersionVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVersionVO.getUpdateUser())).getData().getUser().getName());
|
|
|
|
|
// }
|
|
|
|
|
dsTaskingVO.setChildren(dsPartEntityList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return page.setRecords(dsTaskingVOS); |
|
|
|
|
} |
|
|
|
|
@ -306,7 +306,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
if(dsTaskingEntity.getTaskType().equals(TaskingConstant.REWORK_PLAN_EDIT)){ |
|
|
|
|
DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(dsTaskingEntity.getPartCode(),dsTaskingEntity.getVersion()); |
|
|
|
|
//返工单号 返工工艺
|
|
|
|
|
List<PrReworkProcessEntity> reworkProcessEntityList = reworkProcessService.selectPrReworkProcess(dsTaskingEntity.getReworkOrder(), partEntity.getPartCode(), dsTaskingEntity.getVersion()); |
|
|
|
|
List<PrReworkProcessEntity> reworkProcessEntityList = reworkProcessService.selectPrReworkProcess(dsTaskingEntity.getReworkOrder(), partEntity.getPartCode(), dsTaskingEntity.getBatchNo()); |
|
|
|
|
if(CollectionUtils.isEmpty(reworkProcessEntityList)){ |
|
|
|
|
throw new ServiceException("返工工序缺失"); |
|
|
|
|
} |
|
|
|
|
@ -314,7 +314,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
if(null == prReworkProcessEntity.getMakeTeam() && null == prReworkProcessEntity.getOcId()){ |
|
|
|
|
throw new ServiceException("外协厂商或加工班组为空"); |
|
|
|
|
} |
|
|
|
|
BsProcessSetEntity processSet = processSetService.selectBsProcessSetByProcessCode(prReworkProcessEntity.getProcessNo()); |
|
|
|
|
BsProcessSetEntity processSet = processSetService.getById(prReworkProcessEntity.getPpsId()); |
|
|
|
|
if(TaskingConstant.IS_CHECKOUT.equals(processSet.getIsCheckout()) ){ |
|
|
|
|
List<DsProcessProjectEntity> processProjectEntities = processProjectService.selectDsProcessProjectByProcessId(prReworkProcessEntity.getId()); |
|
|
|
|
if(CollectionUtils.isEmpty(processProjectEntities)){ |
|
|
|
|
@ -331,25 +331,25 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
|
|
|
|
|
//查询零件和子件是否编制工序
|
|
|
|
|
//零件工艺
|
|
|
|
|
DsCraftEntity craft = craftService.getPartCraft(partEntity.getId(),"2"); |
|
|
|
|
if(null == craft){ |
|
|
|
|
List<DsCraftEntity> craftEntityList = craftService.getPartCraft(partEntity.getId(),"2"); |
|
|
|
|
if(CollectionUtils.isEmpty(craftEntityList) ){ |
|
|
|
|
throw new ServiceException("零件工艺缺失"); |
|
|
|
|
} |
|
|
|
|
//零件工序
|
|
|
|
|
List<DsProcessEntity> processEntities = processService.selectDsProcessByCraftId(craft.getId()); |
|
|
|
|
if(CollectionUtils.isEmpty(processEntities)){ |
|
|
|
|
throw new ServiceException("【零件号】"+partEntity.getPartCode()+"工艺未编制工序"); |
|
|
|
|
} |
|
|
|
|
//判断工序下的检验项目
|
|
|
|
|
for (DsProcessEntity processEntity : processEntities) { |
|
|
|
|
BsProcessSetEntity processSet = processSetService.selectBsProcessSetByProcessCode(processEntity.getProcessCode()); |
|
|
|
|
if(TaskingConstant.IS_CHECKOUT.equals(processSet.getIsCheckout()) ){ |
|
|
|
|
List<DsProcessProjectEntity> processProjectEntities = processProjectService.selectDsProcessProjectByProcessId(processEntity.getId()); |
|
|
|
|
if(CollectionUtils.isEmpty(processProjectEntities)){ |
|
|
|
|
throw new ServiceException(processEntity.getProcessName()+":未编制检验项目"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// //零件工序
|
|
|
|
|
// List<DsProcessEntity> processEntities = processService.selectDsProcessByCraftId(craft.getId());
|
|
|
|
|
// if(CollectionUtils.isEmpty(processEntities)){
|
|
|
|
|
// throw new ServiceException("【零件号】"+partEntity.getPartCode()+"工艺未编制工序");
|
|
|
|
|
// }
|
|
|
|
|
// //判断工序下的检验项目
|
|
|
|
|
// for (DsProcessEntity processEntity : processEntities) {
|
|
|
|
|
// BsProcessSetEntity processSet = processSetService.selectBsProcessSetByProcessCode(processEntity.getProcessCode());
|
|
|
|
|
// if(TaskingConstant.IS_CHECKOUT.equals(processSet.getIsCheckout()) ){
|
|
|
|
|
// List<DsProcessProjectEntity> processProjectEntities = processProjectService.selectDsProcessProjectByProcessId(processEntity.getId());
|
|
|
|
|
// if(CollectionUtils.isEmpty(processProjectEntities)){
|
|
|
|
|
// throw new ServiceException(processEntity.getProcessName()+":未编制检验项目");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//子件工艺
|
|
|
|
|
@ -358,20 +358,24 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
DsPartEntity zPartEntity = partService.getById(dsPartRelationEntity.getChildPartId()); |
|
|
|
|
if(null != zPartEntity){ |
|
|
|
|
//检验子件超期
|
|
|
|
|
if(null == zPartEntity.getNextDue()){ |
|
|
|
|
throw new ServiceException("【子件号】"+zPartEntity.getPartCode()+"工艺超期"); |
|
|
|
|
} |
|
|
|
|
Date nextDue = zPartEntity.getNextDue(); |
|
|
|
|
if (nextDue.before(new Date())) { |
|
|
|
|
throw new ServiceException("【零件号】"+zPartEntity.getPartCode()+"工艺超期"); |
|
|
|
|
throw new ServiceException("【子件号】"+zPartEntity.getPartCode()+"工艺超期"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
assert zPartEntity != null; |
|
|
|
|
if(null != zPartEntity.getSinTerType()){ |
|
|
|
|
DsCraftEntity zCraft = craftService.getPartCraft(zPartEntity.getId(),"2"); |
|
|
|
|
if(null == zCraft){ |
|
|
|
|
List<DsCraftEntity> zCraftList = craftService.getPartCraft(zPartEntity.getId(),"2"); |
|
|
|
|
if(CollectionUtils.isEmpty(zCraftList) ){ |
|
|
|
|
throw new ServiceException("子件工艺缺失"); |
|
|
|
|
} |
|
|
|
|
List<DsProcessEntity> zProcessEntities = processService.selectDsProcessByCraftId(zCraft.getId()); |
|
|
|
|
if(CollectionUtils.isEmpty(zProcessEntities)){ |
|
|
|
|
throw new ServiceException("【子件号】工艺未编制工序"); |
|
|
|
|
} |
|
|
|
|
// List<DsProcessEntity> zProcessEntities = processService.selectDsProcessByCraftId(zCraft.getId());
|
|
|
|
|
// if(CollectionUtils.isEmpty(zProcessEntities)){
|
|
|
|
|
// throw new ServiceException("【子件号】工艺未编制工序");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//判断工序下的检验项目
|
|
|
|
|
// for (DsProcessEntity zProcessEntity : zProcessEntities) {
|
|
|
|
|
@ -384,8 +388,8 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
zCraft.setCraftStatus(TaskingConstant.IN_USE); |
|
|
|
|
craftService.updateById(zCraft); |
|
|
|
|
// zCraft.setCraftStatus(TaskingConstant.IN_USE);
|
|
|
|
|
// craftService.updateById(zCraft);
|
|
|
|
|
|
|
|
|
|
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartId(zPartEntity.getId()); |
|
|
|
|
// 5新图任务 - 磨具计划下发 对接坤哥
|
|
|
|
|
@ -413,8 +417,8 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
taskingMapper.updateById(dsTaskingEntity); |
|
|
|
|
|
|
|
|
|
//4.更新零件、子件当前版本的工艺任务状态为【使用中】
|
|
|
|
|
craft.setCraftStatus(TaskingConstant.IN_USE); |
|
|
|
|
craftService.updateById(craft); |
|
|
|
|
// craft.setCraftStatus(TaskingConstant.IN_USE);
|
|
|
|
|
// craftService.updateById(craft);
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -530,10 +534,13 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
List<DsPartVersionVO> dsPartEntityList = partService.selectDsPartVersionByIds(idList); |
|
|
|
|
for (DsPartVersionVO dsPartVersionVO : dsPartEntityList) { |
|
|
|
|
// dsPartVersionVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVersionVO.getUpdateUser())).getData().getUser().getName());
|
|
|
|
|
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartId(dsPartVersionVO.getId()); |
|
|
|
|
dsPartVersionVO.setPartVersion(partVersionEntity.getPartVersion()); |
|
|
|
|
if(null != dsPartVersionVO.getSinTerType()){ |
|
|
|
|
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartId(dsPartVersionVO.getId()); |
|
|
|
|
dsPartVersionVO.setPartVersion(partVersionEntity.getPartVersion()); |
|
|
|
|
dsTaskingVO.setChildren(dsPartEntityList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
dsTaskingVO.setChildren(dsPartEntityList); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -770,7 +777,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
|
|
|
|
|
if(null != craft){ |
|
|
|
|
//查询返工工序
|
|
|
|
|
List<PrReworkProcessEntity> reworkProcessEntityList = reworkProcessService.selectPrReworkProcess(dsTaskingEntity.getReworkOrder(),dsTaskingEntity.getPartCode(),dsTaskingEntity.getVersion()); |
|
|
|
|
List<PrReworkProcessEntity> reworkProcessEntityList = reworkProcessService.selectPrReworkProcess(dsTaskingEntity.getReworkOrder(),dsTaskingEntity.getPartCode(),dsTaskingEntity.getBatchNo()); |
|
|
|
|
if(!CollectionUtils.isEmpty(reworkProcessEntityList)){ |
|
|
|
|
List<Long> reworkProcessId = reworkProcessEntityList.stream() |
|
|
|
|
.map(PrReworkProcessEntity::getId) |
|
|
|
|
@ -790,52 +797,58 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
result.getCraftList().add(craftTree); |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
// 没有返工工艺信息的情况
|
|
|
|
|
// 创建新的工艺实体并设置返工订单号
|
|
|
|
|
// craft = new DsCraftEntity();
|
|
|
|
|
// craft.setReworkOrder(dsTaskingEntity.getReworkOrder());
|
|
|
|
|
// craft.setPartId(partEntity.getId());
|
|
|
|
|
// craft.setPartVersions(dsTaskingEntity.getVersion());
|
|
|
|
|
// // 创建工艺节点并设置craftInfo
|
|
|
|
|
// craftTree.setCraftInfo(JSONObject.from(craft));
|
|
|
|
|
// craftTree.setProcessList(new ArrayList<>());
|
|
|
|
|
// result.getCraftList().add(craftTree);
|
|
|
|
|
|
|
|
|
|
// 查询零件工艺信息
|
|
|
|
|
List<DsCraftVO> dsCraftVOList = craftService.selectDsCraftByPartId(partEntity.getId(), "2"); |
|
|
|
|
if(CollectionUtils.isEmpty(dsCraftVOList)){ |
|
|
|
|
throw new ServiceException("零件工艺信息有误 请检查该零件是否有工艺信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(dsCraftVOList)) { |
|
|
|
|
for (DsCraftVO craftVO : dsCraftVOList) { |
|
|
|
|
|
|
|
|
|
craftVO.setReworkOrder(dsTaskingEntity.getReworkOrder()); |
|
|
|
|
craftVO.setPartId(partEntity.getId()); |
|
|
|
|
craftVO.setPartVersions(dsTaskingEntity.getVersion()); |
|
|
|
|
|
|
|
|
|
// 查询工序信息
|
|
|
|
|
List<DsProcessEntity> processEntities = processService.selectDsProcessByCraftId(craftVO.getId()); |
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(processEntities)) { |
|
|
|
|
List<Long> processIds = processEntities.stream() |
|
|
|
|
.map(DsProcessEntity::getId) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
// 批量查询关联数据
|
|
|
|
|
List<DsProcessProjectEntity> processProjectEntityList = processProjectService.selectDsProcessProjectByProcessIds(processIds); |
|
|
|
|
List<DsProcessMeasuringToolEntity> processMeasuringToolEntityList = processMeasuringToolService.selectDsProcessMeasuringToolByProcessIds(processIds); |
|
|
|
|
List<DsProcessMoldToolEntity> processMoldToolEntityList = processMoldToolService.selectDsProcessMoldToolByProcessIds(processIds); |
|
|
|
|
// 没有返工工艺信息的情况
|
|
|
|
|
// 创建新的工艺实体并设置返工订单号
|
|
|
|
|
craft = new DsCraftEntity(); |
|
|
|
|
craft.setReworkOrder(dsTaskingEntity.getReworkOrder()); |
|
|
|
|
craft.setPartId(partEntity.getId()); |
|
|
|
|
craft.setPartCode(partEntity.getPartCode()); |
|
|
|
|
craft.setPartVersions(dsTaskingEntity.getBatchNo()); |
|
|
|
|
// 创建工艺节点并设置craftInfo
|
|
|
|
|
craftTree.setCraftInfo(JSONObject.from(craft)); |
|
|
|
|
craftTree.setProcessList(new ArrayList<>()); |
|
|
|
|
result.getCraftList().add(craftTree); |
|
|
|
|
|
|
|
|
|
// 构建工序树
|
|
|
|
|
List<ProcessTreeVO> processTree = buildProcessTree(processEntities, processProjectEntityList, |
|
|
|
|
processMeasuringToolEntityList, processMoldToolEntityList); |
|
|
|
|
craftTree.setProcessList(processTree); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
result.getCraftList().add(craftTree); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// // 查询零件工艺信息
|
|
|
|
|
// List<DsCraftVO> dsCraftVOList = craftService.selectDsCraftByPartId(partEntity.getId(), "2");
|
|
|
|
|
// if(CollectionUtils.isEmpty(dsCraftVOList)){
|
|
|
|
|
// throw new ServiceException("零件工艺信息有误 请检查该零件是否有工艺信息");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (!CollectionUtils.isEmpty(dsCraftVOList)) {
|
|
|
|
|
// for (DsCraftVO craftVO : dsCraftVOList) {
|
|
|
|
|
// // 每次循环创建新的craftTree对象
|
|
|
|
|
// CraftTreeVO craftTree1 = new CraftTreeVO();
|
|
|
|
|
//
|
|
|
|
|
// craftVO.setReworkOrder(dsTaskingEntity.getReworkOrder());
|
|
|
|
|
// craftVO.setPartId(partEntity.getId());
|
|
|
|
|
// craftVO.setPartVersions(dsTaskingEntity.getVersion());
|
|
|
|
|
//
|
|
|
|
|
// craftTree1.setCraftInfo(JSONObject.from(craftVO));
|
|
|
|
|
//
|
|
|
|
|
// // 查询工序信息
|
|
|
|
|
// List<DsProcessEntity> processEntities = processService.selectDsProcessByCraftId(craftVO.getId());
|
|
|
|
|
//
|
|
|
|
|
// if (!CollectionUtils.isEmpty(processEntities)) {
|
|
|
|
|
// List<Long> processIds = processEntities.stream()
|
|
|
|
|
// .map(DsProcessEntity::getId)
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
//
|
|
|
|
|
// // 批量查询关联数据
|
|
|
|
|
// List<DsProcessProjectEntity> processProjectEntityList = processProjectService.selectDsProcessProjectByProcessIds(processIds);
|
|
|
|
|
// List<DsProcessMeasuringToolEntity> processMeasuringToolEntityList = processMeasuringToolService.selectDsProcessMeasuringToolByProcessIds(processIds);
|
|
|
|
|
// List<DsProcessMoldToolEntity> processMoldToolEntityList = processMoldToolService.selectDsProcessMoldToolByProcessIds(processIds);
|
|
|
|
|
//
|
|
|
|
|
// // 构建工序树
|
|
|
|
|
// List<ProcessTreeVO> processTree = buildProcessTree(processEntities, processProjectEntityList,
|
|
|
|
|
// processMeasuringToolEntityList, processMoldToolEntityList);
|
|
|
|
|
// craftTree1.setProcessList(processTree);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// result.getCraftList().add(craftTree1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
@ -993,11 +1006,19 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
// todo 查审理单 获取返修原因
|
|
|
|
|
|
|
|
|
|
// 2. 保存任务信息
|
|
|
|
|
if(TaskingConstant.TASK_STATUS_ALREADY.equals(dsTasking.getTaskStatus())){ |
|
|
|
|
dsTasking.setTaskStatus(TaskingConstant.TASK_STATUS_UNDERWAY); |
|
|
|
|
} |
|
|
|
|
int taskInsert = taskingMapper.insert(dsTasking); |
|
|
|
|
if (taskInsert <= 0) { |
|
|
|
|
throw new RuntimeException("返工任务插入失败:" + reworkOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(null == yieldOrder){ |
|
|
|
|
log.info("返工任务同步成功,未同步工艺工序:{}", reworkOrder); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 3. 获取零件信息
|
|
|
|
|
DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(partCode, partVersion); |
|
|
|
|
if (partEntity == null) { |
|
|
|
|
@ -1005,12 +1026,13 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 4. 创建返工工艺
|
|
|
|
|
DsCraftEntity craftEntity = createReworkCraft(partEntity, partVersion, reworkOrder); |
|
|
|
|
DsCraftEntity craftEntity = createReworkCraft(partEntity, batchNo, reworkOrder); |
|
|
|
|
boolean saveCraft = craftService.save(craftEntity); |
|
|
|
|
if (!saveCraft) { |
|
|
|
|
throw new RuntimeException("返工工艺添加失败:" + reworkOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 5. 查询并添加工序、加工班组、外协厂商
|
|
|
|
|
addReworkProcesses(partEntity, yieldOrder, reworkOrder); |
|
|
|
|
|
|
|
|
|
@ -1021,14 +1043,15 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
/** |
|
|
|
|
* 创建返工工艺实体 |
|
|
|
|
*/ |
|
|
|
|
private DsCraftEntity createReworkCraft(DsPartEntity partEntity, String partVersion, String reworkOrder) { |
|
|
|
|
private DsCraftEntity createReworkCraft(DsPartEntity partEntity, String batchNo, String reworkOrder) { |
|
|
|
|
DsCraftEntity craftEntity = new DsCraftEntity(); |
|
|
|
|
craftEntity.setPartId(partEntity.getId()); |
|
|
|
|
craftEntity.setPrority(3); |
|
|
|
|
craftEntity.setRank("2"); |
|
|
|
|
craftEntity.setPartVersions(partVersion); |
|
|
|
|
craftEntity.setPartVersions(batchNo); |
|
|
|
|
craftEntity.setReworkOrder(reworkOrder); |
|
|
|
|
craftEntity.setCraftStatus("3"); |
|
|
|
|
craftEntity.setPartCode(partEntity.getPartCode()); |
|
|
|
|
return craftEntity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1128,7 +1151,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
//保存工艺信息
|
|
|
|
|
if(null == craft.getId()){ |
|
|
|
|
craft.setPrority(3); |
|
|
|
|
craft.setRank("2"); |
|
|
|
|
craft.setRank("2");; |
|
|
|
|
craftService.save(craft); |
|
|
|
|
}else { |
|
|
|
|
craftService.updateById(craft); |
|
|
|
|
@ -1555,8 +1578,8 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
// 3. 处理成功后新增任务记录
|
|
|
|
|
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartId(newPart.getId()); |
|
|
|
|
//修改状态
|
|
|
|
|
if(dsTasking.getTaskStatus().equals(1)){ |
|
|
|
|
dsTasking.setTaskStatus(2); |
|
|
|
|
if(TaskingConstant.TASK_STATUS_ALREADY.equals(dsTasking.getTaskStatus())){ |
|
|
|
|
dsTasking.setTaskStatus(TaskingConstant.TASK_STATUS_UNDERWAY); |
|
|
|
|
} |
|
|
|
|
dsTasking.setVersion(partVersionEntity.getPartVersion()); |
|
|
|
|
int taskingInsert = taskingMapper.insert(dsTasking); |
|
|
|
|
|